diff options
author | Glease <4586901+Glease@users.noreply.github.com> | 2022-01-06 15:53:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-06 08:53:10 +0100 |
commit | 8690a845534cb40802878193d5e469128d57a31d (patch) | |
tree | fcaef19c1ee384d5b3f27dc060c64cffab7a9432 /src/main/java/gregtech/common | |
parent | 2721dd99417a48db7c96ee87adc4bc5e63e15947 (diff) | |
download | GT5-Unofficial-8690a845534cb40802878193d5e469128d57a31d.tar.gz GT5-Unofficial-8690a845534cb40802878193d5e469128d57a31d.tar.bz2 GT5-Unofficial-8690a845534cb40802878193d5e469128d57a31d.zip |
Add in game GUI to configure client preference (#852)
* Add in game GUI to configure client preference
* Fix backslash
Diffstat (limited to 'src/main/java/gregtech/common')
-rw-r--r-- | src/main/java/gregtech/common/GT_Client.java | 14 |
1 files changed, 14 insertions, 0 deletions
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); |