Posted August 24, 201411 yr I am working on updating my Coffee & Tea Mod and I am trying to fix a bug that has been in it for a while. Basically whenever the farmland underneath my custom crop (technically a coffee bush) has a block update it turns to dirt. I have no idea how to fix this and it is really weird. Here is the code to my Coffee Bush. package net.richardsprojects.teamod.main; //Removed the imports to shorten the code here public class BlockCoffeeBush extends BlockContainer implements IGrowable { protected BlockCoffeeBush(Material mat) { super(mat); this.setTickRandomly(true); float f = 0.5F; this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f); this.setCreativeTab((CreativeTabs)null); this.setHardness(0.0F); this.setStepSound(soundTypeGrass); this.disableStats(); } public static void mainRegistry() { initializeBlock(); registerBlock(); } //Used to handle crops growing public void updateTick(World world, int x, int y, int z, Random random) { if (world.getBlockLightValue(x, y + 1, z) >= 9) { int metadata = world.getBlockMetadata(x, y, z); if (metadata < 7) { if (random.nextInt(2) == 0) { metadata++; world.setBlockMetadataWithNotify(x, y, z, metadata, 2); } } } } public static Block coffeeBush; public static void initializeBlock() { coffeeBush = new BlockCoffeeBush(Material.grass).setBlockName("coffeeBush").setBlockTextureName("teamod:CoffeeStage1_4"); } public static void registerBlock() { GameRegistry.registerBlock(coffeeBush, coffeeBush.getUnlocalizedName()); } //Set the TileEntity @Override public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) { return new CoffeeBushEntity(); } //Can be grown on farmland, dirt, or grass protected boolean canPlaceBlockOn(Block block) { return block == Blocks.farmland; } //Not a normal renderType @Override public int getRenderType() { return -1; } //It's not an opaque cube @Override public boolean isOpaqueCube() { return false; } //It's not a normal block public boolean renderAsNormalBlock() { return false; } //Returns whether its fully grown? @Override public boolean func_149851_a(World world, int x, int y, int z, boolean flag) { return world.getBlockMetadata(x, y, z) != 7; } //I have no idea what this is for. @Override public boolean func_149852_a(World world, Random random, int x, int y, int z) { return true; } //Handles Bonemeal @Override public void func_149853_b(World world, Random random, int x, int y, int z) { int metadata = 0; metadata = world.getBlockMetadata(x, y, z) + MathHelper.getRandomIntegerInRange(world.rand, 2, 5); if (metadata > 7) { metadata = 7; } world.setBlockMetadataWithNotify(x, y, z, metadata, 2); } protected Item func_149865_P() { return null; } /** * Gets an item for the block being called on. Args: world, x, y, z */ @SideOnly(Side.CLIENT) public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { return this.func_149866_i(); } /** * Returns the quantity of items to drop on block destruction. */ @Override public int quantityDropped(Random p_149745_1_) { return 0; } /** * Gets an item for the block being called on. Args: world, x, y, z */ //TODO: Don't know if this needs to be only client side or not @SideOnly(Side.CLIENT) public Item getItemDropped(int p_149650_1_, Random rnd, int p_149650_3_) { return null; } protected Item func_149866_i() { return ItemCoffeeBeans.unroastedBean; } }[/Code] It may seem a bit odd because it is also a TileEntity so that it can display different 3d models for each stage. Any help would be greatly appreciated. I am trying to get this update out as quickly as possible (everything else is finished). TIA Creator of the Recipe Expansion Pack mod. http://www.minecraftforum.net/topic/1983421-172-forge-recipe-expansion-pack-version-012/ Updated to 1.7.2!
August 25, 201411 yr Author I figured it out. I needed to set the material to Material.plants. I'll leave this here for future reference. Creator of the Recipe Expansion Pack mod. http://www.minecraftforum.net/topic/1983421-172-forge-recipe-expansion-pack-version-012/ Updated to 1.7.2!
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.