Remove the dependency in RenderEngine, decided on the simple API for texture FX

This commit is contained in:
Christian Weeks 2012-05-17 15:11:21 -04:00
parent bc3790e3ca
commit 8aacd2d127
7 changed files with 49 additions and 62 deletions

View file

@ -1,30 +0,0 @@
/*
* The FML Forge Mod Loader suite.
* Copyright (C) 2012 cpw
*
* This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
package com.pclewis.mcpatcher.mod;
/**
* @author cpw
*
*/
@Deprecated
public class TileSize
{
@Deprecated
public static int int_numPixels;
@Deprecated
public static int int_size;
@Deprecated
public static int int_sizeMinus1;
}

View file

@ -38,8 +38,6 @@ import javax.imageio.ImageIO;
import org.lwjgl.opengl.GL11;
import com.pclewis.mcpatcher.mod.TileSize;
import net.minecraft.client.Minecraft;
import net.minecraft.src.BaseMod;
import net.minecraft.src.BiomeGenBase;
@ -106,7 +104,6 @@ import cpw.mods.fml.common.modloader.ModLoaderModContainer;
* @author cpw
*
*/
@SuppressWarnings("deprecation")
public class FMLClientHandler implements IFMLSidedHandler
{
/**
@ -655,7 +652,7 @@ public class FMLClientHandler implements IFMLSidedHandler
*/
public BufferedImage loadImageFromTexturePack(RenderEngine renderEngine, String path) throws IOException
{
InputStream image=renderEngine.getTexturePackList().field_6534_a.func_6481_a(path);
InputStream image=client.field_6298_C.field_6534_a.func_6481_a(path);
if (image==null) {
throw new RuntimeException(String.format("The requested image path %s is not found",path));
}
@ -825,7 +822,7 @@ public class FMLClientHandler implements IFMLSidedHandler
return meta;
}
public void preTexturePackChange(TexturePackBase var1, int tileSize, int tileSizeSquare, int tileSizeMask, int tileSizeSquareMask)
public void pruneOldTextureFX(TexturePackBase var1, int tileSize, int tileSizeSquare, int tileSizeMask, int tileSizeSquareMask)
{
ListIterator<TextureFX> li = addedTextureFX.listIterator();
while (li.hasNext()) {
@ -834,15 +831,12 @@ public class FMLClientHandler implements IFMLSidedHandler
li.remove();
}
}
TileSize.int_numPixels=tileSizeSquare;
TileSize.int_size=tileSize;
TileSize.int_sizeMinus1=tileSizeMask;
}
/**
* @param p_6531_1_
*/
public void postTexturePackChange(TexturePackBase texturePack)
public void loadTextures(TexturePackBase texturePack)
{
registerTextureOverrides(client.field_6315_n);
}
@ -856,7 +850,7 @@ public class FMLClientHandler implements IFMLSidedHandler
// We're far too early- let's wait
this.fallbackTexturePack=fallback;
} else {
postTexturePackChange(fallback);
loadTextures(fallback);
}
}
@ -898,6 +892,14 @@ public class FMLClientHandler implements IFMLSidedHandler
Profiler.func_40662_b();
}
/**
*
*/
public void preGameLoad()
{
// NOOP at the minute
}
/**
* @param var1
* @param tileSize

View file

@ -35,6 +35,9 @@ public class ModClassLoader extends URLClassLoader
super(new URL[0], ModClassLoader.class.getClassLoader());
}
public ModClassLoader(ClassLoader parent) {
super(new URL[0], null);
}
public void addFile(File modFile) throws MalformedURLException
{
ClassLoader cl=getParent();

View file

@ -1,5 +1,7 @@
breadcrumb.org.eclipse.jdt.ui.JavaPerspective=true
content_assist_disabled_computers=org.eclipse.jdt.ui.javaAllProposalCategory\u0000org.eclipse.jdt.ui.javaNoTypeProposalCategory\u0000org.eclipse.jdt.ui.textProposalCategory\u0000org.eclipse.jdt.ui.javaTypeProposalCategory\u0000
content_assist_favorite_static_members=
content_assist_lru_history=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><history maxLHS\="100" maxRHS\="10"><lhs name\="net.minecraft.src.IMinecraftRegistry"><rhs name\="net.minecraft.src.ServerRegistry"/></lhs><lhs name\="java.lang.ClassLoader"><rhs name\="java.net.URLClassLoader"/></lhs><lhs name\="java.util.logging.Level"><rhs name\="java.util.logging.Level"/></lhs><lhs name\="java.util.logging.Formatter"><rhs name\="cpw.mods.fml.common.FMLLogFormatter"/></lhs><lhs name\="java.lang.Enum"><rhs name\="cpw.mods.fml.common.ModContainer$TickType"/><rhs name\="cpw.mods.fml.common.ModContainer$ModState"/><rhs name\="cpw.mods.fml.common.ModContainer$SourceType"/></lhs><lhs name\="cpw.mods.fml.common.ModContainer$TickType"><rhs name\="cpw.mods.fml.common.ModContainer$TickType"/></lhs><lhs name\="cpw.mods.fml.common.ModContainer"><rhs name\="cpw.mods.fml.common.modloader.ModLoaderModContainer"/></lhs><lhs name\="cpw.mods.fml.common.modloader.ModLoaderModContainer"><rhs name\="cpw.mods.fml.common.modloader.ModLoaderModContainer"/></lhs><lhs name\="java.util.List"><rhs name\="java.util.ArrayList"/></lhs><lhs name\="java.util.RandomAccess"><rhs name\="java.util.ArrayList"/></lhs><lhs name\="java.lang.Cloneable"><rhs name\="java.util.ArrayList"/></lhs><lhs name\="java.util.Collection"><rhs name\="java.util.ArrayList"/></lhs><lhs name\="java.lang.Iterable"><rhs name\="java.util.ArrayList"/></lhs><lhs name\="java.util.AbstractList"><rhs name\="java.util.ArrayList"/></lhs><lhs name\="java.util.AbstractCollection"><rhs name\="java.util.ArrayList"/></lhs><lhs name\="java.util.ArrayList"><rhs name\="java.util.ArrayList"/></lhs><lhs name\="cpw.mods.fml.common.ModContainer$ModState"><rhs name\="cpw.mods.fml.common.ModContainer$ModState"/></lhs><lhs name\="cpw.mods.fml.common.ModContainer$SourceType"><rhs name\="cpw.mods.fml.common.ModContainer$SourceType"/></lhs><lhs name\="net.minecraft.src.TextureFX"><rhs name\="net.minecraft.src.ModTextureStatic"/></lhs><lhs name\="net.minecraft.src.ModTextureStatic"><rhs name\="net.minecraft.src.ModTextureStatic"/></lhs><lhs name\="cpw.mods.fml.client.OverrideInfo"><rhs name\="cpw.mods.fml.client.OverrideInfo"/></lhs></history>
content_assist_lru_history=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><history maxLHS\="100" maxRHS\="10"><lhs name\="net.minecraft.src.IMinecraftRegistry"><rhs name\="net.minecraft.src.ServerRegistry"/></lhs><lhs name\="java.lang.ClassLoader"><rhs name\="java.net.URLClassLoader"/></lhs><lhs name\="java.util.logging.Level"><rhs name\="java.util.logging.Level"/></lhs><lhs name\="java.util.logging.Formatter"><rhs name\="cpw.mods.fml.common.FMLLogFormatter"/></lhs><lhs name\="java.lang.Enum"><rhs name\="cpw.mods.fml.common.ModContainer$TickType"/><rhs name\="cpw.mods.fml.common.ModContainer$ModState"/><rhs name\="cpw.mods.fml.common.ModContainer$SourceType"/></lhs><lhs name\="cpw.mods.fml.common.ModContainer$TickType"><rhs name\="cpw.mods.fml.common.ModContainer$TickType"/></lhs><lhs name\="cpw.mods.fml.common.ModContainer"><rhs name\="cpw.mods.fml.common.modloader.ModLoaderModContainer"/><rhs name\="cpw.mods.fml.common.FMLModContainer"/><rhs name\="cpw.mods.fml.common.FMLModLoaderContainer"/></lhs><lhs name\="cpw.mods.fml.common.modloader.ModLoaderModContainer"><rhs name\="cpw.mods.fml.common.modloader.ModLoaderModContainer"/></lhs><lhs name\="java.util.List"><rhs name\="java.util.ArrayList"/></lhs><lhs name\="java.util.RandomAccess"><rhs name\="java.util.ArrayList"/></lhs><lhs name\="java.lang.Cloneable"><rhs name\="java.util.ArrayList"/></lhs><lhs name\="java.util.Collection"><rhs name\="java.util.ArrayList"/></lhs><lhs name\="java.lang.Iterable"><rhs name\="java.util.ArrayList"/></lhs><lhs name\="java.util.AbstractList"><rhs name\="java.util.ArrayList"/></lhs><lhs name\="java.util.AbstractCollection"><rhs name\="java.util.ArrayList"/></lhs><lhs name\="java.util.ArrayList"><rhs name\="java.util.ArrayList"/></lhs><lhs name\="cpw.mods.fml.common.ModContainer$ModState"><rhs name\="cpw.mods.fml.common.ModContainer$ModState"/></lhs><lhs name\="cpw.mods.fml.common.ModContainer$SourceType"><rhs name\="cpw.mods.fml.common.ModContainer$SourceType"/></lhs><lhs name\="net.minecraft.src.TextureFX"><rhs name\="net.minecraft.src.ModTextureStatic"/></lhs><lhs name\="net.minecraft.src.ModTextureStatic"><rhs name\="net.minecraft.src.ModTextureStatic"/></lhs><lhs name\="cpw.mods.fml.client.OverrideInfo"><rhs name\="cpw.mods.fml.client.OverrideInfo"/></lhs><lhs name\="cpw.mods.fml.common.ModMetadata"><rhs name\="cpw.mods.fml.common.ModMetadata"/></lhs></history>
content_assist_number_of_computers=17
content_assist_proposals_background=255,255,255
content_assist_proposals_foreground=0,0,0

View file

@ -4,6 +4,6 @@ PROBLEMS_FILTERS_MIGRATE=true
SAVE_ALL_BEFORE_BUILD=true
TASKS_FILTERS_MIGRATE=true
eclipse.preferences.version=1
platformState=1333336227380
platformState=1333336227447
quickStart=true
tipsAndTricks=true

View file

@ -55,3 +55,24 @@
this.field_6287_N = System.currentTimeMillis();
}
@@ -2233,7 +2243,7 @@
return this.field_6322_g instanceof EntityClientPlayerMP ? ((EntityClientPlayerMP)this.field_6322_g).field_797_bg : null;
}
- public static void main(String[] p_main_0_)
+ public static void main(String[] p_main_0_) throws Exception
{
String var1 = null;
String var2 = null;
@@ -2250,7 +2260,10 @@
{
var2 = p_main_0_[1];
}
-
+ FMLClientHandler.instance().preGameLoad();
+ }
+ public static void fmlReentry(String var1, String var2)
+ {
func_6269_a(var1, var2);
}

View file

@ -9,7 +9,7 @@
import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
@@ -13,9 +16,17 @@
@@ -13,9 +16,15 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -19,15 +19,13 @@
+
import org.lwjgl.opengl.GL11;
+import com.pclewis.mcpatcher.mod.TileSize;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.common.FMLCommonHandler;
+
public class RenderEngine
{
public static boolean field_1609_a = false;
@@ -24,7 +35,7 @@
@@ -24,7 +33,7 @@
private IntHashMap field_1607_c = new IntHashMap();
private IntBuffer field_1606_d = GLAllocation.func_1125_c(1);
private ByteBuffer field_1605_e = GLAllocation.func_1127_b(16777216);
@ -36,7 +34,7 @@
private Map field_1603_g = new HashMap();
private GameSettings field_1602_h;
public boolean field_4281_i = false;
@@ -97,6 +108,7 @@
@@ -97,6 +106,7 @@
}
catch (IOException var5)
{
@ -44,7 +42,7 @@
var5.printStackTrace();
int[] var4 = this.func_28148_b(this.field_25189_l);
this.field_28151_c.put(p_28149_1_, var4);
@@ -459,8 +471,17 @@
@@ -459,8 +469,17 @@
for (int var2 = 0; var2 < this.field_1604_f.size(); ++var2)
{
TextureFX var3 = (TextureFX)this.field_1604_f.get(var2);
@ -63,7 +61,7 @@
this.field_1605_e.clear();
this.field_1605_e.put(var3.field_1127_a);
this.field_1605_e.position(0).limit(var3.field_1127_a.length);
@@ -470,12 +491,17 @@
@@ -470,12 +489,17 @@
var3.func_782_a(this);
var1 = var3.field_1126_b;
}
@ -82,7 +80,7 @@
}
}
}
@@ -579,6 +605,7 @@
@@ -579,6 +603,7 @@
}
catch (IOException var7)
{
@ -90,7 +88,7 @@
var7.printStackTrace();
}
}
@@ -616,9 +643,28 @@
@@ -616,9 +641,28 @@
}
catch (IOException var6)
{
@ -104,7 +102,7 @@
+ int tileSizeMask = tileSize - 1;
+ int tileSizeSquareMask = tileSizeSquare - 1;
+
+ FMLClientHandler.instance().preTexturePackChange(var1, tileSize, tileSizeSquare, tileSizeMask, tileSizeSquareMask);
+ FMLClientHandler.instance().pruneOldTextureFX(var1, tileSize, tileSizeSquare, tileSizeMask, tileSizeSquareMask);
+
+ TextureFX.iconTileSize = tileSize;
+ TextureFX.tileSizeSquare = tileSizeSquare;
@ -115,16 +113,7 @@
+ ((TextureFX)tex).onTexturePackChange(tileSize, tileSizeSquare, tileSizeMask, tileSizeSquareMask);
+ }
+
+ FMLClientHandler.instance().postTexturePackChange(var1);
+ FMLClientHandler.instance().loadTextures(var1);
}
private BufferedImage func_6526_a(InputStream p_6526_1_) throws IOException
@@ -635,4 +681,8 @@
GL11.glBindTexture(GL11.GL_TEXTURE_2D, p_1076_1_);
}
}
+
+ public TexturePackList getTexturePackList() {
+ return field_6527_k;
+ }
}