當前位置: 首頁>>代碼示例>>Java>>正文


Java KeyBinding.setKeyBindState方法代碼示例

本文整理匯總了Java中net.minecraft.client.settings.KeyBinding.setKeyBindState方法的典型用法代碼示例。如果您正苦於以下問題:Java KeyBinding.setKeyBindState方法的具體用法?Java KeyBinding.setKeyBindState怎麽用?Java KeyBinding.setKeyBindState使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.client.settings.KeyBinding的用法示例。


在下文中一共展示了KeyBinding.setKeyBindState方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: doChargeTick

import net.minecraft.client.settings.KeyBinding; //導入方法依賴的package包/類
public static void doChargeTick(EntityLivingBase player) {
	if (player == Minecraft.getMinecraft().player) {
		if (player.getActivePotionEffect(TF2weapons.charging) != null
				&& !(Minecraft.getMinecraft().player.movementInput instanceof MovementInputCharging)) {
			player.getCapability(TF2weapons.PLAYER_CAP,
					null).lastMovementInput = Minecraft.getMinecraft().player.movementInput;
			Minecraft.getMinecraft().player.movementInput = new MovementInputCharging();
			KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSprint.getKeyCode(), true);
			Minecraft.getMinecraft().gameSettings.mouseSensitivity *= 0.1f;
		} else if (player.getActivePotionEffect(TF2weapons.charging) == null
				&& player.getCapability(TF2weapons.PLAYER_CAP, null).lastMovementInput != null) {

			Minecraft.getMinecraft().player.movementInput = player.getCapability(TF2weapons.PLAYER_CAP,
					null).lastMovementInput;
			player.getCapability(TF2weapons.PLAYER_CAP, null).lastMovementInput = null;
			Minecraft.getMinecraft().gameSettings.mouseSensitivity *= 10f;
		}
		//Minecraft.getMinecraft().player.movementInput.moveForward = 1f;
	}
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:21,代碼來源:ClientProxy.java

示例2: onDisable

import net.minecraft.client.settings.KeyBinding; //導入方法依賴的package包/類
@Override
protected void onDisable() {
    if (!Keyboard.isKeyDown(mc.gameSettings.keyBindSneak.getKeyCode())) {
        KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.getKeyCode(), false);
        if (this.sneaking) {
            mc.thePlayer.sendQueue.addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING));
            this.sneaking = false;
        }
    }

    this.sneaking = false;
}
 
開發者ID:SerenityEnterprises,項目名稱:SerenityCE,代碼行數:13,代碼來源:Sneak.java

示例3: mousePress

import net.minecraft.client.settings.KeyBinding; //導入方法依賴的package包/類
@SubscribeEvent
public void mousePress(MouseEvent event) {
	if (event.getButton() != -1) {
		Minecraft minecraft = Minecraft.getMinecraft();
		if (minecraft.player != null && !minecraft.player.getHeldItemMainhand().isEmpty())
			if (minecraft.player.getHeldItemMainhand().getItem() instanceof ItemUsable) {
				KeyBinding.setKeyBindState(event.getButton() - 100, event.isButtonstate());
				keyPressUpdate(minecraft.gameSettings.keyBindAttack.isKeyDown(), minecraft.gameSettings.keyBindUseItem.isKeyDown());
			}
	}
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:12,代碼來源:TF2EventsClient.java

示例4: setPressed

import net.minecraft.client.settings.KeyBinding; //導入方法依賴的package包/類
public void setPressed(boolean b) {
    // press key
    KeyBinding.setKeyBindState(binding.getKeyCode(), b);
}
 
開發者ID:fr1kin,項目名稱:ForgeHax,代碼行數:5,代碼來源:KeyBindingHandler.java

示例5: runTickMouse

import net.minecraft.client.settings.KeyBinding; //導入方法依賴的package包/類
private void runTickMouse() throws IOException
{
    while (Mouse.next())
    {
        int i = Mouse.getEventButton();
        KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState());

        if (Mouse.getEventButtonState())
        {
            if (this.player.isSpectator() && i == 2)
            {
                this.ingameGUI.getSpectatorGui().onMiddleClick();
            }
            else
            {
                KeyBinding.onTick(i - 100);
            }
        }

        long j = getSystemTime() - this.systemTime;

        if (j <= 200L)
        {
            int k = Mouse.getEventDWheel();

            if (k != 0)
            {
                if (this.player.isSpectator())
                {
                    k = k < 0 ? -1 : 1;

                    if (this.ingameGUI.getSpectatorGui().isMenuActive())
                    {
                        this.ingameGUI.getSpectatorGui().onMouseScroll(-k);
                    }
                    else
                    {
                        float f = MathHelper.clamp(this.player.capabilities.getFlySpeed() + (float)k * 0.005F, 0.0F, 0.2F);
                        this.player.capabilities.setFlySpeed(f);
                    }
                }
                else
                {
                    this.player.inventory.changeCurrentItem(k);
                }
            }

            if (this.currentScreen == null)
            {
                if (!this.inGameHasFocus && Mouse.getEventButtonState())
                {
                    this.setIngameFocus();
                }
            }
            else if (this.currentScreen != null)
            {
                this.currentScreen.handleMouseInput();
            }
        }
    }
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:62,代碼來源:Minecraft.java

示例6: removeSprint

import net.minecraft.client.settings.KeyBinding; //導入方法依賴的package包/類
public static void removeSprint() {
	KeyBinding.setKeyBindState(Minecraft.getMinecraft().gameSettings.keyBindSprint.getKeyCode(), false);
}
 
開發者ID:rafradek,項目名稱:Mods,代碼行數:4,代碼來源:ClientProxy.java

示例7: runTickMouse

import net.minecraft.client.settings.KeyBinding; //導入方法依賴的package包/類
private void runTickMouse() throws IOException
{
    while (Mouse.next())
    {
        if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue;

        int i = Mouse.getEventButton();
        KeyBinding.setKeyBindState(i - 100, Mouse.getEventButtonState());

        if (Mouse.getEventButtonState())
        {
            if (this.thePlayer.isSpectator() && i == 2)
            {
                this.ingameGUI.getSpectatorGui().onMiddleClick();
            }
            else
            {
                KeyBinding.onTick(i - 100);
            }
        }

        long j = getSystemTime() - this.systemTime;

        if (j <= 200L)
        {
            int k = Mouse.getEventDWheel();

            if (k != 0)
            {
                if (this.thePlayer.isSpectator())
                {
                    k = k < 0 ? -1 : 1;

                    if (this.ingameGUI.getSpectatorGui().isMenuActive())
                    {
                        this.ingameGUI.getSpectatorGui().onMouseScroll(-k);
                    }
                    else
                    {
                        float f = MathHelper.clamp_float(this.thePlayer.capabilities.getFlySpeed() + (float)k * 0.005F, 0.0F, 0.2F);
                        this.thePlayer.capabilities.setFlySpeed(f);
                    }
                }
                else
                {
                    this.thePlayer.inventory.changeCurrentItem(k);
                }
            }

            if (this.currentScreen == null)
            {
                if (!this.inGameHasFocus && Mouse.getEventButtonState())
                {
                    this.setIngameFocus();
                }
            }
            else if (this.currentScreen != null)
            {
                this.currentScreen.handleMouseInput();
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:64,代碼來源:Minecraft.java


注:本文中的net.minecraft.client.settings.KeyBinding.setKeyBindState方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。