Jump to content

Recommended Posts

Posted

This is probably just me not knowing enough about Java, but I'm trying to get some custom actions to take place when the player collects the item from my crafting table.  I figure slotClicked is the method that I want to use, but the trace I have in place calls twice when I grab the item from the table.

 

 

	public ItemStack slotClick(int par1,int par2,int par3, EntityPlayer player)
{
	ItemStack r = super.slotClick(par1, par2, par3, player);
	if (par1 == 0 && r != null){
		Item crafted = r.getItem();
		if (crafted instanceof SummonerItem){
			System.out.println("Summoner Item Result");
		} 
	}
	this.onCraftMatrixChanged(this.craftingMatrix);
	return r;
}	

 

 

Is the method that I am using, and I get my trace twice.

Posted

That is because it is being run both client and server side, to make it run only once just check if(!player.worldObj.isRemote) this will make it run only on the server side

Note: I may have misspelt it so make sure you check the proper spelling

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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