aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/gregtech/GT_Mod.java1
-rw-r--r--src/main/java/gregtech/api/enums/Dyes.java2
-rw-r--r--src/main/java/gregtech/client/GT_GUI_ClientConfig.java44
-rw-r--r--src/main/java/gregtech/client/GT_GuiFactory.java29
-rw-r--r--src/main/java/gregtech/common/GT_Client.java14
-rw-r--r--src/main/java/gregtech/loaders/preload/GT_PreLoad.java33
-rw-r--r--src/main/resources/assets/gregtech/lang/en_US.lang28
7 files changed, 137 insertions, 14 deletions
diff --git a/src/main/java/gregtech/GT_Mod.java b/src/main/java/gregtech/GT_Mod.java
index ad9686b809..1309186528 100644
--- a/src/main/java/gregtech/GT_Mod.java
+++ b/src/main/java/gregtech/GT_Mod.java
@@ -58,6 +58,7 @@ import static gregtech.api.enums.GT_Values.MOD_ID_FR;
@SuppressWarnings("ALL")
@Mod(modid = "gregtech", name = "GregTech", version = "MC1710", useMetadata = false,
+ guiFactory = "gregtech.client.GT_GuiFactory",
dependencies = " required-after:IC2;" +
" required-after:structurelib;" +
" after:dreamcraft;" +
diff --git a/src/main/java/gregtech/api/enums/Dyes.java b/src/main/java/gregtech/api/enums/Dyes.java
index 418cea65ff..6b1ce244c0 100644
--- a/src/main/java/gregtech/api/enums/Dyes.java
+++ b/src/main/java/gregtech/api/enums/Dyes.java
@@ -44,12 +44,14 @@ public enum Dyes implements IColorModulationContainer {
public final byte mIndex;
public final String mName;
public final short[] mRGBa;
+ public final short[] mOriginalRGBa;
private final ArrayList<Fluid> mFluidDyes = new GT_ArrayList<Fluid>(false, 1);
Dyes(int aIndex, int aR, int aG, int aB, String aName) {
mIndex = (byte) aIndex;
mName = aName;
mRGBa = new short[]{(short) aR, (short) aG, (short) aB, 0};
+ mOriginalRGBa = mRGBa.clone();
}
public static Dyes get(int aColor) {
diff --git a/src/main/java/gregtech/client/GT_GUI_ClientConfig.java b/src/main/java/gregtech/client/GT_GUI_ClientConfig.java
new file mode 100644
index 0000000000..436be7d1df
--- /dev/null
+++ b/src/main/java/gregtech/client/GT_GUI_ClientConfig.java
@@ -0,0 +1,44 @@
+package gregtech.client;
+
+import cpw.mods.fml.client.config.GuiConfig;
+import cpw.mods.fml.client.config.IConfigElement;
+import gregtech.api.GregTech_API;
+import net.minecraft.client.gui.GuiScreen;
+import net.minecraftforge.common.config.ConfigCategory;
+import net.minecraftforge.common.config.ConfigElement;
+import net.minecraftforge.common.config.Configuration;
+import net.minecraftforge.common.config.Property;
+
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class GT_GUI_ClientConfig extends GuiConfig {
+ public GT_GUI_ClientConfig(GuiScreen parentScreen) {
+ super(parentScreen, getConfigElements(), "gregtech", "client", false, false, getAbridgedConfigPath(GregTech_API.sClientDataFile.mConfig.toString()));
+ }
+
+ @SuppressWarnings("rawtypes")
+ private static List<IConfigElement> getConfigElements() {
+ final Configuration config = GregTech_API.sClientDataFile.mConfig;
+ setLanguageKeys(config);
+ return config.getCategoryNames().stream()
+ .filter(name -> name.indexOf('.') == -1)
+ .map(name -> new ConfigElement(config.getCategory(name)))
+ .collect(Collectors.toList());
+ }
+
+ private static void setLanguageKeys(Configuration config) {
+ for (String categoryName : config.getCategoryNames()) {
+ ConfigCategory category = config.getCategory(categoryName);
+ category.setLanguageKey("GT5U.config." + categoryName);
+ for (Map.Entry<String, Property> entry : category.entrySet()) {
+ // drop the default value in name
+ String name = entry.getKey();
+ int defaultStart = name.lastIndexOf('_');
+ String realName = defaultStart >= 0 ? name.substring(0, defaultStart) : name;
+ entry.getValue().setLanguageKey(String.format("%s.%s", category.getLanguagekey(), realName));
+ }
+ }
+ }
+}
diff --git a/src/main/java/gregtech/client/GT_GuiFactory.java b/src/main/java/gregtech/client/GT_GuiFactory.java
new file mode 100644
index 0000000000..6bc489e297
--- /dev/null
+++ b/src/main/java/gregtech/client/GT_GuiFactory.java
@@ -0,0 +1,29 @@
+package gregtech.client;
+
+import cpw.mods.fml.client.IModGuiFactory;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.GuiScreen;
+
+import java.util.Set;
+
+public class GT_GuiFactory implements IModGuiFactory {
+ @Override
+ public void initialize(Minecraft minecraftInstance) {
+
+ }
+
+ @Override
+ public Class<? extends GuiScreen> mainConfigGuiClass() {
+ return GT_GUI_ClientConfig.class;
+ }
+
+ @Override
+ public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
+ return null;
+ }
+
+ @Override
+ public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
+ return null;
+ }
+}
diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java
index 2637342fc2..21e8eba584 100644
--- a/src/main/java/gregtech/common/GT_Client.java
+++ b/src/main/java/gregtech/common/GT_Client.java
@@ -11,6 +11,7 @@ import codechicken.lib.vec.Transformation;
import codechicken.lib.vec.Translation;
import com.gtnewhorizon.structurelib.alignment.IAlignment;
import com.gtnewhorizon.structurelib.alignment.IAlignmentProvider;
+import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
@@ -43,6 +44,7 @@ import gregtech.common.render.GT_MetaGenerated_Tool_Renderer;
import gregtech.common.render.GT_PollutionRenderer;
import gregtech.common.render.GT_Renderer_Block;
import gregtech.common.render.GT_Renderer_Entity_Arrow;
+import gregtech.loaders.preload.GT_PreLoad;
import ic2.api.tile.IWrenchable;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
@@ -568,6 +570,18 @@ public class GT_Client extends GT_Proxy
}
@SubscribeEvent
+ public void onConfigChange(ConfigChangedEvent.OnConfigChangedEvent e) {
+ if ("gregtech".equals(e.modID) && "client".equals(e.configID)) {
+ GregTech_API.sClientDataFile.mConfig.save();
+ // refresh client preference and send to server, since it's the only config we allow changing at runtime.
+ mPreference = new GT_ClientPreference(GregTech_API.sClientDataFile);
+ GT_PreLoad.loadClientConfig();
+ if (e.isWorldRunning)
+ GT_Values.NW.sendToServer(new GT_Packet_ClientPreference(mPreference));
+ }
+ }
+
+ @SubscribeEvent
public void onDrawBlockHighlight(DrawBlockHighlightEvent aEvent) {
Block aBlock = aEvent.player.worldObj.getBlock(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ);
TileEntity aTileEntity = aEvent.player.worldObj.getTileEntity(aEvent.target.blockX, aEvent.target.blockY, aEvent.target.blockZ);
diff --git a/src/main/java/gregtech/loaders/preload/GT_PreLoad.java b/src/main/java/gregtech/loaders/preload/GT_PreLoad.java
index 15f402e062..9984b229c9 100644
--- a/src/main/java/gregtech/loaders/preload/GT_PreLoad.java
+++ b/src/main/java/gregtech/loaders/preload/GT_PreLoad.java
@@ -362,20 +362,8 @@ public class GT_PreLoad {
GregTech_API.sDrinksAlwaysDrinkable = tMainConfig.get(GT_Mod.aTextGeneral, "drinks_always_drinkable", false).getBoolean(false);
GregTech_API.sDoShowAllItemsInCreative = tMainConfig.get(GT_Mod.aTextGeneral, "show_all_metaitems_in_creative_and_NEI", false).getBoolean(false);
GregTech_API.sMultiThreadedSounds = tMainConfig.get(GT_Mod.aTextGeneral, "sound_multi_threading", false).getBoolean(false);
- String SBdye0 = "ColorModulation.";
- Arrays.stream(Dyes.values()).filter(tDye -> (tDye != Dyes._NULL) && (tDye.mIndex < 0)).forEach(tDye -> {
- String SBdye1 = SBdye0 + tDye;
- tDye.mRGBa[0] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "R", tDye.mRGBa[0]))));
- tDye.mRGBa[1] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "G", tDye.mRGBa[1]))));
- tDye.mRGBa[2] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "B", tDye.mRGBa[2]))));
- }
- );
- GT_Mod.gregtechproxy.mRenderTileAmbientOcclusion = GregTech_API.sClientDataFile.get("render", "TileAmbientOcclusion", true);
- GT_Mod.gregtechproxy.mRenderGlowTextures = GregTech_API.sClientDataFile.get("render", "GlowTextures", true);
- GT_Mod.gregtechproxy.mRenderFlippedMachinesFlipped = GregTech_API.sClientDataFile.get("render", "RenderFlippedMachinesFlipped", true);
- GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch = GregTech_API.sClientDataFile.get("render", "RenderIndicatorsOnHatch", true);
- GT_Mod.gregtechproxy.mRenderDirtParticles = GregTech_API.sClientDataFile.get("render", "RenderDirtParticles", true);
- GT_Mod.gregtechproxy.mRenderPollutionFog = GregTech_API.sClientDataFile.get("render", "RenderPollutionFog", true);
+
+ loadClientConfig();
GT_Mod.gregtechproxy.mMaxEqualEntitiesAtOneSpot = tMainConfig.get(GT_Mod.aTextGeneral, "MaxEqualEntitiesAtOneSpot", 3).getInt(3);
GT_Mod.gregtechproxy.mSkeletonsShootGTArrows = tMainConfig.get(GT_Mod.aTextGeneral, "SkeletonsShootGTArrows", 16).getInt(16);
@@ -524,4 +512,21 @@ public class GT_PreLoad {
}
}
}
+
+ public static void loadClientConfig() {
+ String SBdye0 = "ColorModulation.";
+ Arrays.stream(Dyes.values()).filter(tDye -> (tDye != Dyes._NULL) && (tDye.mIndex < 0)).forEach(tDye -> {
+ String SBdye1 = SBdye0 + tDye;
+ tDye.mRGBa[0] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "R", tDye.mOriginalRGBa[0]))));
+ tDye.mRGBa[1] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "G", tDye.mOriginalRGBa[1]))));
+ tDye.mRGBa[2] = ((short) Math.min(255, Math.max(0, GregTech_API.sClientDataFile.get(SBdye1, "B", tDye.mOriginalRGBa[2]))));
+ }
+ );
+ GT_Mod.gregtechproxy.mRenderTileAmbientOcclusion = GregTech_API.sClientDataFile.get("render", "TileAmbientOcclusion", true);
+ GT_Mod.gregtechproxy.mRenderGlowTextures = GregTech_API.sClientDataFile.get("render", "GlowTextures", true);
+ GT_Mod.gregtechproxy.mRenderFlippedMachinesFlipped = GregTech_API.sClientDataFile.get("render", "RenderFlippedMachinesFlipped", true);
+ GT_Mod.gregtechproxy.mRenderIndicatorsOnHatch = GregTech_API.sClientDataFile.get("render", "RenderIndicatorsOnHatch", true);
+ GT_Mod.gregtechproxy.mRenderDirtParticles = GregTech_API.sClientDataFile.get("render", "RenderDirtParticles", true);
+ GT_Mod.gregtechproxy.mRenderPollutionFog = GregTech_API.sClientDataFile.get("render", "RenderPollutionFog", true);
+ }
}
diff --git a/src/main/resources/assets/gregtech/lang/en_US.lang b/src/main/resources/assets/gregtech/lang/en_US.lang
index 8a75355f64..f4a43e9ba0 100644
--- a/src/main/resources/assets/gregtech/lang/en_US.lang
+++ b/src/main/resources/assets/gregtech/lang/en_US.lang
@@ -113,6 +113,34 @@ GT5U.multiblock.problems=Problems
GT5U.multiblock.mei=Max Energy Income
GT5U.multiblock.usage=Probably uses
+GT5U.config.colormodulation=Color Modulator
+GT5U.config.colormodulation.cable_insulation=Cable Insulation
+GT5U.config.colormodulation.cable_insulation.B=Blue
+GT5U.config.colormodulation.cable_insulation.G=Green
+GT5U.config.colormodulation.cable_insulation.R=Red
+GT5U.config.colormodulation.construction_foam=Construction Foam
+GT5U.config.colormodulation.construction_foam.B=Blue
+GT5U.config.colormodulation.construction_foam.G=Green
+GT5U.config.colormodulation.construction_foam.R=Red
+GT5U.config.colormodulation.machine_metal=Machine Metal (Default GUI color)
+GT5U.config.colormodulation.machine_metal.B=Blue
+GT5U.config.colormodulation.machine_metal.G=Green
+GT5U.config.colormodulation.machine_metal.R=Red
+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
+GT5U.config.preference.mSingleBlockInitialAllowMultiStack=Single Block Initial MultiStack Input Status
+GT5U.config.preference.mSingleBlockInitialAllowMultiStack.tooltip=Whether single block machines enable multistack input upon placed\nDoes not affect busses placed by others\nDoes not affect existing busses
+GT5U.config.preference.mSingleBlockInitialFilter=Single Block Initial Input Filter Status
+GT5U.config.preference.mSingleBlockInitialFilter.tooltip=Whether single block machines enable the input filter upon placed\nDoes not affect busses placed by others\nDoes not affect existing busses
+GT5U.config.render=Rendering
+GT5U.config.render.GlowTextures=Use Glowing Textures
+GT5U.config.render.RenderDirtParticles=Render Dirt Particles
+GT5U.config.render.RenderFlippedMachinesFlipped=Render flipped machines with flipped textures
+GT5U.config.render.RenderIndicatorsOnHatch=Render indicator on hatch
+GT5U.config.render.RenderPollutionFog=Render pollution fog
+GT5U.config.render.TileAmbientOcclusion=Enable Ambient Occlusion
+
achievement.Naquadah=Find Naquadah Ore
achievement.Naquadah.desc=Height: 10-90, Chance: 10, Asteroids/Venus/Titan/Oberon/Pluto/KuiperBelt/VegaB/BarnardE/BarnardF//
achievement.NaquadahEnriched=Find Enriched Naquadah Ore