-Fixed some really old golem type api errors... But nobody is using the api right?

-Added golem slot texture + small modification to obsidian golem texture
This commit is contained in:
makeo committed 2015-12-24 18:31:00 +01:00
1 parent df5548fa3c
commit a978d0b859
10 files changed
+46 -6

No files matched your search

@@ -56,6 +56,7 @@ import thaumcraft.common.tiles.TileEldritchAltar;
import thaumcraft.common.tiles.TileEldritchCap;
import thaumcraft.common.tiles.TileEldritchObelisk;
import java.util.ArrayList;
import java.util.List;
/**
@@ -163,7 +164,7 @@ public class ClientProxy extends CommonProxy {
IResourceManager manager = Minecraft.getMinecraft().getResourceManager();
if(manager instanceof SimpleReloadableResourceManager) {
SimpleReloadableResourceManager rm = (SimpleReloadableResourceManager) manager;
rm.registerReloadListener(new ResourceReloadListener());
rm.registerReloadListener(ResourceReloadListener.getInstance());
}
MinecraftForge.EVENT_BUS.register(EffectHandler.getInstance());
@@ -225,4 +226,11 @@ public class ClientProxy extends CommonProxy {
}
return null;
}
public final List<Runnable> clientActions = new ArrayList<Runnable>();
@Override
public void runDelayedClientSide(Runnable run) {
clientActions.add(run);
}
}
@@ -3,10 +3,14 @@ package makeo.gadomancy.client.events;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.network.FMLNetworkEvent;
import makeo.gadomancy.client.ClientProxy;
import makeo.gadomancy.client.effect.EffectHandler;
import makeo.gadomancy.client.util.FamiliarHandlerClient;
import makeo.gadomancy.common.Gadomancy;
import net.minecraft.client.Minecraft;
import java.util.List;
/**
* This class is part of the Gadomancy Mod
* Gadomancy is Open Source and distributed under the
@@ -27,6 +31,12 @@ public class ClientHandler {
EffectHandler.getInstance().tick();
}
List<Runnable> actions = ((ClientProxy)Gadomancy.proxy).clientActions;
while(actions.size() > 0) {
actions.get(0).run();
actions.remove(0);
}
}
@SubscribeEvent
@@ -3,6 +3,7 @@ package makeo.gadomancy.client.events;
import makeo.gadomancy.api.GadomancyApi;
import makeo.gadomancy.api.golems.AdditionalGolemType;
import makeo.gadomancy.client.textures.GolemGuiTexture;
import makeo.gadomancy.common.Gadomancy;
import makeo.gadomancy.common.utils.Injector;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.IResourceManager;
@@ -22,9 +23,14 @@ import java.util.Map;
* Created by makeo @ 03.10.2015 12:09
*/
public class ResourceReloadListener implements IResourceManagerReloadListener {
public static final ResourceReloadListener instance = new ResourceReloadListener();
public static ResourceReloadListener getInstance() {
return instance;
}
public static Map languageList;
public ResourceReloadListener() {
private ResourceReloadListener() {
Injector instance = new Injector(new Injector(StringTranslate.class)
.getField(Injector.findField(StringTranslate.class, StringTranslate.class)));
languageList = instance.getField(instance.findField(Map.class));
@@ -32,8 +38,18 @@ public class ResourceReloadListener implements IResourceManagerReloadListener {
@Override
public void onResourceManagerReload(IResourceManager resourceManager) {
reloadGolemResources();
}
public void reloadGolemResources() {
manipulateLanguageFile();
registerTextureOverride();
Gadomancy.proxy.runDelayedClientSide(new Runnable() {
@Override
public void run() {
registerTextureOverride();
}
});
}
private void manipulateLanguageFile() {
@@ -128,6 +128,8 @@ public class CommonProxy implements IGuiHandler {
return null;
}
public void runDelayedClientSide(Runnable run) { }
public Side getSide() {
return this instanceof ClientProxy ? Side.CLIENT : Side.SERVER;
}
@@ -23,7 +23,7 @@ public class ObsidianGolemType extends AdditionalGolemType {
@Override
public String getUnlocalizedName() {
return "item.ItemGolemPlacer.obsidian.name";
return "item.ItemGolemPlacer.obsidian";
}
private IIcon icon;
@@ -44,6 +44,6 @@ public class ObsidianGolemType extends AdditionalGolemType {
@Override
public ResourceLocation getInvSlotTexture() {
return new SimpleResourceLocation("gui/default_slot.png");
return new SimpleResourceLocation("gui/obsidian_slot.png");
}
}
@@ -44,6 +44,6 @@ public class SilverwoodGolemType extends AdditionalGolemType {
@Override
public ResourceLocation getInvSlotTexture() {
return new SimpleResourceLocation("gui/default_slot.png");
return new SimpleResourceLocation("gui/silverwood_slot.png");
}
}
@@ -2,6 +2,7 @@ package makeo.gadomancy.common.utils;
import makeo.gadomancy.api.GadomancyApi;
import makeo.gadomancy.api.golems.AdditionalGolemType;
import makeo.gadomancy.client.events.ResourceReloadListener;
import makeo.gadomancy.common.Gadomancy;
import makeo.gadomancy.common.entities.golems.types.RemovedGolemType;
import net.minecraftforge.common.util.EnumHelper;
@@ -145,6 +146,9 @@ public class GolemEnumHelper {
}
}
}
new Injector(EnumGolemType.class).setField("codeToTypeMapping", null);
ResourceReloadListener.getInstance().reloadGolemResources();
}
private static void resetEnum() {