Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

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.

  • Author

correct method.

not called with forge

Also, I should have you know that you are reading my signature.

  • Author

Anyone else want to give it a shot? i'm stumped.

Also, I should have you know that you are reading my signature.

  • Author

nobody???? common, there must be something wrong!!!

 

Also, I should have you know that you are reading my signature.

  • 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.

  • 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.

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

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

  • 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!! :D

 

 

Also, I should have you know that you are reading my signature.

  • 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!! :D

 

 

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.