本文整理汇总了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);
}
}
示例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;
}
}
示例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();
}
}
示例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() );
}
}
}
示例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);
}
}
}
示例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."));
}
}
}
示例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);
}
}
}
示例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();
}
示例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());
}
}
示例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);
}
});
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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;
}
}
示例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();
}
}
}
}