Jump to content

Recommended Posts

Posted

I am trying to tick item. But onUpdate never works, how is it work? I try this;

 

	@SideOnly(Side.CLIENT)
public void onUpdate(ItemStack stack, World world, EntityPlayer player, int par4, boolean par5) {
	if (player.inventory.hasItem(stack.getItem())) {
		outStream = new BufferedWriter(new FileWriter(new File("hamit.txt"), true));
		outStream.write("onUpdate!");
		outStream.newLine();
		outStream.close();
	}
}

 

But it never write onUpdate! in hamit.txt, I try to walk, run, right click, left click... How can I fix it?

 

I can use onPlayerTick but it affect all items with same id, I just want to tick items from inventory.

Posted

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

This is helpful for me thanks for this, I remove sideonly, but it still not working.

 

//I solved it, I can delete topic but maybe someone will make same mistake so I can explain, I used EntityPlayer for onUpdate but have to use Entity. So I change my code;

 

public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {
	if (entity instanceof EntityPlayer) {
		  EntityPlayer player = (EntityPlayer) entity;
		  if (player.inventory.hasItem(stack.getItem())) {
			  Minecraft mc = FMLClientHandler.instance().getClient();
			  update(mc);
		  }
	}
}

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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