Posted October 20, 201410 yr If you have read any of my previous posts you have noticed i am trying to make a custom crop. I have had much help and eventually ended up with it working. I mainly have been following this tutorial http://jabelarminecraft.blogspot.com.au/p/minecraft-forge-172-creating-custom.html And when i put this set of code (below) @Override public void func_149853_b(World parWorld, Random parRand, int parX, int parY, int parZ) { incrementGrowStage(parWorld, parX, parY, parZ); } I get an error on the line incrementGrowStage(parWorld, parX, parY, parZ); Specifically incrementGrowStage part. I don't know what it is meaning as i have put the rest of the code from the tutorial into the relevant class ( i am mainly talking about the wrapper class if you would call it) here is my class for it so you can see and possibly tell me what i have done wrong or what i need to do: package com.SirRoyGbiv.magicores.block; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.IGrowable; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import com.SirRoyGbiv.magicores.creativetab.CreativeTabMagicOres; import com.SirRoyGbiv.magicores.reference.Reference; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class MagicOresBlock extends Block implements IGrowable { protected int maxGrowthStage = 7; @SideOnly(Side.CLIENT) protected IIcon[] iIcon; public MagicOresBlock(Material material) { super(material); this.setCreativeTab(CreativeTabMagicOres.MAGICORES_TAB); setTickRandomly(true); float f = 0.5F; setHardness(0.0F); setStepSound(soundTypeGrass); disableStats(); } public MagicOresBlock() { this(Material.rock); } @Override public String getUnlocalizedName() { return String.format("tile.%s%s", Reference.MOD_ID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { blockIcon = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()))); } protected String getUnwrappedUnlocalizedName(String unlocalizedName) { return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1); } protected boolean canPlaceBlockOn(Block parBlock) { return parBlock == Blocks.farmland; } public void incrementGrowStage(World parWorld, Random parRand, int parX, int parY, int parZ) { int growStage = parWorld.getBlockMetadata(parX, parY, parZ) + MathHelper.getRandomIntegerInRange(parRand, 2, 5); if (growStage > maxGrowthStage) { growStage = maxGrowthStage; } parWorld.setBlockMetadataWithNotify(parX, parY, parZ, growStage, 2); } @Override public Item getItemDropped(int p_149650_1_, Random parRand, int parFortune) { return Item.getItemFromBlock(this); } @Override public int getRenderType() { return 1; // Cross like flowers } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int parSide, int parGrowthStage) { return iIcon[parGrowthStage]; } @Override // checks if finished growing (a grow stage of 7 is final stage) public boolean func_149851_a(World parWorld, int parX, int parY, int parZ, boolean p_149851_5_) { return parWorld.getBlockMetadata(parX, parY, parZ) != 7; } @Override public boolean func_149852_a(World p_149852_1_, Random parRand, int p_149852_3_, int p_149852_4_, int p_149852_5_) { return true; } @Override public void func_149853_b(World parWorld, Random parRand, int parX, int parY, int parZ) { incrementGrowStage(parWorld, parX, parY, parZ); } } This is my last challenge i guess to get this working, i do have other issue but i will be able to fix them relatively easy (just for now it plants onto tilled dirt)
October 20, 201410 yr Sorry, that seems to be a mistake in my tutorial. I just updated it. I think I edited the text without running the code again, after a discussion with someone about the obfuscated method names. As diesieben07 says, the Eclipse editor should have warned you about the problem -- it would indicate the method doesn't exist. That is because a method only matches if all the parameters match. In fact you can have dozens of methods all with same name and they are technically different if they have different parameter types. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
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.