jordan30001 Posted March 13, 2013 Posted March 13, 2013 When the onItemUse() is called from my item I have noticed that it runs twice within the same tick. so if my method is taking 1/20th of a tick to run its actually taking 2-20th of a tick now this may seem redundant as its only 2/20th of a tick but if its running on a server that has 50 people on it and they all use the item at once then it takes 100/20th of a tick to run the method where as if its only running the method once its running 50/20th of a tick which is better because obviously its not needlessly doing things it doesn't need to do twice. How can I detect if the current item has run this method the previous tick or current tick and then not do it without setting the global itemstacks of the same item to do the same I am not 100% sure about this but the onItemRightClick() method sounds like it would do what I want it to do but its missing most of the params that I need to use. Quote
VengeanceSoldier Posted March 13, 2013 Posted March 13, 2013 The problem propably is that your onItemUse() is getting called client and serversided. Just use if(!world.isRemote) and it will only be run server sided. Often running certain functions on the client results in problems, f.e. ghost items. Server functions (f.e. world changes, entity spawns,...) will get sent to the client anyway so it shouldnt cause any problems. Quote
jordan30001 Posted March 13, 2013 Author Posted March 13, 2013 even with only running it server side it still runs twice on the server rather than running just once on the client and once on the server Quote
Recommended Posts
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.