当前位置: 首页>>代码示例>>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;未经允许,请勿转载。