diff --git a/gradle.properties b/gradle.properties index 8761436..11aa35b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ yarn_mappings=1.20.1+build.10 loader_version=0.15.7 # Mod Properties -mod_version=0.1.0 +mod_version=0.2.0 maven_group=pl.xyundy.squaredadditions archives_base_name=squaredadditions diff --git a/src/main/generated/.cache/9adbe1c44971b18122390f472ecf7bb970889f75 b/src/main/generated/.cache/9adbe1c44971b18122390f472ecf7bb970889f75 new file mode 100644 index 0000000..526935a --- /dev/null +++ b/src/main/generated/.cache/9adbe1c44971b18122390f472ecf7bb970889f75 @@ -0,0 +1,6 @@ +// 1.20.1 2024-03-07T23:18:18.414589 Squared Additions/Model Definitions +71776dfec5b5f01ce4a9d3b3e000c3bf53bd5bf5 assets/squaredadditions/models/item/copper_shovel.json +5dc59b79a3e713f07045de3613f4ed4b3e29befc assets/squaredadditions/models/item/copper_sword.json +32fe678c1527b64ea225930db2db5251c0a7ba7a assets/squaredadditions/models/item/copper_pickaxe.json +f6bd2f2c35340d899a2928bdacb127ca28140e3d assets/squaredadditions/models/item/copper_hoe.json +e707267f36198cf7a546e3b58db73fa98b8e056a assets/squaredadditions/models/item/copper_axe.json diff --git a/src/main/generated/assets/squaredadditions/models/item/copper_axe.json b/src/main/generated/assets/squaredadditions/models/item/copper_axe.json new file mode 100644 index 0000000..5f5016e --- /dev/null +++ b/src/main/generated/assets/squaredadditions/models/item/copper_axe.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "squaredadditions:item/copper_axe" + } +} \ No newline at end of file diff --git a/src/main/generated/assets/squaredadditions/models/item/copper_hoe.json b/src/main/generated/assets/squaredadditions/models/item/copper_hoe.json new file mode 100644 index 0000000..5cdc21b --- /dev/null +++ b/src/main/generated/assets/squaredadditions/models/item/copper_hoe.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "squaredadditions:item/copper_hoe" + } +} \ No newline at end of file diff --git a/src/main/generated/assets/squaredadditions/models/item/copper_pickaxe.json b/src/main/generated/assets/squaredadditions/models/item/copper_pickaxe.json new file mode 100644 index 0000000..b70226f --- /dev/null +++ b/src/main/generated/assets/squaredadditions/models/item/copper_pickaxe.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "squaredadditions:item/copper_pickaxe" + } +} \ No newline at end of file diff --git a/src/main/generated/assets/squaredadditions/models/item/copper_shovel.json b/src/main/generated/assets/squaredadditions/models/item/copper_shovel.json new file mode 100644 index 0000000..83202d7 --- /dev/null +++ b/src/main/generated/assets/squaredadditions/models/item/copper_shovel.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "squaredadditions:item/copper_shovel" + } +} \ No newline at end of file diff --git a/src/main/generated/assets/squaredadditions/models/item/copper_sword.json b/src/main/generated/assets/squaredadditions/models/item/copper_sword.json new file mode 100644 index 0000000..07caf54 --- /dev/null +++ b/src/main/generated/assets/squaredadditions/models/item/copper_sword.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "squaredadditions:item/copper_sword" + } +} \ No newline at end of file diff --git a/src/main/java/pl/xyundy/squaredadditions/SquaredAdditions.java b/src/main/java/pl/xyundy/squaredadditions/SquaredAdditions.java index 65af658..c45f7c0 100644 --- a/src/main/java/pl/xyundy/squaredadditions/SquaredAdditions.java +++ b/src/main/java/pl/xyundy/squaredadditions/SquaredAdditions.java @@ -4,19 +4,15 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import pl.xyundy.squaredadditions.item.ModItems; public class SquaredAdditions implements ModInitializer { - // This logger is used to write text to the console and the log file. - // It is considered best practice to use your mod id as the logger's name. - // That way, it's clear which mod wrote info, warnings, and errors. - public static final Logger LOGGER = LoggerFactory.getLogger("squaredadditions"); + public static final String MOD_ID = "squaredadditions"; + public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); @Override public void onInitialize() { - // This code runs as soon as Minecraft is in a mod-load-ready state. - // However, some things (like resources) may still be uninitialized. - // Proceed with mild caution. - + ModItems.registerModItems(); LOGGER.info("SquaredAdditions initialized!"); } } \ No newline at end of file diff --git a/src/main/java/pl/xyundy/squaredadditions/SquaredAdditionsDataGenerator.java b/src/main/java/pl/xyundy/squaredadditions/SquaredAdditionsDataGenerator.java index b54df9b..5d02a13 100644 --- a/src/main/java/pl/xyundy/squaredadditions/SquaredAdditionsDataGenerator.java +++ b/src/main/java/pl/xyundy/squaredadditions/SquaredAdditionsDataGenerator.java @@ -2,10 +2,13 @@ import net.fabricmc.fabric.api.datagen.v1.DataGeneratorEntrypoint; import net.fabricmc.fabric.api.datagen.v1.FabricDataGenerator; +import pl.xyundy.squaredadditions.datagen.ModModelProvider; public class SquaredAdditionsDataGenerator implements DataGeneratorEntrypoint { @Override public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { + FabricDataGenerator.Pack pack = fabricDataGenerator.createPack(); + pack.addProvider(ModModelProvider::new); } } diff --git a/src/main/java/pl/xyundy/squaredadditions/datagen/ModModelProvider.java b/src/main/java/pl/xyundy/squaredadditions/datagen/ModModelProvider.java new file mode 100644 index 0000000..54415e5 --- /dev/null +++ b/src/main/java/pl/xyundy/squaredadditions/datagen/ModModelProvider.java @@ -0,0 +1,27 @@ +package pl.xyundy.squaredadditions.datagen; + +import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput; +import net.fabricmc.fabric.api.datagen.v1.provider.FabricModelProvider; +import net.minecraft.data.client.BlockStateModelGenerator; +import net.minecraft.data.client.ItemModelGenerator; +import pl.xyundy.squaredadditions.item.ModItems; +import net.minecraft.data.client.Models; +public class ModModelProvider extends FabricModelProvider { + public ModModelProvider(FabricDataOutput output) { + super(output); + } + + @Override + public void generateBlockStateModels(BlockStateModelGenerator blockStateModelGenerator) { + + } + + @Override + public void generateItemModels(ItemModelGenerator itemModelGenerator) { + itemModelGenerator.register(ModItems.COPPER_SWORD, Models.HANDHELD); + itemModelGenerator.register(ModItems.COPPER_PICKAXE, Models.HANDHELD); + itemModelGenerator.register(ModItems.COPPER_SHOVEL, Models.HANDHELD); + itemModelGenerator.register(ModItems.COPPER_AXE, Models.HANDHELD); + itemModelGenerator.register(ModItems.COPPER_HOE, Models.HANDHELD); + } +} \ No newline at end of file diff --git a/src/main/java/pl/xyundy/squaredadditions/item/ModItems.java b/src/main/java/pl/xyundy/squaredadditions/item/ModItems.java new file mode 100644 index 0000000..8122ba6 --- /dev/null +++ b/src/main/java/pl/xyundy/squaredadditions/item/ModItems.java @@ -0,0 +1,49 @@ +package pl.xyundy.squaredadditions.item; + +import net.fabricmc.fabric.api.item.v1.FabricItemSettings; +import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroupEntries; +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.util.Identifier; +import pl.xyundy.squaredadditions.SquaredAdditions; + +public class ModItems { + + public static final Item COPPER_SWORD = registerItem("copper_sword", + new SwordItem(ModToolMaterial.COPPER_INGOT, 2, 2f, new FabricItemSettings())); + public static final Item COPPER_PICKAXE = registerItem("copper_pickaxe", + new PickaxeItem(ModToolMaterial.COPPER_INGOT, 1, 1f, new FabricItemSettings())); + public static final Item COPPER_SHOVEL = registerItem("copper_shovel", + new ShovelItem(ModToolMaterial.COPPER_INGOT, 0, 0f, new FabricItemSettings())); + public static final Item COPPER_AXE = registerItem("copper_axe", + new AxeItem(ModToolMaterial.COPPER_INGOT, 6, -2f, new FabricItemSettings())); + public static final Item COPPER_HOE = registerItem("copper_hoe", + new HoeItem(ModToolMaterial.COPPER_INGOT, 0, 0f, new FabricItemSettings())); + + + + private static Item registerItem(String name, Item item) { + return Registry.register(Registries.ITEM, new Identifier(SquaredAdditions.MOD_ID, name), item); + } + + + public static void itemGroupCombat(FabricItemGroupEntries entries) { + entries.add(COPPER_SWORD); + entries.add(COPPER_PICKAXE); + } + public static void itemGroupTools(FabricItemGroupEntries entries) { + entries.add(COPPER_PICKAXE); + entries.add(COPPER_SHOVEL); + entries.add(COPPER_AXE); + entries.add(COPPER_HOE); + } + + public static void registerModItems() { + SquaredAdditions.LOGGER.info("Registering Mod Items for " + SquaredAdditions.MOD_ID); + + ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register(ModItems::itemGroupTools); + ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register(ModItems::itemGroupCombat); + } +} diff --git a/src/main/java/pl/xyundy/squaredadditions/item/ModToolMaterial.java b/src/main/java/pl/xyundy/squaredadditions/item/ModToolMaterial.java new file mode 100644 index 0000000..37da4d5 --- /dev/null +++ b/src/main/java/pl/xyundy/squaredadditions/item/ModToolMaterial.java @@ -0,0 +1,59 @@ +package pl.xyundy.squaredadditions.item; + +import net.minecraft.item.Items; +import net.minecraft.item.ToolMaterial; +import net.minecraft.recipe.Ingredient; +import net.minecraft.util.Lazy; + +import java.util.function.Supplier; + +public enum ModToolMaterial implements ToolMaterial { + COPPER_INGOT(5, 1500, 11.0f, 5.0f, 28, () -> Ingredient.ofItems(Items.COPPER_INGOT)); + + private final int miningLevel; + private final int itemDurability; + private final float miningSpeed; + private final float attackDamage; + private final int enchantability; + private final Lazy repairIngredient; + + ModToolMaterial(int miningLevel, int itemDurability, float miningSpeed, float attackDamage, + int enchantability, Supplier repairIngredient) { + this.miningLevel = miningLevel; + this.itemDurability = itemDurability; + this.miningSpeed = miningSpeed; + this.attackDamage = attackDamage; + this.enchantability = enchantability; + this.repairIngredient = new Lazy<>(repairIngredient); + } + + @Override + public int getDurability() { + return this.itemDurability; + } + + @Override + public float getMiningSpeedMultiplier() { + return this.miningSpeed; + } + + @Override + public float getAttackDamage() { + return this.attackDamage; + } + + @Override + public int getMiningLevel() { + return this.miningLevel; + } + + @Override + public int getEnchantability() { + return this.enchantability; + } + + @Override + public Ingredient getRepairIngredient() { + return this.repairIngredient.get(); + } +} diff --git a/src/main/resources/assets/squaredadditions/lang/de_de.json b/src/main/resources/assets/squaredadditions/lang/de_de.json index 5227e4e..f75ed45 100644 --- a/src/main/resources/assets/squaredadditions/lang/de_de.json +++ b/src/main/resources/assets/squaredadditions/lang/de_de.json @@ -4,5 +4,11 @@ "_comment2": "Copying English entries will cause them to become outdated when this file changes", "_comment3": "Untranslated entries will automatically be inherited from this file.", "_comment4": "Once again, don't copy from English, and THANK YOU for your hard work!", - "_comment5": "Hinweis für Übersetzer: KOPIEREN SIE KEINE EINTRÄGE AUS DEM ENGLISCHEN" + "_comment5": "Hinweis für Übersetzer: KOPIEREN SIE KEINE EINTRÄGE AUS DEM ENGLISCHEN", + + "item.squaredadditions.copper_sword": "Kupfer Schwert", + "item.squaredadditions.copper_shovel": "Kupfer Schaufel", + "item.squaredadditions.copper_hoe": "Kupfer Hacke", + "item.squaredadditions.copper_axe": "Kupfer Axt", + "item.squaredadditions.copper_pickaxe": "Kupfer Spitzhacke" } \ No newline at end of file diff --git a/src/main/resources/assets/squaredadditions/lang/en_us.json b/src/main/resources/assets/squaredadditions/lang/en_us.json index 372adb5..e2deab3 100644 --- a/src/main/resources/assets/squaredadditions/lang/en_us.json +++ b/src/main/resources/assets/squaredadditions/lang/en_us.json @@ -3,5 +3,11 @@ "_comment1": "I repeat: do NOT copy entries from English!!", "_comment2": "Copying English entries will cause them to become outdated when this file changes", "_comment3": "Untranslated entries will automatically be inherited from this file.", - "_comment4": "Once again, don't copy from English, and THANK YOU for your hard work!" + "_comment4": "Once again, don't copy from English, and THANK YOU for your hard work!", + + "item.squaredadditions.copper_sword": "Copper Sword", + "item.squaredadditions.copper_shovel": "Copper Shovel", + "item.squaredadditions.copper_hoe": "Copper Hoe", + "item.squaredadditions.copper_axe": "Copper Axe", + "item.squaredadditions.copper_pickaxe": "Copper Pickaxe" } \ No newline at end of file diff --git a/src/main/resources/assets/squaredadditions/lang/pl_pl.json b/src/main/resources/assets/squaredadditions/lang/pl_pl.json index ed483b8..615e950 100644 --- a/src/main/resources/assets/squaredadditions/lang/pl_pl.json +++ b/src/main/resources/assets/squaredadditions/lang/pl_pl.json @@ -4,5 +4,11 @@ "_comment2": "Copying English entries will cause them to become outdated when this file changes", "_comment3": "Untranslated entries will automatically be inherited from this file.", "_comment4": "Once again, don't copy from English, and THANK YOU for your hard work!", - "_comment5": "Uwaga dla tłumaczy: NIE KOPIUJ WPISÓW Z JĘZYKA ANGIELSKIEGO" + "_comment5": "Uwaga dla tłumaczy: NIE KOPIUJ WPISÓW Z JĘZYKA ANGIELSKIEGO", + + "item.squaredadditions.copper_sword": "Miedziany Miecz", + "item.squaredadditions.copper_shovel": "Miedziana Łopata", + "item.squaredadditions.copper_hoe": "Miedziana Motyka", + "item.squaredadditions.copper_axe": "Miedziana Siekiera", + "item.squaredadditions.copper_pickaxe": "Miedziany Kilof" } \ No newline at end of file diff --git a/src/main/resources/assets/squaredadditions/textures/item/copper_axe.png b/src/main/resources/assets/squaredadditions/textures/item/copper_axe.png new file mode 100755 index 0000000..0807b03 Binary files /dev/null and b/src/main/resources/assets/squaredadditions/textures/item/copper_axe.png differ diff --git a/src/main/resources/assets/squaredadditions/textures/item/copper_hoe.png b/src/main/resources/assets/squaredadditions/textures/item/copper_hoe.png new file mode 100755 index 0000000..7f92144 Binary files /dev/null and b/src/main/resources/assets/squaredadditions/textures/item/copper_hoe.png differ diff --git a/src/main/resources/assets/squaredadditions/textures/item/copper_pickaxe.png b/src/main/resources/assets/squaredadditions/textures/item/copper_pickaxe.png new file mode 100755 index 0000000..38d544b Binary files /dev/null and b/src/main/resources/assets/squaredadditions/textures/item/copper_pickaxe.png differ diff --git a/src/main/resources/assets/squaredadditions/textures/item/copper_shovel.png b/src/main/resources/assets/squaredadditions/textures/item/copper_shovel.png new file mode 100755 index 0000000..e5c9d11 Binary files /dev/null and b/src/main/resources/assets/squaredadditions/textures/item/copper_shovel.png differ diff --git a/src/main/resources/assets/squaredadditions/textures/item/copper_sword.png b/src/main/resources/assets/squaredadditions/textures/item/copper_sword.png new file mode 100755 index 0000000..93011d6 Binary files /dev/null and b/src/main/resources/assets/squaredadditions/textures/item/copper_sword.png differ