diff --git a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java index 8a440d5..0083c8d 100644 --- a/src/main/java/com/zivilon/cinder_loe/CinderLoE.java +++ b/src/main/java/com/zivilon/cinder_loe/CinderLoE.java @@ -131,11 +131,13 @@ public class CinderLoE { public static Block mistBlock; public static Block cutDrystone; public static Block cindercobble; + public static Block cinderfur; public static Block reeflessCoral; public static Block silverChain; public static Block goldChain; public static Block ironChain; public static Block bronzeChain; + public static Block plaster; public static Block voidblock; public static Block entityBarrier; @@ -189,6 +191,7 @@ public class CinderLoE { // Misc public static Item forgingKit; + public static Item cinderFurItem; // Common tools/weapons public static Item whip; @@ -461,6 +464,7 @@ public class CinderLoE { bronzeChain = (new bronzeChain()); GameRegistry.registerBlock(bronzeChain, "bronzeChain"); + // Staff mistBlock = (new MistBlock()); GameRegistry.registerBlock(mistBlock, "mist"); @@ -476,6 +480,9 @@ public class CinderLoE { cindercobble = (new CobbleBlock()); GameRegistry.registerBlock(cindercobble, CinderBlockMetaData.class, "cindercobble"); + cinderfur = (new CinderFurBlock()); + GameRegistry.registerBlock(cinderfur, CinderBlockMetaData.class, "cinderfur"); + plaster = (new plaster()); GameRegistry.registerBlock(plaster, "plaster"); @@ -601,6 +608,9 @@ public class CinderLoE { linkLOTRWeapon(welfRelic, "welfRelic"); // Misc + cinderFurItem = (new CinderFurItem()).setUnlocalizedName("cinder_fur_item").setTextureName("lotr:cinder_fur_item_0"); + ItemRegistration.register(cinderFurItem,"cinderFurItem",6004); + EVENT = getLOTRMaterialByName("EVENT"); MATERIAL_JADE = getLOTRMaterialByName("JADE"); @@ -1097,6 +1107,7 @@ public class CinderLoE { CinderCore.registerItemFallback(Block.getIdFromBlock(mistBlock), Block.getIdFromBlock(LOTRMod.utumnoPortal), "cinder_loe", "1.1"); CinderCore.registerItemFallback(Block.getIdFromBlock(cutDrystone), Block.getIdFromBlock(LOTRMod.cobblebrick), "cinder_loe", "1.2"); CinderCore.registerItemFallback(Block.getIdFromBlock(cindercobble), Block.getIdFromBlock(LOTRMod.cobblebrick), "cinder_loe", "1.2"); + CinderCore.registerItemFallback(Block.getIdFromBlock(cinderfur), Block.getIdFromBlock(Blocks.wool), "cinder_loe", "1.2.4"); CinderCore.registerItemFallback(Block.getIdFromBlock(reeflessCoral), Block.getIdFromBlock(LOTRMod.coralReef), "cinder_loe", "1.2"); CinderCore.registerItemFallback(Block.getIdFromBlock(plaster), Block.getIdFromBlock(Blocks.brick_block), "cinder_loe", "1.2.1"); CinderCore.registerItemFallback(Block.getIdFromBlock(voidblock), Block.getIdFromBlock(Blocks.coal_block), "cinder_loe", "1.2.1"); diff --git a/src/main/java/com/zivilon/cinder_loe/LoECreativeTabs.java b/src/main/java/com/zivilon/cinder_loe/LoECreativeTabs.java index 4738a99..2ec2cdd 100644 --- a/src/main/java/com/zivilon/cinder_loe/LoECreativeTabs.java +++ b/src/main/java/com/zivilon/cinder_loe/LoECreativeTabs.java @@ -28,7 +28,7 @@ public class LoECreativeTabs extends CreativeTabs { tabSpawnLoE.theIcon = new ItemStack(CinderLoE.spawnEgg); tabMiscLoE.theIcon = new ItemStack(CinderLoE.bonemold); tabFoodLoE.theIcon = new ItemStack(CinderLoE.onion); - tabDecoLoE.theIcon = new ItemStack(CinderLoE.silverChain); + tabDecoLoE.theIcon = new ItemStack(CinderLoE.cinderchain); tabCharacterLoE.theIcon = new ItemStack(CinderLoE.sarumanStaff); } diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/BarsBase.java b/src/main/java/com/zivilon/cinder_loe/blocks/BarsBase.java index 0dab051..c159a43 100644 --- a/src/main/java/com/zivilon/cinder_loe/blocks/BarsBase.java +++ b/src/main/java/com/zivilon/cinder_loe/blocks/BarsBase.java @@ -1,5 +1,6 @@ package com.zivilon.cinder_loe.blocks; +import com.zivilon.cinder_loe.LoECreativeTabs; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -26,7 +27,7 @@ public abstract class BarsBase extends BlockPane { super("", "", Material.iron, true); this.textureName = Utilities.toSnakeCase(blockName); this.setBlockName(blockName); - setCreativeTab((CreativeTabs)LOTRCreativeTabs.tabDeco); + this.setCreativeTab(LoECreativeTabs.tabBlockLoE); setHardness(5.0F); setResistance(10.0F); setStepSound(Block.soundTypeMetal); diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/BlockRedDwarfSteel.java b/src/main/java/com/zivilon/cinder_loe/blocks/BlockRedDwarfSteel.java index 3715765..df907fa 100644 --- a/src/main/java/com/zivilon/cinder_loe/blocks/BlockRedDwarfSteel.java +++ b/src/main/java/com/zivilon/cinder_loe/blocks/BlockRedDwarfSteel.java @@ -1,5 +1,6 @@ package com.zivilon.cinder_loe.blocks; +import com.zivilon.cinder_loe.LoECreativeTabs; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -16,13 +17,7 @@ public class BlockRedDwarfSteel extends Block { public BlockRedDwarfSteel() { super(Material.iron); // Choose the appropriate material - try { - Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabBlock"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to - LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null); - setCreativeTab((CreativeTabs)tab); - } catch (NoSuchFieldException | IllegalAccessException e) { - e.printStackTrace(); - } + this.setCreativeTab(LoECreativeTabs.tabBlockLoE); setHardness(5.0F); setResistance(15.0F); setStepSound(Block.soundTypeMetal); diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/ChandelierBase.java b/src/main/java/com/zivilon/cinder_loe/blocks/ChandelierBase.java index 1f345e5..af002f2 100644 --- a/src/main/java/com/zivilon/cinder_loe/blocks/ChandelierBase.java +++ b/src/main/java/com/zivilon/cinder_loe/blocks/ChandelierBase.java @@ -1,5 +1,6 @@ package com.zivilon.cinder_loe.blocks; +import com.zivilon.cinder_loe.LoECreativeTabs; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -29,7 +30,7 @@ public abstract class ChandelierBase extends Block { super(Material.circuits); this.textureName = Utilities.toSnakeCase(blockName); this.setBlockName(blockName); - setCreativeTab((CreativeTabs)LOTRCreativeTabs.tabDeco); + this.setCreativeTab(LoECreativeTabs.tabBlockLoE); setHardness(0.0F); setResistance(2.0F); setStepSound(Block.soundTypeMetal); diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/CinderChain.java b/src/main/java/com/zivilon/cinder_loe/blocks/CinderChain.java new file mode 100644 index 0000000..2aa4fa2 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/blocks/CinderChain.java @@ -0,0 +1,149 @@ +package com.zivilon.cinder_loe.blocks; + +import com.zivilon.cinder_loe.LoECreativeTabs; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import lotr.common.block.LOTRBlockOrcChain; +import net.minecraft.block.*; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +import java.util.List; + +public class CinderChain extends LOTRBlockOrcChain { + + public static final String[] chainTypes = {"bronze", "gold", "silver", "iron"}; + @SideOnly(value= Side.CLIENT) + private IIcon[] iconMiddle; + @SideOnly(value=Side.CLIENT) + private IIcon[] iconTop; + @SideOnly(value=Side.CLIENT) + private IIcon[] iconBottom; + @SideOnly(value=Side.CLIENT) + private IIcon[] iconSingle; + @SideOnly(Side.CLIENT) + private IIcon[] iconItem; + + + public CinderChain() { + this.setCreativeTab(LoECreativeTabs.tabDecoLoE); + this.setHardness(1.0f); + this.setStepSound(Block.soundTypeMetal); + setBlockName("lotr:cinderchain"); + setBlockTextureName("lotr:cinderchain"); + float f = 0.2f; + this.setBlockBounds(0.5f - f, 0.0f, 0.5f - f, 0.5f + f, 1.0f, 0.5f + f); + } + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(IIconRegister iconRegister) { + + this.iconItem = new IIcon[chainTypes.length]; + + for (int i = 0; i < chainTypes.length; ++i) { + this.iconItem[i] = iconRegister.registerIcon(this.getTextureName() + "_" + chainTypes[i] + "_item"); + } + + this.iconMiddle = new IIcon[chainTypes.length]; + this.iconTop = new IIcon[chainTypes.length]; + this.iconBottom = new IIcon[chainTypes.length]; + this.iconSingle = new IIcon[chainTypes.length]; + + for (int i = 0; i < chainTypes.length; ++i) { + this.iconMiddle[i] = iconRegister.registerIcon(this.getTextureName() + "_" + chainTypes[i] + "_mid"); + this.iconTop[i] = iconRegister.registerIcon(this.getTextureName() + "_" + chainTypes[i] + "_top"); + this.iconBottom[i] = iconRegister.registerIcon(this.getTextureName() + "_" + chainTypes[i] + "_bottom"); + this.iconSingle[i] = iconRegister.registerIcon(this.getTextureName() + "_" + chainTypes[i] + "_single"); + } + } + @SideOnly(Side.CLIENT) + @Override + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { + Block above = world.getBlock(x, y + 1, z); + Block below = world.getBlock(x, y - 1, z); + boolean chainAbove = above instanceof CinderChain; + boolean chainBelow = below instanceof CinderChain; + + int meta = world.getBlockMetadata(x, y, z); + if (chainAbove && chainBelow) { + return this.iconMiddle[meta]; + } + if (chainAbove) { + return this.iconBottom[meta]; + } + if (chainBelow) { + return this.iconTop[meta]; + } + return this.iconSingle[meta]; + } + + @SideOnly(value=Side.CLIENT) + public IIcon getIcon(int i, int j) { + return i == 1 ? this.iconItem[0] : this.iconItem[1]; + } + + @SideOnly(value=Side.CLIENT) + public String getItemIconName() { + return this.getTextureName(); + } + + @Override + public int damageDropped(int meta) { + return meta; + } + + @SideOnly(Side.CLIENT) + @Override + public void getSubBlocks(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < chainTypes.length; ++i) { + list.add(new ItemStack(item, 1, i)); + } + } + + @Override + public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int metadata) { + // The metadata provided here is the metadata of the block being placed (from the item stack). + return metadata; // Return the metadata of the block that should be placed. + } + + + @Override + public boolean canPlaceBlockAt(World world, int x, int y, int z) { + Block blockAbove = world.getBlock(x, y + 1, z); + int metaAbove = world.getBlockMetadata(x, y + 1, z); + + // Get the metadata of the block to be placed (already handled by onBlockPlaced) + int currentMeta = world.getBlockMetadata(x, y, z); // Metadata of the block being placed + + // Check if the block above is a chain block and if the metadata matches + if (blockAbove instanceof CinderChain) { + if (metaAbove != currentMeta) { + return false; // Prevent placement of different types of chains + } + return true; // Same type, allow placement + } + + // Other checks for fences, walls, slabs, etc. + if (blockAbove instanceof BlockFence || blockAbove instanceof BlockWall) { + return true; + } + if (blockAbove instanceof BlockSlab && !blockAbove.isOpaqueCube() && (metaAbove & 8) == 0) { + return true; + } + if (blockAbove instanceof BlockStairs && (metaAbove & 4) == 0) { + return true; + } + + // Check if the block above is solid on the bottom + return blockAbove.isSideSolid(world, x, y + 1, z, ForgeDirection.DOWN); + } + + +} diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/CinderFurBlock.java b/src/main/java/com/zivilon/cinder_loe/blocks/CinderFurBlock.java new file mode 100644 index 0000000..af2ad42 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/blocks/CinderFurBlock.java @@ -0,0 +1,64 @@ +package com.zivilon.cinder_loe.blocks; + +import com.zivilon.cinder_loe.LoECreativeTabs; +import com.zivilon.cinder_loe.util.Utilities; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import lotr.common.LOTRCreativeTabs; +import lotr.common.block.LOTRBlockBrickBase; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +import java.lang.reflect.Field; +import java.util.List; + +public class CinderFurBlock extends Block { + protected IIcon[] brickIcons; + protected String[] brickNames; + + + public CinderFurBlock() { + super(Material.cloth); + this.setCreativeTab(LoECreativeTabs.tabBlockLoE); + setBlockTextureName("lotr:cinderfur"); + setBlockName("lotr:cinderfur"); + setStepSound(Block.soundTypeCloth); + this.setBrickNames("brown", "gray", "black", "white", "obsidian", "bearblack", "bearbrown", "lion", "lioness"); + } + + protected void setBrickNames(String ... names) { + this.brickNames = names; + } + + @SideOnly(Side.CLIENT) + @Override + public void registerBlockIcons(IIconRegister iconregister) { + this.brickIcons = new IIcon[this.brickNames.length]; + for (int i = 0; i < this.brickNames.length; ++i) { + String texturePath = this.getTextureName() + "_" + this.brickNames[i]; + System.out.println("Registering texture: " + texturePath); // Debug log + this.brickIcons[i] = iconregister.registerIcon(texturePath); + } + } + @Override + public IIcon getIcon(int side, int meta) { + return this.brickIcons[meta]; + } + + @Override + public int damageDropped(int meta) { + return meta; + } + @SideOnly(Side.CLIENT) + @Override + public void getSubBlocks(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < this.brickNames.length; ++i) { + list.add(new ItemStack(item, 1, i)); + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/CobbleBlock.java b/src/main/java/com/zivilon/cinder_loe/blocks/CobbleBlock.java index 550d7ca..9e8c110 100644 --- a/src/main/java/com/zivilon/cinder_loe/blocks/CobbleBlock.java +++ b/src/main/java/com/zivilon/cinder_loe/blocks/CobbleBlock.java @@ -1,5 +1,6 @@ package com.zivilon.cinder_loe.blocks; +import com.zivilon.cinder_loe.LoECreativeTabs; import com.zivilon.cinder_loe.util.Utilities; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -26,15 +27,7 @@ public class CobbleBlock extends Block { this.setHardness(1.5f); this.setResistance(10.0f); this.setStepSound(Block.soundTypeStone); - - try { - Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabBlock"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to - LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null); - setCreativeTab((CreativeTabs)tab); - } catch (NoSuchFieldException | IllegalAccessException e) { - e.printStackTrace(); - } - + this.setCreativeTab(LoECreativeTabs.tabBlockLoE); setBlockTextureName("lotr:cindercobble"); setBlockName("lotr:cindercobble"); this.setBrickNames("drystone", "mordor"); diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/FishBarrel.java b/src/main/java/com/zivilon/cinder_loe/blocks/FishBarrel.java index 30b483a..d857567 100644 --- a/src/main/java/com/zivilon/cinder_loe/blocks/FishBarrel.java +++ b/src/main/java/com/zivilon/cinder_loe/blocks/FishBarrel.java @@ -1,5 +1,6 @@ package com.zivilon.cinder_loe.blocks; +import com.zivilon.cinder_loe.LoECreativeTabs; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import lotr.common.LOTRCreativeTabs; @@ -15,13 +16,7 @@ public class FishBarrel extends StaticBlockBase3 { public FishBarrel() { super(Material.wood, "lotr:fishbarrel"); - try { - Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabDeco"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to - LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null); - setCreativeTab((CreativeTabs)tab); - } catch (NoSuchFieldException | IllegalAccessException e) { - e.printStackTrace(); - } + this.setCreativeTab(LoECreativeTabs.tabDecoLoE); setStepSound(Block.soundTypeWood); setBlockName("lotr:fishbarrel"); setHardness(1.0F); diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/FurBundle.java b/src/main/java/com/zivilon/cinder_loe/blocks/FurBundle.java index b05ebb7..398a03d 100644 --- a/src/main/java/com/zivilon/cinder_loe/blocks/FurBundle.java +++ b/src/main/java/com/zivilon/cinder_loe/blocks/FurBundle.java @@ -1,5 +1,6 @@ package com.zivilon.cinder_loe.blocks; +import com.zivilon.cinder_loe.LoECreativeTabs; import com.zivilon.cinder_loe.blocks.RotatableBlockBase3; import lotr.common.LOTRCreativeTabs; import net.minecraft.block.Block; @@ -12,13 +13,7 @@ import java.lang.reflect.Field; public class FurBundle extends RotatableBlockBase3 { public FurBundle() { super(Material.cloth, "lotr:furBundle"); - try { - Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabDeco"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to - LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null); - setCreativeTab((CreativeTabs)tab); - } catch (NoSuchFieldException | IllegalAccessException e) { - e.printStackTrace(); - } + this.setCreativeTab(LoECreativeTabs.tabDecoLoE); setStepSound(Block.soundTypeCloth); setBlockName("lotr:furBundle"); setHardness(0.5F); diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/LeatherBundle.java b/src/main/java/com/zivilon/cinder_loe/blocks/LeatherBundle.java index a841847..1ae87f7 100644 --- a/src/main/java/com/zivilon/cinder_loe/blocks/LeatherBundle.java +++ b/src/main/java/com/zivilon/cinder_loe/blocks/LeatherBundle.java @@ -1,5 +1,6 @@ package com.zivilon.cinder_loe.blocks; +import com.zivilon.cinder_loe.LoECreativeTabs; import com.zivilon.cinder_loe.blocks.RotatableBlockBase3; import lotr.common.LOTRCreativeTabs; import net.minecraft.block.Block; @@ -12,13 +13,7 @@ import java.lang.reflect.Field; public class LeatherBundle extends RotatableBlockBase3 { public LeatherBundle() { super(Material.cloth, "lotr:leatherBundle"); - try { - Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabDeco"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to - LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null); - setCreativeTab((CreativeTabs)tab); - } catch (NoSuchFieldException | IllegalAccessException e) { - e.printStackTrace(); - } + this.setCreativeTab(LoECreativeTabs.tabDecoLoE); setStepSound(Block.soundTypeCloth); setBlockName("lotr:leatherBundle"); setHardness(0.5F); diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/ReedBale.java b/src/main/java/com/zivilon/cinder_loe/blocks/ReedBale.java index 467767b..3d173f5 100644 --- a/src/main/java/com/zivilon/cinder_loe/blocks/ReedBale.java +++ b/src/main/java/com/zivilon/cinder_loe/blocks/ReedBale.java @@ -1,5 +1,6 @@ package com.zivilon.cinder_loe.blocks; +import com.zivilon.cinder_loe.LoECreativeTabs; import com.zivilon.cinder_loe.blocks.RotatableBlockBase3; import lotr.common.LOTRCreativeTabs; import net.minecraft.block.Block; @@ -12,13 +13,7 @@ import java.lang.reflect.Field; public class ReedBale extends RotatableBlockBase3 { public ReedBale() { super(Material.grass, "lotr:reedBale"); - try { - Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabDeco"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to - LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null); - setCreativeTab((CreativeTabs)tab); - } catch (NoSuchFieldException | IllegalAccessException e) { - e.printStackTrace(); - } + setCreativeTab(LoECreativeTabs.tabDecoLoE); setStepSound(Block.soundTypeGrass); setBlockName("lotr:reedBale"); setHardness(0.5F); diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/RunedDwarvenBrick.java b/src/main/java/com/zivilon/cinder_loe/blocks/RunedDwarvenBrick.java index 3b0541f..9afd624 100644 --- a/src/main/java/com/zivilon/cinder_loe/blocks/RunedDwarvenBrick.java +++ b/src/main/java/com/zivilon/cinder_loe/blocks/RunedDwarvenBrick.java @@ -1,5 +1,6 @@ package com.zivilon.cinder_loe.blocks; +import com.zivilon.cinder_loe.LoECreativeTabs; import lotr.common.LOTRCreativeTabs; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -19,13 +20,7 @@ public class RunedDwarvenBrick extends Block { public RunedDwarvenBrick() { super(Material.rock); // Choose the appropriate material - try { - Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabDeco"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to - LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null); - setCreativeTab((CreativeTabs)tab); - } catch (NoSuchFieldException | IllegalAccessException e) { - e.printStackTrace(); - } + setCreativeTab(LoECreativeTabs.tabDecoLoE); // Set other properties like hardness, resistance, name, etc. setHardness(2.0F); setResistance(5.0F); diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/cutDrystone.java b/src/main/java/com/zivilon/cinder_loe/blocks/cutDrystone.java index 7697104..74beb96 100644 --- a/src/main/java/com/zivilon/cinder_loe/blocks/cutDrystone.java +++ b/src/main/java/com/zivilon/cinder_loe/blocks/cutDrystone.java @@ -1,5 +1,6 @@ package com.zivilon.cinder_loe.blocks; +import com.zivilon.cinder_loe.LoECreativeTabs; import com.zivilon.cinder_loe.util.Utilities; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -16,13 +17,7 @@ public class cutDrystone extends Block { public cutDrystone() { super(Material.rock); // Choose the appropriate material // Set other properties like hardness, resistance, name, etc. - try { - Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabBlock"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to - LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null); - setCreativeTab((CreativeTabs)tab); - } catch (NoSuchFieldException | IllegalAccessException e) { - e.printStackTrace(); - } + this.setCreativeTab(LoECreativeTabs.tabBlockLoE); setHardness(2.0F); setResistance(5.0F); setBlockTextureName(Utilities.toSnakeCase("lotr:cut_drystone")); diff --git a/src/main/java/com/zivilon/cinder_loe/blocks/reeflessCoral.java b/src/main/java/com/zivilon/cinder_loe/blocks/reeflessCoral.java index 3ad20a2..67294ee 100644 --- a/src/main/java/com/zivilon/cinder_loe/blocks/reeflessCoral.java +++ b/src/main/java/com/zivilon/cinder_loe/blocks/reeflessCoral.java @@ -1,5 +1,6 @@ package com.zivilon.cinder_loe.blocks; +import com.zivilon.cinder_loe.LoECreativeTabs; import com.zivilon.cinder_loe.util.Utilities; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -15,13 +16,7 @@ public class reeflessCoral extends Block { public reeflessCoral() { super(Material.rock); // Choose the appropriate material - try { - Field tabField = LOTRCreativeTabs.class.getDeclaredField("tabDeco"); // Stupid workaround because ForgeGradle tries to obfuscate field LOTRCreativeTabs.tabBlock when it's not supposed to - LOTRCreativeTabs tab = (LOTRCreativeTabs)tabField.get(null); - setCreativeTab((CreativeTabs)tab); - } catch (NoSuchFieldException | IllegalAccessException e) { - e.printStackTrace(); - } + setCreativeTab(LoECreativeTabs.tabBlockLoE); // Set other properties like hardness, resistance, name, etc. setHardness(2.0F); setResistance(5.0F); diff --git a/src/main/java/com/zivilon/cinder_loe/items/CinderFurItem.java b/src/main/java/com/zivilon/cinder_loe/items/CinderFurItem.java new file mode 100644 index 0000000..fd7f897 --- /dev/null +++ b/src/main/java/com/zivilon/cinder_loe/items/CinderFurItem.java @@ -0,0 +1,56 @@ +package com.zivilon.cinder_loe.items; + +import com.zivilon.cinder_loe.LoECreativeTabs; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +import java.util.List; + +public class CinderFurItem extends Item { + public IIcon[] icons; + + public CinderFurItem() { + super(); + this.setCreativeTab(LoECreativeTabs.tabMiscLoE); + setHasSubtypes(true); + } + + @Override + public void registerIcons(IIconRegister iconRegister) { + icons = new IIcon[7]; + for (int i = 0; i < 7; i++) { + icons[i] = iconRegister.registerIcon("lotr:cinder_fur_item_" + i); + } + } + + @Override + public String getUnlocalizedName(ItemStack item) { + return "item.cinder_fur_item_" + item.getItemDamage(); + } + + @Override + public IIcon getIconIndex(ItemStack item) { + return getIcon(item, 0); + } + + @Override + public IIcon getIcon(ItemStack stack, int renderPass) { + int dmg = stack.getItemDamage(); + + // Ensure dmg is within the expected range of subtypes + if (dmg < 7) { + return icons[dmg]; + } + return icons[0]; // Default to 0 if out of bounds + } + + @Override + public void getSubItems(Item item, CreativeTabs tab, List list) { + for (int i = 0; i < 7; i++) { + list.add(new ItemStack(item, 1, i)); + } + } +} diff --git a/src/main/java/com/zivilon/cinder_loe/recipes.java b/src/main/java/com/zivilon/cinder_loe/recipes.java index fa5d3c8..4e16912 100644 --- a/src/main/java/com/zivilon/cinder_loe/recipes.java +++ b/src/main/java/com/zivilon/cinder_loe/recipes.java @@ -163,14 +163,18 @@ public class recipes { 'X', Items.fish)); //GameRegistry.addRecipe((IRecipe)new ShapedOreRecipe(new ItemStack(CinderLoE.rustedsword, 8), new Object[] { "X", "y", "y", //Character.valueOf('Y'), Items.iron_ingot, Character.valueOf('X'), "stickWood"})); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.silverChain, 8), "X", "X", "X", - 'X', LOTRMod.silver)); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.goldChain, 8), "X", "X", "X", + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cinderchain, 8, 0), + "X", "X", "X", + 'X', LOTRMod.bronze)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cinderchain, 8, 1), + "X", "X", "X", 'X', Items.gold_ingot)); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.ironChain, 8), "X", "X", "X", + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cinderchain, 8, 2), + "X", "X", "X", + 'X', LOTRMod.silver)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cinderchain, 8, 3), + "X", "X", "X", 'X', Items.iron_ingot)); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.bronzeChain, 8), "X", "X", "X", - 'X', LOTRMod.bronze)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cindercobble, 4, 0), "XX", "XX", 'X', LOTRMod.cobblebrick)); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(CinderLoE.cutDrystone, 4), "XX", "XX", diff --git a/src/main/resources/assets/lotr/textures/blocks/cinderfur_bearblack.png b/src/main/resources/assets/lotr/textures/blocks/cinderfur_bearblack.png new file mode 100644 index 0000000..a56ff66 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/blocks/cinderfur_bearblack.png differ diff --git a/src/main/resources/assets/lotr/textures/blocks/cinderfur_bearbrown.png b/src/main/resources/assets/lotr/textures/blocks/cinderfur_bearbrown.png new file mode 100644 index 0000000..cc6107c Binary files /dev/null and b/src/main/resources/assets/lotr/textures/blocks/cinderfur_bearbrown.png differ diff --git a/src/main/resources/assets/lotr/textures/blocks/bronzeChain_bottom.png b/src/main/resources/assets/lotr/textures/blocks/cinderfur_black.png similarity index 51% rename from src/main/resources/assets/lotr/textures/blocks/bronzeChain_bottom.png rename to src/main/resources/assets/lotr/textures/blocks/cinderfur_black.png index 5cfcd06..6a0ec9c 100644 Binary files a/src/main/resources/assets/lotr/textures/blocks/bronzeChain_bottom.png and b/src/main/resources/assets/lotr/textures/blocks/cinderfur_black.png differ diff --git a/src/main/resources/assets/lotr/textures/blocks/cinderfur_brown.png b/src/main/resources/assets/lotr/textures/blocks/cinderfur_brown.png new file mode 100644 index 0000000..0ad91ed Binary files /dev/null and b/src/main/resources/assets/lotr/textures/blocks/cinderfur_brown.png differ diff --git a/src/main/resources/assets/lotr/textures/blocks/bronzeChain_single.png b/src/main/resources/assets/lotr/textures/blocks/cinderfur_gray.png similarity index 50% rename from src/main/resources/assets/lotr/textures/blocks/bronzeChain_single.png rename to src/main/resources/assets/lotr/textures/blocks/cinderfur_gray.png index f55d397..ac386b9 100644 Binary files a/src/main/resources/assets/lotr/textures/blocks/bronzeChain_single.png and b/src/main/resources/assets/lotr/textures/blocks/cinderfur_gray.png differ diff --git a/src/main/resources/assets/lotr/textures/blocks/cinderfur_lion.png b/src/main/resources/assets/lotr/textures/blocks/cinderfur_lion.png new file mode 100644 index 0000000..04e9f16 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/blocks/cinderfur_lion.png differ diff --git a/src/main/resources/assets/lotr/textures/blocks/cinderfur_lioness.png b/src/main/resources/assets/lotr/textures/blocks/cinderfur_lioness.png new file mode 100644 index 0000000..450aa46 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/blocks/cinderfur_lioness.png differ diff --git a/src/main/resources/assets/lotr/textures/blocks/cinderfur_obsidian.png b/src/main/resources/assets/lotr/textures/blocks/cinderfur_obsidian.png new file mode 100644 index 0000000..28eb3eb Binary files /dev/null and b/src/main/resources/assets/lotr/textures/blocks/cinderfur_obsidian.png differ diff --git a/src/main/resources/assets/lotr/textures/blocks/bronzeChain_top.png b/src/main/resources/assets/lotr/textures/blocks/cinderfur_white.png similarity index 50% rename from src/main/resources/assets/lotr/textures/blocks/bronzeChain_top.png rename to src/main/resources/assets/lotr/textures/blocks/cinderfur_white.png index 4713718..4d0492f 100644 Binary files a/src/main/resources/assets/lotr/textures/blocks/bronzeChain_top.png and b/src/main/resources/assets/lotr/textures/blocks/cinderfur_white.png differ diff --git a/src/main/resources/assets/lotr/textures/blocks/goldChain_bottom.png b/src/main/resources/assets/lotr/textures/blocks/goldChain_bottom.png deleted file mode 100644 index 6b76c9b..0000000 Binary files a/src/main/resources/assets/lotr/textures/blocks/goldChain_bottom.png and /dev/null differ diff --git a/src/main/resources/assets/lotr/textures/blocks/goldChain_mid.png b/src/main/resources/assets/lotr/textures/blocks/goldChain_mid.png deleted file mode 100644 index c40b6eb..0000000 Binary files a/src/main/resources/assets/lotr/textures/blocks/goldChain_mid.png and /dev/null differ diff --git a/src/main/resources/assets/lotr/textures/blocks/goldChain_single.png b/src/main/resources/assets/lotr/textures/blocks/goldChain_single.png deleted file mode 100644 index f8b0e15..0000000 Binary files a/src/main/resources/assets/lotr/textures/blocks/goldChain_single.png and /dev/null differ diff --git a/src/main/resources/assets/lotr/textures/blocks/goldChain_top.png b/src/main/resources/assets/lotr/textures/blocks/goldChain_top.png deleted file mode 100644 index f8b0e15..0000000 Binary files a/src/main/resources/assets/lotr/textures/blocks/goldChain_top.png and /dev/null differ diff --git a/src/main/resources/assets/lotr/textures/blocks/ironChain_bottom.png b/src/main/resources/assets/lotr/textures/blocks/ironChain_bottom.png deleted file mode 100644 index 05523c5..0000000 Binary files a/src/main/resources/assets/lotr/textures/blocks/ironChain_bottom.png and /dev/null differ diff --git a/src/main/resources/assets/lotr/textures/blocks/ironChain_mid.png b/src/main/resources/assets/lotr/textures/blocks/ironChain_mid.png deleted file mode 100644 index ee0680f..0000000 Binary files a/src/main/resources/assets/lotr/textures/blocks/ironChain_mid.png and /dev/null differ diff --git a/src/main/resources/assets/lotr/textures/blocks/ironChain_single.png b/src/main/resources/assets/lotr/textures/blocks/ironChain_single.png deleted file mode 100644 index be3a2f4..0000000 Binary files a/src/main/resources/assets/lotr/textures/blocks/ironChain_single.png and /dev/null differ diff --git a/src/main/resources/assets/lotr/textures/blocks/ironChain_top.png b/src/main/resources/assets/lotr/textures/blocks/ironChain_top.png deleted file mode 100644 index be3a2f4..0000000 Binary files a/src/main/resources/assets/lotr/textures/blocks/ironChain_top.png and /dev/null differ diff --git a/src/main/resources/assets/lotr/textures/blocks/silverChain_bottom.png b/src/main/resources/assets/lotr/textures/blocks/silverChain_bottom.png deleted file mode 100644 index 4508f63..0000000 Binary files a/src/main/resources/assets/lotr/textures/blocks/silverChain_bottom.png and /dev/null differ diff --git a/src/main/resources/assets/lotr/textures/blocks/silverChain_mid.png b/src/main/resources/assets/lotr/textures/blocks/silverChain_mid.png deleted file mode 100644 index 4e40b50..0000000 Binary files a/src/main/resources/assets/lotr/textures/blocks/silverChain_mid.png and /dev/null differ diff --git a/src/main/resources/assets/lotr/textures/blocks/silverChain_single.png b/src/main/resources/assets/lotr/textures/blocks/silverChain_single.png deleted file mode 100644 index b708df9..0000000 Binary files a/src/main/resources/assets/lotr/textures/blocks/silverChain_single.png and /dev/null differ diff --git a/src/main/resources/assets/lotr/textures/blocks/silverChain_top.png b/src/main/resources/assets/lotr/textures/blocks/silverChain_top.png deleted file mode 100644 index 4539b1b..0000000 Binary files a/src/main/resources/assets/lotr/textures/blocks/silverChain_top.png and /dev/null differ diff --git a/src/main/resources/assets/lotr/textures/items/bronzeChain.png b/src/main/resources/assets/lotr/textures/items/bronzeChain.png deleted file mode 100644 index 43e2cae..0000000 Binary files a/src/main/resources/assets/lotr/textures/items/bronzeChain.png and /dev/null differ diff --git a/src/main/resources/assets/lotr/textures/items/cinder_fur_item_0.png b/src/main/resources/assets/lotr/textures/items/cinder_fur_item_0.png new file mode 100644 index 0000000..029301d Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/cinder_fur_item_0.png differ diff --git a/src/main/resources/assets/lotr/textures/blocks/bronzeChain_mid.png b/src/main/resources/assets/lotr/textures/items/cinder_fur_item_1.png similarity index 51% rename from src/main/resources/assets/lotr/textures/blocks/bronzeChain_mid.png rename to src/main/resources/assets/lotr/textures/items/cinder_fur_item_1.png index 069555b..50c925f 100644 Binary files a/src/main/resources/assets/lotr/textures/blocks/bronzeChain_mid.png and b/src/main/resources/assets/lotr/textures/items/cinder_fur_item_1.png differ diff --git a/src/main/resources/assets/lotr/textures/items/cinder_fur_item_2.png b/src/main/resources/assets/lotr/textures/items/cinder_fur_item_2.png new file mode 100644 index 0000000..9dbc84f Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/cinder_fur_item_2.png differ diff --git a/src/main/resources/assets/lotr/textures/items/cinder_fur_item_3.png b/src/main/resources/assets/lotr/textures/items/cinder_fur_item_3.png new file mode 100644 index 0000000..6753689 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/cinder_fur_item_3.png differ diff --git a/src/main/resources/assets/lotr/textures/items/cinder_fur_item_4.png b/src/main/resources/assets/lotr/textures/items/cinder_fur_item_4.png new file mode 100644 index 0000000..f3d8335 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/cinder_fur_item_4.png differ diff --git a/src/main/resources/assets/lotr/textures/items/cinder_fur_item_5.png b/src/main/resources/assets/lotr/textures/items/cinder_fur_item_5.png new file mode 100644 index 0000000..b2000cd Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/cinder_fur_item_5.png differ diff --git a/src/main/resources/assets/lotr/textures/items/cinder_fur_item_6.png b/src/main/resources/assets/lotr/textures/items/cinder_fur_item_6.png new file mode 100644 index 0000000..cf9a1c8 Binary files /dev/null and b/src/main/resources/assets/lotr/textures/items/cinder_fur_item_6.png differ diff --git a/src/main/resources/assets/lotr/textures/items/goldChain.png b/src/main/resources/assets/lotr/textures/items/goldChain.png deleted file mode 100644 index 3f28968..0000000 Binary files a/src/main/resources/assets/lotr/textures/items/goldChain.png and /dev/null differ diff --git a/src/main/resources/assets/lotr/textures/items/ironChain.png b/src/main/resources/assets/lotr/textures/items/ironChain.png deleted file mode 100644 index c9e8732..0000000 Binary files a/src/main/resources/assets/lotr/textures/items/ironChain.png and /dev/null differ diff --git a/src/main/resources/assets/lotr/textures/items/silverChain.png b/src/main/resources/assets/lotr/textures/items/silverChain.png deleted file mode 100644 index 7d70ba2..0000000 Binary files a/src/main/resources/assets/lotr/textures/items/silverChain.png and /dev/null differ