From d7d3eef9047796abbbf1fd4b1d22f91a0e543983 Mon Sep 17 00:00:00 2001 From: makeo Date: Thu, 7 Jan 2016 20:00:46 +0100 Subject: [PATCH] -Fixed missing golemblurb --- .../client/events/RenderEventHandler.java | 36 +++++++++++++++++++ .../assets/gadomancy/lang/en_US.lang | 2 +- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/main/java/makeo/gadomancy/client/events/RenderEventHandler.java b/src/main/java/makeo/gadomancy/client/events/RenderEventHandler.java index 4e8a14e..b2b8923 100644 --- a/src/main/java/makeo/gadomancy/client/events/RenderEventHandler.java +++ b/src/main/java/makeo/gadomancy/client/events/RenderEventHandler.java @@ -2,6 +2,8 @@ package makeo.gadomancy.client.events; import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import makeo.gadomancy.api.GadomancyApi; +import makeo.gadomancy.api.golems.cores.AdditionalGolemCore; import makeo.gadomancy.client.gui.GuiResearchRecipeAuraEffects; import makeo.gadomancy.client.util.ExtendedTypeDisplayManager; import makeo.gadomancy.client.util.FamiliarHandlerClient; @@ -22,6 +24,7 @@ import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.StatCollector; import net.minecraftforge.client.event.*; import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; @@ -29,8 +32,10 @@ import thaumcraft.api.BlockCoordinates; import thaumcraft.api.IArchitect; import thaumcraft.api.research.ResearchItem; import thaumcraft.api.wands.ItemFocusBasic; +import thaumcraft.client.gui.GuiGolem; import thaumcraft.client.gui.GuiResearchRecipe; import thaumcraft.client.lib.REHWandHandler; +import thaumcraft.common.entities.golems.EntityGolemBase; import thaumcraft.common.items.relics.ItemThaumometer; import thaumcraft.common.items.wands.ItemWandCasting; @@ -48,6 +53,37 @@ public class RenderEventHandler { private static final REHWandHandler WAND_HANDLER = new REHWandHandler(); private static final FakeArchitectItem ARCHITECT_ITEM = new FakeArchitectItem(); + private Object oldGolemblurb = null; + private int blurbId; + + @SubscribeEvent + public void on(GuiScreenEvent.DrawScreenEvent.Pre e) { + if(e.gui instanceof GuiGolem) { + GuiGolem gui = (GuiGolem) e.gui; + EntityGolemBase golem = new Injector(gui, GuiGolem.class).getField("golem"); + if(golem != null) { + AdditionalGolemCore core = GadomancyApi.getAdditionalGolemCore(golem); + if(core != null) { + blurbId = core.getBaseCore(); + String key = "golemblurb." + blurbId + ".text"; + oldGolemblurb = ResourceReloadListener.languageList.get(key); + ResourceReloadListener.languageList.put(key, StatCollector.translateToLocal(core.getUnlocalizedGuiText())); + } + } + } + + ResourceReloadListener.languageList.get(""); + } + + @SubscribeEvent + public void on(GuiScreenEvent.DrawScreenEvent.Post e) { + if(oldGolemblurb != null) { + String key = "golemblurb." + blurbId + ".text"; + ResourceReloadListener.languageList.put(key, oldGolemblurb); + oldGolemblurb = null; + } + } + @SubscribeEvent public void on(DrawBlockHighlightEvent e) { if(e.currentItem == null) return; diff --git a/src/main/resources/assets/gadomancy/lang/en_US.lang b/src/main/resources/assets/gadomancy/lang/en_US.lang index c3afe99..18f7690 100644 --- a/src/main/resources/assets/gadomancy/lang/en_US.lang +++ b/src/main/resources/assets/gadomancy/lang/en_US.lang @@ -131,7 +131,7 @@ tc.research_name.GADOMANCY.ARCANE_PACKAGER=Arcane Packager tc.research_text.GADOMANCY.ARCANE_PACKAGER=Compressing items gadomancy.golemblurb.default=?? -gadomancy.golemblurb.breakcore=Master, should I break anything, or something specific? +gadomancy.golemblurb.breakcore=Master, should I break anything, or something specific and should I use a tool or none? gadomancy.golem.breakcore=Break gadomancy.golem.bodyguardcore=Bodyguard