aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod/bop/blocks/base
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/bop/blocks/base')
-rw-r--r--src/main/java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java180
-rw-r--r--src/main/java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java122
-rw-r--r--src/main/java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java338
3 files changed, 310 insertions, 330 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java b/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java
index 5c86c45591..c2d534dfb6 100644
--- a/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java
+++ b/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LeavesBase.java
@@ -1,13 +1,16 @@
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;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import java.util.List;
+import java.util.Random;
import net.minecraft.block.BlockLeaves;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
@@ -18,92 +21,87 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.core.creative.AddToCreativeTab;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-
public class LeavesBase extends BlockLeaves {
- protected IIcon[][] leafTextures = new IIcon[2][];
- protected String[][] leafType = new String[][] {{}, {}};
- protected String[] treeType = new String[] {};
- protected ItemStack[] bonusDrops;
-
- @SuppressWarnings("deprecation")
- public LeavesBase(String blockNameLocalized, String blockNameUnlocalized, ItemStack[] bonusDrops){
- this.bonusDrops = bonusDrops;
- String blockName = "block"+Utils.sanitizeString(blockNameLocalized)+"Leaves";
- GameRegistry.registerBlock(this, ItemBlock.class, blockName);
- this.setBlockName(blockName);
- ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "treeLeaves", true);
- 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
- 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){
- Logger.INFO("Dropping Bonus Drops");
- for (int i = 0; i < this.bonusDrops.length; ++i){
- if (this.bonusDrops[i] != null && world.rand.nextInt(randomChance) == 0){
- this.dropBlockAsItem(world, x, y, z, ItemUtils.getSimpleStack(this.bonusDrops[i], 1));
- }
- }
- }
-
- /**
- * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
- */
- @SuppressWarnings("unchecked")
- @Override
- @SideOnly(Side.CLIENT)
- public void getSubBlocks(Item item, CreativeTabs tab, @SuppressWarnings("rawtypes") List metaList){
- for (int i = 0; i < this.treeType.length; ++i){
- metaList.add(new ItemStack(item, 1, i));
- }
- }
-
- /**
- * 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];
- }
-
- @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);
- }
-
- @Override
- public String[] func_150125_e()
- {
- return treeType;
- }
-} \ No newline at end of file
+ protected IIcon[][] leafTextures = new IIcon[2][];
+ protected String[][] leafType = new String[][] {{}, {}};
+ protected String[] treeType = new String[] {};
+ protected ItemStack[] bonusDrops;
+
+ @SuppressWarnings("deprecation")
+ public LeavesBase(String blockNameLocalized, String blockNameUnlocalized, ItemStack[] bonusDrops) {
+ this.bonusDrops = bonusDrops;
+ String blockName = "block" + Utils.sanitizeString(blockNameLocalized) + "Leaves";
+ GameRegistry.registerBlock(this, ItemBlock.class, blockName);
+ this.setBlockName(blockName);
+ ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "treeLeaves", true);
+ 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
+ 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) {
+ Logger.INFO("Dropping Bonus Drops");
+ for (int i = 0; i < this.bonusDrops.length; ++i) {
+ if (this.bonusDrops[i] != null && world.rand.nextInt(randomChance) == 0) {
+ this.dropBlockAsItem(world, x, y, z, ItemUtils.getSimpleStack(this.bonusDrops[i], 1));
+ }
+ }
+ }
+
+ /**
+ * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
+ */
+ @SuppressWarnings("unchecked")
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item item, CreativeTabs tab, @SuppressWarnings("rawtypes") List metaList) {
+ for (int i = 0; i < this.treeType.length; ++i) {
+ metaList.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ /**
+ * 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];
+ }
+
+ @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);
+ }
+
+ @Override
+ public String[] func_150125_e() {
+ return treeType;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java b/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java
index 8e8ca0ed0a..4c8a905834 100644
--- a/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java
+++ b/src/main/java/gtPlusPlus/xmod/bop/blocks/base/LogBase.java
@@ -1,12 +1,14 @@
package gtPlusPlus.xmod.bop.blocks.base;
-import java.util.List;
-
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import java.util.List;
import net.minecraft.block.BlockLog;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
@@ -16,71 +18,65 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
-import gtPlusPlus.core.creative.AddToCreativeTab;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-
-public abstract class LogBase extends BlockLog
-{
- public String[] treeType = new String[] {};
- protected IIcon[] textureSide;
- protected IIcon[] textureTop;
-
- @SuppressWarnings("deprecation")
- public LogBase(String blockNameLocalized, String blockNameUnlocalized, String[] treeTypes){
- this.treeType = treeTypes;
- String blockName = "block"+Utils.sanitizeString(blockNameLocalized)+"Log";
- GameRegistry.registerBlock(this, ItemBlock.class, blockName);
- this.setBlockName(blockName);
- ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "log"+Utils.sanitizeString(blockNameLocalized), true);
- ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "logWood", true);
- this.setCreativeTab(AddToCreativeTab.tabBOP);
- LanguageRegistry.addName(this, blockNameLocalized);
- Blocks.fire.setFireInfo(this, 20, 100);
- }
+public abstract class LogBase extends BlockLog {
+ public String[] treeType = new String[] {};
+ protected IIcon[] textureSide;
+ protected IIcon[] textureTop;
- private final void setVanillaVariable(Object toSet, Object value){
- toSet = value;
- }
+ @SuppressWarnings("deprecation")
+ public LogBase(String blockNameLocalized, String blockNameUnlocalized, String[] treeTypes) {
+ this.treeType = treeTypes;
+ String blockName = "block" + Utils.sanitizeString(blockNameLocalized) + "Log";
+ GameRegistry.registerBlock(this, ItemBlock.class, blockName);
+ this.setBlockName(blockName);
+ ItemUtils.addItemToOreDictionary(
+ ItemUtils.getSimpleStack(this), "log" + Utils.sanitizeString(blockNameLocalized), true);
+ ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "logWood", true);
+ this.setCreativeTab(AddToCreativeTab.tabBOP);
+ LanguageRegistry.addName(this, blockNameLocalized);
+ Blocks.fire.setFireInfo(this, 20, 100);
+ }
- /**
- * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
- */
- @Override
- @SideOnly(Side.CLIENT)
- public void getSubBlocks(Item item, CreativeTabs tab, List metaList){
- for (int i = 0; i < this.textureSide.length; ++i){
- metaList.add(new ItemStack(item, 1, i));
- }
- }
+ private final void setVanillaVariable(Object toSet, Object value) {
+ toSet = value;
+ }
- @Override
- @SideOnly(Side.CLIENT)
- protected IIcon getTopIcon(int meta){
- return this.textureTop[meta % this.textureTop.length];
- }
+ /**
+ * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item item, CreativeTabs tab, List metaList) {
+ for (int i = 0; i < this.textureSide.length; ++i) {
+ metaList.add(new ItemStack(item, 1, i));
+ }
+ }
- @Override
- @SideOnly(Side.CLIENT)
- protected IIcon getSideIcon(int metaID){
- return this.textureSide[metaID % this.textureSide.length];
- }
+ @Override
+ @SideOnly(Side.CLIENT)
+ protected IIcon getTopIcon(int meta) {
+ return this.textureTop[meta % this.textureTop.length];
+ }
- @Override
- @SideOnly(Side.CLIENT)
- public void registerBlockIcons(IIconRegister iIcon)
- {
- this.textureSide = new IIcon[treeType.length];
- this.textureTop = new IIcon[treeType.length];
+ @Override
+ @SideOnly(Side.CLIENT)
+ protected IIcon getSideIcon(int metaID) {
+ return this.textureSide[metaID % this.textureSide.length];
+ }
- for (int i = 0; i < this.textureSide.length; ++i){
- this.textureSide[i] = iIcon.registerIcon(CORE.MODID + ":" + "trees/" + "logs/" + "log_" + treeType[i]);
- this.textureTop[i] = iIcon.registerIcon(CORE.MODID + ":" + "trees/" + "logs/" + "log_" + treeType[i] + "_top");
- }
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister iIcon) {
+ this.textureSide = new IIcon[treeType.length];
+ this.textureTop = new IIcon[treeType.length];
- setVanillaVariable(this.field_150167_a, this.textureSide);
- setVanillaVariable(this.field_150166_b, this.textureTop);
- }
+ for (int i = 0; i < this.textureSide.length; ++i) {
+ this.textureSide[i] = iIcon.registerIcon(CORE.MODID + ":" + "trees/" + "logs/" + "log_" + treeType[i]);
+ this.textureTop[i] =
+ iIcon.registerIcon(CORE.MODID + ":" + "trees/" + "logs/" + "log_" + treeType[i] + "_top");
+ }
-} \ No newline at end of file
+ setVanillaVariable(this.field_150167_a, this.textureSide);
+ setVanillaVariable(this.field_150166_b, this.textureTop);
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java b/src/main/java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java
index c039e1ebac..f606a3c173 100644
--- a/src/main/java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java
+++ b/src/main/java/gtPlusPlus/xmod/bop/blocks/base/SaplingBase.java
@@ -1,13 +1,16 @@
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;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
-
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.minecraft.ItemUtils;
+import java.util.List;
+import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSapling;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -23,176 +26,159 @@ import net.minecraft.world.gen.feature.WorldGenBigTree;
import net.minecraft.world.gen.feature.WorldGenTrees;
import net.minecraft.world.gen.feature.WorldGenerator;
-import gtPlusPlus.api.objects.Logger;
-import gtPlusPlus.core.creative.AddToCreativeTab;
-import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-
-public class SaplingBase extends BlockSapling
-{
- protected String[] saplingTypes = new String[] {};
- protected IIcon[] saplingTextures = new IIcon[] {};
-
- //Sapling types - field_149882_a
- //Iicons - field_149881_b
-
- protected SaplingBase(String blockNameLocalized, String blockNameUnlocalized, String[] saplingTypes){
- float f = 0.4F;
- this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
- this.saplingTypes = saplingTypes;
- this.saplingTextures = new IIcon[saplingTypes.length];
- String blockName = "block"+Utils.sanitizeString(blockNameLocalized);
- GameRegistry.registerBlock(this, ItemBlock.class, blockName);
- this.setBlockName(blockName);
- ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "treeSapling", true);
- this.setCreativeTab(AddToCreativeTab.tabBOP);
- LanguageRegistry.addName(this, blockNameLocalized);
- }
-
- private final void setVanillaVariable(Object toSet, Object value){
- toSet = value;
- }
-
- /**
- * Gets the block's texture. Args: side, meta
- */
- @Override
- @SideOnly(Side.CLIENT)
- public IIcon getIcon(int someInt, int meta){
- /* p_149691_2_ &= 7;
+public class SaplingBase extends BlockSapling {
+ protected String[] saplingTypes = new String[] {};
+ protected IIcon[] saplingTextures = new IIcon[] {};
+
+ // Sapling types - field_149882_a
+ // Iicons - field_149881_b
+
+ protected SaplingBase(String blockNameLocalized, String blockNameUnlocalized, String[] saplingTypes) {
+ float f = 0.4F;
+ this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
+ this.saplingTypes = saplingTypes;
+ this.saplingTextures = new IIcon[saplingTypes.length];
+ String blockName = "block" + Utils.sanitizeString(blockNameLocalized);
+ GameRegistry.registerBlock(this, ItemBlock.class, blockName);
+ this.setBlockName(blockName);
+ ItemUtils.addItemToOreDictionary(ItemUtils.getSimpleStack(this), "treeSapling", true);
+ this.setCreativeTab(AddToCreativeTab.tabBOP);
+ LanguageRegistry.addName(this, blockNameLocalized);
+ }
+
+ private final void setVanillaVariable(Object toSet, Object value) {
+ toSet = value;
+ }
+
+ /**
+ * Gets the block's texture. Args: side, meta
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(int someInt, int meta) {
+ /* p_149691_2_ &= 7;
return saplingTextures[MathHelper.clamp_int(p_149691_2_, 0, 5)];*/
- //return this.saplingTextures[meta % this.saplingTextures.length];
- try {
- return this.saplingTextures[meta];
- }catch(Throwable T){
- Logger.WARNING("Invalid Sapling meta is "+meta);
- return this.saplingTextures[0];
- }
- }
-
- /**
- * Ticks the block if it's been scheduled
- */
- @Override
- public void updateTick(World world, int x, int y, int z, Random rand){
- if (!world.isRemote){
- super.updateTick(world, x, y, z, rand);
- if (world.getBlockLightValue(x, y + 1, z) >= 9 && rand.nextInt(7) == 0){
- Logger.WARNING("Update Tick");
- this.updateMeta(world, x, y, z, rand);
- }
- else {
- Logger.WARNING("Tried to Tick.");
- }
- }
- }
-
- //Dunno - Think it is doGrow || doGrowthTick
- @Override
- public void func_149853_b(World world, Random rand, int x, int y, int z){
- Logger.WARNING("Please find what calls me - func_149853_b");
- this.updateMeta(world, x, y, z, rand);
- }
-
- public void updateMeta(World world, int x, int y, int z, Random rand){
- func_149879_c(world, x, y, z, rand);
- }
-
- @Override
- public void func_149879_c(World world, int x, int y, int z, Random rand){
- Logger.WARNING("func_149879_c - 1");
- int l = world.getBlockMetadata(x, y, z);
-
- if ((l & 8) == 0){
- Logger.WARNING("func_149879_c - 2");
- world.setBlockMetadataWithNotify(x, y, z, l | 8, 4);
- }
- else{
- Logger.WARNING("func_149879_c - 3");
- this.func_149878_d(world, x, y, z, rand);
- }
- }
-
- @Override
- public void func_149878_d(World world, int x, int y, int z, Random rand){
- Logger.WARNING("func_149878_d - 1");
- if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(world, rand, x, y, z)) return;
- int l = world.getBlockMetadata(x, y, z) & 7;
- Object object = rand.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true);
- int i1 = 0;
- int j1 = 0;
- boolean flag = false;
-
- switch (l)
- {
- case 0:
- default:
- Logger.WARNING("Case 0 - Grow Tree");
- break;
-
- }
-
- Block block = Blocks.air;
-
- if (flag)
- {
- world.setBlock(x + i1, y, z + j1, block, 0, 4);
- world.setBlock(x + i1 + 1, y, z + j1, block, 0, 4);
- world.setBlock(x + i1, y, z + j1 + 1, block, 0, 4);
- world.setBlock(x + i1 + 1, y, z + j1 + 1, block, 0, 4);
- }
- else
- {
- world.setBlock(x, y, z, block, 0, 4);
- }
-
- if (!((WorldGenerator)object).generate(world, rand, x + i1, y, z + j1))
- {
- if (flag)
- {
- world.setBlock(x + i1, y, z + j1, this, l, 4);
- world.setBlock(x + i1 + 1, y, z + j1, this, l, 4);
- world.setBlock(x + i1, y, z + j1 + 1, this, l, 4);
- world.setBlock(x + i1 + 1, y, z + j1 + 1, this, l, 4);
- }
- else
- {
- world.setBlock(x, y, z, this, l, 4);
- }
- }
- }
-
- @Override
- public boolean func_149880_a(World world, int p_149880_2_, int p_149880_3_, int p_149880_4_, int p_149880_5_){
- return world.getBlock(p_149880_2_, p_149880_3_, p_149880_4_) == this && (world.getBlockMetadata(p_149880_2_, p_149880_3_, p_149880_4_) & 7) == p_149880_5_;
- }
-
- /**
- * Determines the damage on the item the block drops. Used in cloth and wood.
- */
- @Override
- public int damageDropped(int meta){
- return MathHelper.clamp_int(meta & 7, 0, 5);
- }
-
- /**
- * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
- */
- @Override
- @SideOnly(Side.CLIENT)
- public void getSubBlocks(Item item, CreativeTabs tab, List metaList){
- for (int i = 0; i < this.saplingTextures.length; ++i){
- metaList.add(new ItemStack(item, 1, i));
- }
- }
-
- @Override
- @SideOnly(Side.CLIENT)
- public void registerBlockIcons(IIconRegister iIcon){
- for (int i = 0; i < saplingTextures.length; ++i){
- saplingTextures[i] = iIcon.registerIcon(CORE.MODID + ":" + "trees/" + "saplings/" + "sapling_" + saplingTypes[i]);
- }
- }
-
-} \ No newline at end of file
+ // return this.saplingTextures[meta % this.saplingTextures.length];
+ try {
+ return this.saplingTextures[meta];
+ } catch (Throwable T) {
+ Logger.WARNING("Invalid Sapling meta is " + meta);
+ return this.saplingTextures[0];
+ }
+ }
+
+ /**
+ * Ticks the block if it's been scheduled
+ */
+ @Override
+ public void updateTick(World world, int x, int y, int z, Random rand) {
+ if (!world.isRemote) {
+ super.updateTick(world, x, y, z, rand);
+ if (world.getBlockLightValue(x, y + 1, z) >= 9 && rand.nextInt(7) == 0) {
+ Logger.WARNING("Update Tick");
+ this.updateMeta(world, x, y, z, rand);
+ } else {
+ Logger.WARNING("Tried to Tick.");
+ }
+ }
+ }
+
+ // Dunno - Think it is doGrow || doGrowthTick
+ @Override
+ public void func_149853_b(World world, Random rand, int x, int y, int z) {
+ Logger.WARNING("Please find what calls me - func_149853_b");
+ this.updateMeta(world, x, y, z, rand);
+ }
+
+ public void updateMeta(World world, int x, int y, int z, Random rand) {
+ func_149879_c(world, x, y, z, rand);
+ }
+
+ @Override
+ public void func_149879_c(World world, int x, int y, int z, Random rand) {
+ Logger.WARNING("func_149879_c - 1");
+ int l = world.getBlockMetadata(x, y, z);
+
+ if ((l & 8) == 0) {
+ Logger.WARNING("func_149879_c - 2");
+ world.setBlockMetadataWithNotify(x, y, z, l | 8, 4);
+ } else {
+ Logger.WARNING("func_149879_c - 3");
+ this.func_149878_d(world, x, y, z, rand);
+ }
+ }
+
+ @Override
+ public void func_149878_d(World world, int x, int y, int z, Random rand) {
+ Logger.WARNING("func_149878_d - 1");
+ if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(world, rand, x, y, z)) return;
+ int l = world.getBlockMetadata(x, y, z) & 7;
+ Object object = rand.nextInt(10) == 0 ? new WorldGenBigTree(true) : new WorldGenTrees(true);
+ int i1 = 0;
+ int j1 = 0;
+ boolean flag = false;
+
+ switch (l) {
+ case 0:
+ default:
+ Logger.WARNING("Case 0 - Grow Tree");
+ break;
+ }
+
+ Block block = Blocks.air;
+
+ if (flag) {
+ world.setBlock(x + i1, y, z + j1, block, 0, 4);
+ world.setBlock(x + i1 + 1, y, z + j1, block, 0, 4);
+ world.setBlock(x + i1, y, z + j1 + 1, block, 0, 4);
+ world.setBlock(x + i1 + 1, y, z + j1 + 1, block, 0, 4);
+ } else {
+ world.setBlock(x, y, z, block, 0, 4);
+ }
+
+ if (!((WorldGenerator) object).generate(world, rand, x + i1, y, z + j1)) {
+ if (flag) {
+ world.setBlock(x + i1, y, z + j1, this, l, 4);
+ world.setBlock(x + i1 + 1, y, z + j1, this, l, 4);
+ world.setBlock(x + i1, y, z + j1 + 1, this, l, 4);
+ world.setBlock(x + i1 + 1, y, z + j1 + 1, this, l, 4);
+ } else {
+ world.setBlock(x, y, z, this, l, 4);
+ }
+ }
+ }
+
+ @Override
+ public boolean func_149880_a(World world, int p_149880_2_, int p_149880_3_, int p_149880_4_, int p_149880_5_) {
+ return world.getBlock(p_149880_2_, p_149880_3_, p_149880_4_) == this
+ && (world.getBlockMetadata(p_149880_2_, p_149880_3_, p_149880_4_) & 7) == p_149880_5_;
+ }
+
+ /**
+ * Determines the damage on the item the block drops. Used in cloth and wood.
+ */
+ @Override
+ public int damageDropped(int meta) {
+ return MathHelper.clamp_int(meta & 7, 0, 5);
+ }
+
+ /**
+ * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void getSubBlocks(Item item, CreativeTabs tab, List metaList) {
+ for (int i = 0; i < this.saplingTextures.length; ++i) {
+ metaList.add(new ItemStack(item, 1, i));
+ }
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(IIconRegister iIcon) {
+ for (int i = 0; i < saplingTextures.length; ++i) {
+ saplingTextures[i] =
+ iIcon.registerIcon(CORE.MODID + ":" + "trees/" + "saplings/" + "sapling_" + saplingTypes[i]);
+ }
+ }
+}