aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/gregtech/api/GregTech_API.java23
-rw-r--r--src/main/java/gregtech/common/GT_Proxy.java5
-rw-r--r--src/main/java/gregtech/loaders/preload/GT_PreLoad.java8
-rw-r--r--src/main/resources/assets/gregtech/lang/en_US.lang2
4 files changed, 35 insertions, 3 deletions
diff --git a/src/main/java/gregtech/api/GregTech_API.java b/src/main/java/gregtech/api/GregTech_API.java
index d38c9181dd..b4f1e0fcd8 100644
--- a/src/main/java/gregtech/api/GregTech_API.java
+++ b/src/main/java/gregtech/api/GregTech_API.java
@@ -2,8 +2,10 @@ package gregtech.api;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
+import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.GT_Mod;
import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.IDamagableItem;
@@ -31,6 +33,7 @@ import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Utility;
import gregtech.api.world.GT_Worldgen;
+import gregtech.common.items.GT_IntegratedCircuit_Item;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
@@ -44,6 +47,7 @@ import net.minecraftforge.fluids.Fluid;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
@@ -684,7 +688,24 @@ public class GregTech_API {
* DO NOT MODIFY THE ItemStacks!
*/
public static List<ItemStack> getConfigurationCircuitList(int machineTier) {
- return Collections.unmodifiableList(sConfigurationLists.computeIfAbsent(machineTier, (t) -> sRealConfigurationList.entries().stream().filter(e -> e.getKey() <= machineTier).map(Map.Entry::getValue).collect(Collectors.toList())));
+ return Collections.unmodifiableList(
+ sConfigurationLists.computeIfAbsent(machineTier, (t) -> sRealConfigurationList.entries().stream().filter(e -> e.getKey() <= machineTier).map(Map.Entry::getValue).collect(Collectors.toList()))
+ .stream()
+ .sorted(getConfigurationCircuitsComparator())
+ .collect(Collectors.toList())
+ );
+ }
+
+ public static Comparator<ItemStack> getConfigurationCircuitsComparator() {
+ return Comparator
+ .comparingInt((ItemStack is) -> {
+ // By default, the Programmed Circuit should be the earliest configuration circuit to which the player is exposed
+ if (GT_Mod.gregtechproxy.mCircuitsOrder.isEmpty())
+ return is.getItem() instanceof GT_IntegratedCircuit_Item ? 0 : 1;
+ return GT_Mod.gregtechproxy.mCircuitsOrder.getOrDefault(GameRegistry.findUniqueIdentifierFor(is.getItem()).toString(), Integer.MAX_VALUE);
+ })
+ .thenComparing(ItemStack::getUnlocalizedName)
+ .thenComparing(ItemStack::getItemDamage);
}
public static void registerCircuitProgrammer(ItemStack stack, boolean ignoreNBT, boolean useContainer) {
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java
index 987b573637..40b7381e48 100644
--- a/src/main/java/gregtech/common/GT_Proxy.java
+++ b/src/main/java/gregtech/common/GT_Proxy.java
@@ -290,6 +290,11 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
*/
public int mTooltipShiftVerbosity = 3;
+ /**
+ * What is the order of the circuits when they are selected?
+ */
+ public Map<String, Integer> mCircuitsOrder = new HashMap<>();
+
public static final int GUI_ID_COVER_SIDE_BASE = 10; // Takes GUI ID 10 - 15
public static Map<String, Integer> oreDictBurnTimes = new HashMap<>();
diff --git a/src/main/java/gregtech/loaders/preload/GT_PreLoad.java b/src/main/java/gregtech/loaders/preload/GT_PreLoad.java
index e3d4178d97..4fb7ec54a3 100644
--- a/src/main/java/gregtech/loaders/preload/GT_PreLoad.java
+++ b/src/main/java/gregtech/loaders/preload/GT_PreLoad.java
@@ -167,7 +167,7 @@ public class GT_PreLoad {
}
public static void runMineTweakerCompat() {
- if (!Loader.isModLoaded("MineTweaker3"))
+ if (!Loader.isModLoaded("MineTweaker3"))
return;
GT_FML_LOGGER.info("preReader");
@@ -535,6 +535,10 @@ public class GT_PreLoad {
GT_Mod.gregtechproxy.mCoverTabsFlipped = GregTech_API.sClientDataFile.get("interface", "FlipCoverTabs", false);
GT_Mod.gregtechproxy.mTooltipVerbosity = GregTech_API.sClientDataFile.get("interface", "TooltipVerbosity", 2);
GT_Mod.gregtechproxy.mTooltipShiftVerbosity = GregTech_API.sClientDataFile.get("interface", "TooltipShiftVerbosity", 3);
-
+ final String[] Circuits = GregTech_API.sClientDataFile.get("interface", "CircuitsOrder" );
+ GT_Mod.gregtechproxy.mCircuitsOrder.clear();
+ for (int i = 0; i < Circuits.length; i++) {
+ GT_Mod.gregtechproxy.mCircuitsOrder.putIfAbsent(Circuits[i], i);
+ }
}
}
diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang
index 5a95aa9a6c..4e505e3b68 100644
--- a/src/main/resources/assets/gregtech/lang/en_US.lang
+++ b/src/main/resources/assets/gregtech/lang/en_US.lang
@@ -186,6 +186,8 @@ GT5U.config.interface.TooltipVerbosity=Tooltip verbosity (See details)
GT5U.config.interface.TooltipVerbosity.tooltip=How verbose should GregTech interface tooltips be?\n0: No tooltips\n1: One line tooltips only\n2: Normal tooltips [DEFAULT]\n3+: Extended tooltips
GT5U.config.interface.TooltipShiftVerbosity=Tooltip verbosity (LSHIFT Down)
GT5U.config.interface.TooltipShiftVerbosity.tooltip=How verbose should GregTech interface tooltips be when LSHIFT is held down?\n0: No tooltips\n1: One line tooltips only\n2: Normal tooltips\n3+: Extended tooltips [DEFAULT]
+GT5U.config.interface.CircuitsOrder=Circuits Order (See details)
+GT5U.config.interface.CircuitsOrder.tooltip=What is the order of the circuits when they are selected?\nFill in the Unique Identifier of the circuits.\nFor example: gregtech:gt.integrated_circuit
GT5U.config.preference=Client Preference
GT5U.config.preference.mInputBusInitialFilter=Input Bus Initial Input Filter Status
GT5U.config.preference.mInputBusInitialFilter.tooltip=Whether Input busses enable the input filter upon placed\nDoes not affect busses placed by others\nDoes not affect existing busses