From 230617a2bcac2493a15cdf24510a0caf967ceacc Mon Sep 17 00:00:00 2001 From: Draknyte1 Date: Sat, 27 May 2017 19:14:30 +1000 Subject: $ Fixed leaf generation on Rainforest Oaks. $ Fixed leaf drops on Rainforest Oaks. $ Fixed Flammability on custom Logs/Leaves. --- .../xmod/bop/blocks/base/LeavesBase.java | 92 ++++++++++++---------- .../gtPlusPlus/xmod/bop/blocks/base/LogBase.java | 2 + .../xmod/bop/blocks/base/SaplingBase.java | 83 +------------------ .../blocks/rainforest/LeavesRainforestTree.java | 19 +++-- 4 files changed, 67 insertions(+), 129 deletions(-) (limited to 'src/Java/gtPlusPlus/xmod/bop/blocks') 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 diff --git a/src/Java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java b/src/Java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java index 2bc1b2cf41..20b791edce 100644 --- a/src/Java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java +++ b/src/Java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java @@ -13,6 +13,7 @@ import gtPlusPlus.core.util.item.ItemUtils; import net.minecraft.block.BlockLog; 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; @@ -32,6 +33,7 @@ public abstract class LogBase extends BlockLog ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "logWood"); this.setCreativeTab(AddToCreativeTab.tabBOP); LanguageRegistry.addName(this, blockNameLocalized); + Blocks.fire.setFireInfo(this, 20, 100); } private final void setVanillaVariable(Object toSet, Object value){ diff --git a/src/Java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java b/src/Java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java index ce79dcb3e9..62da4d29f6 100644 --- a/src/Java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java +++ b/src/Java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java @@ -123,85 +123,7 @@ public class SaplingBase extends BlockSapling default: Utils.LOG_INFO("Case 0 - Grow Tree"); break; - case 1: - Utils.LOG_INFO("Case 1 - Grow Tree"); - label78: - - for (i1 = 0; i1 >= -1; --i1) - { - for (j1 = 0; j1 >= -1; --j1) - { - if (this.func_149880_a(world, x + i1, y, z + j1, 1) && this.func_149880_a(world, x + i1 + 1, y, z + j1, 1) && this.func_149880_a(world, x + i1, y, z + j1 + 1, 1) && this.func_149880_a(world, x + i1 + 1, y, z + j1 + 1, 1)) - { - object = new WorldGenMegaPineTree(false, rand.nextBoolean()); - flag = true; - break label78; - } - } - } - - if (!flag) - { - j1 = 0; - i1 = 0; - object = new WorldGenTaiga2(true); - } - - break; - case 2: - Utils.LOG_INFO("Case 2 - Grow Tree"); - object = new WorldGenForest(true, false); - break; - case 3: - Utils.LOG_INFO("Case 3 - Grow Tree"); - label93: - - for (i1 = 0; i1 >= -1; --i1) - { - for (j1 = 0; j1 >= -1; --j1) - { - if (this.func_149880_a(world, x + i1, y, z + j1, 3) && this.func_149880_a(world, x + i1 + 1, y, z + j1, 3) && this.func_149880_a(world, x + i1, y, z + j1 + 1, 3) && this.func_149880_a(world, x + i1 + 1, y, z + j1 + 1, 3)) - { - object = new WorldGenMegaJungle(true, 10, 20, 3, 3); - flag = true; - break label93; - } - } - } - - if (!flag) - { - j1 = 0; - i1 = 0; - object = new WorldGenTrees(true, 4 + rand.nextInt(7), 3, 3, false); - } - - break; - case 4: - Utils.LOG_INFO("Case 4 - Grow Tree"); - object = new WorldGenSavannaTree(true); - break; - case 5: - Utils.LOG_INFO("Case 5 - Grow Tree"); - label108: - - for (i1 = 0; i1 >= -1; --i1) - { - for (j1 = 0; j1 >= -1; --j1) - { - if (this.func_149880_a(world, x + i1, y, z + j1, 5) && this.func_149880_a(world, x + i1 + 1, y, z + j1, 5) && this.func_149880_a(world, x + i1, y, z + j1 + 1, 5) && this.func_149880_a(world, x + i1 + 1, y, z + j1 + 1, 5)) - { - object = new WorldGenCanopyTree(true); - flag = true; - break label108; - } - } - } - - if (!flag) - { - return; - } + } Block block = Blocks.air; @@ -217,9 +139,6 @@ public class SaplingBase extends BlockSapling { world.setBlock(x, y, z, block, 0, 4); } -//public WorldGenRainForestTree_Ex(Block wood, Block leaves, int woodMeta, int leavesMeta, boolean doBlockNotify, int minTreeHeight, int randomTreeHeight) { - - //Object o = new WorldGenRainForestTree_Ex(BOP_Block_Registrator.); if (!((WorldGenerator)object).generate(world, rand, x + i1, y, z + j1)) { diff --git a/src/Java/gtPlusPlus/xmod/bop/blocks/rainforest/LeavesRainforestTree.java b/src/Java/gtPlusPlus/xmod/bop/blocks/rainforest/LeavesRainforestTree.java index 890775537f..2fcbd966ee 100644 --- a/src/Java/gtPlusPlus/xmod/bop/blocks/rainforest/LeavesRainforestTree.java +++ b/src/Java/gtPlusPlus/xmod/bop/blocks/rainforest/LeavesRainforestTree.java @@ -1,16 +1,25 @@ package gtPlusPlus.xmod.bop.blocks.rainforest; +import java.util.Random; + import gtPlusPlus.core.util.item.ItemUtils; +import gtPlusPlus.xmod.bop.blocks.BOP_Block_Registrator; import gtPlusPlus.xmod.bop.blocks.base.LeavesBase; import net.minecraft.init.Items; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class LeavesRainforestTree extends LeavesBase { - public LeavesRainforestTree(){ - super("Rainforest Oak", "rainforestoak", new ItemStack[]{ItemUtils.getSimpleStack(Items.apple)}); - this.treeType = new String[] {"rainforest"}; - this.leafType = new String[][] {{"rainforest"},{"rainforest_opaque"}}; - } + public LeavesRainforestTree(){ + super("Rainforest Oak", "rainforestoak", new ItemStack[]{ItemUtils.getSimpleStack(Items.apple)}); + this.treeType = new String[] {"rainforest"}; + this.leafType = new String[][] {{"rainforest"},{"rainforest_opaque"}}; + } + + @Override + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_){ + return Item.getItemFromBlock(BOP_Block_Registrator.sapling_Rainforest); + } } \ No newline at end of file -- cgit