Compare commits

..
Author SHA1 Message Date
Martin Robertz 5b2e934284 fix 2024-12-26 23:33:14 +01:00
Martin Robertz d3184d4a4f Merge remote-tracking branch 'slprime/extend_subset_widget' into dev
# Conflicts:
#	src/main/java/codechicken/nei/ItemPanel.java
#	src/main/java/codechicken/nei/guihook/GuiContainerManager.java
2024-12-26 23:23:41 +01:00
Martin Robertz 581f909721 Merge remote-tracking branch 'slprime/option_integer_field_width' into dev 2024-12-26 23:21:48 +01:00
Martin Robertz dc51a285b2 Merge remote-tracking branch 'origin/colored-tooltips' into dev 2024-12-26 23:21:16 +01:00
Martin Robertz 43c2a09996 Merge remote-tracking branch 'slprime/fix_item_rendering_cache' into dev 2024-12-26 23:19:20 +01:00
Martin Robertz 8841e81cfc Merge remote-tracking branch 'slprime/hide_items_until_searching' into dev 2024-12-26 23:19:11 +01:00
3 changed files with 33 additions and 25 deletions

No files matched your search

+12 -3
View File
@@ -1,5 +1,9 @@
package codechicken.nei;
import static codechicken.nei.LayoutManager.less;
import static codechicken.nei.LayoutManager.more;
import static codechicken.nei.LayoutManager.quantity;
import java.awt.Color;
import java.util.ArrayList;
import java.util.HashMap;
@@ -398,15 +402,15 @@ public class ItemPanel extends PanelWidget {
historyPanel.h = ItemsGrid.SLOT_SIZE * NEIClientConfig.getIntSetting("inventory.history.useRows");
if (NEIClientConfig.showItemQuantityWidget() || !NEIClientConfig.isSearchWidgetCentered()) {
historyPanel.y = LayoutManager.quantity.y - historyPanel.h - PanelWidget.PADDING;
return LayoutManager.quantity.h + historyPanel.h + PanelWidget.PADDING * 2;
historyPanel.y = quantity.y - historyPanel.h - PanelWidget.PADDING;
return quantity.h + historyPanel.h + PanelWidget.PADDING * 2;
} else {
historyPanel.y = y + h - historyPanel.h;
return historyPanel.h + PanelWidget.PADDING;
}
}
return LayoutManager.quantity.h + PanelWidget.PADDING;
return quantity.h + PanelWidget.PADDING;
}
@Override
@@ -414,6 +418,11 @@ public class ItemPanel extends PanelWidget {
super.setVisible();
if (grid.getPerPage() > 0) {
if (NEIClientConfig.showItemQuantityWidget()) {
LayoutManager.addWidget(more);
LayoutManager.addWidget(less);
LayoutManager.addWidget(quantity);
}
if (!CollapsibleItems.isEmpty() && !grid.isEmpty()) {
LayoutManager.addWidget(toggleGroups);
@@ -723,25 +723,21 @@ public class NEIClientConfig {
public static void loadWorld(String worldPath) {
unloadWorld();
NEIClientConfig.worldPath = worldPath;
setInternalEnabled(true);
logger.debug("Loading " + (Minecraft.getMinecraft().isSingleplayer() ? "Local" : "Remote") + " World");
if (!worldPath.equals(NEIClientConfig.worldPath)) {
NEIClientConfig.worldPath = worldPath;
final File specificDir = new File(CommonUtils.getMinecraftDir(), "saves/NEI/" + worldPath);
final boolean newWorld = !specificDir.exists();
logger.debug("Loading " + (Minecraft.getMinecraft().isSingleplayer() ? "Local" : "Remote") + " World");
final File specificDir = new File(CommonUtils.getMinecraftDir(), "saves/NEI/" + worldPath);
final boolean newWorld = !specificDir.exists();
if (newWorld) {
specificDir.mkdirs();
}
world = new ConfigSet(new File(specificDir, "NEI.dat"), new ConfigFile(new File(specificDir, "NEI.cfg")));
bootNEI(ClientUtils.getWorld());
onWorldLoad(newWorld);
ItemPanels.bookmarkPanel.load();
if (newWorld) {
specificDir.mkdirs();
}
world = new ConfigSet(new File(specificDir, "NEI.dat"), new ConfigFile(new File(specificDir, "NEI.cfg")));
bootNEI(ClientUtils.getWorld());
onWorldLoad(newWorld);
}
public static String getWorldPath() {
@@ -842,8 +838,9 @@ public class NEIClientConfig {
});
RecipeCatalysts.loadCatalystInfo();
CollapsibleItems.load();
ItemPanels.bookmarkPanel.load();
SubsetWidget.loadHidden();
CollapsibleItems.load();
ItemSorter.loadConfig();
// Set pluginNEIConfigLoaded here before posting the NEIConfigsLoadedEvent. This used to be the
@@ -857,6 +854,10 @@ public class NEIClientConfig {
ItemList.loadItems.restart();
}
}.start();
} else {
ItemPanels.bookmarkPanel.load();
SubsetWidget.loadHidden();
ItemList.loadItems.restart();
}
}
@@ -10,7 +10,6 @@ import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
@@ -22,7 +21,6 @@ import codechicken.nei.recipe.stackinfo.GTFluidStackStringifyHandler;
public class StackInfo {
private static final FluidStack NULL_FLUID = new FluidStack(FluidRegistry.WATER, 0);
public static final ArrayList<IStackStringifyHandler> stackStringifyHandlers = new ArrayList<>();
private static final HashMap<String, HashMap<String, String[]>> guidfilters = new HashMap<>();
private static final ItemStackMap<String> guidcache = new ItemStackMap<>();
@@ -32,7 +30,7 @@ public class StackInfo {
@Override
protected boolean removeEldestEntry(Map.Entry<ItemStack, FluidStack> eldest) {
return size() > 200;
return size() > 20;
}
};
@@ -94,7 +92,7 @@ public class StackInfo {
return true;
}
public static synchronized FluidStack getFluid(ItemStack stack) {
public static FluidStack getFluid(ItemStack stack) {
FluidStack fluid = fluidcache.get(stack);
if (fluid == null && !fluidcache.containsKey(stack)) {
@@ -103,10 +101,10 @@ public class StackInfo {
fluid = stackStringifyHandlers.get(i).getFluid(stack);
}
fluidcache.put(stack, fluid == null ? NULL_FLUID : fluid);
fluidcache.put(stack, fluid);
}
return fluid == NULL_FLUID ? null : fluid;
return fluid;
}
public static boolean isFluidContainer(ItemStack stack) {