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


Java GameSettings.isKeyDown方法代碼示例

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


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

示例1: onUpdate

import net.minecraft.client.settings.GameSettings; //導入方法依賴的package包/類
@Override
public void onUpdate()
{
	// update timer
	updateMS();
	
	// check if clicking
	if(!GameSettings.isKeyDown(mc.gameSettings.keyBindAttack))
		return;
	
	// check timer / cooldown
	if(useCooldown != null && useCooldown.isChecked()
		? WPlayer.getCooldown() < 1 : !hasTimePassedS(speed.getValueF()))
		return;
	
	attack();
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:18,代碼來源:ClickAuraMod.java

示例2: onDisable

import net.minecraft.client.settings.GameSettings; //導入方法依賴的package包/類
@Override
public void onDisable()
{
	wurst.events.remove(UpdateListener.class, this);
	wurst.events.remove(PostUpdateListener.class, this);
	
	switch(mode.getSelected())
	{
		case 0:
		WConnection.sendPacket(new CPacketEntityAction(
			WMinecraft.getPlayer(), Action.STOP_SNEAKING));
		break;
		
		case 1:
		mc.gameSettings.keyBindSneak.pressed =
			GameSettings.isKeyDown(mc.gameSettings.keyBindSneak);
		break;
	}
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:20,代碼來源:SneakMod.java

示例3: updateScreen

import net.minecraft.client.settings.GameSettings; //導入方法依賴的package包/類
@Override
public void updateScreen() {
    super.updateScreen();
    if (!GameSettings.isKeyDown(ModKeybind.keybindChalk))
    {
        Minecraft.getMinecraft().displayGuiScreen(null);
    }
}
 
開發者ID:Drazuam,項目名稱:RunicArcana,代碼行數:9,代碼來源:GuiChalk.java

示例4: keyTyped

import net.minecraft.client.settings.GameSettings; //導入方法依賴的package包/類
/**
 * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
 * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
 */
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
    if (selectedTabIndex != CreativeTabs.tabAllSearch.getTabIndex())
    {
        if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat))
        {
            this.setCurrentCreativeTab(CreativeTabs.tabAllSearch);
        }
        else
        {
            super.keyTyped(typedChar, keyCode);
        }
    }
    else
    {
        if (this.field_147057_D)
        {
            this.field_147057_D = false;
            this.searchField.setText("");
        }

        if (!this.checkHotbarKeys(keyCode))
        {
            if (this.searchField.textboxKeyTyped(typedChar, keyCode))
            {
                this.updateCreativeSearch();
            }
            else
            {
                super.keyTyped(typedChar, keyCode);
            }
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:39,代碼來源:GuiContainerCreative.java

示例5: onDisable

import net.minecraft.client.settings.GameSettings; //導入方法依賴的package包/類
@Override
public void onDisable()
{
	wurst.events.remove(UpdateListener.class, this);
	wurst.events.remove(RenderListener.class, this);
	
	mc.gameSettings.keyBindForward.pressed =
		GameSettings.isKeyDown(mc.gameSettings.keyBindForward);
	mc.gameSettings.keyBindJump.pressed =
		GameSettings.isKeyDown(mc.gameSettings.keyBindJump);
	
	pathFinder = null;
	processor = null;
	PathProcessor.releaseControls();
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:16,代碼來源:AntiAfkMod.java

示例6: onDisable

import net.minecraft.client.settings.GameSettings; //導入方法依賴的package包/類
@Override
public void onDisable()
{
	wurst.events.remove(UpdateListener.class, this);
	
	// reset forward key
	mc.gameSettings.keyBindForward.pressed =
		GameSettings.isKeyDown(mc.gameSettings.keyBindForward);
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:10,代碼來源:AutoWalkMod.java

示例7: onDisable

import net.minecraft.client.settings.GameSettings; //導入方法依賴的package包/類
@Override
public void onDisable()
{
	wurst.events.remove(UpdateListener.class, this);
	mc.gameSettings.keyBindSneak.pressed =
		GameSettings.isKeyDown(mc.gameSettings.keyBindSneak);
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:8,代碼來源:MileyCyrusMod.java

示例8: keyTyped

import net.minecraft.client.settings.GameSettings; //導入方法依賴的package包/類
/**
 * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
 * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
 */
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
    if (selectedTabIndex != CreativeTabs.SEARCH.getTabIndex())
    {
        if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat))
        {
            this.setCurrentCreativeTab(CreativeTabs.SEARCH);
        }
        else
        {
            super.keyTyped(typedChar, keyCode);
        }
    }
    else
    {
        if (this.clearSearch)
        {
            this.clearSearch = false;
            this.searchField.setText("");
        }

        if (!this.checkHotbarKeys(keyCode))
        {
            if (this.searchField.textboxKeyTyped(typedChar, keyCode))
            {
                this.updateCreativeSearch();
            }
            else
            {
                super.keyTyped(typedChar, keyCode);
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:39,代碼來源:GuiContainerCreative.java

示例9: keyTyped

import net.minecraft.client.settings.GameSettings; //導入方法依賴的package包/類
/**
 * Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
 * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
 */
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
    if (!CreativeTabs.CREATIVE_TAB_ARRAY[selectedTabIndex].hasSearchBar())
    {
        if (GameSettings.isKeyDown(this.mc.gameSettings.keyBindChat))
        {
            this.setCurrentCreativeTab(CreativeTabs.SEARCH);
        }
        else
        {
            super.keyTyped(typedChar, keyCode);
        }
    }
    else
    {
        if (this.clearSearch)
        {
            this.clearSearch = false;
            this.searchField.setText("");
        }

        if (!this.checkHotbarKeys(keyCode))
        {
            if (this.searchField.textboxKeyTyped(typedChar, keyCode))
            {
                this.updateCreativeSearch();
            }
            else
            {
                super.keyTyped(typedChar, keyCode);
            }
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:39,代碼來源:GuiContainerCreative.java

示例10: mouseClicked

import net.minecraft.client.settings.GameSettings; //導入方法依賴的package包/類
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
    super.mouseClicked(mouseX, mouseY, mouseButton);

    if(mouseButton == 0) {
        if(!renderContext.doesRenderIn3D()) {
            if(mouseX >= this.guiLeft + 132 && mouseX <= this.guiLeft + 132 + 16 &&
                    mouseY >= this.guiTop + 106 && mouseY <= this.guiTop + 106 + 16) {
                renderContext.setTo3D();
            }
            if(renderContext.hasSliceUp() && mouseX >= this.guiLeft + 150 && mouseX <= this.guiLeft + 150 + 16 &&
                    mouseY >= this.guiTop + 102 && mouseY <= this.guiTop + 102 + 16) {
                renderContext.sliceUp();
            }
            if(renderContext.hasSliceDown() && mouseX >= this.guiLeft + 150 && mouseX <= this.guiLeft + 150 + 16 &&
                    mouseY >= this.guiTop + 124 && mouseY <= this.guiTop + 124 + 16) {
                renderContext.sliceDown();
            }
        } else {
            if(mouseX >= this.guiLeft + 132 && mouseX <= this.guiLeft + 132 + 16 &&
                    mouseY >= this.guiTop + 122 && mouseY <= this.guiTop + 122 + 16) {
                renderContext.setTo2D();
            }
        }
        if(GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSneak) &&
                mouseX >= this.guiLeft + 116 && mouseX <= this.guiLeft + 116 + 16 &&
                mouseY >= this.guiTop + 106 && mouseY < this.guiTop + 106 + 16) {
            if(ClientProxy.renderHelper.startPreview(this.renderContext)) {
                Minecraft.getMinecraft().displayGuiScreen(null);
            }
        }
    } else if(mouseButton == 1) {
        Minecraft.getMinecraft().displayGuiScreen(null);
    }
}
 
開發者ID:HellFirePvP,項目名稱:ModularMachinery,代碼行數:36,代碼來源:GuiScreenBlueprint.java

示例11: handleClick

import net.minecraft.client.settings.GameSettings; //導入方法依賴的package包/類
@Override
public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton) {
    if(mouseButton == 0) {
        if(!context.doesRenderIn3D()) {
            if(mouseX >= 132 && mouseX <= 132 + 16 &&
                    mouseY >= 106 && mouseY <= 106 + 16) {
                context.setTo3D();
            }
            if(context.hasSliceUp() && mouseX >= 150 && mouseX <= 150 + 16 &&
                    mouseY >= 102 && mouseY <= 102 + 16) {
                context.sliceUp();
            }
            if(context.hasSliceDown() && mouseX >= 150 && mouseX <= 150 + 16 &&
                    mouseY >= 124 && mouseY <= 124 + 16) {
                context.sliceDown();
            }
        } else {
            if(mouseX >= 132 && mouseX <= 132 + 16 &&
                    mouseY >= 122 && mouseY <= 122 + 16) {
                context.setTo2D();
            }
        }
        if(GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSneak) &&
                mouseX >= 116 && mouseX <= 116 + 16 &&
                mouseY >= 106 && mouseY < 106 + 16) {
            if(ClientProxy.renderHelper.startPreview(context)) {
                Minecraft.getMinecraft().displayGuiScreen(null);
            }
        }
    }
    return false;
}
 
開發者ID:HellFirePvP,項目名稱:ModularMachinery,代碼行數:33,代碼來源:StructurePreviewWrapper.java

示例12: isSneakingInGui

import net.minecraft.client.settings.GameSettings; //導入方法依賴的package包/類
@Override
public boolean isSneakingInGui() {
    return GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSneak);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:5,代碼來源:ClientProxy.java

示例13: updateScreen

import net.minecraft.client.settings.GameSettings; //導入方法依賴的package包/類
@Override
public void updateScreen()
{
    super.updateScreen();

    if (closing)
    {
        if (doneClosing || inventory == null)
        {
            Minecraft.getMinecraft().displayGuiScreen(null);

            ClientProxy.wipeOpen();
        }

        return;
    }

    ItemStack inHand = mc.player.getHeldItemMainhand();
    if (!Config.isItemStackAllowed(inHand))
    {
        inventory = null;
    }
    else
    {
        ItemStack stack = getter.getBelt();
        if (stack.getCount() <= 0)
        {
            inventory = null;
            stackEquipped = null;
        }
        // Reference comparison intended
        else if (stackEquipped != stack)
        {
            stackEquipped = stack;
            inventory = ItemToolBelt.getItems(stack);
            cachedStacks = null;
        }
    }

    if (inventory == null)
    {
        Minecraft.getMinecraft().displayGuiScreen(null);
    }
    else if (!GameSettings.isKeyDown(ClientProxy.keyOpenToolMenu))
    {
        if (Config.releaseToSwap)
        {
            int x = Mouse.getEventX() * this.width / this.mc.displayWidth;
            int y = this.height - Mouse.getEventY() * this.height / this.mc.displayHeight - 1;
            mouseReleased(x, y, -1);
        }
        else
        {
            animateClose();
        }
    }
}
 
開發者ID:gigaherz,項目名稱:ToolBelt,代碼行數:58,代碼來源:GuiRadialMenu.java

示例14: releaseControls

import net.minecraft.client.settings.GameSettings; //導入方法依賴的package包/類
public static final void releaseControls()
{
	// reset keys
	for(KeyBinding key : CONTROLS)
		key.pressed = GameSettings.isKeyDown(key);
}
 
開發者ID:Wurst-Imperium,項目名稱:Wurst-MC-1.12,代碼行數:7,代碼來源:PathProcessor.java

示例15: getFOVModifier

import net.minecraft.client.settings.GameSettings; //導入方法依賴的package包/類
/**
 * Changes the field of view of the player depending on if they are underwater or not
 */
private float getFOVModifier(float partialTicks, boolean p_78481_2_)
{
    if (this.debugView)
    {
        return 90.0F;
    }
    else
    {
        Entity entity = this.mc.getRenderViewEntity();
        float f = 70.0F;

        if (p_78481_2_)
        {
            f = this.mc.gameSettings.fovSetting;

            if (Config.isDynamicFov())
            {
                f *= this.fovModifierHandPrev + (this.fovModifierHand - this.fovModifierHandPrev) * partialTicks;
            }
        }

        boolean flag = false;

        if (this.mc.currentScreen == null)
        {
            GameSettings gamesettings = this.mc.gameSettings;
            flag = GameSettings.isKeyDown(this.mc.gameSettings.ofKeyBindZoom);
        }

        if (flag)
        {
            if (!Config.zoomMode)
            {
                Config.zoomMode = true;
                this.mc.gameSettings.smoothCamera = true;
            }

            if (Config.zoomMode)
            {
                f /= 4.0F;
            }
        }
        else if (Config.zoomMode)
        {
            Config.zoomMode = false;
            this.mc.gameSettings.smoothCamera = false;
            this.mouseFilterXAxis = new MouseFilter();
            this.mouseFilterYAxis = new MouseFilter();
            this.mc.renderGlobal.displayListEntitiesDirty = true;
        }

        if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).getHealth() <= 0.0F)
        {
            float f1 = (float)((EntityLivingBase)entity).deathTime + partialTicks;
            f /= (1.0F - 500.0F / (f1 + 500.0F)) * 2.0F + 1.0F;
        }

        Block block = ActiveRenderInfo.getBlockAtEntityViewpoint(this.mc.theWorld, entity, partialTicks);

        if (block.getMaterial() == Material.water)
        {
            f = f * 60.0F / 70.0F;
        }

        return f;
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:71,代碼來源:EntityRenderer.java


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