Posted October 14, 201312 yr 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.
October 14, 201312 yr 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
October 14, 201312 yr Author Worked like a charm, and now I know should I run into a similar problem. Thank you
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.