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


Java KeyInputEvent类代码示例

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


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

示例1: onEvent

import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
public static void onEvent(KeyInputEvent event) {
	Minecraft mc = Minecraft.getMinecraft();
	EntityPlayer player = mc.player;

	CartCapability entityData = player.getCapability(Currency.CART_DATA, null);

	boolean isEmpty = true;

	if (entityData != null && entityData.getCart() != null) {
		for (ItemStack stack : entityData.getCart()) {
			if (!stack.isEmpty()) {
				isEmpty = false;
			}
		}
	}

	if (!isEmpty && openList.isPressed()) {
		Minecraft.getMinecraft().player.openGui(Currency.INSTANCE, 5, mc.world, (int) player.posX, (int) player.posY, (int) player.posZ);
	}
}
 
开发者ID:Zundrel,项目名称:Never-Enough-Currency,代码行数:23,代码来源:KeybindHandler.java

示例2: onKeyInputEvent

import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; //导入依赖的package包/类
@SubscribeEvent
public void onKeyInputEvent(KeyInputEvent event)
{
    if (Keyboard.getEventKeyState() == false)
    {
        return;
    }

    int keyCode = Keyboard.getEventKey();

    if (PlacementPreview.keyToggleGhost.isActiveAndMatches(keyCode))
    {
        Configs.enableRenderGhost = ! Configs.enableRenderGhost;
    }
    else if (PlacementPreview.keyToggleWire.isActiveAndMatches(keyCode))
    {
        Configs.enableRenderWire = ! Configs.enableRenderWire;
    }
    else if (PlacementPreview.keyToggleEnabled.isActiveAndMatches(keyCode))
    {
        RenderEventHandler.renderingEnabled = ! RenderEventHandler.renderingEnabled;
    }
}
 
开发者ID:maruohon,项目名称:placementpreview,代码行数:24,代码来源:InputEventHandler.java

示例3: onKeyInput

import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; //导入依赖的package包/类
@SubscribeEvent
public void onKeyInput(final KeyInputEvent e) {
	if (PathHandler.isTravelling()) {
		return;
	}

	if (Main.point.isPressed()) {
		final Position playerPos = Utils.getPosition();
		PathHandler.addWaypoint(playerPos);
		Utils.sendInformation(Main.pathAdd.toString() + PathHandler.getWaypointSize());
	}

	if (Main.cameraReset.isPressed()) {
		CameraRoll.reset();
	}

	if (Main.fovReset.isPressed()) {
		DynamicFOV.reset();
	}
}
 
开发者ID:daipenger,项目名称:BauerCam,代码行数:21,代码来源:EventListener.java

示例4: onKeyInput

import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; //导入依赖的package包/类
@SubscribeEvent
public void onKeyInput( KeyInputEvent event )
   {
	if( (!FMLClientHandler.instance().isGUIOpen( GuiChat.class )) && (mc.currentScreen == null) && (mc.world != null) )
       {
		if( XRay.keyBind_keys[ XRay.keyIndex_toggleXray ].isPressed() )
		{
			XRay.drawOres = !XRay.drawOres;
			XrayRenderer.ores.clear();
		}
		else if( XRay.keyBind_keys[ XRay.keyIndex_showXrayMenu ].isPressed() )
		{
			mc.displayGuiScreen( new GuiList() );
		}
	}
}
 
开发者ID:MichaelHillcox,项目名称:XRay-Mod,代码行数:17,代码来源:KeyBindingHandler.java

示例5: onInputEvent

import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; //导入依赖的package包/类
@SubscribeEvent
public void onInputEvent(KeyInputEvent event) {
	int key = Keyboard.getEventKey();
	Minecraft mc = Minecraft.getMinecraft();
	EntityPlayer player = mc.thePlayer;
	World world = mc.theWorld;
	int bind = mc.gameSettings.keyBindAttack.getKeyCode();

	BlockPos pos = mc.objectMouseOver.getBlockPos();
	EnumFacing face = mc.objectMouseOver.sideHit;

	if ((key == bind) && (Keyboard.isKeyDown(key))) {
		if (world.getBlockState(pos).getBlock() != null) {
			this.extinguishFire(player, pos, face, world, event, key);
		}
	}
}
 
开发者ID:NovaViper,项目名称:ZeroQuest,代码行数:18,代码来源:FireEventHandler.java

示例6: extinguishFire

import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; //导入依赖的package包/类
private void extinguishFire(EntityPlayer player, BlockPos posIn, EnumFacing face, World world, Event event, int key) {
	BlockPos pos = posIn.offset(face);

	if (world.getBlockState(pos).getBlock() == ModBlocks.nileFire) {
		if ((event instanceof MouseEvent) || (event instanceof PlayerInteractEvent)) {
			PacketHandler.sendToServer(new FireSound(player, face, pos));
			event.setCanceled(true);
		}
		else if (event instanceof KeyInputEvent) {
			player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Please contact the modder of Zero Quest if you are trying to put out a fire " + EnumChatFormatting.RED + "using a key on your keyboard as your attack key."));
		}
	}
	else if (world.getBlockState(pos).getBlock() == ModBlocks.darkFire) {
		if ((event instanceof MouseEvent) || (event instanceof PlayerInteractEvent)) {
			PacketHandler.sendToServer(new FireSound(player, face, pos));
			event.setCanceled(true);
		}
		else if (event instanceof KeyInputEvent) {
			player.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Please contact the modder of Zero Quest if you are trying to put out a fire " + EnumChatFormatting.RED + "using a key on your keyboard as your attack key."));
		}
	}
}
 
