Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.camellias.voidaicarcania.util.handlers;
- import com.camellias.voidaicarcania.network.MessageFly;
- import com.camellias.voidaicarcania.network.NetworkHandler;
- import com.camellias.voidaicarcania.util.Keybindings;
- import jline.internal.Log;
- import net.minecraft.client.Minecraft;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
- import net.minecraftforge.fml.common.gameevent.InputEvent;
- public class KeyInputHandler
- {
- private Keybindings getPressedKey()
- {
- for(Keybindings key : Keybindings.values())
- {
- if(key.isPressed()) return key;
- }
- return null;
- }
- @SubscribeEvent
- public void handleKeyInputEvent(InputEvent.KeyInputEvent event)
- {
- Keybindings key = getPressedKey();
- if(key != null)
- {
- switch(key)
- {
- case FLY:
- EntityPlayer player = Minecraft.getMinecraft().player;
- if(player.getTags().contains("flight"))
- {
- NetworkHandler.sendToServer(new MessageFly());
- }
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment