@Mod.EventBusSubscriber(modid = MoGuns.MOD_ID, bus = Mod.EventBusSubscriber.Bus.FORGE) public class BurstShootingEvent { public static int BURST = 0; @SubscribeEvent public static void onKeyPressed(InputEvent.RawMouseEvent event) { Minecraft mc = Minecraft.getInstance(); PlayerEntity player = mc.player; if(player == null) return; ItemStack heldItem = player.getHeldItemMainhand(); if(heldItem.getItem() instanceof BurstGunItem) { int BUTTON = event.getButton(); if(event.getAction() == GLFW.GLFW_PRESS && BUTTON == GLFW.GLFW_MOUSE_BUTTON_LEFT) BURST = 0; } } @SubscribeEvent public static void preShoot(Pre event) { if(!(event.getStack().getItem() instanceof BurstGunItem)) return; if(BURST > 5) event.setCanceled(true); } @SubscribeEvent public static void postShoot(Post event) { if(BURST <= 5) ++BURST; } }