开发者ID:NovaViper,项目名称:ZeroQuest,代码行数:23,代码来源:FireEventHandler.java

示例7: onKey

import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; //导入依赖的package包/类
/**
 * This will only subscribe when NotEnoughKeys is not installed.
 *
 * @param event
 */
@SubscribeEvent
public void onKey(KeyInputEvent event) {
    for (KeyBinding key : keys) {
        if (key.isPressed()) {
            onKey(key);
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:14,代码来源:KeyHandler.java

示例8: onKeyInput

import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; //导入依赖的package包/类
@SubscribeEvent
public void onKeyInput(KeyInputEvent event)
{
	for(KeyBinding key : ringEvents)
		if(key.isPressed())
			sendRingEvent(ringEvents.indexOf(key));
	if(openInventory.isPressed())
		HarshenClientUtils.openInventory();
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:10,代码来源:HandlerKeyBinding.java

示例9: onEvent

import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; //导入依赖的package包/类
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
public void onEvent(KeyInputEvent event) {
	KeyBinding[] keyBindings = ClientProxy.keyBindings;
	if (keyBindings[0].isPressed()) {
		// TODO convert this to a toggle so that it opens and closes the gui
		NemesisSystem.NETWORK.sendToServer(new MessageOpenNemesisGuiRequest());
	}
}
 
开发者ID:ToroCraft,项目名称:NemesisSystem,代码行数:9,代码来源:InputHandler.java

示例10: addItemKeyBinding

import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; //导入依赖的package包/类
public void addItemKeyBinding(final Item item, String description, int keyCode, String category,
		final Consumer<KeyInputEvent> callback) {
	addKeyBinding(description, keyCode, category, keyInputEvent -> {
		HeldEquipment equipment =
				PlayerUtil.getHeldEquipment(Minecraft.getMinecraft().player, item);
		if (equipment != null) {
			callback.accept(keyInputEvent);
		}
	});
}
 
开发者ID:hea3ven,项目名称:CommonUtils,代码行数:11,代码来源:KeyBindingManager.java

示例11: onKeyInputEvent

import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; //导入依赖的package包/类
@SubscribeEvent
public void onKeyInputEvent(InputEvent.KeyInputEvent event) {
	for (Entry<KeyBinding, Consumer<InputEvent.KeyInputEvent>> entry : keyBindings.entrySet()) {
		if (entry.getKey().isPressed()) {
			entry.getValue().accept(event);
		}
	}
}
 
开发者ID:hea3ven,项目名称:CommonUtils,代码行数:9,代码来源:KeyBindingManager.java

示例12: addKeyBinding

import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; //导入依赖的package包/类
public void addKeyBinding(String description, int keyCode, String category,
		Consumer<KeyInputEvent> callback) {
	if (keyBindingManager == null) {
		keyBindingManager = new KeyBindingManager();
	}
	keyBindingManager.addKeyBinding(description, keyCode, category, callback);
}
 
开发者ID:hea3ven,项目名称:CommonUtils,代码行数:8,代码来源:ProxyModBase.java

示例13: addItemKeyBinding

import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; //导入依赖的package包/类
public void addItemKeyBinding(Item item, String description, int keyCode, String category,
		Consumer<KeyInputEvent> callback) {
	if (keyBindingManager == null) {
		keyBindingManager = new KeyBindingManager();
	}
	keyBindingManager.addItemKeyBinding(item, description, keyCode, category, callback);
}
 
开发者ID:hea3ven,项目名称:CommonUtils,代码行数:8,代码来源:ProxyModBase.java

示例14: onKeyInput

import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; //导入依赖的package包/类
@SubscribeEvent
public void onKeyInput(KeyInputEvent event) {
	if (ClientProxy.attack2.isPressed()) {
		if (!attackpressed) {
			attackpressed = true;
			KeyBinding.onTick(mc.gameSettings.keyBindAttack.getKeyCode());
		}
	} else {
		attackpressed = false;
	}
}
 
开发者ID:HyCraftHD,项目名称:TeambattleMod,代码行数:12,代码来源:ClientEventHandler.java

示例15: onKeyInput

import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent(priority = EventPriority.HIGH)
public static void onKeyInput(KeyInputEvent event) {
	if (System.currentTimeMillis() - lastTime > 500 && AlchemyEventSystem.isKeyBindingActive(key_follower)) {
		EntityPlayer player = Minecraft.getMinecraft().player;
		if (player != null) {
			InventoryBauble bauble = player.getCapability(AlchemyCapabilityLoader.bauble, null);
			ItemStack head = bauble.getStackInSlot(BaubleType.HEAD.getValidSlots()[0]);
			if (head != null && head.getItem() instanceof ItemHeadFollower) {
				SingleProjection.cutoverState();
				lastTime = System.currentTimeMillis();
			}
		}
	}
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:16,代码来源:ItemHeadFollower.java


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