mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-16 18:54:45 +00:00
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
759ea69c9f | ||
|
|
36a2cafdac | ||
|
|
6100012f5b | ||
|
|
2e5781beb5 | ||
|
|
43918f3bb1 | ||
|
|
a41299dfca | ||
|
|
ee060b9253 | ||
|
|
82a2273995 | ||
|
|
06fadcc362 | ||
|
|
b328fd3db1 | ||
|
|
9563ebfe5a | ||
|
|
d9143c584e |
No files matched your search
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:CodeChickenCore:1.3.6:dev')
|
||||
api('com.github.GTNewHorizons:CodeChickenCore:1.3.9:dev')
|
||||
shadowImplementation('org.apache.commons:commons-csv:1.10.0')
|
||||
}
|
||||
+1
-1
@@ -17,7 +17,7 @@ pluginManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.26'
|
||||
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.27'
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -130,9 +130,12 @@ public class BookmarkPanel extends PanelWidget {
|
||||
}
|
||||
|
||||
public void setEndRowIndex(BookmarkGrid BGrid, int rowIndex) {
|
||||
this.endRowIndex = rowIndex;
|
||||
this.endItemIndexTop = getTopItemIndex(BGrid, rowIndex);
|
||||
this.endItemIndexBottom = getBottomItemIndex(BGrid, rowIndex);
|
||||
|
||||
if (BGrid.getRowItemIndex(rowIndex, true) >= 0) {
|
||||
this.endRowIndex = rowIndex;
|
||||
this.endItemIndexTop = getTopItemIndex(BGrid, rowIndex);
|
||||
this.endItemIndexBottom = getBottomItemIndex(BGrid, rowIndex);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasEndRow() {
|
||||
@@ -226,12 +229,12 @@ public class BookmarkPanel extends PanelWidget {
|
||||
}
|
||||
}
|
||||
|
||||
public static enum BookmarkViewMode {
|
||||
public enum BookmarkViewMode {
|
||||
DEFAULT,
|
||||
TODO_LIST
|
||||
}
|
||||
|
||||
public static enum BookmarkLoadingState {
|
||||
public enum BookmarkLoadingState {
|
||||
LOADING,
|
||||
LOADED
|
||||
}
|
||||
@@ -2109,6 +2112,9 @@ public class BookmarkPanel extends PanelWidget {
|
||||
|
||||
@Override
|
||||
public void mouseDragged(int mousex, int mousey, int button, long heldTime) {
|
||||
if (mouseDownSlot >= grid.realItems.size()) {
|
||||
mouseDownSlot = -1;
|
||||
}
|
||||
|
||||
if (this.groupingItem != null) {
|
||||
final int overRowIndex = (mousey - grid.marginTop) / BookmarkGrid.SLOT_SIZE;
|
||||
@@ -2241,8 +2247,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
if (button == 0 && NEIClientUtils.shiftKey() && mouseDownSlot >= 0 && this.sortableItem == null) {
|
||||
ItemPanelSlot mouseOverSlot = getSlotMouseOver(mousex, mousey);
|
||||
|
||||
if (grid.getItem(mouseDownSlot) != null
|
||||
&& (mouseOverSlot == null || mouseOverSlot.slotIndex != mouseDownSlot || heldTime > 250)) {
|
||||
if (mouseOverSlot == null || mouseOverSlot.slotIndex != mouseDownSlot || heldTime > 250) {
|
||||
final BookmarkGrid BGrid = (BookmarkGrid) grid;
|
||||
final ItemStackMetadata meta = BGrid.getMetadata(mouseDownSlot);
|
||||
final List<ItemStack> items = new ArrayList<>();
|
||||
@@ -2724,8 +2729,9 @@ public class BookmarkPanel extends PanelWidget {
|
||||
}
|
||||
|
||||
public boolean pullBookmarkItems(int groupId, boolean onlyIngredients) {
|
||||
IBookmarkContainerHandler containerHandler = BookmarkContainerInfo
|
||||
.getBookmarkContainerHandler(getGuiContainer());
|
||||
final GuiContainer guiContainer = getGuiContainer();
|
||||
final IBookmarkContainerHandler containerHandler = BookmarkContainerInfo
|
||||
.getBookmarkContainerHandler(guiContainer);
|
||||
|
||||
if (containerHandler == null) {
|
||||
return false;
|
||||
@@ -2734,7 +2740,6 @@ public class BookmarkPanel extends PanelWidget {
|
||||
final BookmarkGrid BGrid = (BookmarkGrid) grid;
|
||||
final ArrayList<ItemStack> items = new ArrayList<>();
|
||||
final ItemStackMap<Long> uniqueItems = new ItemStackMap<>();
|
||||
final BookmarkGroup group = groupId >= 0 ? BGrid.groups.get(groupId) : null;
|
||||
ItemStackMetadata meta;
|
||||
|
||||
for (int idx = 0; idx < BGrid.realItems.size(); idx++) {
|
||||
@@ -2742,6 +2747,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
|
||||
if (groupId == -1 || groupId == meta.groupId) {
|
||||
final ItemStack stack = BGrid.getItem(idx);
|
||||
final BookmarkGroup group = BGrid.groups.get(meta.groupId);
|
||||
|
||||
if (!onlyIngredients || meta.ingredient && (group == null || group.crafting == null
|
||||
|| group.crafting.inputs.containsKey(BGrid.realItems.get(idx)))) {
|
||||
@@ -2766,7 +2772,7 @@ public class BookmarkPanel extends PanelWidget {
|
||||
return false;
|
||||
}
|
||||
|
||||
containerHandler.pullBookmarkItemsFromContainer(getGuiContainer(), items);
|
||||
containerHandler.pullBookmarkItemsFromContainer(guiContainer, items);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
import java.util.concurrent.ForkJoinWorkerThread;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -322,15 +323,25 @@ public class ItemList {
|
||||
}
|
||||
};
|
||||
|
||||
public static ForkJoinPool getPool(int poolSize) {
|
||||
public static ForkJoinPool forkJoinPool;
|
||||
|
||||
static {
|
||||
final ForkJoinPool.ForkJoinWorkerThreadFactory factory = new ForkJoinPool.ForkJoinWorkerThreadFactory() {
|
||||
|
||||
private int workerId;
|
||||
|
||||
@Override
|
||||
public ForkJoinWorkerThread newThread(ForkJoinPool pool) {
|
||||
final ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool);
|
||||
worker.setName("NEI-worker-thread-" + workerId++);
|
||||
return worker;
|
||||
}
|
||||
};
|
||||
int poolSize = Runtime.getRuntime().availableProcessors() * 2 / 3;
|
||||
if (poolSize < 1) poolSize = 1;
|
||||
|
||||
return new ForkJoinPool(poolSize);
|
||||
forkJoinPool = new ForkJoinPool(poolSize, factory, null, false);
|
||||
}
|
||||
|
||||
public static final int numProcessors = Runtime.getRuntime().availableProcessors();
|
||||
public static ForkJoinPool forkJoinPool = getPool(numProcessors * 2 / 3);
|
||||
|
||||
public static final RestartableTask updateFilter = new RestartableTask("NEI Item Filtering") {
|
||||
|
||||
private int compare(ItemStack o1, ItemStack o2) {
|
||||
|
||||
@@ -61,6 +61,9 @@ public class ItemZoom extends Widget implements IContainerInputHandler {
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GuiContainerManager.enable2DRender();
|
||||
|
||||
if (NEIClientConfig.getBooleanSetting("inventory.itemzoom.showName")) {
|
||||
String dispalyName = NEIClientUtils.cropText(fontRenderer, this.displayName, this.availableAreaWidth);
|
||||
drawStringC(
|
||||
@@ -90,6 +93,7 @@ public class ItemZoom extends Widget implements IContainerInputHandler {
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -406,7 +406,8 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
@Override
|
||||
public boolean onButtonPress(boolean rightclick) {
|
||||
if (!rightclick) {
|
||||
if (Keyboard.getEventKeyState() && getIsAccessibleControlEventKey()) {
|
||||
if (Keyboard.getEventKeyState() && getIsAccessibleControlEventKey()
|
||||
&& NEIClientConfig.canChangeCheatMode()) {
|
||||
NEIClientConfig.cycleSetting("inventory.cheatmode", 3);
|
||||
} else {
|
||||
if (Keyboard.getEventKeyState() && (Keyboard.getEventKey() == Keyboard.KEY_LSHIFT
|
||||
@@ -430,7 +431,10 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
else if (cheatMode == 2) modeColor = EnumChatFormatting.RED.toString();
|
||||
String controlKeyLocalization = translate(Minecraft.isRunningOnMac ? "key.ctrl.mac" : "key.ctrl");
|
||||
tooltip.add(modeColor + translate("inventory.options.tip.cheatmode." + cheatMode));
|
||||
tooltip.add(modeColor + translate("inventory.options.tip.cheatmode.disable", controlKeyLocalization));
|
||||
if (NEIClientConfig.canChangeCheatMode()) {
|
||||
tooltip.add(
|
||||
modeColor + translate("inventory.options.tip.cheatmode.disable", controlKeyLocalization));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -157,7 +157,7 @@ public class NEIClientConfig {
|
||||
return getLockedMode() == -1 || getLockedMode() == index && NEIInfo.isValidMode(index);
|
||||
}
|
||||
});
|
||||
checkCheatMode();
|
||||
canChangeCheatMode();
|
||||
|
||||
tag.getTag("inventory.utilities").setDefaultValue("delete, magnet");
|
||||
API.addOption(new OptionUtilities("inventory.utilities"));
|
||||
@@ -166,90 +166,7 @@ public class NEIClientConfig {
|
||||
API.addOption(new OptionGamemodes("inventory.gamemodes"));
|
||||
|
||||
ItemSorter.initConfig(tag);
|
||||
|
||||
tag.getTag("inventory.search.widgetPosition").setComment("Widget Position").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.search.widgetPosition", true));
|
||||
|
||||
tag.getTag("inventory.search.widgetAutofocus")
|
||||
.setComment(
|
||||
"Focus Search Widget on Open, blurs/unfocuses on mouse move unless typing has started first")
|
||||
.getIntValue(0);
|
||||
API.addOption(new OptionCycled("inventory.search.widgetAutofocus", 3, true));
|
||||
|
||||
tag.getTag("inventory.search.patternMode").setComment("Search Mode").getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.search.patternMode", 3, true));
|
||||
|
||||
tag.getTag("inventory.search.quoteDropItemName").setComment("Quote Drop Item Name").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.search.quoteDropItemName", true));
|
||||
|
||||
tag.getTag("inventory.search.modNameSearchMode").setComment("Search mode for Mod Names (prefix: @)")
|
||||
.getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.search.modNameSearchMode", 3, true) {
|
||||
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return translateN(name + "." + value(), EnumChatFormatting.LIGHT_PURPLE + "@");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
tag.getTag("inventory.search.tooltipSearchMode").setComment("Search mode for Tooltips (prefix: #)")
|
||||
.getIntValue(0);
|
||||
API.addOption(new OptionCycled("inventory.search.tooltipSearchMode", 3, true) {
|
||||
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return translateN(name + "." + value(), EnumChatFormatting.YELLOW + "#");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
tag.getTag("inventory.search.identifierSearchMode").setComment("Search mode for identifier (prefix: &)")
|
||||
.getIntValue(0);
|
||||
API.addOption(new OptionCycled("inventory.search.identifierSearchMode", 3, true) {
|
||||
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return translateN(name + "." + value(), EnumChatFormatting.GOLD + "&");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
tag.getTag("inventory.search.oreDictSearchMode").setComment("Search mode for Tag Names (prefix: $)")
|
||||
.getIntValue(0);
|
||||
API.addOption(new OptionCycled("inventory.search.oreDictSearchMode", 3, true) {
|
||||
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return translateN(name + "." + value(), EnumChatFormatting.AQUA + "$");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
tag.getTag("inventory.search.subsetsSearchMode").setComment("Search mode for Item Subsets (prefix: %)")
|
||||
.getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.search.subsetsSearchMode", 3, true) {
|
||||
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return translateN(name + "." + value(), EnumChatFormatting.DARK_PURPLE + "%");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
String prefixRedefinitions = tag.getTag("inventory.search.prefixRedefinitions").setComment(
|
||||
"Redefine search prefixes by providing a char-to-char map (JSON). The keys are the original prefixes, the values the new ones. Example: { \"$\": \"€\", \"#\": \"+\", \"@\": \"°\", \"%\": \"!\" }")
|
||||
.getValue("{}");
|
||||
try {
|
||||
TypeToken<Map<Character, Character>> typeToken = new TypeToken<Map<Character, Character>>() {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
};
|
||||
Map<Character, Character> charMap = new Gson().fromJson(prefixRedefinitions, typeToken.getType());
|
||||
SearchField.searchParser.prefixRedefinitions.putAll(charMap);
|
||||
} catch (JsonParseException e) {
|
||||
logger.warn("Failed to convert prefix redefinitions from JSON to CharToCharMap:", e);
|
||||
}
|
||||
setInventorySearchDefaults(tag);
|
||||
|
||||
tag.getTag("inventory.bookmarks.enabled").setComment("Enable/Disable Bookmark Panel").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.bookmarks.enabled", true));
|
||||
@@ -502,6 +419,167 @@ public class NEIClientConfig {
|
||||
});
|
||||
}
|
||||
|
||||
private static void setInventorySearchDefaults(ConfigTagParent tag) {
|
||||
|
||||
tag.getTag("inventory.search.widgetPosition").setComment("Widget Position").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.search.widgetPosition", true));
|
||||
|
||||
tag.getTag("inventory.search.widgetAutofocus")
|
||||
.setComment(
|
||||
"Focus Search Widget on Open, blurs/unfocuses on mouse move unless typing has started first")
|
||||
.getIntValue(0);
|
||||
API.addOption(new OptionCycled("inventory.search.widgetAutofocus", 3, true));
|
||||
|
||||
tag.getTag("inventory.search.patternMode").setComment("Search Mode").getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.search.patternMode", 3, true));
|
||||
|
||||
tag.getTag("inventory.search.quoteDropItemName").setComment("Quote Drop Item Name").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.search.quoteDropItemName", true));
|
||||
|
||||
tag.getTag("inventory.search.format").setComment("Search Format (true: old format, false: custom format)")
|
||||
.getBooleanValue(false);
|
||||
API.addOption(new OptionToggleButton("inventory.search.format", true) {
|
||||
|
||||
@Override
|
||||
public boolean onClick(int button) {
|
||||
|
||||
if (!super.onClick(button)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (state()) {
|
||||
NEIClientConfig.setIntSetting("inventory.search.modNameSearchMode", 0);
|
||||
NEIClientConfig.setIntSetting("inventory.search.tooltipSearchMode", 0);
|
||||
NEIClientConfig.setIntSetting("inventory.search.identifierSearchMode", 0);
|
||||
NEIClientConfig.setIntSetting("inventory.search.oreDictSearchMode", 0);
|
||||
NEIClientConfig.setIntSetting("inventory.search.subsetsSearchMode", 1);
|
||||
tag.getTag("inventory.search.prefixRedefinitions").setValue("{\"%\": \"@\", \"@\": \"%\"}");
|
||||
SearchField.searchParser.prefixRedefinitions.clear();
|
||||
SearchField.searchParser.prefixRedefinitions.put('%', '@');
|
||||
SearchField.searchParser.prefixRedefinitions.put('@', '%');
|
||||
} else {
|
||||
NEIClientConfig.setIntSetting("inventory.search.modNameSearchMode", 1);
|
||||
NEIClientConfig.setIntSetting("inventory.search.tooltipSearchMode", 0);
|
||||
NEIClientConfig.setIntSetting("inventory.search.identifierSearchMode", 0);
|
||||
NEIClientConfig.setIntSetting("inventory.search.oreDictSearchMode", 0);
|
||||
NEIClientConfig.setIntSetting("inventory.search.subsetsSearchMode", 1);
|
||||
tag.getTag("inventory.search.prefixRedefinitions").setValue("{}");
|
||||
SearchField.searchParser.prefixRedefinitions.clear();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
tag.getTag("inventory.search.modNameSearchMode").setComment("Search mode for Mod Names (prefix: @)")
|
||||
.getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.search.modNameSearchMode", 3, true) {
|
||||
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return translateN(
|
||||
name + "." + value(),
|
||||
EnumChatFormatting.LIGHT_PURPLE
|
||||
+ String.valueOf(SearchField.searchParser.getRedefinedPrefix('@')));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return !tag.getTag("inventory.search.format").getBooleanValue();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
tag.getTag("inventory.search.tooltipSearchMode").setComment("Search mode for Tooltips (prefix: #)")
|
||||
.getIntValue(0);
|
||||
API.addOption(new OptionCycled("inventory.search.tooltipSearchMode", 3, true) {
|
||||
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return translateN(
|
||||
name + "." + value(),
|
||||
EnumChatFormatting.YELLOW + String.valueOf(SearchField.searchParser.getRedefinedPrefix('#')));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return !tag.getTag("inventory.search.format").getBooleanValue();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
tag.getTag("inventory.search.identifierSearchMode").setComment("Search mode for identifier (prefix: &)")
|
||||
.getIntValue(0);
|
||||
API.addOption(new OptionCycled("inventory.search.identifierSearchMode", 3, true) {
|
||||
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return translateN(
|
||||
name + "." + value(),
|
||||
EnumChatFormatting.GOLD + String.valueOf(SearchField.searchParser.getRedefinedPrefix('&')));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return !tag.getTag("inventory.search.format").getBooleanValue();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
tag.getTag("inventory.search.oreDictSearchMode").setComment("Search mode for Tag Names (prefix: $)")
|
||||
.getIntValue(0);
|
||||
API.addOption(new OptionCycled("inventory.search.oreDictSearchMode", 3, true) {
|
||||
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return translateN(
|
||||
name + "." + value(),
|
||||
EnumChatFormatting.AQUA + String.valueOf(SearchField.searchParser.getRedefinedPrefix('$')));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return !tag.getTag("inventory.search.format").getBooleanValue();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
tag.getTag("inventory.search.subsetsSearchMode").setComment("Search mode for Item Subsets (prefix: %)")
|
||||
.getIntValue(1);
|
||||
API.addOption(new OptionCycled("inventory.search.subsetsSearchMode", 3, true) {
|
||||
|
||||
@Override
|
||||
public String getButtonText() {
|
||||
return translateN(
|
||||
name + "." + value(),
|
||||
EnumChatFormatting.DARK_PURPLE
|
||||
+ String.valueOf(SearchField.searchParser.getRedefinedPrefix('%')));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return !tag.getTag("inventory.search.format").getBooleanValue();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
String prefixRedefinitions = tag.getTag("inventory.search.prefixRedefinitions").setComment(
|
||||
"Redefine search prefixes by providing a char-to-char map (JSON). The keys are the original prefixes, the values the new ones. Example: { \"$\": \"€\", \"#\": \"+\", \"@\": \"°\", \"%\": \"!\" }")
|
||||
.getValue("{}");
|
||||
try {
|
||||
TypeToken<Map<Character, Character>> typeToken = new TypeToken<Map<Character, Character>>() {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
};
|
||||
Map<Character, Character> charMap = new Gson().fromJson(prefixRedefinitions, typeToken.getType());
|
||||
SearchField.searchParser.prefixRedefinitions.putAll(charMap);
|
||||
} catch (JsonParseException e) {
|
||||
logger.warn("Failed to convert prefix redefinitions from JSON to CharToCharMap:", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void setDefaultKeyBindings() {
|
||||
API.addHashBind("gui.recipe", Keyboard.KEY_R);
|
||||
API.addHashBind("gui.usage", Keyboard.KEY_U);
|
||||
@@ -808,8 +886,13 @@ public class NEIClientConfig {
|
||||
return getIntSetting("inventory.cheatmode");
|
||||
}
|
||||
|
||||
private static void checkCheatMode() {
|
||||
if (getLockedMode() != -1) setIntSetting("inventory.cheatmode", getLockedMode());
|
||||
public static boolean canChangeCheatMode() {
|
||||
if (getLockedMode() != -1) {
|
||||
setIntSetting("inventory.cheatmode", getLockedMode());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static int getLockedMode() {
|
||||
|
||||
@@ -59,11 +59,26 @@ public class NEIClientUtils extends NEIServerUtils {
|
||||
|
||||
/** Formats a number with group separator and at most 2 fraction digits. */
|
||||
private static final Map<Locale, DecimalFormat> decimalFormatters = new HashMap<>();
|
||||
private static final Map<Integer, Integer> keyHashMap = new HashMap<>();
|
||||
|
||||
public static final int ALT_HASH = 1 << 27;
|
||||
public static final int SHIFT_HASH = 1 << 26;
|
||||
public static final int CTRL_HASH = 1 << 25;
|
||||
|
||||
static {
|
||||
keyHashMap.put(Keyboard.KEY_LSHIFT, SHIFT_HASH);
|
||||
keyHashMap.put(Keyboard.KEY_RSHIFT, SHIFT_HASH);
|
||||
|
||||
keyHashMap.put(Keyboard.KEY_LCONTROL, CTRL_HASH);
|
||||
keyHashMap.put(Keyboard.KEY_LCONTROL, CTRL_HASH);
|
||||
|
||||
keyHashMap.put(Keyboard.KEY_LMETA, CTRL_HASH);
|
||||
keyHashMap.put(Keyboard.KEY_RMETA, CTRL_HASH);
|
||||
|
||||
keyHashMap.put(Keyboard.KEY_LMENU, ALT_HASH);
|
||||
keyHashMap.put(Keyboard.KEY_LMENU, ALT_HASH);
|
||||
}
|
||||
|
||||
public static Minecraft mc() {
|
||||
return Minecraft.getMinecraft();
|
||||
}
|
||||
@@ -439,11 +454,7 @@ public class NEIClientUtils extends NEIServerUtils {
|
||||
if (Keyboard.getEventKeyState()) {
|
||||
final int keycode = Keyboard.getEventKey();
|
||||
|
||||
if (keycode != Keyboard.KEY_LSHIFT && keycode != Keyboard.KEY_RSHIFT
|
||||
&& keycode != Keyboard.KEY_LCONTROL
|
||||
&& keycode != Keyboard.KEY_RCONTROL
|
||||
&& keycode != Keyboard.KEY_LMENU
|
||||
&& keycode != Keyboard.KEY_RMENU) {
|
||||
if (!keyHashMap.containsKey(keycode)) {
|
||||
return getMetaHash() + keycode;
|
||||
}
|
||||
}
|
||||
@@ -470,6 +481,7 @@ public class NEIClientUtils extends NEIServerUtils {
|
||||
}
|
||||
|
||||
public static String getKeyName(int keyBind) {
|
||||
keyBind = keyHashMap.getOrDefault(keyBind, keyBind);
|
||||
StringJoiner keyText = new StringJoiner(" + ");
|
||||
String hashText = getKeyHashName(keyBind);
|
||||
int keyID = unHashKey(keyBind);
|
||||
|
||||
@@ -200,6 +200,10 @@ public abstract class PanelWidget extends Widget implements IContainerTooltipHan
|
||||
|
||||
@Override
|
||||
public void mouseDragged(int mousex, int mousey, int button, long heldTime) {
|
||||
if (mouseDownSlot >= grid.realItems.size()) {
|
||||
mouseDownSlot = -1;
|
||||
}
|
||||
|
||||
if (mouseDownSlot >= 0 && draggedStack == null
|
||||
&& NEIClientUtils.getHeldItem() == null
|
||||
&& NEIClientConfig.hasSMPCounterPart()) {
|
||||
|
||||
@@ -32,7 +32,7 @@ import codechicken.nei.util.NBTJson;
|
||||
|
||||
public class PresetsList {
|
||||
|
||||
public static enum PresetMode {
|
||||
public enum PresetMode {
|
||||
HIDE,
|
||||
REMOVE,
|
||||
GROUP;
|
||||
|
||||
@@ -11,6 +11,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.Language;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import codechicken.nei.ItemList.AllMultiItemFilter;
|
||||
@@ -69,6 +70,22 @@ public class SearchTokenParser {
|
||||
}
|
||||
}
|
||||
|
||||
private static class IsRegisteredItemFilter implements ItemFilter {
|
||||
|
||||
public ItemFilter filter;
|
||||
|
||||
public IsRegisteredItemFilter(ItemFilter filter) {
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(ItemStack item) {
|
||||
return item != null && item.getItem() != null
|
||||
&& item.getItem().delegate.name() != null
|
||||
&& this.filter.matches(item);
|
||||
}
|
||||
}
|
||||
|
||||
protected final List<ISearchParserProvider> searchProviders;
|
||||
protected final ProvidersCache providersCache = new ProvidersCache();
|
||||
protected final TCharCharMap prefixRedefinitions = new TCharCharHashMap();
|
||||
@@ -118,15 +135,15 @@ public class SearchTokenParser {
|
||||
|
||||
public ItemFilter getFilter(String filterText) {
|
||||
final String[] parts = EnumChatFormatting.getTextWithoutFormattingCodes(filterText).toLowerCase().split("\\|");
|
||||
final List<ItemFilter> searchTokens = Arrays.stream(parts).map(s -> parseSearchText(s)).filter(s -> s != null)
|
||||
final List<ItemFilter> searchTokens = Arrays.stream(parts).map(this::parseSearchText).filter(s -> s != null)
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
|
||||
if (searchTokens.isEmpty()) {
|
||||
return new EverythingItemFilter();
|
||||
} else if (searchTokens.size() == 1) {
|
||||
return searchTokens.get(0);
|
||||
return new IsRegisteredItemFilter(searchTokens.get(0));
|
||||
} else {
|
||||
return new AnyMultiItemFilter(searchTokens);
|
||||
return new IsRegisteredItemFilter(new AnyMultiItemFilter(searchTokens));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,7 +159,7 @@ public class SearchTokenParser {
|
||||
return Pattern.compile("((-*)([" + Pattern.quote(prefixes.toString()) + "]*)(\\\".*?(?:\\\"|$)|\\S+))");
|
||||
}
|
||||
|
||||
private char getRedefinedPrefix(char prefix) {
|
||||
public char getRedefinedPrefix(char prefix) {
|
||||
if (this.prefixRedefinitions.containsKey(prefix)) {
|
||||
return this.prefixRedefinitions.get(prefix);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.core.gui.GuiScrollSlot;
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
@@ -71,7 +73,8 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
if (slot < sorted.size()) {
|
||||
SubsetTag tag = sorted.get(slot);
|
||||
if (NEIClientUtils.shiftKey()) {
|
||||
LayoutManager.searchField.setText("%" + tag.fullname.replaceAll("\\s+", ""));
|
||||
LayoutManager.searchField.setText(
|
||||
SearchField.searchParser.getRedefinedPrefix('%') + tag.fullname.replaceAll("\\s+", ""));
|
||||
} else if (button == 0 && count >= 2) {
|
||||
SubsetWidget.showOnly(tag);
|
||||
} else {
|
||||
@@ -711,9 +714,14 @@ public class SubsetWidget extends Button implements ItemFilterProvider, ItemsLoa
|
||||
|
||||
hoverStack = null;
|
||||
if (root.isVisible()) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
GuiContainerManager.enable2DRender();
|
||||
|
||||
root.resize(area.x, 0, area.y);
|
||||
root.cacheState();
|
||||
root.draw(mx, my);
|
||||
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import codechicken.lib.math.MathHelper;
|
||||
import codechicken.nei.KeyManager.IKeyStateTracker;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public class WorldOverlayRenderer implements IKeyStateTracker {
|
||||
|
||||
@@ -26,12 +27,11 @@ public class WorldOverlayRenderer implements IKeyStateTracker {
|
||||
private static byte[] mobSpawnCache;
|
||||
private static long mobOverlayUpdateTime;
|
||||
private static String oregenPatternName;
|
||||
private static boolean hasOregenPatternBeenSet = false;
|
||||
|
||||
public static void reset() {
|
||||
mobOverlay = 0;
|
||||
chunkOverlay = 0;
|
||||
hasOregenPatternBeenSet = false;
|
||||
oregenPatternName = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -288,18 +288,9 @@ public class WorldOverlayRenderer implements IKeyStateTracker {
|
||||
GL11.glVertex3d(x2, y2, z1 + h);
|
||||
}
|
||||
} else if (chunkOverlay == 3) {
|
||||
if (!hasOregenPatternBeenSet) {
|
||||
try {
|
||||
oregenPatternName = ((Enum<?>) Class.forName("gregtech.common.GT_Worldgenerator")
|
||||
.getDeclaredField("oregenPattern").get(null)).name();
|
||||
} catch (Exception ignored) {
|
||||
oregenPatternName = "AXISSYMMETRICAL";
|
||||
}
|
||||
hasOregenPatternBeenSet = true;
|
||||
}
|
||||
int gx1;
|
||||
int gz1;
|
||||
if (oregenPatternName.equals("EQUAL_SPACING")) {
|
||||
if (getOregenPatternName().equals("EQUAL_SPACING")) {
|
||||
// gt oregen uses new regular pattern
|
||||
gx1 = ((Math.floorDiv(entity.chunkCoordX, 3) * 3) << 4) - intOffsetX;
|
||||
gz1 = ((Math.floorDiv(entity.chunkCoordZ, 3) * 3) << 4) - intOffsetZ;
|
||||
@@ -368,6 +359,22 @@ public class WorldOverlayRenderer implements IKeyStateTracker {
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
private static String getOregenPatternName() {
|
||||
|
||||
if (oregenPatternName == null) {
|
||||
try {
|
||||
final ClassLoader loader = WorldOverlayRenderer.class.getClassLoader();
|
||||
final Class<?> gtWorldGenerator = ReflectionHelper
|
||||
.getClass(loader, "gregtech.common.GTWorldgenerator", "gregtech.common.GT_Worldgenerator");
|
||||
oregenPatternName = ((Enum<?>) gtWorldGenerator.getDeclaredField("oregenPattern").get(null)).name();
|
||||
} catch (Exception ignored) {
|
||||
oregenPatternName = "AXISSYMMETRICAL";
|
||||
}
|
||||
}
|
||||
|
||||
return oregenPatternName;
|
||||
}
|
||||
|
||||
public static void load() {
|
||||
KeyManager.trackers.add(new WorldOverlayRenderer());
|
||||
}
|
||||
|
||||
@@ -499,6 +499,6 @@ public class ItemInfo {
|
||||
|
||||
@Deprecated
|
||||
public static String getSearchName(ItemStack stack) {
|
||||
return GuiContainerManager.concatenatedDisplayName(stack, true);
|
||||
return GuiContainerManager.concatenatedDisplayName(stack, true).toLowerCase();
|
||||
}
|
||||
}
|
||||
@@ -46,6 +46,8 @@ public class OptionUtilities extends OptionStringSet {
|
||||
x += 24;
|
||||
LayoutManager.drawIcon(x + 4, 4, new Image(132, 12, 12, 12));
|
||||
x += 24;
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
ItemStack sword = new ItemStack(Items.diamond_sword);
|
||||
@@ -55,5 +57,6 @@ public class OptionUtilities extends OptionStringSet {
|
||||
GuiContainerManager.drawItem(x + 2, 2, new ItemStack(Items.potionitem));
|
||||
x += 24;
|
||||
GuiContainerManager.drawItem(x + 2, 2, new ItemStack(Blocks.stone));
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,6 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.ItemStackSet;
|
||||
@@ -270,93 +269,59 @@ public class GuiContainerManager {
|
||||
return EnumChatFormatting.getTextWithoutFormattingCodes(sb.toString());
|
||||
}
|
||||
|
||||
public static void drawItem(int i, int j, ItemStack itemstack) {
|
||||
drawItem(i, j, itemstack, false);
|
||||
public static void drawItem(int offsetX, int offsetY, ItemStack itemstack) {
|
||||
drawItem(offsetX, offsetY, itemstack, false);
|
||||
}
|
||||
|
||||
public static void drawItem(int i, int j, ItemStack itemstack, boolean smallAmount) {
|
||||
drawItem(i, j, itemstack, smallAmount, null);
|
||||
public static void drawItem(int offsetX, int offsetY, ItemStack itemstack, boolean smallAmount) {
|
||||
drawItem(offsetX, offsetY, itemstack, smallAmount, null);
|
||||
}
|
||||
|
||||
public static void drawItem(int i, int j, ItemStack itemstack, boolean smallAmount, String stackSize) {
|
||||
drawItem(i, j, itemstack, getFontRenderer(itemstack), smallAmount, stackSize);
|
||||
public static void drawItem(int offsetX, int offsetY, ItemStack itemstack, boolean smallAmount, String quantity) {
|
||||
drawItem(offsetX, offsetY, itemstack, getFontRenderer(itemstack), smallAmount, quantity);
|
||||
}
|
||||
|
||||
public static void drawItem(int i, int j, ItemStack itemstack, FontRenderer fontRenderer) {
|
||||
drawItem(i, j, itemstack, fontRenderer, false, null);
|
||||
public static void drawItem(int offsetX, int offsetY, ItemStack itemstack, FontRenderer fontRenderer) {
|
||||
drawItem(offsetX, offsetY, itemstack, fontRenderer, false, null);
|
||||
}
|
||||
|
||||
private static int modelviewDepth = -1;
|
||||
private static final HashSet<String> stackTraces = new HashSet<>();
|
||||
private static final ItemStackSet renderingErrorItems = new ItemStackSet();
|
||||
|
||||
public static void drawItem(int i, int j, ItemStack itemstack, FontRenderer fontRenderer, boolean smallAmount,
|
||||
String stackSize) {
|
||||
enable3DRender();
|
||||
// for lighting correction
|
||||
boolean glRescale = GL11.glGetBoolean(GL12.GL_RESCALE_NORMAL);
|
||||
float zLevel = drawItems.zLevel += 100F;
|
||||
public static void drawItem(int offsetX, int offsetY, ItemStack itemstack, FontRenderer fontRenderer,
|
||||
boolean smallAmount, String quantity) {
|
||||
|
||||
if (!renderingErrorItems.contains(itemstack)) {
|
||||
safeItemRenderContext(itemstack, offsetX, offsetY, fontRenderer, () -> {
|
||||
float scale = smallAmount ? 0.5f : 1f;
|
||||
String stackSize = quantity;
|
||||
|
||||
try {
|
||||
drawItems.renderItemAndEffectIntoGUI(fontRenderer, renderEngine, itemstack, i, j);
|
||||
if (stackSize == null) {
|
||||
if (itemstack.stackSize > 1) {
|
||||
stackSize = ReadableNumberConverter.INSTANCE.toWideReadableForm(itemstack.stackSize);
|
||||
|
||||
if (stackSize == null) {
|
||||
if (itemstack.stackSize > 1) {
|
||||
stackSize = ReadableNumberConverter.INSTANCE.toWideReadableForm(itemstack.stackSize);
|
||||
|
||||
if (stackSize.length() == 3) {
|
||||
scale = 0.8f;
|
||||
} else if (stackSize.length() == 4) {
|
||||
scale = 0.6f;
|
||||
} else if (stackSize.length() > 4) {
|
||||
scale = 0.5f;
|
||||
}
|
||||
|
||||
} else {
|
||||
stackSize = "";
|
||||
if (stackSize.length() == 3) {
|
||||
scale = 0.8f;
|
||||
} else if (stackSize.length() == 4) {
|
||||
scale = 0.6f;
|
||||
} else if (stackSize.length() > 4) {
|
||||
scale = 0.5f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (scale != 1f) {
|
||||
|
||||
if (!stackSize.isEmpty()) {
|
||||
drawBigStackSize(i, j, stackSize, scale);
|
||||
}
|
||||
|
||||
// stackSize = "". it needed for correct draw item with alpha and blend
|
||||
drawItems.renderItemOverlayIntoGUI(fontRenderer, renderEngine, itemstack, i, j, "");
|
||||
} else {
|
||||
drawItems.renderItemOverlayIntoGUI(fontRenderer, renderEngine, itemstack, i, j, stackSize);
|
||||
stackSize = "";
|
||||
}
|
||||
|
||||
if (!checkMatrixStack()) throw new IllegalStateException("Modelview matrix stack too deep");
|
||||
if (Tessellator.instance.isDrawing) throw new IllegalStateException("Still drawing");
|
||||
} catch (Exception e) {
|
||||
NEIClientUtils.reportErrorBuffered(e, stackTraces, itemstack);
|
||||
|
||||
restoreMatrixStack();
|
||||
if (Tessellator.instance.isDrawing) Tessellator.instance.draw();
|
||||
|
||||
drawItems.zLevel = zLevel;
|
||||
drawItems.renderItemIntoGUI(fontRenderer, renderEngine, new ItemStack(Blocks.fire), i, j);
|
||||
renderingErrorItems.add(itemstack);
|
||||
}
|
||||
} else {
|
||||
drawItems.renderItemIntoGUI(fontRenderer, renderEngine, new ItemStack(Blocks.fire), i, j);
|
||||
}
|
||||
|
||||
if (glRescale) {
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
} else {
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
}
|
||||
drawItems.renderItemAndEffectIntoGUI(fontRenderer, renderEngine, itemstack, offsetX, offsetY);
|
||||
|
||||
enable2DRender();
|
||||
drawItems.zLevel = zLevel - 100;
|
||||
if (scale != 1f && !stackSize.isEmpty()) {
|
||||
drawBigStackSize(offsetX, offsetY, stackSize, scale);
|
||||
stackSize = "";
|
||||
}
|
||||
|
||||
drawItems.renderItemOverlayIntoGUI(fontRenderer, renderEngine, itemstack, offsetX, offsetY, stackSize);
|
||||
});
|
||||
}
|
||||
|
||||
// copy from appeng.client.render.AppEngRenderItem
|
||||
@@ -366,15 +331,44 @@ public class GuiContainerManager {
|
||||
enable2DRender();
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
|
||||
final int X = (int) (((float) offsetX + 16.0f - fontRenderer.getStringWidth(stackSize) * scale)
|
||||
* inverseScaleFactor);
|
||||
final int Y = (int) (((float) offsetY + 16.0f - 7.0f * scale) * inverseScaleFactor);
|
||||
final int X = (int) ((offsetX + 16.0f - fontRenderer.getStringWidth(stackSize) * scale) * inverseScaleFactor);
|
||||
final int Y = (int) ((offsetY + 16.0f - 7.0f * scale) * inverseScaleFactor);
|
||||
fontRenderer.drawStringWithShadow(stackSize, X, Y, 16777215);
|
||||
|
||||
GL11.glScaled(inverseScaleFactor, inverseScaleFactor, inverseScaleFactor);
|
||||
enable3DRender();
|
||||
}
|
||||
|
||||
private static void safeItemRenderContext(ItemStack stack, int x, int y, FontRenderer fontRenderer,
|
||||
Runnable callback) {
|
||||
float zLevel = drawItems.zLevel += 100F;
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
enable3DRender();
|
||||
|
||||
if (!renderingErrorItems.contains(stack)) {
|
||||
try {
|
||||
callback.run();
|
||||
|
||||
if (!checkMatrixStack()) throw new IllegalStateException("Modelview matrix stack too deep");
|
||||
if (Tessellator.instance.isDrawing) throw new IllegalStateException("Still drawing");
|
||||
} catch (Exception e) {
|
||||
NEIClientUtils.reportErrorBuffered(e, stackTraces, stack);
|
||||
|
||||
restoreMatrixStack();
|
||||
if (Tessellator.instance.isDrawing) Tessellator.instance.draw();
|
||||
|
||||
drawItems.zLevel = zLevel;
|
||||
drawItems.renderItemIntoGUI(fontRenderer, renderEngine, new ItemStack(Blocks.fire), x, y);
|
||||
renderingErrorItems.add(stack);
|
||||
}
|
||||
} else {
|
||||
drawItems.renderItemIntoGUI(fontRenderer, renderEngine, new ItemStack(Blocks.fire), x, y);
|
||||
}
|
||||
|
||||
GL11.glPopAttrib();
|
||||
drawItems.zLevel = zLevel - 100;
|
||||
}
|
||||
|
||||
public static void registerReloadResourceListener() {
|
||||
if (Minecraft.getMinecraft().getResourceManager() instanceof SimpleReloadableResourceManager) {
|
||||
SimpleReloadableResourceManager manager = (SimpleReloadableResourceManager) Minecraft.getMinecraft()
|
||||
@@ -738,43 +732,17 @@ public class GuiContainerManager {
|
||||
* Delegate for changing item rendering for certain slots. Eg. Shrinking text for large itemstacks
|
||||
*/
|
||||
public void drawSlotItem(Slot slot, ItemStack stack, int x, int y, String quantity) {
|
||||
// for lighting correction
|
||||
boolean glRescale = GL11.glGetBoolean(GL12.GL_RESCALE_NORMAL);
|
||||
float zLevel = drawItems.zLevel += 100F;
|
||||
|
||||
if (!renderingErrorItems.contains(stack)) {
|
||||
try {
|
||||
if (window instanceof IGuiSlotDraw) {
|
||||
((IGuiSlotDraw) window).drawSlotItem(slot, stack, x, y, quantity);
|
||||
} else {
|
||||
|
||||
if (quantity == null) {
|
||||
quantity = stack != null && stack.stackSize > 1 ? String.valueOf(stack.stackSize) : "";
|
||||
}
|
||||
|
||||
drawItems.renderItemAndEffectIntoGUI(fontRenderer, renderEngine, stack, x, y);
|
||||
drawItems.renderItemOverlayIntoGUI(fontRenderer, renderEngine, stack, x, y, quantity);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
NEIClientUtils.reportErrorBuffered(e, stackTraces, stack);
|
||||
|
||||
restoreMatrixStack();
|
||||
if (Tessellator.instance.isDrawing) Tessellator.instance.draw();
|
||||
|
||||
drawItems.zLevel = zLevel;
|
||||
drawItems.renderItemIntoGUI(fontRenderer, renderEngine, new ItemStack(Blocks.fire), x, y);
|
||||
renderingErrorItems.add(stack);
|
||||
}
|
||||
} else {
|
||||
drawItems.renderItemIntoGUI(fontRenderer, renderEngine, new ItemStack(Blocks.fire), x, y);
|
||||
if (window instanceof IGuiSlotDraw) {
|
||||
safeItemRenderContext(
|
||||
stack,
|
||||
x,
|
||||
y,
|
||||
fontRenderer,
|
||||
() -> ((IGuiSlotDraw) window).drawSlotItem(slot, stack, x, y, quantity));
|
||||
} else if (stack != null) {
|
||||
drawItem(x, y, stack, false, quantity);
|
||||
}
|
||||
|
||||
if (glRescale) {
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
} else {
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
}
|
||||
drawItems.zLevel = zLevel - 100;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,16 +16,19 @@ import codechicken.lib.inventory.InventoryUtils;
|
||||
import codechicken.nei.FastTransferManager;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.api.IOverlayHandler;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public class DefaultOverlayHandler implements IOverlayHandler {
|
||||
|
||||
public static Class<?> gtItem;
|
||||
private static Class<?> gtItem;
|
||||
|
||||
static {
|
||||
try {
|
||||
gtItem = Class.forName("gregtech.api.items.GT_MetaBase_Item");
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
gtItem = null;
|
||||
final ClassLoader loader = DefaultOverlayHandler.class.getClassLoader();
|
||||
gtItem = ReflectionHelper
|
||||
.getClass(loader, "gregtech.api.items.MetaBaseItem", "gregtech.api.items.GT_MetaBase_Item");
|
||||
} catch (Exception ignored) {
|
||||
/* Do nothing */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,13 +88,16 @@ public class DefaultOverlayHandler implements IOverlayHandler {
|
||||
}
|
||||
|
||||
private boolean clearIngredients(GuiContainer gui, List<PositionedStack> ingreds) {
|
||||
for (PositionedStack pstack : ingreds) for (Slot slot : (List<Slot>) gui.inventorySlots.inventorySlots)
|
||||
if (slot.xDisplayPosition == pstack.relx + offsetx && slot.yDisplayPosition == pstack.rely + offsety) {
|
||||
if (!slot.getHasStack()) continue;
|
||||
for (PositionedStack pstack : ingreds) {
|
||||
for (Slot slot : gui.inventorySlots.inventorySlots) {
|
||||
if (slot.xDisplayPosition == pstack.relx + offsetx && slot.yDisplayPosition == pstack.rely + offsety) {
|
||||
if (!slot.getHasStack()) continue;
|
||||
|
||||
FastTransferManager.clickSlot(gui, slot.slotNumber, 0, 1);
|
||||
if (slot.getHasStack()) return false;
|
||||
FastTransferManager.clickSlot(gui, slot.slotNumber, 0, 1);
|
||||
if (slot.getHasStack()) return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -109,7 +115,7 @@ public class DefaultOverlayHandler implements IOverlayHandler {
|
||||
int slotTransferred = 0;
|
||||
int slotTransferCap = pstack.getMaxStackSize();
|
||||
|
||||
for (Slot slot : (List<Slot>) gui.inventorySlots.inventorySlots) {
|
||||
for (Slot slot : gui.inventorySlots.inventorySlots) {
|
||||
if (!slot.getHasStack() || !canMoveFrom(slot, gui)) continue;
|
||||
|
||||
ItemStack stack = slot.getStack();
|
||||
@@ -178,7 +184,7 @@ public class DefaultOverlayHandler implements IOverlayHandler {
|
||||
assignedSlots.add(new LinkedList<>());
|
||||
}
|
||||
|
||||
while (avaliableSlots.size() > 0 && remainingIngreds.size() > 0) {
|
||||
while (!avaliableSlots.isEmpty() && !remainingIngreds.isEmpty()) {
|
||||
for (Iterator<Integer> iterator = remainingIngreds.iterator(); iterator.hasNext();) {
|
||||
int i = iterator.next();
|
||||
boolean assigned = false;
|
||||
@@ -196,8 +202,9 @@ public class DefaultOverlayHandler implements IOverlayHandler {
|
||||
}
|
||||
}
|
||||
|
||||
if (!assigned || istack.numSlots * istack.stack.getMaxStackSize() >= istack.invAmount)
|
||||
if (!assigned || istack.numSlots * istack.stack.getMaxStackSize() >= istack.invAmount) {
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,7 +250,7 @@ public class DefaultOverlayHandler implements IOverlayHandler {
|
||||
}
|
||||
|
||||
private void findInventoryQuantities(GuiContainer gui, List<DistributedIngred> ingredStacks) {
|
||||
for (Slot slot : (List<Slot>) gui.inventorySlots.inventorySlots) /* work out how much we have to go round */ {
|
||||
for (Slot slot : gui.inventorySlots.inventorySlots) /* work out how much we have to go round */ {
|
||||
if (slot.getHasStack() && canMoveFrom(slot, gui)) {
|
||||
ItemStack pstack = slot.getStack();
|
||||
DistributedIngred istack = findIngred(ingredStacks, pstack);
|
||||
@@ -273,7 +280,7 @@ public class DefaultOverlayHandler implements IOverlayHandler {
|
||||
for (int i = 0; i < ingredients.size(); i++) /* identify slots */ {
|
||||
LinkedList<Slot> recipeSlots = new LinkedList<>();
|
||||
PositionedStack pstack = ingredients.get(i);
|
||||
for (Slot slot : (List<Slot>) gui.inventorySlots.inventorySlots) {
|
||||
for (Slot slot : gui.inventorySlots.inventorySlots) {
|
||||
if (slot.xDisplayPosition == pstack.relx + offsetx && slot.yDisplayPosition == pstack.rely + offsety) {
|
||||
recipeSlots.add(slot);
|
||||
break;
|
||||
|
||||
@@ -982,7 +982,6 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
}
|
||||
|
||||
public void refreshPage() {
|
||||
RecipeCatalysts.updatePosition(ySize - BG_TOP_HEIGHT - (GuiRecipeCatalyst.fullBorder * 2));
|
||||
changePage(0);
|
||||
refreshSlots();
|
||||
final int recipesPerPage = getRecipesPerPage();
|
||||
@@ -996,6 +995,7 @@ public abstract class GuiRecipe<H extends IRecipeHandler> extends GuiContainer i
|
||||
checkYShift();
|
||||
|
||||
if (!limitToOneRecipe) {
|
||||
RecipeCatalysts.updatePosition(ySize - BG_TOP_HEIGHT - (GuiRecipeCatalyst.fullBorder * 2));
|
||||
toggleSearch.w = toggleSearch.h = 12;
|
||||
toggleSearch.x = borderPadding + buttonWidth;
|
||||
toggleSearch.y = 17;
|
||||
|
||||
@@ -11,22 +11,27 @@ import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
import codechicken.nei.api.IStackStringifyHandler;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.ReflectionHelper;
|
||||
|
||||
public class GTFluidStackStringifyHandler implements IStackStringifyHandler {
|
||||
|
||||
protected static Class<?> GTDisplayFluid = null;
|
||||
protected static Class<?> itemFluidDisplay = null;
|
||||
protected static Method getFluidDisplayStack = null;
|
||||
protected static Method getFluidFromDisplayStack = null;
|
||||
public static boolean replaceAE2FCFluidDrop = false;
|
||||
|
||||
static {
|
||||
try {
|
||||
final Class<?> gtUtility = Class.forName("gregtech.api.util.GT_Utility");
|
||||
final ClassLoader loader = GTFluidStackStringifyHandler.class.getClassLoader();
|
||||
final Class<?> gtUtility = ReflectionHelper
|
||||
.getClass(loader, "gregtech.api.util.GTUtility", "gregtech.api.util.GT_Utility");
|
||||
|
||||
GTDisplayFluid = Class.forName("gregtech.common.items.GT_FluidDisplayItem");
|
||||
itemFluidDisplay = ReflectionHelper.getClass(
|
||||
loader,
|
||||
"gregtech.common.items.ItemFluidDisplay",
|
||||
"gregtech.common.items.GT_FluidDisplayItem");
|
||||
getFluidFromDisplayStack = gtUtility.getMethod("getFluidFromDisplayStack", ItemStack.class);
|
||||
getFluidDisplayStack = gtUtility.getMethod("getFluidDisplayStack", FluidStack.class, boolean.class);
|
||||
|
||||
} catch (Exception ignored) {
|
||||
/* Do nothing */
|
||||
}
|
||||
@@ -72,7 +77,7 @@ public class GTFluidStackStringifyHandler implements IStackStringifyHandler {
|
||||
final Item item = stack.getItem();
|
||||
|
||||
try {
|
||||
if (getFluidFromDisplayStack != null && GTDisplayFluid != null && GTDisplayFluid.isInstance(item)) {
|
||||
if (getFluidFromDisplayStack != null && itemFluidDisplay != null && itemFluidDisplay.isInstance(item)) {
|
||||
final Object obj = getFluidFromDisplayStack.invoke(null, stack);
|
||||
|
||||
if (obj != null) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Each line in this file should either be a comment (line starts with '#'), or a prefix of a fully-qualified class name
|
||||
# (that includes the package name) for a Minecraft GUI Container screen.
|
||||
# If you delete this file, it will be regenerated with the default enable autofocus list.
|
||||
net.minecraft.client.gui.inventory.GuiInventory
|
||||
net.minecraft.client.gui.
|
||||
makamys.satchels.gui.GuiSatchelsInventory
|
||||
@@ -822,6 +822,7 @@ gt.recipe.largeboilerfakefuels,gregtech:gt.blockmachines:1022,,gregtech,TRUE,gre
|
||||
gt.recipe.largeboilerfakefuels,gregtech:gt.blockmachines:1023,,gregtech,TRUE,gregapi_post,,,,,
|
||||
gt.recipe.vacuumfreezer,gregtech:gt.blockmachines:1002,,gregtech,TRUE,gregapi_post,,,,,
|
||||
smelting,gregtech:gt.blockmachines:1003,,gregtech,TRUE,gregapi_post,,,,,
|
||||
smelting,gregtech:gt.blockmachines:15412,,gregtech,TRUE,gregapi_post,,,,,
|
||||
gt.recipe.dieselgeneratorfuel,gregtech:gt.blockmachines:1110,,gregtech,TRUE,gregapi_post,,,,,
|
||||
gt.recipe.dieselgeneratorfuel,gregtech:gt.blockmachines:1111,,gregtech,TRUE,gregapi_post,,,,,
|
||||
gt.recipe.dieselgeneratorfuel,gregtech:gt.blockmachines:1112,,gregtech,TRUE,gregapi_post,,,,,
|
||||
|
||||
|
@@ -227,6 +227,9 @@ nei.options.inventory.search.patternMode.2=Regex
|
||||
nei.options.inventory.search.quoteDropItemName=Quote Drop Item Name
|
||||
nei.options.inventory.search.quoteDropItemName.true=Yes
|
||||
nei.options.inventory.search.quoteDropItemName.false=No
|
||||
nei.options.inventory.search.format=Search Format
|
||||
nei.options.inventory.search.format.true=Old Format
|
||||
nei.options.inventory.search.format.false=Extended
|
||||
nei.options.inventory.search.modNameSearchMode=Mod Name Search
|
||||
nei.options.inventory.search.modNameSearchMode.0=Always
|
||||
nei.options.inventory.search.modNameSearchMode.1=Prefix: %s
|
||||
@@ -479,7 +482,7 @@ nei.presets.mode.hide=Hide
|
||||
nei.presets.mode.hide.char=H
|
||||
nei.presets.mode.hide.tip=Hide items in panel
|
||||
nei.presets.mode.remove=Remove
|
||||
nei.presets.mode.remove.tip=Hide items in panel and it recipes
|
||||
nei.presets.mode.remove.tip=Hide items in panel and their recipes
|
||||
nei.presets.mode.remove.char=R
|
||||
nei.presets.mode.group=Group
|
||||
nei.presets.mode.group.tip=Create custom collapsible items group
|
||||
|
||||
Reference in new issue
Block a user