diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLeaves.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLeaves.java index 7420adeb..ccfecec4 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLeaves.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLeaves.java @@ -63,11 +63,6 @@ public class BlockAncientLeaves extends BlockLeaves implements } - @Override - public Map getModelLocations() { - return Collections.singletonMap(new ItemStack(this), new ModelVariant(new ResourceLocation(NaturesAura.MOD_ID, this.getBaseName()), "inventory")); - } - @Override public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) { return Collections.singletonList(new ItemStack(this, 1, 0)); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLog.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLog.java index ce94bed1..b5cd5201 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLog.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLog.java @@ -47,11 +47,6 @@ public class BlockAncientLog extends BlockLog implements IModItem, IModelProvide } - @Override - public Map getModelLocations() { - return Collections.singletonMap(new ItemStack(this), new ModelVariant(new ResourceLocation(NaturesAura.MOD_ID, this.getBaseName()), "inventory")); - } - @Override protected BlockStateContainer createBlockState() { return new BlockStateContainer(this, LOG_AXIS); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java index 461d49cf..fb62a49c 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java @@ -55,11 +55,6 @@ public class BlockAncientSapling extends BlockBush implements IGrowable, IModIte } } - @Override - public Map getModelLocations() { - return Collections.singletonMap(new ItemStack(this), new ModelVariant(new ResourceLocation(NaturesAura.MOD_ID, this.getBaseName()), "inventory")); - } - @Override public String getBaseName() { return "ancient_sapling"; diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java index 2595dbd6..04d3824d 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java @@ -76,11 +76,6 @@ public class BlockContainerImpl extends BlockContainer implements IModItem, IMod } - @Override - public Map getModelLocations() { - return Collections.singletonMap(new ItemStack(this), new ModelVariant(new ResourceLocation(NaturesAura.MOD_ID, this.getBaseName()), "inventory")); - } - @Override public EnumBlockRenderType getRenderType(IBlockState state) { return EnumBlockRenderType.MODEL; diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldenLeaves.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldenLeaves.java index 38cea2a9..681cdc82 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldenLeaves.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldenLeaves.java @@ -67,11 +67,6 @@ public class BlockGoldenLeaves extends BlockLeaves implements } - @Override - public Map getModelLocations() { - return Collections.singletonMap(new ItemStack(this), new ModelVariant(new ResourceLocation(NaturesAura.MOD_ID, this.getBaseName()), "inventory")); - } - @Override public List onSheared(ItemStack item, IBlockAccess world, BlockPos pos, int fortune) { NonNullList drops = NonNullList.create(); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockImpl.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockImpl.java index 14b6a374..eb1fafd8 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockImpl.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockImpl.java @@ -51,11 +51,6 @@ public class BlockImpl extends Block implements IModItem, IModelProvider { } - @Override - public Map getModelLocations() { - return Collections.singletonMap(new ItemStack(this), new ModelVariant(new ResourceLocation(NaturesAura.MOD_ID, this.getBaseName()), "inventory")); - } - @Override public Block setSoundType(SoundType sound) { return super.setSoundType(sound); diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemImpl.java b/src/main/java/de/ellpeck/naturesaura/items/ItemImpl.java index 23ef9b03..2e068927 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemImpl.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemImpl.java @@ -47,9 +47,4 @@ public class ItemImpl extends Item implements IModItem, IModelProvider { public void onPostInit(FMLPostInitializationEvent event) { } - - @Override - public Map getModelLocations() { - return Collections.singletonMap(new ItemStack(this), new ModelVariant(new ResourceLocation(NaturesAura.MOD_ID, this.getBaseName()), "inventory")); - } } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ModItems.java b/src/main/java/de/ellpeck/naturesaura/items/ModItems.java index db47957c..dff6c1b0 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ModItems.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ModItems.java @@ -1,6 +1,11 @@ package de.ellpeck.naturesaura.items; +import de.ellpeck.naturesaura.NaturesAura; +import de.ellpeck.naturesaura.items.tools.*; import net.minecraft.item.Item; +import net.minecraftforge.common.util.EnumHelper; + +import java.util.Locale; public final class ModItems { @@ -8,4 +13,12 @@ public final class ModItems { public static final Item GOLD_FIBER = new ItemGoldFiber(); public static final Item GOLD_LEAF = new ItemImpl("gold_leaf"); public static final Item INFUSED_IRON = new ItemImpl("infused_iron"); + + public static final Item.ToolMaterial TOOL_MATERIAL_INFUSED_IRON = + EnumHelper.addToolMaterial(NaturesAura.MOD_ID.toUpperCase(Locale.ROOT) + "_INFUSED_IRON", 3, 300, 6.25F, 2.25F, 16); + public static final Item INFUSED_PICKAXE = new ItemPickaxeNA("infused_iron_pickaxe", TOOL_MATERIAL_INFUSED_IRON); + public static final Item INFUSED_AXE = new ItemAxeNA("infused_iron_axe", TOOL_MATERIAL_INFUSED_IRON, 8.25F, -3.2F); + public static final Item INFUSED_SHOVEL = new ItemShovelNA("infused_iron_shovel", TOOL_MATERIAL_INFUSED_IRON); + public static final Item INFUSED_HOE = new ItemHoeNA("infused_iron_hoe", TOOL_MATERIAL_INFUSED_IRON); + public static final Item INFUSED_SWORD = new ItemSwordNA("infused_iron_sword", TOOL_MATERIAL_INFUSED_IRON); } diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemAxeNA.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemAxeNA.java new file mode 100644 index 00000000..d3901e55 --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemAxeNA.java @@ -0,0 +1,43 @@ +package de.ellpeck.naturesaura.items.tools; + +import de.ellpeck.naturesaura.reg.IModItem; +import de.ellpeck.naturesaura.reg.IModelProvider; +import de.ellpeck.naturesaura.reg.ModRegistry; +import net.minecraft.item.ItemAxe; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; + +public class ItemAxeNA extends ItemAxe implements IModItem, IModelProvider { + private final String baseName; + + public ItemAxeNA(String baseName, ToolMaterial material, float damage, float speed) { + super(material, damage, speed); + this.baseName = baseName; + ModRegistry.addItemOrBlock(this); + } + + @Override + public String getBaseName() { + return this.baseName; + } + + @Override + public boolean shouldAddCreative() { + return true; + } + + @Override + public void onPreInit(FMLPreInitializationEvent event) { + + } + + @Override + public void onInit(FMLInitializationEvent event) { + + } + + @Override + public void onPostInit(FMLPostInitializationEvent event) { + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemHoeNA.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemHoeNA.java new file mode 100644 index 00000000..02759445 --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemHoeNA.java @@ -0,0 +1,45 @@ +package de.ellpeck.naturesaura.items.tools; + +import de.ellpeck.naturesaura.reg.IModItem; +import de.ellpeck.naturesaura.reg.IModelProvider; +import de.ellpeck.naturesaura.reg.ModRegistry; +import net.minecraft.item.ItemHoe; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; + +public class ItemHoeNA extends ItemHoe implements IModItem, IModelProvider { + + private final String baseName; + + public ItemHoeNA(String baseName, ToolMaterial material) { + super(material); + this.baseName = baseName; + ModRegistry.addItemOrBlock(this); + } + + @Override + public String getBaseName() { + return this.baseName; + } + + @Override + public boolean shouldAddCreative() { + return true; + } + + @Override + public void onPreInit(FMLPreInitializationEvent event) { + + } + + @Override + public void onInit(FMLInitializationEvent event) { + + } + + @Override + public void onPostInit(FMLPostInitializationEvent event) { + + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemPickaxeNA.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemPickaxeNA.java new file mode 100644 index 00000000..b65a62eb --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemPickaxeNA.java @@ -0,0 +1,43 @@ +package de.ellpeck.naturesaura.items.tools; + +import de.ellpeck.naturesaura.reg.IModItem; +import de.ellpeck.naturesaura.reg.IModelProvider; +import de.ellpeck.naturesaura.reg.ModRegistry; +import net.minecraft.item.ItemPickaxe; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; + +public class ItemPickaxeNA extends ItemPickaxe implements IModItem, IModelProvider { + private final String baseName; + + public ItemPickaxeNA(String baseName, ToolMaterial material) { + super(material); + this.baseName = baseName; + ModRegistry.addItemOrBlock(this); + } + + @Override + public String getBaseName() { + return this.baseName; + } + + @Override + public boolean shouldAddCreative() { + return true; + } + + @Override + public void onPreInit(FMLPreInitializationEvent event) { + + } + + @Override + public void onInit(FMLInitializationEvent event) { + + } + + @Override + public void onPostInit(FMLPostInitializationEvent event) { + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovelNA.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovelNA.java new file mode 100644 index 00000000..83b14f5d --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovelNA.java @@ -0,0 +1,43 @@ +package de.ellpeck.naturesaura.items.tools; + +import de.ellpeck.naturesaura.reg.IModItem; +import de.ellpeck.naturesaura.reg.IModelProvider; +import de.ellpeck.naturesaura.reg.ModRegistry; +import net.minecraft.item.ItemSpade; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; + +public class ItemShovelNA extends ItemSpade implements IModItem, IModelProvider { + private final String baseName; + + public ItemShovelNA(String baseName, ToolMaterial material) { + super(material); + this.baseName = baseName; + ModRegistry.addItemOrBlock(this); + } + + @Override + public String getBaseName() { + return this.baseName; + } + + @Override + public boolean shouldAddCreative() { + return true; + } + + @Override + public void onPreInit(FMLPreInitializationEvent event) { + + } + + @Override + public void onInit(FMLInitializationEvent event) { + + } + + @Override + public void onPostInit(FMLPostInitializationEvent event) { + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemSwordNA.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemSwordNA.java new file mode 100644 index 00000000..df2b2723 --- /dev/null +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemSwordNA.java @@ -0,0 +1,44 @@ +package de.ellpeck.naturesaura.items.tools; + +import de.ellpeck.naturesaura.reg.IModItem; +import de.ellpeck.naturesaura.reg.IModelProvider; +import de.ellpeck.naturesaura.reg.ModRegistry; +import net.minecraft.item.ItemSword; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; + +public class ItemSwordNA extends ItemSword implements IModItem, IModelProvider { + private final String baseName; + + public ItemSwordNA(String baseName, ToolMaterial material) { + super(material); + this.baseName = baseName; + ModRegistry.addItemOrBlock(this); + } + + @Override + public String getBaseName() { + return this.baseName; + } + + @Override + public boolean shouldAddCreative() { + return true; + } + + @Override + public void onPreInit(FMLPreInitializationEvent event) { + + } + + @Override + public void onInit(FMLInitializationEvent event) { + + } + + @Override + public void onPostInit(FMLPostInitializationEvent event) { + + } +} diff --git a/src/main/java/de/ellpeck/naturesaura/reg/IModelProvider.java b/src/main/java/de/ellpeck/naturesaura/reg/IModelProvider.java index 4cb00e1f..ce434118 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/IModelProvider.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/IModelProvider.java @@ -1,13 +1,21 @@ package de.ellpeck.naturesaura.reg; +import de.ellpeck.naturesaura.NaturesAura; +import net.minecraft.block.Block; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; +import java.util.Collections; import java.util.Map; public interface IModelProvider { - Map getModelLocations(); + default Map getModelLocations() { + ItemStack stack = this instanceof Item ? new ItemStack((Item) this) : new ItemStack((Block) this); + String name = ((IModItem) this).getBaseName(); + return Collections.singletonMap(stack, new ModelVariant(new ResourceLocation(NaturesAura.MOD_ID, name), "inventory")); + } class ModelVariant { diff --git a/src/main/resources/assets/naturesaura/lang/en_US.lang b/src/main/resources/assets/naturesaura/lang/en_US.lang index 559e61bd..52a40b91 100644 --- a/src/main/resources/assets/naturesaura/lang/en_US.lang +++ b/src/main/resources/assets/naturesaura/lang/en_US.lang @@ -14,6 +14,11 @@ item.naturesaura.eye.name=Environmental Eye item.naturesaura.gold_fiber.name=Brilliant Fiber item.naturesaura.gold_leaf.name=Gold Leaf item.naturesaura.infused_iron.name=Infused Iron +item.naturesaura.infused_iron_pickaxe.name=Botanist's Pickaxe +item.naturesaura.infused_iron_axe.name=Botanist's Handaxe +item.naturesaura.infused_iron_shovel.name=Botanist's Shovel +item.naturesaura.infused_iron_sword.name=Botanist's Blade +item.naturesaura.infused_iron_hoe.name=Botanist's Hoe container.naturesaura.tree_ritual.name=Tree Infusion container.naturesaura.altar.name=Natural Altar diff --git a/src/main/resources/assets/naturesaura/models/item/infused_iron_axe.json b/src/main/resources/assets/naturesaura/models/item/infused_iron_axe.json new file mode 100644 index 00000000..a397794a --- /dev/null +++ b/src/main/resources/assets/naturesaura/models/item/infused_iron_axe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/handheld", + "textures": { + "layer0": "naturesaura:items/infused_iron_axe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/models/item/infused_iron_hoe.json b/src/main/resources/assets/naturesaura/models/item/infused_iron_hoe.json new file mode 100644 index 00000000..689ccfee --- /dev/null +++ b/src/main/resources/assets/naturesaura/models/item/infused_iron_hoe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/handheld", + "textures": { + "layer0": "naturesaura:items/infused_iron_hoe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/models/item/infused_iron_pickaxe.json b/src/main/resources/assets/naturesaura/models/item/infused_iron_pickaxe.json new file mode 100644 index 00000000..7bf2be69 --- /dev/null +++ b/src/main/resources/assets/naturesaura/models/item/infused_iron_pickaxe.json @@ -0,0 +1,6 @@ +{ + "parent": "item/handheld", + "textures": { + "layer0": "naturesaura:items/infused_iron_pickaxe" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/models/item/infused_iron_shovel.json b/src/main/resources/assets/naturesaura/models/item/infused_iron_shovel.json new file mode 100644 index 00000000..e72b1e3b --- /dev/null +++ b/src/main/resources/assets/naturesaura/models/item/infused_iron_shovel.json @@ -0,0 +1,6 @@ +{ + "parent": "item/handheld", + "textures": { + "layer0": "naturesaura:items/infused_iron_shovel" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/models/item/infused_iron_sword.json b/src/main/resources/assets/naturesaura/models/item/infused_iron_sword.json new file mode 100644 index 00000000..b022136c --- /dev/null +++ b/src/main/resources/assets/naturesaura/models/item/infused_iron_sword.json @@ -0,0 +1,6 @@ +{ + "parent": "item/handheld", + "textures": { + "layer0": "naturesaura:items/infused_iron_sword" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/naturesaura/textures/items/infused_iron_axe.png b/src/main/resources/assets/naturesaura/textures/items/infused_iron_axe.png new file mode 100644 index 00000000..33cb340b Binary files /dev/null and b/src/main/resources/assets/naturesaura/textures/items/infused_iron_axe.png differ diff --git a/src/main/resources/assets/naturesaura/textures/items/infused_iron_hoe.png b/src/main/resources/assets/naturesaura/textures/items/infused_iron_hoe.png new file mode 100644 index 00000000..f2c4a359 Binary files /dev/null and b/src/main/resources/assets/naturesaura/textures/items/infused_iron_hoe.png differ diff --git a/src/main/resources/assets/naturesaura/textures/items/infused_iron_pickaxe.png b/src/main/resources/assets/naturesaura/textures/items/infused_iron_pickaxe.png new file mode 100644 index 00000000..ba67f9b0 Binary files /dev/null and b/src/main/resources/assets/naturesaura/textures/items/infused_iron_pickaxe.png differ diff --git a/src/main/resources/assets/naturesaura/textures/items/infused_iron_shovel.png b/src/main/resources/assets/naturesaura/textures/items/infused_iron_shovel.png new file mode 100644 index 00000000..9ada57d2 Binary files /dev/null and b/src/main/resources/assets/naturesaura/textures/items/infused_iron_shovel.png differ diff --git a/src/main/resources/assets/naturesaura/textures/items/infused_iron_sword.png b/src/main/resources/assets/naturesaura/textures/items/infused_iron_sword.png new file mode 100644 index 00000000..b2d5e407 Binary files /dev/null and b/src/main/resources/assets/naturesaura/textures/items/infused_iron_sword.png differ