当前位置: 首页>>代码示例>>Java>>正文


Java InputEvent.KeyInputEvent方法代码示例

本文整理汇总了Java中net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent方法的典型用法代码示例。如果您正苦于以下问题:Java InputEvent.KeyInputEvent方法的具体用法?Java InputEvent.KeyInputEvent怎么用?Java InputEvent.KeyInputEvent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraftforge.fml.common.gameevent.InputEvent的用法示例。


在下文中一共展示了InputEvent.KeyInputEvent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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

示例2: 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

示例3: 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

示例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: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: onKeyInput

import net.minecraftforge.fml.common.gameevent.InputEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
    Minecraft mc = FMLClientHandler.instance().getClient();
    if (mc.inGameHasFocus && keyBinding != null && keyBinding.isPressed()) {
        onMouseClicked(0, 0, 0);
        HUDHandler.instance().addMessage(I18n.format("pneumaticHelmet.message." + (checked ? "enable" : "disable") + "Setting", I18n.format(text)), new ArrayList<String>(), 60, 0x7000AA00);
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:9,代码来源:GuiKeybindCheckBox.java

示例13: keyEvent

import net.minecraftforge.fml.common.gameevent.InputEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void keyEvent(InputEvent.KeyInputEvent keyInputEvent)
{
    //Check if the chalk keybind was pressed, and that the player is holding chalk in one of thier hands
    if (ModKeybind.keybindChalk.isPressed()&&Minecraft.getMinecraft().currentScreen==null
            &&((Minecraft.getMinecraft().thePlayer.getHeldItem(EnumHand.MAIN_HAND)!=null&&Minecraft.getMinecraft().thePlayer.getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof ItemChalkDefault)
            ||(Minecraft.getMinecraft().thePlayer.getHeldItem(EnumHand.OFF_HAND)!=null&&Minecraft.getMinecraft().thePlayer.getHeldItem(EnumHand.OFF_HAND).getItem() instanceof ItemChalkDefault)))
    {
        Minecraft.getMinecraft().displayGuiScreen(new GuiChalk());

    }
}
 
开发者ID:Drazuam,项目名称:RunicArcana,代码行数:13,代码来源:KeyEventHandler.java

示例14: onKeyInput

import net.minecraftforge.fml.common.gameevent.InputEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event)
{
    if (Config.getInstance().isServerListEnabled() && ((Client) CreeperHost.proxy).openGuiKey.isPressed())
    {
        if (CreeperHost.instance.handledInvite != null)
        {
            CreeperHost.instance.clearToast(false);
            mc.displayGuiScreen(new GuiInvited(CreeperHost.instance.handledInvite, mc.currentScreen));
            CreeperHost.instance.handledInvite = null;
        }
        else
            CreeperHost.proxy.openFriendsGui();
    }
}
 
开发者ID:CreeperHost,项目名称:CreeperHostGui,代码行数:16,代码来源:EventHandler.java

示例15: onKeyboardEvent

import net.minecraftforge.fml.common.gameevent.InputEvent; //导入方法依赖的package包/类
@SubscribeEvent
public void onKeyboardEvent(InputEvent.KeyInputEvent event) {
    getGlobalCommand().getChildrenDeep().stream()
            .filter(command -> command instanceof CommandStub)
            .map(command -> (CommandStub)command)
            .filter(stub -> stub.getBind() != null)
            .forEach(stub -> {
                if (stub.getBind().isPressed()) stub.onKeyPressed();
                if (stub.getBind().isKeyDown()) stub.onKeyDown();
            });
}
 
开发者ID:fr1kin,项目名称:ForgeHax,代码行数:12,代码来源:BindEventService.java


注:本文中的net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。