當前位置: 首頁>>代碼示例>>Java>>正文


Java InputEvent類代碼示例

本文整理匯總了Java中net.minecraftforge.fml.common.gameevent.InputEvent的典型用法代碼示例。如果您正苦於以下問題:Java InputEvent類的具體用法?Java InputEvent怎麽用?Java InputEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


InputEvent類屬於net.minecraftforge.fml.common.gameevent包,在下文中一共展示了InputEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handleKeys

import net.minecraftforge.fml.common.gameevent.InputEvent; //導入依賴的package包/類
@SubscribeEvent
public static void handleKeys(InputEvent ev) // Not a mistake, I want both kb & mouse events handled.
{
    Minecraft mc = Minecraft.getMinecraft();

    while (keyOpenToolMenu.isPressed())
    {
        if (mc.currentScreen == null)
        {
            ItemStack inHand = mc.player.getHeldItemMainhand();
            if (Config.isItemStackAllowed(inHand))
            {
                BeltFinder.BeltGetter getter = BeltFinder.instance.findStack(mc.player);
                if (getter == null)
                    return;

                mc.displayGuiScreen(new GuiRadialMenu(getter));
            }
        }
    }
}
 
開發者ID:gigaherz,項目名稱:ToolBelt,代碼行數:22,代碼來源:ClientProxy.java

示例2: onKeyInput

import net.minecraftforge.fml.common.gameevent.InputEvent; //導入依賴的package包/類
/**
 * active when key down
 * @param event
 */
@SubscribeEvent
public static void onKeyInput(InputEvent.KeyInputEvent event) {
    if (!enable()) return;
    float oldX = offsetX, oldY = offsetY, oldZ = offsetZ;

    // base setting
    if (isKeyDown(KEY_NUMPAD0)) reset();
    else if (isKeyDown(KEY_NUMPAD5)) sendOffsetMessage();

    // offset x
    else if (isKeyDown(KEY_NUMPAD6)) offsetX++;
    else if (isKeyDown(KEY_NUMPAD4)) offsetX--;

    // offset y
    else if (isKeyDown(KEY_NUMPAD8)) offsetY++;
    else if (isKeyDown(KEY_NUMPAD2)) offsetY--;

    // offset z
    else if (isKeyDown(KEY_NUMPAD9)) offsetZ++;
    else if (isKeyDown(KEY_NUMPAD1)) offsetZ--;

    if (oldX != offsetX || oldY != offsetY || oldZ != offsetZ) sendOffsetMessage();
}
 
開發者ID:MinecraftPangu,項目名稱:Pangu,代碼行數:28,代碼來源:GlRotateDebugger.java

示例3: onKeyInput

import net.minecraftforge.fml.common.gameevent.InputEvent; //導入依賴的package包/類
@SubscribeEvent
@SuppressWarnings("unused")
public void onKeyInput(InputEvent.KeyInputEvent event) {
    boolean left = ConfigurationHandler.getInstance().useConfigKeyBinds ? Keyboard.isKeyDown(ConfigurationHandler.getInstance().retractLeftKey) : ClientProxy.retractLeft.isKeyDown();
    boolean right = ConfigurationHandler.getInstance().useConfigKeyBinds ? Keyboard.isKeyDown(ConfigurationHandler.getInstance().retractRightKey) : ClientProxy.retractRight.isKeyDown();
    boolean space = Minecraft.getMinecraft().gameSettings.keyBindJump.isKeyDown();
    boolean sneak = Minecraft.getMinecraft().gameSettings.keyBindSneak.isKeyDown();

    if(left != status_left) {
        toggleRetracting(ManeuverGear.proxy.getClientPlayer(), true, left);
        status_left = left;
    }
    if(right != status_right) {
        toggleRetracting(ManeuverGear.proxy.getClientPlayer(), false, right);
        status_right = right;
    }

    if(space && sneak) {
        applyBoost(ManeuverGear.proxy.getClientPlayer());
    }
}
 
