Remove all references to ModLoader

This commit is contained in:
Christian 2012-09-09 10:02:21 -04:00
parent 03b3017e51
commit 66b60bc85e
4 changed files with 81 additions and 72 deletions

View file

@ -7,6 +7,8 @@ import java.util.TreeSet;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.src.Block;
import net.minecraft.src.EntityItem;
@ -16,7 +18,6 @@ import net.minecraft.src.Item;
import net.minecraft.src.ItemBlock;
import net.minecraft.src.ItemStack;
import net.minecraft.src.MathHelper;
import net.minecraft.src.ModLoader;
import net.minecraft.src.MovingObjectPosition;
import net.minecraft.src.RenderBlocks;
import net.minecraft.src.RenderEngine;
@ -75,18 +76,22 @@ public class ForgeHooksClient
Integer texID = textures.get(texture);
if (texID == null)
{
texID = ModLoader.getMinecraftInstance().renderEngine.getTexture(texture);
texID = engine().getTexture(texture);
textures.put(texture, texID);
}
renderHandlers.put(new TesKey(texID, subID), handler);
}
static RenderEngine engine()
{
return FMLClientHandler.instance().getClient().renderEngine;
}
public static void bindTexture(String texture, int subID)
{
Integer texID = textures.get(texture);
if (texID == null)
{
texID = ModLoader.getMinecraftInstance().renderEngine.getTexture(texture);
texID = engine().getTexture(texture);
textures.put(texture, texID);
}
if (!inWorld)
@ -132,7 +137,7 @@ public class ForgeHooksClient
}
Tessellator.instance.startDrawing(mode);
}
GL11.glBindTexture(GL11.GL_TEXTURE_2D, ModLoader.getMinecraftInstance().renderEngine.getTexture("/terrain.png"));
GL11.glBindTexture(GL11.GL_TEXTURE_2D, engine().getTexture("/terrain.png"));
return;
}
}
@ -165,7 +170,7 @@ public class ForgeHooksClient
renderPass = pass;
defaultTessellator = Tessellator.instance;
Tessellator.renderingWorldRenderer = true;
GL11.glBindTexture(GL11.GL_TEXTURE_2D, ModLoader.getMinecraftInstance().renderEngine.getTexture("/terrain.png"));
GL11.glBindTexture(GL11.GL_TEXTURE_2D, engine().getTexture("/terrain.png"));
renderTextures.clear();
inWorld = true;
}
@ -191,7 +196,7 @@ public class ForgeHooksClient
handler.afterRenderContext();
}
}
GL11.glBindTexture(GL11.GL_TEXTURE_2D, ModLoader.getMinecraftInstance().renderEngine.getTexture("/terrain.png"));
GL11.glBindTexture(GL11.GL_TEXTURE_2D, engine().getTexture("/terrain.png"));
Tessellator.renderingWorldRenderer = false;
Tessellator.instance = defaultTessellator;
}
@ -398,7 +403,7 @@ public class ForgeHooksClient
{
if (Tessellator.class.getPackage().equals("net.minecraft.src"))
{
Minecraft mc = ModLoader.getMinecraftInstance();
Minecraft mc = FMLClientHandler.instance().getClient();
if (mc.ingameGUI != null)
{
mc.ingameGUI.getChatGUI().printChatMessage(msg);

View file

@ -11,7 +11,6 @@ import net.minecraft.src.Block;
import net.minecraft.src.Entity;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.ModLoader;
import net.minecraft.src.RenderBlocks;
import net.minecraft.src.World;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
@ -39,7 +38,7 @@ public class MinecraftForgeClient
*/
public static void preloadTexture(String texture)
{
ModLoader.getMinecraftInstance().renderEngine.getTexture(texture);
ForgeHooksClient.engine().getTexture(texture);
}
/** Render a block. Render a block which may have a custom texture.

View file

@ -3,6 +3,10 @@ package net.minecraftforge.client;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.logging.Level;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.FMLLog;
import paulscode.sound.SoundSystemConfig;
import paulscode.sound.codecs.CodecIBXM;
@ -86,8 +90,7 @@ public class ModCompatibilityClient
}
catch (IOException ex)
{
ModLoader.getLogger().fine("Loading Mod audio failed for folder: " + path);
ModLoader.getLogger().fine(ex.toString());
FMLLog.log(Level.FINE, ex, "Loading Mod audio failed for folder: %s", path);
ex.printStackTrace();
}
}
@ -142,7 +145,7 @@ public class ModCompatibilityClient
*/
public static SoundPoolEntry audioModPickBackgroundMusic(SoundManager soundManager, SoundPoolEntry current)
{
Minecraft mc = ModLoader.getMinecraftInstance();
Minecraft mc = FMLClientHandler.instance().getClient();
if (mc != null && mc.theWorld != null && audioModSoundPoolCave != null)
{
Entity ent = mc.renderViewEntity;
@ -227,7 +230,7 @@ public class ModCompatibilityClient
if (thrower == null)
{
System.out.println("Received spawn packet for entity with owner, but owner was not found.");
ModLoader.getLogger().fine("Received spawn packet for entity with owner, but owner was not found.");
FMLLog.fine("Received spawn packet for entity with owner, but owner was not found.");
}
else
{

View file

@ -2,6 +2,8 @@ package net.minecraftforge.common;
import java.util.*;
import cpw.mods.fml.common.FMLLog;
import net.minecraft.src.*;
import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.event.entity.living.LivingEvent.*;
@ -221,7 +223,7 @@ public class ForgeHooks
seedList.add(new SeedEntry(new ItemStack(Item.seeds), 10));
initTools();
System.out.printf("MinecraftForge v%s Initialized\n", ForgeVersion.getVersion());
ModLoader.getLogger().info(String.format("MinecraftForge v%s Initialized", ForgeVersion.getVersion()));
FMLLog.info("MinecraftForge v%s Initialized", ForgeVersion.getVersion());
}
/**