diff options
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java')
-rw-r--r-- | src/Java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java | 92 |
1 files changed, 50 insertions, 42 deletions
diff --git a/src/Java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java b/src/Java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java index d82e2d52b0..228e7d9394 100644 --- a/src/Java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java +++ b/src/Java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java @@ -1,6 +1,7 @@ package gtPlusPlus.xmod.bop.blocks.base; import java.util.List; +import java.util.Random; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @@ -13,6 +14,7 @@ import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.block.BlockLeaves; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.init.Blocks; import net.minecraft.item.*; import net.minecraft.util.IIcon; import net.minecraft.world.World; @@ -21,7 +23,7 @@ public class LeavesBase extends BlockLeaves { protected IIcon[][] leafTextures = new IIcon[2][]; protected String[][] leafType = new String[][] {{}, {}}; - protected String[] treeType = new String[] {}; + protected String[] treeType = new String[] {}; protected ItemStack[] bonusDrops; @SuppressWarnings("deprecation") @@ -31,32 +33,38 @@ public class LeavesBase extends BlockLeaves { GameRegistry.registerBlock(this, ItemBlock.class, blockName); this.setBlockName(blockName); ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "treeLeaves"); - this.setCreativeTab(AddToCreativeTab.tabBOP); + this.setCreativeTab(AddToCreativeTab.tabBOP); LanguageRegistry.addName(this, blockNameLocalized+" Leaves"); + Blocks.fire.setFireInfo(this, 80, 150); } - + private final void setVanillaVariable(Object toSet, Object value){ toSet = value; } - - - @Override//Drops when Leaf is broken + + @Override + public int quantityDropped(Random p_149745_1_){ + return p_149745_1_.nextInt(20) == 0 ? 1 : 0; + } + + + @Override//Drops when Leaf is broken protected void func_150124_c(World world, int x, int y, int z, int meta, int randomChance){ - if (this.treeType.length == this.bonusDrops.length){ - for (int i = 0; i < this.treeType.length; ++i){ - if (this.bonusDrops[i] != null && world.rand.nextInt(randomChance) == 0){ - this.dropBlockAsItem(world, x, y, z, ItemUtils.getSimpleStack(this.bonusDrops[i], 1)); - } - } - } - else { - Utils.LOG_INFO("Unable to drop anything, Leaf Type array and Loot array are different sizes."); - } - } + if (this.treeType.length == this.bonusDrops.length){ + for (int i = 0; i < this.treeType.length; ++i){ + if (this.bonusDrops[i] != null && world.rand.nextInt(randomChance) == 0){ + this.dropBlockAsItem(world, x, y, z, ItemUtils.getSimpleStack(this.bonusDrops[i], 1)); + } + } + } + else { + Utils.LOG_INFO("Unable to drop anything, Leaf Type array and Loot array are different sizes."); + } + } - /** - * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) - */ + /** + * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) + */ @SuppressWarnings("unchecked") @Override @SideOnly(Side.CLIENT) @@ -65,36 +73,36 @@ public class LeavesBase extends BlockLeaves { metaList.add(new ItemStack(item, 1, i)); } } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override + + /** + * Gets the block's texture. Args: side, meta + */ + @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int p_149691_1_, int metaID){ - return (metaID & 3) == 1 ? this.leafTextures[this.field_150127_b][1] : this.leafTextures[this.field_150127_b][0]; - } + public IIcon getIcon(int p_149691_1_, int metaID){ + return (metaID & 3) == 1 ? this.leafTextures[this.field_150127_b][1] : this.leafTextures[this.field_150127_b][0]; + } - @Override + @Override public boolean isOpaqueCube() { return false; } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iIcon){ - for (int i = 0; i < leafType.length; ++i){ - this.leafTextures[i] = new IIcon[leafType[i].length]; - for (int j = 0; j < leafType[i].length; ++j){ - this.leafTextures[i][j] = iIcon.registerIcon(CORE.MODID + ":" + "trees/" + "leaves/" + "leaves_" + leafType[i][j]); - } - } - setVanillaVariable(this.field_150129_M, this.leafTextures); - } + public void registerBlockIcons(IIconRegister iIcon){ + for (int i = 0; i < leafType.length; ++i){ + this.leafTextures[i] = new IIcon[leafType[i].length]; + for (int j = 0; j < leafType[i].length; ++j){ + this.leafTextures[i][j] = iIcon.registerIcon(CORE.MODID + ":" + "trees/" + "leaves/" + "leaves_" + leafType[i][j]); + } + } + setVanillaVariable(this.field_150129_M, this.leafTextures); + } - @Override + @Override public String[] func_150125_e() - { - return treeType; - } + { + return treeType; + } }
\ No newline at end of file |