開發者ID:InfinityRaider,項目名稱:3DManeuverGear,代碼行數:22,代碼來源:KeyInputHandler.java

示例4: onKeyPressed

import net.minecraftforge.fml.common.gameevent.InputEvent; //導入依賴的package包/類
@SubscribeEvent
public void onKeyPressed(InputEvent.KeyInputEvent event) {
    if (enableOverlays) {
        int kC = Keyboard.getEventKey();

        if (Keyboard.getEventKeyState()) {
            if (ClientProxy.mobOverlay.isActiveAndMatches(kC)) {
                drawMobOverlay = !drawMobOverlay;
                if (!drawMobOverlay) {
                    MobOverlayRenderer.clearCache();
                    lastPlayerPos = null;
                }
            }

            if (ClientProxy.chunkOverlay.isActiveAndMatches(kC)) {
                ClientProxy.mc.debugRenderer.toggleChunkBorders();
            }
        }

    }
}
 
開發者ID:univrsal,項目名稱:JustEnoughButtons,代碼行數:22,代碼來源:EventHandlers.java

示例5: onPlayerKeypressed

import net.minecraftforge.fml.common.gameevent.InputEvent; //導入依賴的package包/類
@SubscribeEvent
public void onPlayerKeypressed(InputEvent.KeyInputEvent event)
{
	EntityPlayerSP player = Minecraft.getMinecraft().player;
	if (playerPooping.isPressed()) {
		System.out.println("Pressed z");
		ARKPlayer.get(player).go();
	}
	else if (playerCrafting.isPressed()) {
		ARKCraft.modChannel.sendToServer(new OpenPlayerCrafting());
	}
	else if (reload.isPressed()) {
		doReload();
	}
	else if (attachment.isKeyDown()) {
		if (player.getHeldItem(EnumHand.MAIN_HAND) != null && player.getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof ItemRangedWeapon && !(player.getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof NonSupporting)) {
			ARKCraft.modChannel.sendToServer(new OpenAttachmentInventory());
		}
	}
	else if (arkmode.isPressed()) {
		ARKPlayer.get(Minecraft.getMinecraft().player).toggleARKMode();
		ARKCraft.modChannel.sendToServer(new ARKModeToggle());
	}
}
 
開發者ID:BubbleTrouble14,項目名稱:ARKCraft,代碼行數:25,代碼來源:ClientEventHandler.java

示例6: onKeyInput

import net.minecraftforge.fml.common.gameevent.InputEvent; //導入依賴的package包/類
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
    Minecraft mc = Minecraft.getMinecraft();

    for(ToolPage page : WigMod.Pages) {
        if (page.shouldToggle()) {
            if (page == WigMod.ActivePage) {
                if (WigMod.ActiveTool == null) {
                    WigMod.ActivePage = null;
                    GuiIngameForge.renderHotbar = true;
                    mc.ingameGUI.remainingHighlightTicks = 40;
                } else {
                    WigMod.ActiveTool = null;
                }
            } else {
                WigMod.ActivePage = page;
                GuiIngameForge.renderHotbar = false;
                mc.ingameGUI.remainingHighlightTicks = 0;
            }
        }
    }
}
 
開發者ID:CannibalVox,項目名稱:wig,代碼行數:23,代碼來源:BarSelectInputHandler.java

示例7: onKeyInput

import net.minecraftforge.fml.common.gameevent.InputEvent; //導入依賴的package包/類
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) 
{   
		
    if(ClientProxy.keyShiftUp.isPressed() )
    { 	     
    	 ModInventory.network.sendToServer( new MessageSlotUp()); 
    }        
    else if(ClientProxy.keyShiftDown.isPressed() )
    { 	      
    	 ModInventory.network.sendToServer( new MessageSlotDown());  
    }      
    else if(ClientProxy.keyBarUp.isPressed() )
    { 	      
    	 ModInventory.network.sendToServer( new MessageBarUp());  
    }   
    else if(ClientProxy.keyBarDown.isPressed() )
    { 	      
    	 ModInventory.network.sendToServer( new MessageBarDown());  
    }  
}
 
