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


Java KeyBinding類代碼示例

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


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

示例1: AutoClicker

import net.minecraft.client.settings.KeyBinding; //導入依賴的package包/類
public AutoClicker() {
    super("Auto Clicker", 0xb22c2c, ModuleCategory.COMBAT);
    listeners.add(new Listener<PlayerUpdate>() {
        @Override
        public void call(PlayerUpdate event) {
            if (maxCPS.getValue() < minCPS.getValue()) {
                maxCPS.setValue(minCPS.getValue());
            }
            if (timer.hasReached(delay)) {
                timer.reset();
                KeyBinding.onTick(mc.gameSettings.keyBindAttack.getKeyCode());

                double min = minCPS.getValue();
                double delta = maxCPS.getValue() - min;

                double nextDelay = 1 / (min + Math.random() * delta);
                delay = (int) Math.floor(nextDelay * 1000);
            }
        }
    });
}
 
開發者ID:SerenityEnterprises,項目名稱:SerenityCE,代碼行數:22,代碼來源:AutoClicker.java

示例2: mousePressed

import net.minecraft.client.settings.KeyBinding; //導入依賴的package包/類
/**
 * Called when the mouse is clicked within this entry. Returning true means that something within this entry was
 * clicked and the list should not be dragged.
 */
public boolean mousePressed(int slotIndex, int mouseX, int mouseY, int mouseEvent, int relativeX, int relativeY)
{
    if (this.btnChangeKeyBinding.mousePressed(GuiKeyBindingList.this.mc, mouseX, mouseY))
    {
        GuiKeyBindingList.this.controlsScreen.buttonId = this.keybinding;
        return true;
    }
    else if (this.btnReset.mousePressed(GuiKeyBindingList.this.mc, mouseX, mouseY))
    {
        this.keybinding.setToDefault();
        GuiKeyBindingList.this.mc.gameSettings.setOptionKeyBinding(this.keybinding, this.keybinding.getKeyCodeDefault());
        KeyBinding.resetKeyBindingArrayAndHash();
        return true;
    }
    else
    {
        return false;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:24,代碼來源:GuiKeyBindingList.java

示例3: onKeyPress

import net.minecraft.client.settings.KeyBinding; //導入依賴的package包/類
@Override
public void onKeyPress(KeyBinding key) {
    Minecraft mc = FMLClientHandler.instance().getClient();
    if (mc.inGameHasFocus) {
        if (key == KeyHandler.getInstance().keybindOpenOptions) {
            ItemStack helmetStack = mc.player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
            if (helmetStack.getItem() == Itemss.PNEUMATIC_HELMET) {
                FMLCommonHandler.instance().showGuiScreen(GuiHelmetMainScreen.getInstance());
            }
        } else if (key == KeyHandler.getInstance().keybindHack && HackUpgradeRenderHandler.enabledForPlayer(mc.player)) {
            getSpecificRenderer(BlockTrackUpgradeHandler.class).hack();
            getSpecificRenderer(EntityTrackUpgradeHandler.class).hack();
        } else if (key == KeyHandler.getInstance().keybindDebuggingDrone && DroneDebugUpgradeHandler.enabledForPlayer(PneumaticCraftRepressurized.proxy.getPlayer())) {
            getSpecificRenderer(EntityTrackUpgradeHandler.class).selectAsDebuggingTarget();
        }
    }
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:18,代碼來源:HUDHandler.java

示例4: init

import net.minecraft.client.settings.KeyBinding; //導入依賴的package包/類
@Override
public void init()
{
    ClientRegistry.registerKeyBinding(keyOpenToolMenu =
            new KeyBinding("key.toolbelt.open", Keyboard.KEY_R, "key.toolbelt.category"));
    //keyOpenToolMenu.

    ClientRegistry.registerKeyBinding(keyCycleToolMenuL =
            new KeyBinding("key.toolbelt.cycle.left", 0, "key.toolbelt.category"));

    ClientRegistry.registerKeyBinding(keyCycleToolMenuR =
            new KeyBinding("key.toolbelt.cycle.right", 0, "key.toolbelt.category"));

    Map<String, RenderPlayer> skinMap = Minecraft.getMinecraft().getRenderManager().getSkinMap();

    RenderPlayer render = skinMap.get("default");
    render.addLayer(new LayerToolBelt(render));

    render = skinMap.get("slim");
    render.addLayer(new LayerToolBelt(render));
}
 
開發者ID:gigaherz,項目名稱:ToolBelt,代碼行數:22,代碼來源:ClientProxy.java

示例5: actionPerformed

import net.minecraft.client.settings.KeyBinding; //導入依賴的package包/類
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.id == 200)
    {
        this.mc.displayGuiScreen(this.parentScreen);
    }
    else if (button.id == 201)
    {
        for (KeyBinding keybinding : this.mc.gameSettings.keyBindings)
        {
            keybinding.setToDefault();
        }

        KeyBinding.resetKeyBindingArrayAndHash();
    }
    else if (button.id < 100 && button instanceof GuiOptionButton)
    {
        this.options.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1);
        button.displayString = this.options.getKeyBinding(GameSettings.Options.getEnumOptions(button.id));
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:25,代碼來源:GuiControls.java

示例6: actionPerformed

import net.minecraft.client.settings.KeyBinding; //導入依賴的package包/類
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.id == 200)
    {
        this.mc.displayGuiScreen(this.parentScreen);
    }
    else if (button.id == 201)
    {
        for (KeyBinding keybinding : this.mc.gameSettings.keyBindings)
        {
            keybinding.setKeyCode(keybinding.getKeyCodeDefault());
        }

        KeyBinding.resetKeyBindingArrayAndHash();
    }
    else if (button.id < 100 && button instanceof GuiOptionButton)
    {
        this.options.setOptionValue(((GuiOptionButton)button).returnEnumOptions(), 1);
        button.displayString = this.options.getKeyBinding(GameSettings.Options.getEnumOptions(button.id));
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:25,代碼來源:GuiControls.java

示例7: drawScreen

import net.minecraft.client.settings.KeyBinding; //導入依賴的package包/類
/**
 * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
 */
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
    this.drawDefaultBackground();
    this.keyBindingList.drawScreen(mouseX, mouseY, partialTicks);
    this.drawCenteredString(this.fontRendererObj, this.screenTitle, this.width / 2, 8, 16777215);
    boolean flag = true;

    for (KeyBinding keybinding : this.options.keyBindings)
    {
        if (keybinding.getKeyCode() != keybinding.getKeyCodeDefault())
        {
            flag = false;
            break;
        }
    }

    this.buttonReset.enabled = !flag;
    super.drawScreen(mouseX, mouseY, partialTicks);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:23,代碼來源:GuiControls.java

示例8: mousePressed

import net.minecraft.client.settings.KeyBinding; //導入依賴的package包/類
public boolean mousePressed(int slotIndex, int p_148278_2_, int p_148278_3_, int p_148278_4_, int p_148278_5_, int p_148278_6_)
{
    if (this.btnChangeKeyBinding.mousePressed(GuiKeyBindingList.this.mc, p_148278_2_, p_148278_3_))
    {
        GuiKeyBindingList.this.field_148191_k.buttonId = this.keybinding;
        return true;
    }
    else if (this.btnReset.mousePressed(GuiKeyBindingList.this.mc, p_148278_2_, p_148278_3_))
    {
        GuiKeyBindingList.this.mc.gameSettings.setOptionKeyBinding(this.keybinding, this.keybinding.getKeyCodeDefault());
        KeyBinding.resetKeyBindingArrayAndHash();
        return true;
    }
    else
    {
        return false;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:19,代碼來源:GuiKeyBindingList.java

示例9: fixAdditionalKeyBindings

import net.minecraft.client.settings.KeyBinding; //導入依賴的package包/類
/** Call this to finalise any additional key bindings we want to create in the mod.
 * @param settings Minecraft's original GameSettings object which we are appending to.
 */
private void fixAdditionalKeyBindings(GameSettings settings)
{
    if (this.additionalKeys == null)
    {
        return; // No extra keybindings to add.
    }

    // The keybindings are stored in GameSettings as a java built-in array.
    // There is no way to append to such arrays, so instead we create a new
    // array of the correct
    // length, copy across the current keybindings, add our own ones, and
    // set the new array back
    // into the GameSettings:
    KeyBinding[] bindings = (KeyBinding[]) ArrayUtils.addAll(settings.keyBindings, this.additionalKeys.toArray());
    settings.keyBindings = bindings;
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:20,代碼來源:KeyManager.java

示例10: setIngameFocus

import net.minecraft.client.settings.KeyBinding; //導入依賴的package包/類
/**
 * Will set the focus to ingame if the Minecraft window is the active with focus. Also clears any GUI screen
 * currently displayed
 */
public void setIngameFocus()
{
    if (Display.isActive())
    {
        if (!this.inGameHasFocus)
        {
            if (!IS_RUNNING_ON_MAC)
            {
                KeyBinding.updateKeyBindState();
            }

            this.inGameHasFocus = true;
            this.mouseHelper.grabMouseCursor();
            this.displayGuiScreen((GuiScreen)null);
            this.leftClickCounter = 10000;
        }
    }
}
 
開發者ID:NSExceptional,項目名稱:Zombe-Modpack,代碼行數:23,代碼來源:Minecraft.java

示例11: drawScreen

import net.minecraft.client.settings.KeyBinding; //導入依賴的package包/類
/**
 * Draws the screen and all the components in it.
 */
public void drawScreen(int mouseX, int mouseY, float partialTicks)
{
    this.drawDefaultBackground();
    this.keyBindingList.drawScreen(mouseX, mouseY, partialTicks);
    this.drawCenteredString(this.fontRendererObj, this.screenTitle, this.width / 2, 8, 16777215);
    boolean flag = false;

    for (KeyBinding keybinding : this.options.keyBindings)
    {
        if (keybinding.getKeyCode() != keybinding.getKeyCodeDefault())
        {
            flag = true;
            break;
        }
    }

    this.buttonReset.enabled = flag;
    super.drawScreen(mouseX, mouseY, partialTicks);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:23,代碼來源:GuiControls.java

示例12: mousePressed

import net.minecraft.client.settings.KeyBinding; //導入依賴的package包/類
public boolean mousePressed(int slotIndex, int mouseX, int mouseY, int mouseEvent, int relativeX, int relativeY)
{
    if (this.btnChangeKeyBinding.mousePressed(GuiKeyBindingList.this.mc, mouseX, mouseY))
    {
        GuiKeyBindingList.this.controlsScreen.buttonId = this.keybinding;
        return true;
    }
    else if (this.btnReset.mousePressed(GuiKeyBindingList.this.mc, mouseX, mouseY))
    {
        GuiKeyBindingList.this.mc.gameSettings.setOptionKeyBinding(this.keybinding, this.keybinding.getKeyCodeDefault());
        KeyBinding.resetKeyBindingArrayAndHash();
        return true;
    }
    else
    {
        return false;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:19,代碼來源:GuiKeyBindingList.java

示例13: init

import net.minecraft.client.settings.KeyBinding; //導入依賴的package包/類
@Override
public void init(FMLInitializationEvent event)
{
	bindingP = new KeyBinding("Player Information", Keyboard.KEY_P, "Lost Eclipse");
	
	ClientRegistry.registerKeyBinding(bindingP);
}
 
開發者ID:TheXFactor117,項目名稱:Loot-Slash-Conquer,代碼行數:8,代碼來源:ClientProxy.java

示例14: onInput

import net.minecraft.client.settings.KeyBinding; //導入依賴的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.
}
 
開發者ID:TheXFactor117,項目名稱:Loot-Slash-Conquer,代碼行數:15,代碼來源:EventInput.java

示例15: KeyHandler

import net.minecraft.client.settings.KeyBinding; //導入依賴的package包/類
private KeyHandler() {
    registerKeyListener(HUDHandler.instance());

    keybindOpenOptions = registerKeyBinding(new KeyBinding(KeyHandler.DESCRIPTION_HELMET_OPTIONS, Keyboard.KEY_U, Names.PNEUMATIC_KEYBINDING_CATEGORY));
    keybindHack = registerKeyBinding(new KeyBinding(KeyHandler.DESCRIPTION_HELMET_HACK, Keyboard.KEY_H, Names.PNEUMATIC_KEYBINDING_CATEGORY));
    keybindDebuggingDrone = registerKeyBinding(new KeyBinding(KeyHandler.DESCRIPTION_HELMET_DEBUGGING_DRONE, Keyboard.KEY_Y, Names.PNEUMATIC_KEYBINDING_CATEGORY));
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:8,代碼來源:KeyHandler.java


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