net.minecraft.client.settings.GameSettings Java Examples
The following examples show how to use
net.minecraft.client.settings.GameSettings.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JesusHack.java From ForgeWurst with GNU General Public License v3.0 | 6 votes |
@SubscribeEvent public void onEntityPlayerJump(WEntityPlayerJumpEvent event) { if(!preventJumping.isChecked()) return; EntityPlayer player = event.getPlayer(); if(player != WMinecraft.getPlayer()) return; // Allow jump when pressing the sneak key but not actually sneaking. // This enables a glitch that allows the player to jump on water by // pressing the jump and sneak keys at the exact same time or by // pressing the sneak key while using BunnyHop. if(GameSettings.isKeyDown(mc.gameSettings.keyBindSneak) && !player.isSneaking()) return; if(!isStandingOnLiquid(player)) return; event.setCanceled(true); }
Example #2
Source File: Scaffold.java From LiquidBounce with GNU General Public License v3.0 | 6 votes |
/** * Disable scaffold module */ @Override public void onDisable() { if (mc.thePlayer == null) return; if (!GameSettings.isKeyDown(mc.gameSettings.keyBindSneak)) { mc.gameSettings.keyBindSneak.pressed = false; if (eagleSneaking) mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING)); } if (!GameSettings.isKeyDown(mc.gameSettings.keyBindRight)) mc.gameSettings.keyBindRight.pressed = false; if (!GameSettings.isKeyDown(mc.gameSettings.keyBindLeft)) mc.gameSettings.keyBindLeft.pressed = false; lockRotation = null; mc.timer.timerSpeed = 1F; shouldGoDown = false; if (slot != mc.thePlayer.inventory.currentItem) mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem)); }
Example #3
Source File: Sneak.java From LiquidBounce with GNU General Public License v3.0 | 6 votes |
@Override public void onDisable() { if(mc.thePlayer == null) return; switch(modeValue.get().toLowerCase()) { case "legit": if(!GameSettings.isKeyDown(mc.gameSettings.keyBindSneak)) mc.gameSettings.keyBindSneak.pressed = false; break; case "vanilla": case "switch": case "minesecure": mc.getNetHandler().addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING)); break; } super.onDisable(); }
Example #4
Source File: MalmoModClient.java From malmo with MIT License | 6 votes |
public void init(FMLInitializationEvent event) { // Register for various events: MinecraftForge.EVENT_BUS.register(this); GameSettings settings = Minecraft.getMinecraft().gameSettings; TextureHelper.hookIntoRenderPipeline(); setUpExtraKeys(settings); this.stateMachine = new ClientStateMachine(ClientState.WAITING_FOR_MOD_READY, this); this.originalMouseHelper = Minecraft.getMinecraft().mouseHelper; this.mouseHook = new MouseHook(); this.mouseHook.isOverriding = true; Minecraft.getMinecraft().mouseHelper = this.mouseHook; setInputType(InputType.AI); }
Example #5
Source File: ResourcePackInstaller.java From I18nUpdateMod with MIT License | 6 votes |
public static void setResourcesRepository() { Minecraft mc = Minecraft.getMinecraft(); GameSettings gameSettings = mc.gameSettings; // 在gameSetting中加载资源包 if (!gameSettings.resourcePacks.contains(I18nConfig.download.i18nLangPackName)) { if (I18nConfig.priority) { mc.gameSettings.resourcePacks.add(I18nConfig.download.i18nLangPackName); } else { List<String> packs = new ArrayList<>(10); packs.add(I18nConfig.download.i18nLangPackName); // 资源包的 index 越小优先级越低(在资源包 gui 中置于更低层) packs.addAll(gameSettings.resourcePacks); gameSettings.resourcePacks = packs; } } reloadResources(); }
Example #6
Source File: KeyManager.java From malmo with MIT License | 6 votes |
/** 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; }
Example #7
Source File: MixinEntityRenderer.java From Valkyrien-Skies with Apache License 2.0 | 5 votes |
@Redirect( method = "Lnet/minecraft/client/renderer/EntityRenderer;orientCamera(F)V", at = @At( value = "FIELD", target = "Lnet/minecraft/client/settings/GameSettings;thirdPersonView:I", ordinal = 2 )) private int unexcludeShipFromRayTracerAfterDepthProbe(GameSettings settings) { ((IWorldVS) this.mc.world) .unexcludeShipFromRayTracer(((IShipPilot) this.mc.player).getPilotedShip()); return settings.thirdPersonView; }
Example #8
Source File: JesusHack.java From ForgeWurst with GNU General Public License v3.0 | 5 votes |
private boolean isLiquidCollisionEnabled(EntityPlayer player) { if(player == null) return false; if(player.isSneaking() && GameSettings.isKeyDown(mc.gameSettings.keyBindSneak)) return false; if(player.isInWater() || player.fallDistance > 3) return false; return true; }
Example #9
Source File: ClientProxy.java From TFC2 with GNU General Public License v3.0 | 5 votes |
@Override public void uploadKeyBindingsToGame() { GameSettings settings = Minecraft.getMinecraft().gameSettings; KeyBinding[] tfcKeyBindings = KeyBindings.gatherKeyBindings(); KeyBinding[] allKeys = new KeyBinding[settings.keyBindings.length + tfcKeyBindings.length]; System.arraycopy(settings.keyBindings, 0, allKeys, 0, settings.keyBindings.length); System.arraycopy(tfcKeyBindings, 0, allKeys, settings.keyBindings.length, tfcKeyBindings.length); settings.keyBindings = allKeys; settings.loadOptions(); }
Example #10
Source File: Bindings.java From ForgeHax with MIT License | 5 votes |
@Nullable private static List<KeyBindingHandler> getAllKeys() { Field[] fields = GameSettings.class.getFields(); return Arrays.stream(fields) .filter(f -> f.getType() == KeyBinding.class) .map(Bindings::getBinding) .filter(Objects::nonNull) .map(KeyBindingHandler::new) .collect(toList()); }
Example #11
Source File: ItemBlueprint.java From Cyberware with MIT License | 5 votes |
@SideOnly(Side.CLIENT) public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) { if (stack.hasTagCompound()) { NBTTagCompound comp = stack.getTagCompound(); if (comp.hasKey("blueprintItem")) { GameSettings settings = Minecraft.getMinecraft().gameSettings; if (settings.isKeyDown(settings.keyBindSneak)) { ItemStack blueprintItem = ItemStack.loadItemStackFromNBT(comp.getCompoundTag("blueprintItem")); if (blueprintItem != null && CyberwareAPI.canDeconstruct(blueprintItem)) { ItemStack[] items = CyberwareAPI.getComponents(blueprintItem).clone(); tooltip.add(I18n.format("cyberware.tooltip.blueprint", blueprintItem.getDisplayName())); for (ItemStack item : items) { if (item != null) { tooltip.add(item.stackSize + " x " + item.getDisplayName()); } } return; } } else { tooltip.add(ChatFormatting.DARK_GRAY + I18n.format("cyberware.tooltip.shiftPrompt", Minecraft.getMinecraft().gameSettings.keyBindSneak.getDisplayName())); return; } } } tooltip.add(ChatFormatting.DARK_GRAY + I18n.format("cyberware.tooltip.craftBlueprint")); }
Example #12
Source File: EssentialsMissingHandlerClient.java From Cyberware with MIT License | 5 votes |
@SubscribeEvent public void handleWorldUnload(WorldEvent.Unload event) { if (missingArm) { GameSettings settings = Minecraft.getMinecraft().gameSettings; missingArm = false; settings.mainHand = oldHand; } }
Example #13
Source File: MixinEntityRenderer.java From Valkyrien-Skies with Apache License 2.0 | 5 votes |
@Redirect( method = "Lnet/minecraft/client/renderer/EntityRenderer;orientCamera(F)V", at = @At( value = "FIELD", target = "Lnet/minecraft/client/settings/GameSettings;thirdPersonView:I", ordinal = 1 )) private int excludeShipFromRayTracerBeforeDepthProbe(GameSettings settings) { ((IWorldVS) this.mc.world) .excludeShipFromRayTracer(((IShipPilot) this.mc.player).getPilotedShip()); return settings.thirdPersonView; }
Example #14
Source File: JesusHack.java From ForgeWurst with GNU General Public License v3.0 | 5 votes |
@SubscribeEvent public void onUpdate(WUpdateEvent event) { EntityPlayerSP player = event.getPlayer(); // check if sneaking if(player.isSneaking() && GameSettings.isKeyDown(mc.gameSettings.keyBindSneak)) return; // move up in water if(player.isInWater()) { player.motionY = 0.11; tickTimer = 0; return; } // simulate jumping out of water if(tickTimer == 0) player.motionY = 0.30; else if(tickTimer == 1) player.motionY = 0; // update timer tickTimer++; }
Example #15
Source File: MalmoModClient.java From malmo with MIT License | 5 votes |
/** Set up some handy extra keys: * @param settings Minecraft's original GameSettings object */ private void setUpExtraKeys(GameSettings settings) { // Create extra key bindings here and pass them to the KeyManager. ArrayList<InternalKey> extraKeys = new ArrayList<InternalKey>(); // Create a key binding to toggle between player and Malmo control: extraKeys.add(new InternalKey("key.toggleMalmo", 28, "key.categories.malmo") // 28 is the keycode for enter. { @Override public void onPressed() { InputType it = (inputType != InputType.AI) ? InputType.AI : InputType.HUMAN; System.out.println("Toggling control between human and AI - now " + it); setInputType(it); super.onPressed(); } }); extraKeys.add(new InternalKey("key.handyTestHook", 22, "key.categories.malmo") { @Override public void onPressed() { // Use this if you want to test some code with a handy key press try { CraftingHelper.dumpRecipes("recipe_dump.txt"); } catch (IOException e) { e.printStackTrace(); } } }); this.keyManager = new KeyManager(settings, extraKeys); }
Example #16
Source File: ClientStateMachine.java From malmo with MIT License | 5 votes |
@Override protected void execute() throws Exception { ClientStateMachine.this.initialiseComms(); // This is necessary in order to allow user to exit the Minecraft window without halting the experiment: GameSettings settings = Minecraft.getMinecraft().gameSettings; settings.pauseOnLostFocus = false; // And hook the screen helper into the ingame gui (which is responsible for overlaying chat, titles etc) - // this has to be done after Minecraft.init(), so we do it here. ScreenHelper.hookIntoInGameGui(); }
Example #17
Source File: KeyManager.java From malmo with MIT License | 5 votes |
/** Create a new KeyManager class which will be responsible for maintaining our own extra internal keys. * @param settings the original Minecraft GameSettings which we are modifying * @param additionalKeys an array of extra "internal" keys which we want to hook in to Minecraft. */ public KeyManager(GameSettings settings, ArrayList<InternalKey> additionalKeys) { this.additionalKeys = additionalKeys; if (additionalKeys != null) { fixAdditionalKeyBindings(settings); MinecraftForge.EVENT_BUS.register(this); } }
Example #18
Source File: AutoSwimHack.java From ForgeWurst with GNU General Public License v3.0 | 5 votes |
@SubscribeEvent public void onUpdate(WUpdateEvent event) { EntityPlayerSP player = event.getPlayer(); if(player.isInWater() && !player.isSneaking() && !GameSettings.isKeyDown(mc.gameSettings.keyBindJump)) player.motionY += mode.getSelected().upwardsMotion; }
Example #19
Source File: TunnellerHack.java From ForgeWurst with GNU General Public License v3.0 | 5 votes |
@SubscribeEvent public void onUpdate(WUpdateEvent event) { HackList hax = wurst.getHax(); Hack[] incompatibleHax = {hax.autoToolHack, hax.autoWalkHack, hax.blinkHack, hax.flightHack, hax.nukerHack, hax.sneakHack}; for(Hack hack : incompatibleHax) hack.setEnabled(false); if(hax.freecamHack.isEnabled()) return; GameSettings gs = mc.gameSettings; KeyBinding[] bindings = {gs.keyBindForward, gs.keyBindBack, gs.keyBindLeft, gs.keyBindRight, gs.keyBindJump, gs.keyBindSneak}; for(KeyBinding binding : bindings) KeyBindingUtils.setPressed(binding, false); for(Task task : tasks) { if(!task.canRun()) continue; task.run(); break; } }
Example #20
Source File: FreecamHack.java From ForgeWurst with GNU General Public License v3.0 | 5 votes |
@Override protected void onEnable() { MinecraftForge.EVENT_BUS.register(this); fakePlayer = new EntityFakePlayer(); GameSettings gs = mc.gameSettings; KeyBinding[] bindings = {gs.keyBindForward, gs.keyBindBack, gs.keyBindLeft, gs.keyBindRight, gs.keyBindJump, gs.keyBindSneak}; for(KeyBinding binding : bindings) KeyBindingUtils.resetPressed(binding); }
Example #21
Source File: GuiKeyBindingList.java From ehacks-pro with GNU General Public License v3.0 | 5 votes |
@Override public void drawEntry(int index, int x, int y, int width, int height, Tessellator tesselator, int buttonX, int buttonY, boolean p_148279_9_) { boolean var10 = GuiKeyBindingList.this.parentScreen.currentKeyBinding == this.entryKeybinding; GuiKeyBindingList.this.mc.fontRenderer.drawString(this.keyDesctiption, x + 90 - GuiKeyBindingList.this.maxListLabelWidth, y + height / 2 - GuiKeyBindingList.this.mc.fontRenderer.FONT_HEIGHT / 2, 16777215); this.btnReset.xPosition = x + 190; this.btnReset.yPosition = y; this.btnReset.enabled = this.entryKeybinding.getKeyCode() != this.entryKeybinding.getKeyCodeDefault(); this.btnReset.drawButton(GuiKeyBindingList.this.mc, buttonX, buttonY); this.btnChangeKeyBinding.xPosition = x + 105; this.btnChangeKeyBinding.yPosition = y; this.btnChangeKeyBinding.displayString = GameSettings.getKeyDisplayString(this.entryKeybinding.getKeyCode()); boolean var11 = false; if (this.entryKeybinding.getKeyCode() != 0) { ModuleKeyBinding[] var12 = GuiKeyBindingList.this.parentScreen.keyBindings; int var13 = var12.length; for (int var14 = 0; var14 < var13; ++var14) { ModuleKeyBinding var15 = var12[var14]; if (var15 != this.entryKeybinding && var15.getKeyCode() == this.entryKeybinding.getKeyCode()) { var11 = true; break; } } } if (var10) { this.btnChangeKeyBinding.displayString = EnumChatFormatting.WHITE + "> " + EnumChatFormatting.YELLOW + this.btnChangeKeyBinding.displayString + EnumChatFormatting.WHITE + " <"; } else if (var11) { this.btnChangeKeyBinding.displayString = EnumChatFormatting.RED + this.btnChangeKeyBinding.displayString; } this.btnChangeKeyBinding.drawButton(GuiKeyBindingList.this.mc, buttonX, buttonY); }
Example #22
Source File: GuiKeyBindingList.java From ehacks-pro with GNU General Public License v3.0 | 5 votes |
@Override public void drawEntry(int index, int x, int y, int width, int height, Tessellator tesselator, int buttonX, int buttonY, boolean p_148279_9_) { boolean var10 = GuiKeyBindingList.this.parentScreen.currentKeyBinding == this.entryKeybinding; GuiKeyBindingList.this.mc.fontRenderer.drawString(this.keyDesctiption, x + 90 - GuiKeyBindingList.this.maxListLabelWidth, y + height / 2 - GuiKeyBindingList.this.mc.fontRenderer.FONT_HEIGHT / 2, 16777215); this.btnRemove.xPosition = x + 190; this.btnRemove.yPosition = y; this.btnRemove.drawButton(GuiKeyBindingList.this.mc, buttonX, buttonY); this.btnChangeKeyBinding.xPosition = x + 105; this.btnChangeKeyBinding.yPosition = y; this.btnChangeKeyBinding.displayString = GameSettings.getKeyDisplayString(this.entryKeybinding.getKeyCode()); if (var10) { this.btnChangeKeyBinding.displayString = EnumChatFormatting.WHITE + "> " + EnumChatFormatting.YELLOW + this.btnChangeKeyBinding.displayString + EnumChatFormatting.WHITE + " <"; } this.btnChangeKeyBinding.drawButton(GuiKeyBindingList.this.mc, buttonX, buttonY); }
Example #23
Source File: ClientProxy.java From SimplyJetpacks with MIT License | 5 votes |
@Override public String getPackGUIKey() { int keyCode = KeyHandler.keyOpenPackGUI.getKeyCode(); if (keyCode == 0) { return null; } return GameSettings.getKeyDisplayString(keyCode); }
Example #24
Source File: I18nUtils.java From I18nUpdateMod with MIT License | 5 votes |
/** * 将语言换成中文 */ static void setupLang() { Minecraft mc = Minecraft.getMinecraft(); GameSettings gameSettings = mc.gameSettings; // 强行修改为简体中文 if (!gameSettings.language.equals("zh_cn")) { mc.getLanguageManager().currentLanguage = "zh_cn"; gameSettings.language = "zh_cn"; } }
Example #25
Source File: ResourcePackInstaller.java From I18nUpdateMod with MIT License | 5 votes |
private static void reloadResources() { Minecraft mc = Minecraft.getMinecraft(); GameSettings gameSettings = mc.gameSettings; // 因为这时候资源包已经加载了,所以需要重新读取,重新加载 ResourcePackRepository resourcePackRepository = mc.getResourcePackRepository(); resourcePackRepository.updateRepositoryEntriesAll(); List<ResourcePackRepository.Entry> repositoryEntriesAll = resourcePackRepository.getRepositoryEntriesAll(); List<ResourcePackRepository.Entry> repositoryEntries = Lists.newArrayList(); Iterator<String> it = gameSettings.resourcePacks.iterator(); while (it.hasNext()) { String packName = it.next(); for (ResourcePackRepository.Entry entry : repositoryEntriesAll) { if (entry.getResourcePackName().equals(packName)) { // packFormat 为 3,或者 incompatibleResourcePacks 条目中有的资源包才会加入 if (entry.getPackFormat() == 3 || gameSettings.incompatibleResourcePacks.contains(entry.getResourcePackName())) { repositoryEntries.add(entry); break; } // 否则移除 it.remove(); logger.warn("移除资源包 {},因为它无法兼容当前版本", entry.getResourcePackName()); } } } resourcePackRepository.setRepositories(repositoryEntries); }
Example #26
Source File: MotionBlurMod.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
static boolean isFastRenderEnabled() { try { Field fastRender = GameSettings.class.getDeclaredField("ofFastRender"); return fastRender.getBoolean(Minecraft.getMinecraft().gameSettings); } catch (Exception var1) { return false; } }
Example #27
Source File: TextureSpecial.java From CodeChickenLib with GNU Lesser General Public License v2.1 | 5 votes |
public void addFrame(int[] data, int width, int height) { GameSettings settings = Minecraft.getMinecraft().gameSettings; BufferedImage[] images = new BufferedImage[settings.mipmapLevels+1]; images[0] = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB); images[0].setRGB(0, 0, width, height, data, 0, width); loadSprite(images, null); }
Example #28
Source File: XrayModMainGui.java From MinecraftX-RAY with BSD 2-Clause "Simplified" License | 4 votes |
XrayModMainGui(GuiScreen parentScreen, GameSettings currentGameSettings) { this.parentScreen = parentScreen; }
Example #29
Source File: RenderAutoChisel.java From Chisel-2 with GNU General Public License v2.0 | 4 votes |
@Override public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float scale) { // Render Blocks TileEntityAutoChisel autoChisel = (TileEntityAutoChisel) tile; EntityItem item = autoChisel.getItemForRendering(TileEntityAutoChisel.TARGET); rand.setSeed(tile.xCoord + tile.yCoord + tile.zCoord); rand.nextBoolean(); float max = 0.35f; if (!Minecraft.getMinecraft().isGamePaused()) { autoChisel.xRot += (rand.nextFloat() * max) - (max / 2); autoChisel.yRot += (rand.nextFloat() * max) - (max / 2); autoChisel.zRot += (rand.nextFloat() * max) - (max / 2); } if (item != null) { glPushMatrix(); glPushAttrib(GL_ALL_ATTRIB_BITS); glTranslated(x + 0.5, y + 1.5, z + 0.5); glRotatef(autoChisel.xRot, 1, 0, 0); glRotatef(autoChisel.yRot, 0, 1, 0); glRotatef(autoChisel.zRot, 0, 0, 1); glEnable(GL_BLEND); glDepthMask(false); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); renderItem.doRender(item, 0, 0, 0, 0, 0); glPopMatrix(); glPopAttrib(); } item = autoChisel.getItemForRendering(TileEntityAutoChisel.BASE); if (item != null) { glPushMatrix(); glTranslated(x + 0.35, y + 0.934, z + 0.5); item.getEntityItem().stackSize = autoChisel.getLastBase() == null ? 1 : autoChisel.getLastBase().stackSize; renderItem.doRender(item, 0, 0, 0, 0, 0); glPopMatrix(); } GameSettings settings = Minecraft.getMinecraft().gameSettings; item = autoChisel.getItemForRendering(TileEntityAutoChisel.CHISEL); if (item != null) { glPushMatrix(); glTranslated(x + 0.7, y + 1.01, z + 0.5); float rot = autoChisel.chiselRot == 0 ? 0 : autoChisel.chiseling ? autoChisel.chiselRot + (TileEntityAutoChisel.rotAmnt * scale) : autoChisel.chiselRot - (TileEntityAutoChisel.rotAmnt * scale); glRotatef(rot, 0, 0, 1); glTranslated(-0.12, 0, 0); glScalef(0.9f, 0.9f, 0.9f); boolean was = settings.fancyGraphics; settings.fancyGraphics = true; renderItem.doRender(item, 0, 0, 0, 0, 0); settings.fancyGraphics = was; glPopMatrix(); } }
Example #30
Source File: ClientProxy.java From Signals with GNU General Public License v3.0 | 4 votes |
@Override public boolean isSneakingInGui(){ return GameSettings.isKeyDown(Minecraft.getMinecraft().gameSettings.keyBindSneak); }