Posted April 10, 201312 yr so i have a bank item i created with the xact code: package tuskiomi.common; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class PaintbrushGray extends Item { public PaintbrushGray(int id){ super(id); setCreativeTab(CreativeTabs.tabAllSearch); } public String getTextureFile() { return "/tuskiomi/moditemsheet.png"; } public boolean onItemUse(ItemStack tool, EntityPlayer player, World world, int x, int y, int z, int par7, float xFloat, float yFloat, float zFloat) { System.out.println("access start"); if (!player.canPlayerEdit(x, y, z, par7, tool))//can the player edit this block? if he cant then dont do anything { System.out.println("access denied"); return false; } System.out.println("access granted"); return true; } public void updateIcons(IconRegister iconRegister) { iconIndex = iconRegister.registerIcon(tuskiomi.modid + ":" + this.getUnlocalizedName()); } } when the item is right clicked or left clicked, the console doesn't do anything. the texture is correct. anybody know how to fix this? Also, I should have you know that you are reading my signature.
April 11, 201312 yr so i have a bank item i created with the xact code: package tuskiomi.common; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumToolMaterial; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class PaintbrushGray extends Item { public PaintbrushGray(int id){ super(id); setCreativeTab(CreativeTabs.tabAllSearch); } public String getTextureFile() { return "/tuskiomi/moditemsheet.png"; } public boolean onItemUse(ItemStack tool, EntityPlayer player, World world, int x, int y, int z, int par7, float xFloat, float yFloat, float zFloat) { System.out.print("access start"); if (!player.canPlayerEdit(x, y, z, par7, tool))//can the player edit this block? if he cant then dont do anything { System.out.print("access denied"); return false; } System.out.print("access granted"); return true; } public void updateIcons(IconRegister iconRegister) { iconIndex = iconRegister.registerIcon(tuskiomi.modid + ":" + this.getUnlocalizedName()); } } when the item is right clicked or left clicked, the console doesn't do anything. the texture is correct. anybody know how to fix this? Add @Override to your onItemUse method. If there is an error appearing, you're using the wrong method. Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! | mah twitter This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.
April 14, 201312 yr Author correct method. not called with forge Also, I should have you know that you are reading my signature.
April 15, 201312 yr Author Anyone else want to give it a shot? i'm stumped. Also, I should have you know that you are reading my signature.
April 15, 201312 yr Author nobody? common, there must be something wrong!!! Also, I should have you know that you are reading my signature.
April 16, 201312 yr Author okay, i think im going to report this to bugs if nobody has the input. Also, I should have you know that you are reading my signature.
April 16, 201312 yr Author okay, i think im going to report this to bugs if nobody has the input. Also, I should have you know that you are reading my signature.
April 16, 201312 yr Its not a bug its called when it needs to be called. See the many other things that could be stopping it from being called. Ctrl+Alt+H is your friend in eclipse. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
April 16, 201312 yr Its not a bug its called when it needs to be called. See the many other things that could be stopping it from being called. Ctrl+Alt+H is your friend in eclipse. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
April 18, 201312 yr Author Its not a bug its called when it needs to be called. See the many other things that could be stopping it from being called. Ctrl+Alt+H is your friend in eclipse. Thanks, Lex! I have done some searches and found that the 'PlayerControllerMP' has a direct link to calling this method. i went ahead for debuging pourposes put in a println statement after line 348 to print some thing out whe nthe method was called. The Item did something very pecuilar when i right clicked with it. the lines printed out like so fore every one click: 2013-04-18 16:28:34 [iNFO] [sTDOUT] access granted //one print statement in my item code 2013-04-18 16:28:46 [iNFO] [sTDOUT] Debug RightClick //debug print 2013-04-18 16:28:46 [iNFO] [sTDOUT] access start //another print in my item code 2013-04-18 16:28:46 [iNFO] [sTDOUT] access granted //repeat?? 2013-04-18 16:28:46 [iNFO] [sTDOUT] access start // it started again but didn't end??? i'm very confsed and would be happy if someone could explian why this happens!! Also, I should have you know that you are reading my signature.
April 18, 201312 yr Author Its not a bug its called when it needs to be called. See the many other things that could be stopping it from being called. Ctrl+Alt+H is your friend in eclipse. Thanks, Lex! I have done some searches and found that the 'PlayerControllerMP' has a direct link to calling this method. i went ahead for debuging pourposes put in a println statement after line 348 to print some thing out whe nthe method was called. The Item did something very pecuilar when i right clicked with it. the lines printed out like so fore every one click: 2013-04-18 16:28:34 [iNFO] [sTDOUT] access granted //one print statement in my item code 2013-04-18 16:28:46 [iNFO] [sTDOUT] Debug RightClick //debug print 2013-04-18 16:28:46 [iNFO] [sTDOUT] access start //another print in my item code 2013-04-18 16:28:46 [iNFO] [sTDOUT] access granted //repeat?? 2013-04-18 16:28:46 [iNFO] [sTDOUT] access start // it started again but didn't end??? i'm very confsed and would be happy if someone could explian why this happens!! Also, I should have you know that you are reading my signature.
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.