From 05fec3adcbc15aa46a2cf0e67596aac104b58790 Mon Sep 17 00:00:00 2001 From: May P Date: Mon, 29 Jun 2026 16:51:19 +0200 Subject: [PATCH] added dwarf --- .../smithy/faithful/util/CustomDataTypes.java | 2 + .../smithy/faithful/util/OptionalBool.java | 1 + .../resources/assets/faithful/lang/en_us.json | 14 +- .../faithful/item_modifiers/dwarf_sturdy.json | 20 +++ .../faithful/loot_tables/dwarf_mining.json | 38 ++++ .../data/faithful/origins/dwarf.json | 10 ++ .../dwarf-powers/dwarven_craftsmanship.json | 168 ++++++++++++++++++ .../powers/dwarf-powers/dwarven_mining.json | 7 + .../dwarf-powers/dwarven_resistance.json | 9 + .../faithful/recipes/diamond_pickaxe.json | 21 +++ .../data/faithful/recipes/golden_hoe.json | 21 +++ .../minecraft/recipes/diamond_pickaxe.json | 1 + .../data/minecraft/recipes/golden_hoe.json | 1 + .../data/origins/origin_layers/origin.json | 1 + 14 files changed, 312 insertions(+), 2 deletions(-) create mode 100644 src/main/resources/data/faithful/item_modifiers/dwarf_sturdy.json create mode 100644 src/main/resources/data/faithful/loot_tables/dwarf_mining.json create mode 100644 src/main/resources/data/faithful/origins/dwarf.json create mode 100644 src/main/resources/data/faithful/powers/dwarf-powers/dwarven_craftsmanship.json create mode 100644 src/main/resources/data/faithful/powers/dwarf-powers/dwarven_mining.json create mode 100644 src/main/resources/data/faithful/powers/dwarf-powers/dwarven_resistance.json create mode 100644 src/main/resources/data/faithful/recipes/diamond_pickaxe.json create mode 100644 src/main/resources/data/faithful/recipes/golden_hoe.json create mode 100644 src/main/resources/data/minecraft/recipes/diamond_pickaxe.json create mode 100644 src/main/resources/data/minecraft/recipes/golden_hoe.json diff --git a/src/main/java/com/smithy/faithful/util/CustomDataTypes.java b/src/main/java/com/smithy/faithful/util/CustomDataTypes.java index d664979..23b64dd 100644 --- a/src/main/java/com/smithy/faithful/util/CustomDataTypes.java +++ b/src/main/java/com/smithy/faithful/util/CustomDataTypes.java @@ -10,6 +10,7 @@ import java.util.OptionalInt; public class CustomDataTypes { + @SuppressWarnings("null") public static final SerializableDataType STACK_OR_ITEM_NAME = new SerializableDataType<>( ItemStack.class, PacketByteBuf::writeItemStack, @@ -23,6 +24,7 @@ public class CustomDataTypes { jsonElement -> CodecHelper.STACK_OR_ITEM_NAME.decode(JsonOps.INSTANCE, jsonElement).result().orElseThrow(() -> new JsonParseException("Could not parse ItemStack from JSON.")).getFirst() );*/ + @SuppressWarnings("null") public static final SerializableDataType OPTIONAL_BOOL = new SerializableDataType<>(OptionalBool.class, PacketByteBuf::writeEnumConstant, buf -> buf.readEnumConstant(OptionalBool.class), diff --git a/src/main/java/com/smithy/faithful/util/OptionalBool.java b/src/main/java/com/smithy/faithful/util/OptionalBool.java index 0376b1f..8d4e9d9 100644 --- a/src/main/java/com/smithy/faithful/util/OptionalBool.java +++ b/src/main/java/com/smithy/faithful/util/OptionalBool.java @@ -32,6 +32,7 @@ public enum OptionalBool { return this == DEFAULT ? Optional.empty() : Optional.of(isTrue()); } + @SuppressWarnings("null") public static MapCodec codecFieldOf(String fieldName) { return Codec.BOOL.optionalFieldOf(fieldName).xmap(opt -> opt.map(aBoolean -> aBoolean ? TRUE : FALSE).orElse(DEFAULT), OptionalBool::asOptional); } diff --git a/src/main/resources/assets/faithful/lang/en_us.json b/src/main/resources/assets/faithful/lang/en_us.json index beb1864..c0b8651 100644 --- a/src/main/resources/assets/faithful/lang/en_us.json +++ b/src/main/resources/assets/faithful/lang/en_us.json @@ -1,5 +1,5 @@ { - //-----Muckunde-----// + //-----elf-----// "origin.faithful.elf.name": "Elf", "origin.faithful.elf.description": "Prideful, elegant beings of earthly origin.", "power.faithful.elf-powers/elven_craftsmanship.name": "Elven Magic", @@ -9,5 +9,15 @@ "power.faithful.elf-powers/light_foot.name": "Light of Foot", "power.faithful.elf-powers/light_foot.description": "Elves can walk lightly across snow where the boots of humans would sink.", "power.faithful.elf-powers/nature_connection.name": "Nature's Connection", - "power.faithful.elf-powers/nature_connection.description": "When in biomes such as forests or jungles, elves may receive certain buffs." + "power.faithful.elf-powers/nature_connection.description": "When in biomes such as forests or jungles, elves may receive certain buffs.", + + //-----dwarf-----// + "origin.faithful.dwarf.name": "Dwarf", + "origin.faithful.dwarf.description": "Incredible craftsmen.", + "power.faithful.dwarf-powers/dwarven_craftsmanship.name": "Dwarven Craftsmanship", + "power.faithful.dwarf-powers/dwarven_craftsmanship.description": "Dwarven craftsmanship is said to be rivaled only be that of Elves. Tools crafted by Dwarves are remarkably sturdier than those crafted by common smiths.", + "power.faithful.dwarf-powers/dwarven_resistance.name": "Dwarven Resistance", + "power.faithful.dwarf-powers/dwarven_resistance.description": "Dwarves have thicker skin that acts as armour.", + "power.faithful.dwarf-powers/dwarven_mining.name": "Exceptional Miner", + "power.faithful.dwarf-powers/dwarven_mining.description": "Dwarves are known to be the greatest miners in the world, they are able to get valuable ores from bland stones." } \ No newline at end of file diff --git a/src/main/resources/data/faithful/item_modifiers/dwarf_sturdy.json b/src/main/resources/data/faithful/item_modifiers/dwarf_sturdy.json new file mode 100644 index 0000000..c1e3f9d --- /dev/null +++ b/src/main/resources/data/faithful/item_modifiers/dwarf_sturdy.json @@ -0,0 +1,20 @@ +[ + { + "function": "minecraft:set_lore", + "entity": "this", + "lore": [ + { + "text": "A Dwarven crafted tool.", + "color": "dark_purple", + "italic": true + } + ], + "replace": true + }, + { + "function": "minecraft:set_enchantments", + "enchantments": { + "minecraft:unbreaking": 1 + } + } +] \ No newline at end of file diff --git a/src/main/resources/data/faithful/loot_tables/dwarf_mining.json b/src/main/resources/data/faithful/loot_tables/dwarf_mining.json new file mode 100644 index 0000000..e6bdf28 --- /dev/null +++ b/src/main/resources/data/faithful/loot_tables/dwarf_mining.json @@ -0,0 +1,38 @@ +{ + "type": "minecraft:block", + "pools": [ + { + "rolls": 1, + "entries": [ + { + "type": "minecraft:loot_table", + "name": "apoli:replaced_loot_table" + }, + { + "type": "minecraft:tag", + "name": "c:gems", + "expand": true, + "weight": 1, + "conditions": [ + { + "condition": "minecraft:random_chance", + "chance": 0.1 + } + ] + }, + { + "type": "minecraft:tag", + "name": "c:raw_ores", + "expand": true, + "weight": 1, + "conditions": [ + { + "condition": "minecraft:random_chance", + "chance": 0.1 + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/data/faithful/origins/dwarf.json b/src/main/resources/data/faithful/origins/dwarf.json new file mode 100644 index 0000000..337f259 --- /dev/null +++ b/src/main/resources/data/faithful/origins/dwarf.json @@ -0,0 +1,10 @@ +{ + "powers": [ + "faithful:dwarf-powers/dwarven_craftsmanship", + "faithful:dwarf-powers/dwarven_mining", + "faithful:dwarf-powers/dwarven_resistance" + ], + "icon": "minecraft:dirt", + "order": 1001, + "impact": 3 +} diff --git a/src/main/resources/data/faithful/powers/dwarf-powers/dwarven_craftsmanship.json b/src/main/resources/data/faithful/powers/dwarf-powers/dwarven_craftsmanship.json new file mode 100644 index 0000000..7fa1976 --- /dev/null +++ b/src/main/resources/data/faithful/powers/dwarf-powers/dwarven_craftsmanship.json @@ -0,0 +1,168 @@ +{ + "type": "origins:multiple", + "alter_diamond_axe": { + "type": "origins:modify_crafting", + "recipe": "diamond_axe", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + "alter_gold_axe": { + "type": "origins:modify_crafting", + "recipe": "golden_axe", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + "alter_iron_axe": { + "type": "origins:modify_crafting", + "recipe": "iron_axe", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + "alter_stone_axe": { + "type": "origins:modify_crafting", + "recipe": "stone_axe", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + "alter_wooden_axe": { + "type": "origins:modify_crafting", + "recipe": "wooden_axe", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + + + "alter_diamond_pickaxe": { + "type": "origins:modify_crafting", + "recipe": "faithful:diamond_pickaxe", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + "alter_gold_pickaxe": { + "type": "origins:modify_crafting", + "recipe": "golden_pickaxe", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + "alter_iron_pickaxe": { + "type": "origins:modify_crafting", + "recipe": "iron_pickaxe", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + "alter_stone_pickaxe": { + "type": "origins:modify_crafting", + "recipe": "stone_pickaxe", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + "alter_wooden_pickaxe": { + "type": "origins:modify_crafting", + "recipe": "wooden_pickaxe", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + + + "alter_diamond_shovel": { + "type": "origins:modify_crafting", + "recipe": "diamond_shovel", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + "alter_gold_shovel": { + "type": "origins:modify_crafting", + "recipe": "golden_shovel", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + "alter_iron_shovel": { + "type": "origins:modify_crafting", + "recipe": "iron_shovel", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + "alter_stone_shovel": { + "type": "origins:modify_crafting", + "recipe": "stone_shovel", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + "alter_wooden_shovel": { + "type": "origins:modify_crafting", + "recipe": "wooden_shovel", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + + "alter_diamond_hoe": { + "type": "origins:modify_crafting", + "recipe": "diamond_hoe", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + "alter_gold_hoe": { + "type": "origins:modify_crafting", + "recipe": "faithful:golden_hoe", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + "alter_iron_hoe": { + "type": "origins:modify_crafting", + "recipe": "iron_hoe", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + "alter_stone_hoe": { + "type": "origins:modify_crafting", + "recipe": "stone_hoe", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + }, + "alter_wooden_hoe": { + "type": "origins:modify_crafting", + "recipe": "wooden_hoe", + "item_action": { + "type": "origins:modify", + "modifier": "faithful:dwarf_sturdy" + } + } +} \ No newline at end of file diff --git a/src/main/resources/data/faithful/powers/dwarf-powers/dwarven_mining.json b/src/main/resources/data/faithful/powers/dwarf-powers/dwarven_mining.json new file mode 100644 index 0000000..d7ffa3c --- /dev/null +++ b/src/main/resources/data/faithful/powers/dwarf-powers/dwarven_mining.json @@ -0,0 +1,7 @@ +{ + "type": "origins:replace_loot_table", + "replace": { + "minecraft:blocks/stone": "faithful:dwarf_mining", + "minecraft:blocks/deepslate": "faithful:dwarf_mining" + } +} \ No newline at end of file diff --git a/src/main/resources/data/faithful/powers/dwarf-powers/dwarven_resistance.json b/src/main/resources/data/faithful/powers/dwarf-powers/dwarven_resistance.json new file mode 100644 index 0000000..5446bda --- /dev/null +++ b/src/main/resources/data/faithful/powers/dwarf-powers/dwarven_resistance.json @@ -0,0 +1,9 @@ +{ + "type": "origins:attribute", + "modifier": { + "name": "Natural Armor health bonus", + "attribute": "minecraft:generic.armor", + "value": 4.0, + "operation": "addition" + } +} \ No newline at end of file diff --git a/src/main/resources/data/faithful/recipes/diamond_pickaxe.json b/src/main/resources/data/faithful/recipes/diamond_pickaxe.json new file mode 100644 index 0000000..d825771 --- /dev/null +++ b/src/main/resources/data/faithful/recipes/diamond_pickaxe.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "equipment", + "key": { + "#": { + "item": "minecraft:stick" + }, + "X": { + "item": "minecraft:diamond" + } + }, + "pattern": [ + "XXX", + " # ", + " # " + ], + "result": { + "item": "minecraft:diamond_pickaxe" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/main/resources/data/faithful/recipes/golden_hoe.json b/src/main/resources/data/faithful/recipes/golden_hoe.json new file mode 100644 index 0000000..3e4cfb8 --- /dev/null +++ b/src/main/resources/data/faithful/recipes/golden_hoe.json @@ -0,0 +1,21 @@ +{ + "type": "minecraft:crafting_shaped", + "category": "equipment", + "key": { + "#": { + "item": "minecraft:stick" + }, + "X": { + "item": "minecraft:gold_ingot" + } + }, + "pattern": [ + "XX", + " #", + " #" + ], + "result": { + "item": "minecraft:golden_hoe" + }, + "show_notification": true +} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/recipes/diamond_pickaxe.json b/src/main/resources/data/minecraft/recipes/diamond_pickaxe.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/src/main/resources/data/minecraft/recipes/diamond_pickaxe.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/main/resources/data/minecraft/recipes/golden_hoe.json b/src/main/resources/data/minecraft/recipes/golden_hoe.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/src/main/resources/data/minecraft/recipes/golden_hoe.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/src/main/resources/data/origins/origin_layers/origin.json b/src/main/resources/data/origins/origin_layers/origin.json index 4b24c0d..136f083 100644 --- a/src/main/resources/data/origins/origin_layers/origin.json +++ b/src/main/resources/data/origins/origin_layers/origin.json @@ -2,6 +2,7 @@ "replace": false, "origins": [ "faithful:elf", + "faithful:dwarf", { "condition": { "type": "origins:equipped_item",