May 20, 201411 yr Author Just add a variable in your item class called tickssincefired, and every tick increase it by one, and if it = 4 then fire a bullet and set it to 0. This is basic logic. The reason you don't do that is because that variable will be the same for every single instance of the Item, making it incompatible in multiplayer for sure, and possibly in single player as well if you have two or more of the item in question. @OP Your code is close, but when you right click, you forgot to set the time at which it was fired, meaning that every click will allow it to fire as world time > 0 is always true Add this to your right-click method after determining that you should fire a shot: stack.getTagCompound().setLong("lastShotTime", world.getWorldTime() + delay); // where 'delay' is an integer equal to the number of ticks you want to delay between shots That should now prevent you from spamming right click to fire quickly, while still allowing you to hold right-click and fire continuously while the item is in use. I hate to necro this, but I recently discovered an issue where if you hold down the fire button, it'll keep on firing until you switch weapons even if you let go of holding down fire.
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.