My minecraft is crashing with custom code

Started by RodizzGamer on

Topic category: Advanced modding

Joined May 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
My minecraft is crashing with custom code
Tue, 11/24/2020 - 08:57 (edited)

I am making that when the player clicks the button send a message to the chat but the games crashes

 

here is the function 

@SubscribeEvent
public static void playerTick(TickEvent.PlayerTickEvent event) {
    if (RegistryHandler.keys[0].isPressed() && RegistryHandler.keysStates[0] == false) {
        ExampleMod.LOGGER.info("NINJA CARD");
        ((ServerPlayerEntity)event.player).func_241151_a_(new TranslationTextComponent("NinjaCard"), ChatType.CHAT, Util.field_240973_b_);
        RegistryHandler.keysStates[0] = true;
    }
    else if(RegistryHandler.keys[0].isPressed()) {
        RegistryHandler.keysStates[0] = false;
    }
}
Edited by RodizzGamer on Tue, 11/24/2020 - 08:57
Joined May 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What i do to not crash the…
Thu, 10/22/2020 - 08:25

What i do to not crash the game