From b942946df17bc4c7285d5f531282677c66789716 Mon Sep 17 00:00:00 2001 From: Amnet Date: Sun, 14 Apr 2013 02:23:46 +0200 Subject: [PATCH] Compressing Leaves --- .../biomesop/blocks/BlockAcaciaLeaves.java | 1 + .../biomesop/blocks/BlockAutumnLeaves.java | 1 + .../blocks/BlockBOPColorizedLeaves.java | 132 ++++++++++++++++++ .../biomesop/blocks/BlockBOPFlower.java | 2 + .../biomesop/blocks/BlockBOPLeaves.java | 91 ++++++++++++ .../biomesop/blocks/BlockBambooLeaves.java | 1 + .../biomesop/blocks/BlockBlueLeaves.java | 1 + .../biomesop/blocks/BlockDarkLeaves.java | 1 + .../biomesop/blocks/BlockDeadLeaves.java | 1 + .../biomesop/blocks/BlockFirLeaves.java | 1 + .../biomesop/blocks/BlockHolyLeaves.java | 1 + .../biomesop/blocks/BlockMangroveLeaves.java | 1 + .../biomesop/blocks/BlockOrangeLeaves.java | 1 + .../biomesop/blocks/BlockOriginLeaves.java | 1 + .../biomesop/blocks/BlockPalmLeaves.java | 1 + .../biomesop/blocks/BlockPinkLeaves.java | 1 + .../biomesop/blocks/BlockRedLeaves.java | 1 + .../biomesop/blocks/BlockRedwoodLeaves.java | 1 + .../biomesop/blocks/BlockWhiteLeaves.java | 1 + .../biomesop/blocks/BlockWillowLeaves.java | 1 + .../biomesop/configuration/BOPBlocks.java | 38 ++++- .../items/ItemBOPColorizedLeaves.java | 28 ++++ .../biomesop/items/ItemBOPFlower.java | 1 + .../biomesop/items/ItemBOPLeaves.java | 28 ++++ 24 files changed, 334 insertions(+), 3 deletions(-) create mode 100644 src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPColorizedLeaves.java create mode 100644 src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPLeaves.java create mode 100644 src/minecraft/tdwp_ftw/biomesop/items/ItemBOPColorizedLeaves.java create mode 100644 src/minecraft/tdwp_ftw/biomesop/items/ItemBOPLeaves.java diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaLeaves.java index 603d6de49..3c5819dd7 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAcaciaLeaves.java @@ -19,6 +19,7 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +@Deprecated public class BlockAcaciaLeaves extends BlockLeavesBase implements IShearable { /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAutumnLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAutumnLeaves.java index 48d994035..fd2ff0eb8 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAutumnLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockAutumnLeaves.java @@ -18,6 +18,7 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +@Deprecated public class BlockAutumnLeaves extends BlockLeavesBase implements IShearable { /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPColorizedLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPColorizedLeaves.java new file mode 100644 index 000000000..fad6e23d5 --- /dev/null +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPColorizedLeaves.java @@ -0,0 +1,132 @@ +package tdwp_ftw.biomesop.blocks; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.configuration.BOPBlocks; + +import net.minecraft.block.BlockLeavesBase; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Icon; +import net.minecraft.world.ColorizerFoliage; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; + +public class BlockBOPColorizedLeaves extends BlockLeavesBase implements IShearable +{ + private static final String[] leaves = new String[] {"acacia", "mangrove", "palm", "redwood", "willow"}; + @SideOnly(Side.CLIENT) + private Icon[][] textures; + + public BlockBOPColorizedLeaves(int blockID) + { + super(blockID, Material.leaves, false); + setBurnProperties(this.blockID, 30, 60); + this.setTickRandomly(true); + this.setCreativeTab(mod_BiomesOPlenty.tabBiomesOPlenty); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IconRegister iconRegister) + { + textures = new Icon[2][leaves.length]; + + for (int i = 0; i < leaves.length; ++i) + { + textures[0][i] = iconRegister.registerIcon("BiomesOPlenty:" + leaves[i] + "leaves1"); + textures[1][i] = iconRegister.registerIcon("BiomesOPlenty:" + leaves[i] + "leaves2"); + } + } + + @Override + @SideOnly(Side.CLIENT) + public int getBlockColor() + { + double temperature = 0.5D; + double humidity = 1.0D; + return ColorizerFoliage.getFoliageColor(temperature, humidity); + } + + @Override + @SideOnly(Side.CLIENT) + public int getRenderColor(int par1) + { + // TODO + return (par1 & 3) == 1 ? ColorizerFoliage.getFoliageColorPine() : ((par1 & 3) == 2 ? ColorizerFoliage.getFoliageColorBirch() : ColorizerFoliage.getFoliageColorBasic()); + } + + @Override + @SideOnly(Side.CLIENT) + public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + int var6 = 0; + int var7 = 0; + int var8 = 0; + + for (int var9 = -1; var9 <= 1; ++var9) + { + for (int var10 = -1; var10 <= 1; ++var10) + { + int var11 = par1IBlockAccess.getBiomeGenForCoords(par2 + var10, par4 + var9).getBiomeFoliageColor(); + var6 += (var11 & 16711680) >> 16; + var7 += (var11 & 65280) >> 8; + var8 += var11 & 255; + } + } + + return (var6 / 9 & 255) << 16 | (var7 / 9 & 255) << 8 | var8 / 9 & 255; + } + + @Override + @SideOnly(Side.CLIENT) + public Icon getBlockTextureFromSideAndMetadata(int side, int meta) + { + if (meta < 0 || meta >= textures[0].length) + meta = 0; + + return textures[(!isOpaqueCube() ? 0 : 1)][meta]; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list) { + for (int i = 0; i < textures[0].length; ++i) + list.add(new ItemStack(blockID, 1, i)); + } + + @Override + public int idDropped(int par1, Random par2Random, int par3) + { + return BOPBlocks.yellowSapling.blockID; + } + + @Override + public int damageDropped(int meta) + { + return meta & textures[0].length; + } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + public ArrayList onSheared(ItemStack item, World world, int x, int y, int z, int fortune) + { + ArrayList ret = new ArrayList(); + ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3)); + return ret; + } +} diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPFlower.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPFlower.java index 319def097..f05b05041 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPFlower.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPFlower.java @@ -8,6 +8,7 @@ import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; +import net.minecraft.world.World; import tdwp_ftw.biomesop.mod_BiomesOPlenty; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -33,6 +34,7 @@ public class BlockBOPFlower extends BlockFlower } @Override + @SideOnly(Side.CLIENT) public void registerIcons(IconRegister iconRegister) { textures = new Icon[plants.length]; diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPLeaves.java new file mode 100644 index 000000000..71f04d756 --- /dev/null +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBOPLeaves.java @@ -0,0 +1,91 @@ +package tdwp_ftw.biomesop.blocks; + +import java.util.ArrayList; +import java.util.List; +import java.util.Random; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +import tdwp_ftw.biomesop.mod_BiomesOPlenty; +import tdwp_ftw.biomesop.configuration.BOPBlocks; + +import net.minecraft.block.BlockLeavesBase; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.ItemStack; +import net.minecraft.util.Icon; +import net.minecraft.world.World; +import net.minecraftforge.common.IShearable; + +public class BlockBOPLeaves extends BlockLeavesBase implements IShearable +{ + private static final String[] leaves = new String[] {"autumn", "bamboo", "blue", "dark", "dead", "fir", "holy", "orange", "origin", "pink", "red", "white"}; + @SideOnly(Side.CLIENT) + private Icon[][] textures; + + public BlockBOPLeaves(int blockID) + { + super(blockID, Material.leaves, false); + setBurnProperties(this.blockID, 30, 60); + this.setTickRandomly(true); + this.setCreativeTab(mod_BiomesOPlenty.tabBiomesOPlenty); + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IconRegister iconRegister) + { + textures = new Icon[2][leaves.length]; + + for (int i = 0; i < leaves.length; ++i) + { + textures[0][i] = iconRegister.registerIcon("BiomesOPlenty:" + leaves[i] + "leaves1"); + textures[1][i] = iconRegister.registerIcon("BiomesOPlenty:" + leaves[i] + "leaves2"); + } + } + + @Override + @SideOnly(Side.CLIENT) + public Icon getBlockTextureFromSideAndMetadata(int side, int meta) + { + if (meta < 0 || meta >= textures[0].length) + meta = 0; + + return textures[(!isOpaqueCube() ? 0 : 1)][meta]; + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubBlocks(int blockID, CreativeTabs creativeTabs, List list) { + for (int i = 0; i < textures[0].length; ++i) + list.add(new ItemStack(blockID, 1, i)); + } + + @Override + public int idDropped(int par1, Random par2Random, int par3) + { + return BOPBlocks.yellowSapling.blockID; + } + + @Override + public int damageDropped(int meta) + { + return meta & textures[0].length; + } + + @Override + public boolean isShearable(ItemStack item, World world, int x, int y, int z) + { + return true; + } + + @Override + public ArrayList onSheared(ItemStack item, World world, int x, int y, int z, int fortune) + { + ArrayList ret = new ArrayList(); + ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z) & 3)); + return ret; + } +} diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBambooLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBambooLeaves.java index 90a82f681..39b9457e6 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBambooLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBambooLeaves.java @@ -18,6 +18,7 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +@Deprecated public class BlockBambooLeaves extends BlockLeavesBase implements IShearable { /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBlueLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBlueLeaves.java index fca56b940..5242d72dd 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBlueLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockBlueLeaves.java @@ -18,6 +18,7 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +@Deprecated public class BlockBlueLeaves extends BlockLeavesBase implements IShearable { /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDarkLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDarkLeaves.java index 57966a925..d49e840e7 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDarkLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDarkLeaves.java @@ -18,6 +18,7 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +@Deprecated public class BlockDarkLeaves extends BlockLeavesBase implements IShearable { /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDeadLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDeadLeaves.java index fd6be0381..7cedcaa50 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDeadLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockDeadLeaves.java @@ -18,6 +18,7 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +@Deprecated public class BlockDeadLeaves extends BlockLeavesBase implements IShearable { /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirLeaves.java index b864edd6a..052ba9ab6 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockFirLeaves.java @@ -18,6 +18,7 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +@Deprecated public class BlockFirLeaves extends BlockLeavesBase implements IShearable { /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyLeaves.java index d6d95f087..a0d170fd0 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockHolyLeaves.java @@ -18,6 +18,7 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +@Deprecated public class BlockHolyLeaves extends BlockLeavesBase implements IShearable { /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMangroveLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMangroveLeaves.java index 56b375799..12486e6db 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMangroveLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockMangroveLeaves.java @@ -19,6 +19,7 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +@Deprecated public class BlockMangroveLeaves extends BlockLeavesBase implements IShearable { /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOrangeLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOrangeLeaves.java index c4de3e0fa..749296681 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOrangeLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOrangeLeaves.java @@ -19,6 +19,7 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +@Deprecated public class BlockOrangeLeaves extends BlockLeavesBase implements IShearable { /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOriginLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOriginLeaves.java index 1fc3c2ef2..11f9da7ca 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOriginLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockOriginLeaves.java @@ -18,6 +18,7 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +@Deprecated public class BlockOriginLeaves extends BlockLeavesBase implements IShearable { /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPalmLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPalmLeaves.java index 12cdfda02..24290a79f 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPalmLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPalmLeaves.java @@ -19,6 +19,7 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +@Deprecated public class BlockPalmLeaves extends BlockLeavesBase implements IShearable { /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPinkLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPinkLeaves.java index 007f71360..f9d67b213 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPinkLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockPinkLeaves.java @@ -18,6 +18,7 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +@Deprecated public class BlockPinkLeaves extends BlockLeavesBase implements IShearable { /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedLeaves.java index 5b636fccd..ef66378b2 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedLeaves.java @@ -18,6 +18,7 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +@Deprecated public class BlockRedLeaves extends BlockLeavesBase implements IShearable { /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedwoodLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedwoodLeaves.java index 7428e3948..b348e4739 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedwoodLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockRedwoodLeaves.java @@ -19,6 +19,7 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +@Deprecated public class BlockRedwoodLeaves extends BlockLeavesBase implements IShearable { /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWhiteLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWhiteLeaves.java index dfc118c9c..e31da6bd1 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWhiteLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWhiteLeaves.java @@ -18,6 +18,7 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +@Deprecated public class BlockWhiteLeaves extends BlockLeavesBase implements IShearable { /** diff --git a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWillowLeaves.java b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWillowLeaves.java index 2e2e50653..38da6ec60 100644 --- a/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWillowLeaves.java +++ b/src/minecraft/tdwp_ftw/biomesop/blocks/BlockWillowLeaves.java @@ -19,6 +19,7 @@ import tdwp_ftw.biomesop.configuration.BOPBlocks; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +@Deprecated public class BlockWillowLeaves extends BlockLeavesBase implements IShearable { /** diff --git a/src/minecraft/tdwp_ftw/biomesop/configuration/BOPBlocks.java b/src/minecraft/tdwp_ftw/biomesop/configuration/BOPBlocks.java index bd0c7804f..097980ca0 100644 --- a/src/minecraft/tdwp_ftw/biomesop/configuration/BOPBlocks.java +++ b/src/minecraft/tdwp_ftw/biomesop/configuration/BOPBlocks.java @@ -10,6 +10,8 @@ import tdwp_ftw.biomesop.blocks.*; import tdwp_ftw.biomesop.items.ItemBOPFlower; import tdwp_ftw.biomesop.items.ItemBOPPlank; import tdwp_ftw.biomesop.items.ItemBOPSlab; +import tdwp_ftw.biomesop.items.ItemBOPLeaves; +import tdwp_ftw.biomesop.items.ItemBOPColorizedLeaves; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @@ -194,7 +196,9 @@ public class BOPBlocks { // public static Block stairs; // public static BlockHalfSlab singleSlab; // public static BlockHalfSlab doubleSlab; -// public static Block flowers; + public static Block flowers; + public static Block leaves; + public static Block leavesColorized; public static void init() { @@ -433,8 +437,8 @@ public class BOPBlocks { LanguageRegistry.addName(new ItemStack(stairs,1,9), "Willow Wood Stairs"); // Flowers - mostly working, missing glow on Glowflower - flowers = (new BlockBOPFlower(2000)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("flowers"); - GameRegistry.registerBlock(flowers, ItemBOPFlower.class, "plants"); + flowers = (new BlockBOPFlower(2002)).setHardness(0.0F).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("flowers"); + GameRegistry.registerBlock(flowers, ItemBOPFlower.class, "flowers"); LanguageRegistry.addName(new ItemStack(flowers,1,0), "Swampflower"); LanguageRegistry.addName(new ItemStack(flowers,1,1), "Deathbloom"); @@ -445,8 +449,36 @@ public class BOPBlocks { LanguageRegistry.addName(new ItemStack(flowers,1,6), "Wildflower"); LanguageRegistry.addName(new ItemStack(flowers,1,7), "Violet"); LanguageRegistry.addName(new ItemStack(flowers,1,8), "Anemone"); + + + // Leaves - Almost working, will have to fix drops + leaves = (new BlockBOPLeaves(2000)).setHardness(0.2F).setLightOpacity(1).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("leaves"); + GameRegistry.registerBlock(leaves, ItemBOPLeaves.class, "leaves"); + + LanguageRegistry.addName(new ItemStack(leaves,1,0), "Autumn Leaves"); + LanguageRegistry.addName(new ItemStack(leaves,1,1), "Bamboo Leaves"); + LanguageRegistry.addName(new ItemStack(leaves,1,2), "Magic Leaves"); + LanguageRegistry.addName(new ItemStack(leaves,1,3), "Dark Leaves"); + LanguageRegistry.addName(new ItemStack(leaves,1,4), "Dying Leaves"); + LanguageRegistry.addName(new ItemStack(leaves,1,5), "Fir Leaves"); + LanguageRegistry.addName(new ItemStack(leaves,1,6), "Holy Leaves"); + LanguageRegistry.addName(new ItemStack(leaves,1,7), "Autumn Leaves"); + LanguageRegistry.addName(new ItemStack(leaves,1,8), "Origin Leaves"); + LanguageRegistry.addName(new ItemStack(leaves,1,9), "Cherry Leaves"); + LanguageRegistry.addName(new ItemStack(leaves,1,10), "Maple Leaves"); + LanguageRegistry.addName(new ItemStack(leaves,1,11), "Cherry Leaves"); + + leavesColorized = (new BlockBOPColorizedLeaves(2001)).setHardness(0.2F).setLightOpacity(1).setStepSound(Block.soundGrassFootstep).setUnlocalizedName("leavesColorized"); + GameRegistry.registerBlock(leavesColorized, ItemBOPColorizedLeaves.class, "leavesColorized"); + + LanguageRegistry.addName(new ItemStack(leavesColorized,1,0), "Acacia Leaves"); + LanguageRegistry.addName(new ItemStack(leavesColorized,1,1), "Mangrove Leaves"); + LanguageRegistry.addName(new ItemStack(leavesColorized,1,2), "Palm Leaves"); + LanguageRegistry.addName(new ItemStack(leavesColorized,1,3), "Redwood Leaves"); + LanguageRegistry.addName(new ItemStack(leavesColorized,1,4), "Willow Leaves"); */ + // Add block registration GameRegistry.registerBlock(mud, "mud"); GameRegistry.registerBlock(driedDirt, "driedDirt"); diff --git a/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPColorizedLeaves.java b/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPColorizedLeaves.java new file mode 100644 index 000000000..be47506dd --- /dev/null +++ b/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPColorizedLeaves.java @@ -0,0 +1,28 @@ +package tdwp_ftw.biomesop.items; + +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +public class ItemBOPColorizedLeaves extends ItemBlock +{ + private static final String[] leaves = new String[] {"acacia", "mangrove", "palm", "redwood", "willow"}; + + public ItemBOPColorizedLeaves(int par1) + { + super(par1); + setMaxDamage(0); + setHasSubtypes(true); + } + + @Override + public int getMetadata(int meta) + { + return meta; + } + + @Override + public String getUnlocalizedName(ItemStack itemStack) + { + return (new StringBuilder()).append(leaves[itemStack.getItemDamage()]).append("Planks").toString(); + } +} diff --git a/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPFlower.java b/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPFlower.java index 84c410c88..8d0a975fd 100644 --- a/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPFlower.java +++ b/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPFlower.java @@ -28,6 +28,7 @@ public class ItemBOPFlower extends ItemBlock return (new StringBuilder()).append(plants[itemStack.getItemDamage()]).toString(); } + @Override public Icon getIconFromDamage(int meta) { return Block.blocksList[this.itemID].getBlockTextureFromSideAndMetadata(0, meta); diff --git a/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPLeaves.java b/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPLeaves.java new file mode 100644 index 000000000..9f9400cc1 --- /dev/null +++ b/src/minecraft/tdwp_ftw/biomesop/items/ItemBOPLeaves.java @@ -0,0 +1,28 @@ +package tdwp_ftw.biomesop.items; + +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; + +public class ItemBOPLeaves extends ItemBlock +{ + private static final String[] leaves = new String[] {"autumn", "bamboo", "blue", "dark", "dead", "fir", "holy", "orange", "origin", "pink", "red", "white"}; + + public ItemBOPLeaves(int par1) + { + super(par1); + setMaxDamage(0); + setHasSubtypes(true); + } + + @Override + public int getMetadata(int meta) + { + return meta; + } + + @Override + public String getUnlocalizedName(ItemStack itemStack) + { + return (new StringBuilder()).append(leaves[itemStack.getItemDamage()]).append("Planks").toString(); + } +}