当前位置: 首页>>代码示例>>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;未经允许,请勿转载。