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