From 28e9f7f8cd8aca54111f58c366f397320ee4db3e Mon Sep 17 00:00:00 2001 From: DavidDGTNT Date: Mon, 30 Dec 2024 14:50:04 -0600 Subject: [PATCH] Update to 1.21.2 --- gradle.properties | 8 ++-- .../java/me/daviddgtnt/stringtools/Main.java | 16 ++++---- .../stringtools/StringToolMaterial.java | 41 ++----------------- .../data/stringtools/block/string.json | 6 +++ .../data/stringtools/recipe/string_axe.json | 8 +--- .../recipe/string_axe_reverse.json | 8 +--- .../data/stringtools/recipe/string_hoe.json | 8 +--- .../recipe/string_hoe_reversed.json | 8 +--- .../stringtools/recipe/string_pickaxe.json | 8 +--- .../stringtools/recipe/string_shovel.json | 8 +--- .../data/stringtools/recipe/string_stick.json | 4 +- .../data/stringtools/recipe/string_sword.json | 8 +--- src/main/resources/fabric.mod.json | 4 +- 13 files changed, 40 insertions(+), 95 deletions(-) create mode 100644 src/main/resources/data/stringtools/block/string.json diff --git a/gradle.properties b/gradle.properties index 6cc1d18..13d8108 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,14 +4,14 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop - minecraft_version=1.21 - yarn_mappings=1.21+build.9 + minecraft_version=1.21.2 + yarn_mappings=1.21.2+build.1 loader_version=0.16.9 # Mod Properties - mod_version = 1.0.2-1.21 + mod_version = 1.0.2-1.21.2 maven_group = me.daviddgtnt archives_base_name = stringtools # Dependencies - fabric_version=0.102.0+1.21 + fabric_version=0.106.1+1.21.2 diff --git a/src/main/java/me/daviddgtnt/stringtools/Main.java b/src/main/java/me/daviddgtnt/stringtools/Main.java index 3991f7c..20207e9 100644 --- a/src/main/java/me/daviddgtnt/stringtools/Main.java +++ b/src/main/java/me/daviddgtnt/stringtools/Main.java @@ -5,15 +5,17 @@ import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; import net.minecraft.item.*; import net.minecraft.registry.Registries; import net.minecraft.registry.Registry; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; import net.minecraft.util.Identifier; public class Main implements ModInitializer { - public static final Item STRING_STICK = new Item(new Item.Settings()); - public static final ToolItem STRING_SWORD = new SwordItem(StringToolMaterial.INSTANCE, new Item.Settings().attributeModifiers(SwordItem.createAttributeModifiers(StringToolMaterial.INSTANCE, 4, 1.6F))); - public static final ToolItem STRING_PICKAXE = new PickaxeItem(StringToolMaterial.INSTANCE, new Item.Settings().attributeModifiers(PickaxeItem.createAttributeModifiers(StringToolMaterial.INSTANCE, 2.0F, 2.4F))); - public static final ToolItem STRING_AXE = new AxeItem(StringToolMaterial.INSTANCE, new Item.Settings().attributeModifiers(AxeItem.createAttributeModifiers(StringToolMaterial.INSTANCE, 7.0F, 0.8F))); - public static final ToolItem STRING_SHOVEL = new ShovelItem(StringToolMaterial.INSTANCE, new Item.Settings().attributeModifiers(ShovelItem.createAttributeModifiers(StringToolMaterial.INSTANCE, 2.5F, 1.0F))); - public static final ToolItem STRING_HOE = new HoeItem(StringToolMaterial.INSTANCE, new Item.Settings().attributeModifiers(HoeItem.createAttributeModifiers(StringToolMaterial.INSTANCE, 1.0F, 1.0F))); + public static final Item STRING_STICK = new Item(new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of("stringtools","string_stick" )))); + public static final SwordItem STRING_SWORD = new SwordItem(StringToolMaterial.INSTANCE, 4, 1.6F, new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of("stringtools", "string_sword")))); + public static final MiningToolItem STRING_PICKAXE = new PickaxeItem(StringToolMaterial.INSTANCE, 2.0F, 2.4F, new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of("stringtools", "string_pickaxe")))); + public static final MiningToolItem STRING_AXE = new AxeItem(StringToolMaterial.INSTANCE, 7.0F, 0.8F, new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of("stringtools", "string_axe")))); + public static final MiningToolItem STRING_SHOVEL = new ShovelItem(StringToolMaterial.INSTANCE, 2.5F, 1.0F, new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of("stringtools", "string_shovel")))); + public static final MiningToolItem STRING_HOE = new HoeItem(StringToolMaterial.INSTANCE, 1.0F, 1.0F, new Item.Settings().registryKey(RegistryKey.of(RegistryKeys.ITEM, Identifier.of("stringtools", "string_hoe")))); @Override public void onInitialize() { @@ -25,7 +27,7 @@ public class Main implements ModInitializer { Registry.register(Registries.ITEM, Identifier.of("stringtools", "string_hoe"), STRING_HOE); ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register(content -> content.addBefore(Items.STICK, STRING_STICK)); - + ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register(content -> { content.addBefore(Items.WOODEN_SHOVEL, STRING_HOE); content.addBefore(STRING_HOE, STRING_AXE); diff --git a/src/main/java/me/daviddgtnt/stringtools/StringToolMaterial.java b/src/main/java/me/daviddgtnt/stringtools/StringToolMaterial.java index b195ee4..b9c6708 100644 --- a/src/main/java/me/daviddgtnt/stringtools/StringToolMaterial.java +++ b/src/main/java/me/daviddgtnt/stringtools/StringToolMaterial.java @@ -1,44 +1,11 @@ package me.daviddgtnt.stringtools; -import net.minecraft.block.Block; -import net.minecraft.item.Items; import net.minecraft.item.ToolMaterial; -import net.minecraft.recipe.Ingredient; +import net.minecraft.registry.RegistryKeys; import net.minecraft.registry.tag.BlockTags; import net.minecraft.registry.tag.TagKey; +import net.minecraft.util.Identifier; -public class StringToolMaterial implements ToolMaterial { - public static final StringToolMaterial INSTANCE = new StringToolMaterial(); - - @Override - public int getDurability() { - return 1; - } - - @Override - public float getMiningSpeedMultiplier() { - return 2.0F; - } - - @Override - public float getAttackDamage() { - return 0.0F; - } - - @Override - public TagKey getInverseTag() { - return BlockTags.INCORRECT_FOR_WOODEN_TOOL; - } - - @Override - public int getEnchantability() { - return 15; - } - - @Override - public Ingredient getRepairIngredient() { - return Ingredient.ofItems(Items.STRING); - } - - +public class StringToolMaterial { + public static final ToolMaterial INSTANCE = new ToolMaterial(BlockTags.INCORRECT_FOR_WOODEN_TOOL, 1, 2.0F, 0.0F, 15, TagKey.of(RegistryKeys.ITEM, Identifier.of("stringtools", "string"))); } diff --git a/src/main/resources/data/stringtools/block/string.json b/src/main/resources/data/stringtools/block/string.json new file mode 100644 index 0000000..90efbd8 --- /dev/null +++ b/src/main/resources/data/stringtools/block/string.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "minecraft:string" + ] +} \ No newline at end of file diff --git a/src/main/resources/data/stringtools/recipe/string_axe.json b/src/main/resources/data/stringtools/recipe/string_axe.json index ef426ad..8038036 100644 --- a/src/main/resources/data/stringtools/recipe/string_axe.json +++ b/src/main/resources/data/stringtools/recipe/string_axe.json @@ -6,12 +6,8 @@ "T " ], "key": { - "S": { - "item": "minecraft:string" - }, - "T": { - "item": "stringtools:string_stick" - } + "S": "minecraft:string", + "T": "stringtools:string_stick" }, "result": { "id": "stringtools:string_axe" diff --git a/src/main/resources/data/stringtools/recipe/string_axe_reverse.json b/src/main/resources/data/stringtools/recipe/string_axe_reverse.json index 571f495..5484ed6 100644 --- a/src/main/resources/data/stringtools/recipe/string_axe_reverse.json +++ b/src/main/resources/data/stringtools/recipe/string_axe_reverse.json @@ -6,12 +6,8 @@ " T" ], "key": { - "S": { - "item": "minecraft:string" - }, - "T": { - "item": "stringtools:string_stick" - } + "S": "minecraft:string", + "T": "stringtools:string_stick" }, "result": { "id": "stringtools:string_axe" diff --git a/src/main/resources/data/stringtools/recipe/string_hoe.json b/src/main/resources/data/stringtools/recipe/string_hoe.json index 42c9eeb..3498c87 100644 --- a/src/main/resources/data/stringtools/recipe/string_hoe.json +++ b/src/main/resources/data/stringtools/recipe/string_hoe.json @@ -6,12 +6,8 @@ " T" ], "key": { - "S": { - "item": "minecraft:string" - }, - "T": { - "item": "stringtools:string_stick" - } + "S": "minecraft:string", + "T": "stringtools:string_stick" }, "result": { "id": "stringtools:string_hoe" diff --git a/src/main/resources/data/stringtools/recipe/string_hoe_reversed.json b/src/main/resources/data/stringtools/recipe/string_hoe_reversed.json index c53f62d..4b49917 100644 --- a/src/main/resources/data/stringtools/recipe/string_hoe_reversed.json +++ b/src/main/resources/data/stringtools/recipe/string_hoe_reversed.json @@ -6,12 +6,8 @@ "T " ], "key": { - "S": { - "item": "minecraft:string" - }, - "T": { - "item": "stringtools:string_stick" - } + "S": "minecraft:string", + "T": "stringtools:string_stick" }, "result": { "id": "stringtools:string_hoe" diff --git a/src/main/resources/data/stringtools/recipe/string_pickaxe.json b/src/main/resources/data/stringtools/recipe/string_pickaxe.json index 52e6a8e..ad2498c 100644 --- a/src/main/resources/data/stringtools/recipe/string_pickaxe.json +++ b/src/main/resources/data/stringtools/recipe/string_pickaxe.json @@ -6,12 +6,8 @@ " T " ], "key": { - "S": { - "item": "minecraft:string" - }, - "T": { - "item": "stringtools:string_stick" - } + "S": "minecraft:string", + "T": "stringtools:string_stick" }, "result": { "id": "stringtools:string_pickaxe" diff --git a/src/main/resources/data/stringtools/recipe/string_shovel.json b/src/main/resources/data/stringtools/recipe/string_shovel.json index 94726ff..6c3dc9a 100644 --- a/src/main/resources/data/stringtools/recipe/string_shovel.json +++ b/src/main/resources/data/stringtools/recipe/string_shovel.json @@ -6,12 +6,8 @@ "T" ], "key": { - "S": { - "item": "minecraft:string" - }, - "T": { - "item": "stringtools:string_stick" - } + "S": "minecraft:string", + "T": "stringtools:string_stick" }, "result": { "id": "stringtools:string_shovel" diff --git a/src/main/resources/data/stringtools/recipe/string_stick.json b/src/main/resources/data/stringtools/recipe/string_stick.json index 41ab6ce..7085d69 100644 --- a/src/main/resources/data/stringtools/recipe/string_stick.json +++ b/src/main/resources/data/stringtools/recipe/string_stick.json @@ -5,9 +5,7 @@ "S" ], "key": { - "S": { - "item": "minecraft:string" - } + "S": "minecraft:string" }, "result": { "id": "stringtools:string_stick", diff --git a/src/main/resources/data/stringtools/recipe/string_sword.json b/src/main/resources/data/stringtools/recipe/string_sword.json index 3c825b0..ef9c51b 100644 --- a/src/main/resources/data/stringtools/recipe/string_sword.json +++ b/src/main/resources/data/stringtools/recipe/string_sword.json @@ -6,12 +6,8 @@ "T" ], "key": { - "S": { - "item": "minecraft:string" - }, - "T": { - "item": "stringtools:string_stick" - } + "S": "minecraft:string", + "T": "stringtools:string_stick" }, "result": { "id": "stringtools:string_sword" diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 89a6170..94ba75e 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "stringtools", - "version": "1.0.2-1.21", + "version": "1.0.2-1.21.2", "name": "String Tools", "description": "Single use tools made out of string!", @@ -26,7 +26,7 @@ "depends": { "fabricloader": ">=0.16.9", "fabric-api": "*", - "minecraft": "~1.21", + "minecraft": "~1.21.2", "java": ">=21" } }