Hey, I'm trying to loop a method that damages an entity 3 blocks in front of the player (which works) as long as the left mouse button is held down, but the game just runs the method way too quickly to the point that the game freezes, I tried to slow this down with a modulo operator as seen below, but it doesn't work. Thanks in advance!
public static void onClick(MouseInputEvent e) {
GameSettings gs = Minecraft.getMinecraft().gameSettings;
EntityPlayer p = Util.getPlayerbyUUID(Minecraft.getMinecraft().player.getPersistentID());
if(p.getCapability(PMDataProvider.PDAT, null).getMMode()) {
p.getCapability(PMDataProvider.PDAT, null).setLSpell(new SpellBase("test", MagickaType.ARCANE, SpellComponents.Telekinetic, 1));
while(gs.keyBindAttack.isKeyDown()) {
if(Minecraft.getMinecraft().world.getWorldTime()%10==0) {
p.getCapability(PMDataProvider.PDAT, null).getLSpell().activateSpell(p);
Util.logger.info("Left Spell: "+p.getCapability(PMDataProvider.PDAT, null).getLSpell().getRegistryName());
}
}
if(gs.keyBindAttack.isPressed()) {
KeyBinding.setKeyBindState(gs.keyBindAttack.getKeyCode(), false);
}
if(gs.keyBindUseItem.isPressed()) {
KeyBinding.setKeyBindState(gs.keyBindUseItem.getKeyCode(), false);
}
}
}