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