開發者ID:LothrazarMinecraftMods,項目名稱:InventoryControlKeys,代碼行數:22,代碼來源:ModInventory.java

示例8: onKeyInput

import net.minecraftforge.fml.common.gameevent.InputEvent; //導入依賴的package包/類
@SubscribeEvent
  public void onKeyInput(InputEvent.KeyInputEvent event) 
  {   
if(Minecraft.getMinecraft().objectMouseOver == null){return;}

BlockPos posMouse = Minecraft.getMinecraft().objectMouseOver.getBlockPos();

if(posMouse == null){return;}

//send different packet depending on which key is pressed
      if(ClientProxy.keyPush.isPressed())
      {
     		ModControlBlocks.network.sendToServer( new MessageKeyPush(posMouse));
      }
      else if(ClientProxy.keyPull.isPressed())
      {
     		ModControlBlocks.network.sendToServer( new MessageKeyPull(posMouse));
      }
      else if(ClientProxy.keyTransform.isPressed())
      {
     		ModControlBlocks.network.sendToServer( new MessageKeyRotate(posMouse));
      } 
  }
 
開發者ID:LothrazarMinecraftMods,項目名稱:BlockControl,代碼行數:24,代碼來源:ModControlBlocks.java

示例9: onKeyInput

import net.minecraftforge.fml.common.gameevent.InputEvent; //導入依賴的package包/類
@SubscribeEvent
  public void onKeyInput(InputEvent.KeyInputEvent event) 
  {   
int macroNumber = -1;
      if(ClientProxy.keyBindMacro1.isPressed())
      {
      	macroNumber = 1;
      }
      else if(ClientProxy.keyBindMacro2.isPressed())
      {
      	macroNumber = 2;
      }
      else if(ClientProxy.keyBindMacro3.isPressed())
      {
      	macroNumber = 3;
      }
      else if(ClientProxy.keyBindMacro4.isPressed())
      {
      	macroNumber = 4;
      }
      
      if(macroNumber > 0)
      	ModKeyMacros.network.sendToServer( new MessageKeyPressed(macroNumber));
  }
 
開發者ID:LothrazarMinecraftMods,項目名稱:PlayerMacros,代碼行數:25,代碼來源:ModKeyMacros.java

示例10: onPlayerKeypressed

import net.minecraftforge.fml.common.gameevent.InputEvent; //導入依賴的package包/類
@SubscribeEvent
public void onPlayerKeypressed(InputEvent.KeyInputEvent event)
{
	if (reload.isPressed())
	{
		doReload();
	}
	else if (attachment.isPressed())
	{
		EntityPlayer player = mc.thePlayer;
		if (player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem()
				.getItem() instanceof ItemRangedWeapon && !(player.getCurrentEquippedItem()
				.getItem() instanceof NonSupporting))
		{
			player.openGui(ARKCraft.instance, GlobalAdditions.GUI.ATTACHMENT_GUI.getID(),
					player.worldObj, 0, 0, 0);
			ARKCraft.modChannel.sendToServer(new OpenAttachmentInventory());
		}
	}
}
 
開發者ID:Archiving,項目名稱:ARKCraft-Code,代碼行數:21,代碼來源:ClientEventHandler.java

示例11: handleKeyInputEvent

