codechicken.nei.NEIClientConfig Java Examples
The following examples show how to use
codechicken.nei.NEIClientConfig.
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: ContainerEventHandler.java From NotEnoughItems with MIT License | 6 votes |
@SubscribeEvent (priority = EventPriority.LOWEST, receiveCanceled = true)//We need to be called before JEI. public void onGuiMouseEventpre(MouseInputEvent.Pre event) { if (Mouse.getEventButton() == -1 || event.getGui() == null || !Mouse.getEventButtonState()) { return; } Point mouse = GuiDraw.getMousePosition(); int eventButton = Mouse.getEventButton(); if (JEIIntegrationManager.searchBoxOwner == EnumItemBrowser.JEI) { GuiTextFieldFilter fieldFilter = JEIIntegrationManager.getTextFieldFilter(); if (fieldFilter != null && fieldFilter.isMouseOver(mouse.x, mouse.y)) { if (eventButton == 0) { if (fieldFilter.isFocused() && (System.currentTimeMillis() - lastSearchBoxClickTime < 500)) {//double click NEIClientConfig.world.nbt.setBoolean("searchinventories", !SearchField.searchInventories()); NEIClientConfig.world.saveNBT(); lastSearchBoxClickTime = 0L; } else { lastSearchBoxClickTime = System.currentTimeMillis(); } } else if (eventButton == 1) { NEIClientConfig.setSearchExpression("", false); LayoutManager.searchField.setText("", false); } } } }
Example #2
Source File: ItemPanel.java From NotEnoughItems with MIT License | 6 votes |
@Override public void mouseUp(int mousex, int mousey, int button) { ItemPanelSlot hoverSlot = getSlotMouseOver(mousex, mousey); if (hoverSlot != null && hoverSlot.slotIndex == mouseDownSlot && draggedStack.isEmpty()) { ItemStack item = hoverSlot.item; if (!NEIClientConfig.canCheatItem(item)) { if (button == 0) { JEIIntegrationManager.openRecipeGui(item); } else if (button == 1) { JEIIntegrationManager.openUsageGui(item); } draggedStack = ItemStack.EMPTY; mouseDownSlot = -1; return; } NEIClientUtils.cheatItem(item, button, -1); } mouseDownSlot = -1; }
Example #3
Source File: SubsetWidget.java From NotEnoughItems with MIT License | 6 votes |
public static void loadHidden() { synchronized (hiddenItems) { hiddenItems.clear(); } List<ItemStack> itemList = new LinkedList<>(); try { NBTTagList list = NEIClientConfig.world.nbt.getTagList("hiddenItems", 10); for (int i = 0; i < list.tagCount(); i++) { itemList.add(new ItemStack(list.getCompoundTagAt(i))); } } catch (Exception e) { LogHelper.errorError("Error loading hiddenItems", e); return; } synchronized (hiddenItems) { for (ItemStack item : itemList) { hiddenItems.add(item); } } updateState.restart(); }
Example #4
Source File: SearchField.java From NotEnoughItems with MIT License | 6 votes |
public static Pattern getPattern(String search) { switch (NEIClientConfig.getIntSetting("inventory.searchmode")) { case 0://plain search = "\\Q" + search + "\\E"; break; case 1: search = search.replace(".", "").replace("?", ".").replace("*", ".+?"); break; } Pattern pattern = null; try { pattern = Pattern.compile(search); } catch (PatternSyntaxException ignored) { } return pattern == null || pattern.toString().length() == 0 ? null : pattern; }
Example #5
Source File: NEIClientUtils.java From NotEnoughItems with MIT License | 6 votes |
/** * @param mode -1 = normal cheats, 0 = no infinites, 1 = replenish stack */ public static void cheatItem(ItemStack stack, int button, int mode) { if (!canCheatItem(stack)) { return; } if (mode == -1 && button == 0 && shiftKey() && NEIClientConfig.hasSMPCounterPart()) { cheatItem(stack, button, 0); } else if (button == 1) { giveStack(stack, 1); } else { if (mode == 1 && stack.getCount() < stack.getMaxStackSize()) { giveStack(stack, stack.getMaxStackSize() - stack.getCount()); } else { int amount = getItemQuantity(); if (amount == 0) { amount = stack.getMaxStackSize(); } giveStack(stack, amount); } } }
Example #6
Source File: WorldOverlayRenderer.java From NotEnoughItems with MIT License | 6 votes |
@SubscribeEvent public void renderLastEvent(RenderWorldLastEvent event) { if (NEIClientConfig.isEnabled()) { GlStateManager.pushMatrix(); GlStateTracker.pushState(); Entity entity = Minecraft.getMinecraft().getRenderViewEntity(); RenderUtils.translateToWorldCoords(entity, event.getPartialTicks()); renderChunkBounds(entity); renderMobSpawnOverlay(entity); GlStateTracker.popState(); GlStateManager.popMatrix(); } }
Example #7
Source File: ShapedRecipeHandler.java From NotEnoughItems with MIT License | 6 votes |
public CachedShapedRecipe forgeShapedRecipe(ShapedOreRecipe recipe) { int width; int height; try { width = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 4); height = ReflectionManager.getField(ShapedOreRecipe.class, Integer.class, recipe, 5); } catch (Exception e) { NEIClientConfig.logger.error("Error loading recipe", e); return null; } Object[] items = recipe.getInput(); for (Object item : items) if (item instanceof List && ((List<?>) item).isEmpty())//ore handler, no ores return null; return new CachedShapedRecipe(width, height, items, recipe.getRecipeOutput()); }
Example #8
Source File: NEIClientPacketHandler.java From NotEnoughItems with MIT License | 6 votes |
/** * Handles the servers ServerSideCheck. * Checks both local and remote protocol versions for a mismatch. * If no mismatch is found it does the following: * Notifies ClientHandler of a world change. * Resets all local data of that dimension. * Requests the server for a LoginState. * Finally it sets the availability of a ServerSide counterpart as true. * * @param serverProtocol The servers protocol version. * @param worldName The dimension data to load. * @param world The clients current world object. */ private void handleServerSideCheck(int serverProtocol, String worldName, World world) { if (serverProtocol > NEIActions.protocol) { NEIClientUtils.printChatMessage(new TextComponentTranslation("nei.chat.mismatch.client")); } else if (serverProtocol < NEIActions.protocol) { NEIClientUtils.printChatMessage(new TextComponentTranslation("nei.chat.mismatch.server")); } else { try { ClientHandler.INSTANCE.loadWorld(world); NEIClientConfig.loadWorld(getSaveName(worldName)); NEIClientConfig.setHasSMPCounterPart(true); sendRequestLoginInfo(); } catch (Exception e) { LogHelper.errorError("Error handling SMP Check", e); } } }
Example #9
Source File: DataDumper.java From NotEnoughItems with MIT License | 5 votes |
public void dumpFile() { try { File file = new File(CommonUtils.getMinecraftDir(), "dumps/" + getFileName(name.replaceFirst(".+\\.", ""))); if (!file.getParentFile().exists()) file.getParentFile().mkdirs(); if (!file.exists()) file.createNewFile(); dumpTo(file); NEIClientUtils.printChatMessage(dumpMessage(file)); } catch (Exception e) { NEIClientConfig.logger.error("Error dumping " + renderName() + " mode: " + getMode(), e); } }
Example #10
Source File: GuiNEIOptionList.java From NotEnoughItems with MIT License | 5 votes |
@Override public void confirmClicked(boolean yes, int id) { if(yes && id == 0) { try { Desktop.getDesktop().browse(new URI("http://patreon.com/cb")); } catch (Exception e) { NEIClientConfig.logger.error("Failed to open patreon page", e); } } mc.displayGuiScreen(this); }
Example #11
Source File: RecipeItemInputHandler.java From NotEnoughItems with MIT License | 5 votes |
@Override public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyCode) { ItemStack stackover = GuiContainerManager.getStackMouseOver(gui); if(stackover == null) return false; if(keyCode == NEIClientConfig.getKeyBinding("gui.usage") || (keyCode == NEIClientConfig.getKeyBinding("gui.recipe") && NEIClientUtils.shiftKey())) return GuiUsageRecipe.openRecipeGui("item", stackover.copy()); if(keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) return GuiCraftingRecipe.openRecipeGui("item", stackover.copy()); return false; }
Example #12
Source File: ProfilerRecipeHandler.java From NotEnoughItems with MIT License | 5 votes |
@Override public int numRecipes() { if(!NEIClientConfig.getBooleanSetting("inventory.profileRecipes")) return 0; return (int) Math.ceil(((crafting ? GuiCraftingRecipe.craftinghandlers.size() : GuiUsageRecipe.usagehandlers.size())-1)/6D); }
Example #13
Source File: GuiItemIconDumper.java From NotEnoughItems with MIT License | 5 votes |
@Override public void drawScreen(int mousex, int mousey, float frame) { try { drawItems(); exportItems(); } catch (Exception e) { NEIClientConfig.logger.error("Error dumping item icons", e); } }
Example #14
Source File: OptionOpenGui.java From NotEnoughItems with MIT License | 5 votes |
@Override public boolean onClick(int button) { try { Minecraft.getMinecraft().displayGuiScreen(guiClass.getConstructor(Option.class).newInstance(this)); } catch (Exception e) { NEIClientConfig.logger.error("Unable to open gui class: "+guiClass.getName()+" from option "+fullName(), e); } return true; }
Example #15
Source File: TemplateRecipeHandler.java From NotEnoughItems with MIT License | 5 votes |
@Override public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) { if (keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) return transferRect(gui, recipe, false); else if (keyCode == NEIClientConfig.getKeyBinding("gui.usage")) return transferRect(gui, recipe, true); return false; }
Example #16
Source File: TemplateRecipeHandler.java From NotEnoughItems with MIT License | 5 votes |
@Override public boolean lastKeyTyped(GuiContainer gui, char keyChar, int keyCode) { if (!canHandle(gui)) return false; if (keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) return transferRect(gui, false); else if (keyCode == NEIClientConfig.getKeyBinding("gui.usage")) return transferRect(gui, true); return false; }
Example #17
Source File: NEIInfo.java From NotEnoughItems with MIT License | 5 votes |
public static void load(World world) { OptionCycled modeOption = (OptionCycled) NEIClientConfig.getOptionList().getOption("inventory.cheatmode"); modeOption.parent.synthesizeEnvironment(false); if(!modeOption.optionValid(modeOption.value())) { modeOption.copyGlobals(); modeOption.cycle(); } }
Example #18
Source File: OptionList.java From NotEnoughItems with MIT License | 5 votes |
private void addOption(Option o, String fullName, String subName) { if (subName.contains(".")) { subList(parent(subName)).addOption(o, fullName, child(subName)); return; } if (options.containsKey(subName)) NEIClientConfig.logger.warn("Replacing option: " + fullName); options.put(subName, o); addSorted(o); o.onAdded(this); }
Example #19
Source File: SearchField.java From NotEnoughItems with MIT License | 5 votes |
@Override public boolean handleClick(int mousex, int mousey, int button) { if (button == 0) { if (focused() && (System.currentTimeMillis() - lastclicktime < 500)) {//double click NEIClientConfig.world.nbt.setBoolean("searchinventories", !searchInventories()); NEIClientConfig.world.saveNBT(); } else { lastclicktime = System.currentTimeMillis(); } } return super.handleClick(mousex, mousey, button); }
Example #20
Source File: SubsetWidget.java From NotEnoughItems with MIT License | 5 votes |
private static void saveHidden() { NBTTagList list = dirtyHiddenItems.getAndSet(null); if (list != null) { NEIClientConfig.world.nbt.setTag("hiddenItems", list); NEIClientConfig.world.saveNBT(); } }
Example #21
Source File: ProfilerRecipeHandler.java From NotEnoughItems with MIT License | 5 votes |
@Override public int numRecipes() { if (!NEIClientConfig.getBooleanSetting("inventory.profileRecipes")) { return 0; } return (int) Math.ceil(((crafting ? GuiCraftingRecipe.craftinghandlers.size() : GuiUsageRecipe.usagehandlers.size()) - 1) / 6D); }
Example #22
Source File: RecipeHandlerBase.java From NEI-Integration with MIT License | 5 votes |
@Override public boolean keyTyped(GuiRecipe gui, char keyChar, int keyCode, int recipe) { if (keyCode == NEIClientConfig.getKeyBinding("gui.recipe")) { if (this.transferFluidTank(gui, recipe, false)) { return true; } } else if (keyCode == NEIClientConfig.getKeyBinding("gui.usage")) { if (this.transferFluidTank(gui, recipe, true)) { return true; } } return super.keyTyped(gui, keyChar, keyCode, recipe); }
Example #23
Source File: ExtendedCreativeInv.java From NotEnoughItems with MIT License | 5 votes |
@Override public boolean isEmpty() { ItemStack[] items; if (side.isClient()) { items = NEIClientConfig.creativeInv; } else { items = playerSave.creativeInv; } return ArrayUtils.count(items, (stack -> !stack.isEmpty())) <= 0; }
Example #24
Source File: ContainerEventHandler.java From NotEnoughItems with MIT License | 5 votes |
@SubscribeEvent (priority = EventPriority.LOWEST, receiveCanceled = true)//we need to be called after JEI has registered the key press and updated the search box. public void onKeyTypedPost(KeyboardInputEvent.Post event) { GuiTextFieldFilter fieldFilter = JEIIntegrationManager.getTextFieldFilter(); if (fieldFilter != null && JEIIntegrationManager.searchBoxOwner == EnumItemBrowser.JEI && isNEIInWorld() && fieldFilter.isFocused()) { NEIClientConfig.setSearchExpression(fieldFilter.getText(), false); LayoutManager.searchField.setText(fieldFilter.getText(), false); } }
Example #25
Source File: NEIClientPacketHandler.java From NotEnoughItems with MIT License | 5 votes |
private void handleActionEnabled(PacketCustom packet) { String name = packet.readString(); if (packet.readBoolean()) { NEIClientConfig.enabledActions.add(name); } else { NEIClientConfig.enabledActions.remove(name); } }
Example #26
Source File: NEIClientPacketHandler.java From NotEnoughItems with MIT License | 5 votes |
/** * Handles when an action is disabled. * For Example. Noon, Weather. * * @param packet The packet to handle. */ private void handleActionDisableStateChange(PacketCustom packet) { String name = packet.readString(); if (packet.readBoolean()) { NEIClientConfig.disabledActions.add(name); } else { NEIClientConfig.disabledActions.remove(name); } }
Example #27
Source File: NEIClientPacketHandler.java From NotEnoughItems with MIT License | 5 votes |
/** * Handles the LoginState sent by the server. * Resets and loads from the packet the following things: * Permissible actions. * Disabled actions. * Enabled actions. * Banned items. * * @param packet Packet to handle. */ private void handleLoginState(PacketCustom packet) { NEIClientConfig.permissibleActions.clear(); int num = packet.readUByte(); for (int i = 0; i < num; i++) { NEIClientConfig.permissibleActions.add(packet.readString()); } NEIClientConfig.disabledActions.clear(); num = packet.readUByte(); for (int i = 0; i < num; i++) { NEIClientConfig.disabledActions.add(packet.readString()); } NEIClientConfig.enabledActions.clear(); num = packet.readUByte(); for (int i = 0; i < num; i++) { NEIClientConfig.enabledActions.add(packet.readString()); } NEIClientConfig.bannedItems.clear(); num = packet.readInt(); for (int i = 0; i < num; i++) { NEIClientConfig.bannedItems.add(packet.readItemStack()); } if (NEIClientUtils.getGuiContainer() != null) { LayoutManager.instance().refresh(NEIClientUtils.getGuiContainer()); } }
Example #28
Source File: NEIClientPacketHandler.java From NotEnoughItems with MIT License | 5 votes |
public static void sendOpenPotionWindow() { ItemStack[] potionStore = new ItemStack[9]; ArrayUtils.fillArray(potionStore, ItemStack.EMPTY); InventoryUtils.readItemStacksFromTag(potionStore, NEIClientConfig.global.nbt.getCompoundTag("potionStore").getTagList("items", 10)); PacketCustom packet = new PacketCustom(channel, 24); for (ItemStack stack : potionStore) { packet.writeItemStack(stack); } packet.sendToServer(); }
Example #29
Source File: NEIInfo.java From NotEnoughItems with MIT License | 5 votes |
public static void load(World world) { OptionCycled modeOption = (OptionCycled) NEIClientConfig.getOptionList().getOption("inventory.cheatmode"); modeOption.parent.synthesizeEnvironment(false); if (!modeOption.optionValid(modeOption.value())) { modeOption.copyGlobals(); modeOption.cycle(); } }
Example #30
Source File: ExtendedCreativeInv.java From NotEnoughItems with MIT License | 5 votes |
@Override public ItemStack getStackInSlot(int slot) { if (side.isClient()) { return NEIClientConfig.creativeInv[slot]; } return playerSave.creativeInv[slot]; }