import net.minecraftforge.fml.common.gameevent.InputEvent; //導入依賴的package包/類
@SubscribeEvent
public void handleKeyInputEvent(InputEvent.KeyInputEvent event){
    Key pressed = getPressedKeybinding();
    if(pressed==Key.UNKNOWN){
        return;
    }
    if(FMLClientHandler.instance().getClient().inGameHasFocus){
        if(FMLClientHandler.instance().getClientPlayerEntity()!=null){
            EntityPlayer entityPlayer = FMLClientHandler.instance().getClientPlayerEntity();
            if(entityPlayer.getCurrentEquippedItem()!=null){
                ItemStack itemStack = entityPlayer.getCurrentEquippedItem();
                if(itemStack.getItem() instanceof IKeyBound){
                    if(entityPlayer.worldObj.isRemote){
                        MessageDispatcher.INSTANCE.sendToServer(new MessageKeyPressed(pressed));
                    }else{
                        ((IKeyBound) itemStack.getItem()).doKeyBindingAction(entityPlayer, itemStack, getPressedKeybinding());
                    }
                }
            }
        }
    }
}
 
開發者ID:Mattpenguin,項目名稱:MagicaSolaris,代碼行數:23,代碼來源:KeyInputEventHandler.java

示例12: onKeyInput

import net.minecraftforge.fml.common.gameevent.InputEvent; //導入依賴的package包/類
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent evt) {
    if (mouseIndicator.isPressed()) {
        if (!mouseState) {
            handler.toggleMouse();
            mouseState = true;
        }
    } else
        mouseState = false;

    if (keyboardIndicator.isPressed()) {
        if (!keyboardState) {
            handler.toggleKeyboard();
            keyboardState = true;
        }
    } else
        keyboardState = false;
}
 
開發者ID:boq,項目名稱:ClicketyClack,代碼行數:19,代碼來源:KeyBindingHandler.java

示例13: toggleKey

import net.minecraftforge.fml.common.gameevent.InputEvent; //導入依賴的package包/類
public void toggleKey(KeyBinding key) {
    if (!TOGGLED_KEYS.contains(key)) {
        TOGGLED_KEYS.add(key);
        KeyReflectionHelper.pressKey(key);
        KeyReflectionHelper.increasePressTime(key);
    } else {
        TOGGLED_KEYS.remove(key);
        KeyReflectionHelper.unpressKey(key);
    }

    boolean old = Minecraft.getMinecraft().inGameHasFocus;
    Minecraft.getMinecraft().inGameHasFocus = true;
    MinecraftForge.EVENT_BUS.post(new InputEvent.KeyInputEvent());
    Minecraft.getMinecraft().inGameHasFocus = old;

    ignoreNextTick = true;
}
 
開發者ID:dmillerw,項目名稱:MineMenu,代碼行數:18,代碼來源:KeyboardHandler.java

示例14: onKeyInput

import net.minecraftforge.fml.common.gameevent.InputEvent; //導入依賴的package包/類
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
    // don't poll keys when there's an active task
    if (task != null) {
        return;
    }
    
    if (keyCapture.isPressed()) {
        taskFile = getScreenshotFile();
        if (config.captureTiled.get()) {
            task = new CaptureTiledTask(config, taskFile);
        } else {
            task = new CaptureTask(config, taskFile);
        }
    }
}
 
開發者ID:ata4,項目名稱:mineshot,代碼行數:17,代碼來源:ScreenshotHandler.java

示例15: onInput

import net.minecraftforge.fml.common.gameevent.InputEvent; //導入依賴的package包/類
@SubscribeEvent
public void onInput(InputEvent event)
{
	KeyBinding p = ClientProxy.bindingP;
	EntityPlayer player = Minecraft.getMinecraft().player;
	
	if (player != null && p.isPressed())
	{
		player.openGui(LootSlashConquer.instance, GuiHandler.PLAYER_INFORMATION, player.getEntityWorld(), player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ());
	}
	
	// if ability key is pressed.
	// send server packet calling ability start.
}
 
開發者ID:TheXFactor117,項目名稱:Loot-Slash-Conquer,代碼行數:15,代碼來源:EventInput.java


注:本文中的net.minecraftforge.fml.common.gameevent.InputEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。