my tweaks

This commit is contained in:
Christian Weeks 2012-05-24 21:06:27 -04:00
parent 00ca4ead44
commit 012c378427
8 changed files with 101 additions and 191 deletions

View file

@ -40,11 +40,49 @@ import javax.imageio.ImageIO;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.src.*;
import net.minecraft.src.BaseMod;
import net.minecraft.src.BiomeGenBase;
import net.minecraft.src.Block;
import net.minecraft.src.ClientRegistry;
import net.minecraft.src.CommonRegistry;
import net.minecraft.src.EntityItem;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.GameSettings;
import net.minecraft.src.GuiScreen;
import net.minecraft.src.IBlockAccess;
import net.minecraft.src.IChunkProvider;
import net.minecraft.src.IInventory;
import net.minecraft.src.Item;
import net.minecraft.src.ItemStack;
import net.minecraft.src.KeyBinding;
import net.minecraft.src.ModTextureStatic;
import net.minecraft.src.NetClientHandler;
import net.minecraft.src.NetworkManager;
import net.minecraft.src.Packet;
import net.minecraft.src.Packet1Login;
import net.minecraft.src.Packet250CustomPayload;
import net.minecraft.src.Packet3Chat;
import net.minecraft.src.Profiler;
import net.minecraft.src.Render;
import net.minecraft.src.RenderBlocks;
import net.minecraft.src.RenderEngine;
import net.minecraft.src.RenderManager;
import net.minecraft.src.RenderPlayer;
import net.minecraft.src.StringTranslate;
import net.minecraft.src.TextureFX;
import net.minecraft.src.TexturePackBase;
import net.minecraft.src.World;
import net.minecraft.src.WorldType;
import argo.jdom.JdomParser;
import argo.jdom.JsonNode;
import cpw.mods.fml.common.*;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.IFMLSidedHandler;
import cpw.mods.fml.common.IKeyHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import cpw.mods.fml.common.ModContainer.TickType;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.ReflectionHelper;
import cpw.mods.fml.common.modloader.ModLoaderHelper;
import cpw.mods.fml.common.modloader.ModLoaderModContainer;
@ -101,6 +139,7 @@ public class FMLClientHandler implements IFMLSidedHandler
private List<TextureFX> addedTextureFX = new ArrayList<TextureFX>();
private boolean firstTick;
/**
* Called to start the whole game off from
* {@link MinecraftServer#startServer}
@ -159,7 +198,19 @@ public class FMLClientHandler implements IFMLSidedHandler
r.func_4009_a(RenderManager.field_1233_a);
}
}
client.field_6304_y.loadModKeySettings(harvestKeyBindings());
// Load the key bindings into the settings table
GameSettings gs = client.field_6304_y;
KeyBinding[] modKeyBindings = harvestKeyBindings();
KeyBinding[] allKeys = new KeyBinding[gs.field_1564_t.length + modKeyBindings.length];
System.arraycopy(gs.field_1564_t, 0, allKeys, 0, gs.field_1564_t.length);
System.arraycopy(modKeyBindings, 0, allKeys, gs.field_1564_t.length, modKeyBindings.length);
gs.field_1564_t = allKeys;
gs.func_6519_a();
// Mark this as a "first tick"
firstTick = true;
}
public KeyBinding[] harvestKeyBindings() {
@ -201,8 +252,14 @@ public class FMLClientHandler implements IFMLSidedHandler
public void onRenderTickStart(float partialTickTime)
{
if (client.field_6324_e != null) {
if (firstTick)
{
loadTextures(fallbackTexturePack);
firstTick = false;
}
FMLCommonHandler.instance().tickStart(TickType.RENDER, partialTickTime);
if (client.field_6324_e!=null) {
if (client.field_6324_e!=null)
{
FMLCommonHandler.instance().tickStart(TickType.GUI, partialTickTime, client.field_6313_p);
}
}
@ -789,22 +846,12 @@ public class FMLClientHandler implements IFMLSidedHandler
return meta;
}
public void pruneOldTextureFX(TexturePackBase var1, List<TextureFX> effects)
public void pruneOldTextureFX(TexturePackBase var1, int tileSize, int tileSizeSquare, int tileSizeMask, int tileSizeSquareMask)
{
ListIterator<TextureFX> li = addedTextureFX.listIterator();
while (li.hasNext())
{
TextureFX tex = li.next();
if (tex instanceof FMLTextureFX)
{
if (((FMLTextureFX)tex).unregister(client.field_6315_n, effects))
{
li.remove();
}
}
else
{
effects.remove(tex);
while (li.hasNext()) {
TextureFX tex=li.next();
if (tex.unregister(client.field_6315_n)) {
li.remove();
}
}
@ -878,117 +925,11 @@ public class FMLClientHandler implements IFMLSidedHandler
Minecraft.fmlReentry(user, sessionToken);
}
public void onTexturePackChange(RenderEngine engine, TexturePackBase texturepack, List<TextureFX> effects)
{
FMLClientHandler.instance().pruneOldTextureFX(texturepack, effects);
for (TextureFX tex : effects)
{
if (tex instanceof ITextureFX)
{
((ITextureFX)tex).onTexturePackChanged(engine, texturepack, getTextureDimensions(tex));
}
}
FMLClientHandler.instance().loadTextures(texturepack);
}
private HashMap<Integer, Dimension> textureDims = new HashMap<Integer, Dimension>();
private IdentityHashMap<TextureFX, Integer> effectTextures = new IdentityHashMap<TextureFX, Integer>();
public void setTextureDimensions(int id, int width, int height, List<TextureFX> effects)
{
Dimension dim = new Dimension(width, height);
textureDims.put(id, dim);
for (TextureFX tex : effects)
{
if (getEffectTexture(tex) == id && tex instanceof ITextureFX)
{
((ITextureFX)tex).onTextureDimensionsUpdate(width, height);
}
}
}
public Dimension getTextureDimensions(TextureFX effect)
{
return getTextureDimensions(getEffectTexture(effect));
}
public Dimension getTextureDimensions(int id)
{
return textureDims.get(id);
}
public int getEffectTexture(TextureFX effect)
{
Integer id = effectTextures.get(effect);
if (id != null)
{
return id;
}
int old = GL11.glGetInteger(GL_TEXTURE_BINDING_2D);
effect.func_782_a(client.field_6315_n);
id = GL11.glGetInteger(GL_TEXTURE_BINDING_2D);
GL11.glBindTexture(GL_TEXTURE_2D, old);
effectTextures.put(effect, id);
return id;
}
public boolean onUpdateTextureEffect(TextureFX effect)
{
Logger log = FMLCommonHandler.instance().getFMLLogger();
ITextureFX ifx = (effect instanceof ITextureFX ? ((ITextureFX)effect) : null);
if (ifx != null && ifx.getErrored())
{
return false;
}
String name = effect.getClass().getSimpleName();
Profiler.func_40663_a(name);
try
{
effect.func_783_a();
}
catch (Exception e)
{
log.warning(String.format("Texture FX %s has failed to animate. Likely caused by a texture pack change that they did not respond correctly to", name));
if (ifx != null)
{
ifx.setErrored(true);
}
Profiler.func_40662_b();
return false;
}
Profiler.func_40662_b();
Dimension dim = getTextureDimensions(effect);
int target = ((dim.width >> 4) * (dim.height >> 4)) << 2;
if (effect.field_1127_a.length != target)
{
log.warning(String.format("Detected a texture FX sizing discrepancy in %s (%d, %d)", name, effect.field_1127_a.length, target));
if (ifx != null)
{
ifx.setErrored(true);
}
return false;
}
return true;
}
public void onPreRegisterEffect(TextureFX effect)
{
Dimension dim = getTextureDimensions(effect);
if (effect instanceof ITextureFX)
{
((ITextureFX)effect).onTextureDimensionsUpdate(dim.width, dim.height);
}
}
/**
* @param var1
* @param tileSize
* @param tileSizeSquare
* @param tileSizeMask
* @param tileSizeSquareMask
*/
}

View file

@ -38,9 +38,9 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
{
Minecraft mc = (Minecraft) minecraftInstance;
// World and render ticks
if ((tickEnd && tick==TickType.WORLD) || (!tickEnd && tick==TickType.RENDER)) {
if ((tickEnd && tick==TickType.WORLD) || (tickEnd && tick==TickType.RENDER)) {
return onTickInGame((Float) data[0], mc);
} else if (((tickEnd && tick==TickType.WORLDGUI) || (!tickEnd && tick==TickType.GUI))) {
} else if (((tickEnd && tick==TickType.WORLDGUI) || (tickEnd && tick==TickType.GUI))) {
return onTickInGUI((Float) data[0], mc, (GuiScreen)data[1]);
}
return true;

View file

@ -659,7 +659,7 @@ public class ModLoader
@Deprecated
public static boolean renderBlockIsItemFull3D(int modelID)
{
return false;
return FMLClientHandler.instance().renderItemAsFull3DBlock(modelID);
}
@Deprecated

View file

@ -63,7 +63,7 @@ public class ModTextureStatic extends FMLTextureFX
if (tWidth != tileSizeBase || tHeight != tileSizeBase)
{
log.warning(String.format("Override %s is not applied - there is a mismatch between the underlying texture (%s) size %d,%d and the current texture tile size %d", target, tWidth, tHeight, tileSizeBase));
errored = true;
errored=true;
return;
}
pixels = new int[tileSizeSquare];

View file

@ -27,7 +27,7 @@
this.func_6250_c("Startup");
this.field_6286_O = new OpenGlCapsChecker();
this.field_6301_A.func_340_a(this.field_6304_y);
@@ -747,9 +753,11 @@
@@ -744,9 +750,11 @@
this.field_6327_b.func_6467_a(this.field_9237_P.field_1378_c);
}
@ -39,7 +39,7 @@
}
GL11.glFlush();
@@ -1343,6 +1351,7 @@
@@ -1340,6 +1348,7 @@
this.func_28001_B();
}
@ -47,7 +47,7 @@
Profiler.func_40663_a("stats");
this.field_25001_G.func_27178_d();
Profiler.func_40661_c("gui");
@@ -1733,6 +1742,7 @@
@@ -1730,6 +1739,7 @@
}
Profiler.func_40662_b();
@ -55,7 +55,7 @@
this.field_6287_N = System.currentTimeMillis();
}
@@ -2253,7 +2263,11 @@
@@ -2250,7 +2260,11 @@
{
var2 = p_main_0_[1];
}

View file

@ -1,31 +0,0 @@
--- ../src-base/minecraft/net/minecraft/src/GameSettings.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src-work/minecraft/net/minecraft/src/GameSettings.java 0000-00-00 00:00:00.000000000 -0000
@@ -5,6 +5,9 @@
import java.io.FileReader;
import java.io.FileWriter;
import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.List;
+
import net.minecraft.client.Minecraft;
import org.lwjgl.input.Keyboard;
@@ -483,4 +486,18 @@
{
return this.field_1580_e < 2 && this.field_40445_l;
}
+
+ /**
+ * @param harvestKeyBindings
+ */
+ public void loadModKeySettings(KeyBinding[] modKeyBindings)
+ {
+ KeyBinding[] allKeys=new KeyBinding[field_1564_t.length+modKeyBindings.length];
+ System.arraycopy(field_1564_t, 0, allKeys, 0, field_1564_t.length);
+ System.arraycopy(modKeyBindings, 0, allKeys, field_1564_t.length, modKeyBindings.length);
+ field_1564_t=allKeys;
+
+ // Reload settings with mod keys in place
+ func_6519_a();
+ }
}

View file

@ -25,7 +25,7 @@
this.field_1212_e.field_6308_u.func_552_a(p_4113_1_.field_517_a);
}
@@ -1031,4 +1035,13 @@
@@ -1026,4 +1030,13 @@
var2.field_35212_aW.field_35759_a = p_50100_1_.field_50072_a;
var2.field_35212_aW.field_35758_c = p_50100_1_.field_50071_c;
}

View file

@ -239,7 +239,7 @@
{
Tessellator var5 = Tessellator.field_1512_a;
int var6 = this.field_1772_a.func_602_e(p_22331_2_, p_22331_3_, p_22331_4_);
@@ -313,7 +346,7 @@
@@ -310,7 +343,7 @@
return true;
}
@ -248,7 +248,7 @@
{
p_40730_1_.func_213_a(0.4375F, 0.0F, 0.4375F, 0.5625F, 0.875F, 0.5625F);
this.func_1228_k(p_40730_1_, p_40730_2_, p_40730_3_, p_40730_4_);
@@ -387,7 +420,7 @@
@@ -384,7 +417,7 @@
return true;
}
@ -257,7 +257,7 @@
{
this.func_1228_k(p_40728_1_, p_40728_2_, p_40728_3_, p_40728_4_);
Tessellator var5 = Tessellator.field_1512_a;
@@ -470,7 +503,7 @@
@@ -467,7 +500,7 @@
return true;
}
@ -266,7 +266,7 @@
{
int var5 = this.field_1772_a.func_602_e(p_22332_2_, p_22332_3_, p_22332_4_);
int var6 = var5 & 3;
@@ -563,7 +596,7 @@
@@ -557,7 +590,7 @@
this.field_1773_d = false;
}
@ -275,7 +275,7 @@
{
int var6 = this.field_1772_a.func_602_e(p_31074_2_, p_31074_3_, p_31074_4_);
boolean var7 = p_31074_5_ || (var6 & 8) != 0;
@@ -676,7 +709,7 @@
@@ -660,7 +693,7 @@
return true;
}
@ -284,7 +284,7 @@
{
int var16 = 108;
@@ -699,7 +732,7 @@
@@ -683,7 +716,7 @@
var19.func_983_a(p_31076_3_, p_31076_7_, p_31076_11_, var24, var26);
}
@ -293,7 +293,7 @@
{
int var16 = 108;
@@ -722,7 +755,7 @@
@@ -706,7 +739,7 @@
var19.func_983_a(p_31081_3_, p_31081_7_, p_31081_11_, var24, var26);
}
@ -302,7 +302,7 @@
{
int var16 = 108;
@@ -752,7 +785,7 @@
@@ -736,7 +769,7 @@
this.field_1773_d = false;
}
@ -311,7 +311,7 @@
{
int var6 = this.field_1772_a.func_602_e(p_31080_2_, p_31080_3_, p_31080_4_);
int var7 = BlockPistonExtension.func_31050_c(var6);
@@ -2728,7 +2761,7 @@
@@ -2707,7 +2740,7 @@
}
}
@ -320,7 +320,7 @@
{
int var5 = 0;
float var6 = 0.0F;
@@ -3260,7 +3293,7 @@
@@ -3239,7 +3272,7 @@
var27 = p_22330_1_.func_211_a(this.field_1772_a, p_22330_2_, p_22330_3_, p_22330_4_, 2);
this.func_1220_c(p_22330_1_, (double)p_22330_2_, (double)p_22330_3_, (double)p_22330_4_, var27);
@ -329,7 +329,7 @@
{
this.field_22351_H *= p_22330_5_;
this.field_22350_I *= p_22330_5_;
@@ -3383,7 +3416,7 @@
@@ -3362,7 +3395,7 @@
var27 = p_22330_1_.func_211_a(this.field_1772_a, p_22330_2_, p_22330_3_, p_22330_4_, 3);
this.func_1225_d(p_22330_1_, (double)p_22330_2_, (double)p_22330_3_, (double)p_22330_4_, p_22330_1_.func_211_a(this.field_1772_a, p_22330_2_, p_22330_3_, p_22330_4_, 3));
@ -338,7 +338,7 @@
{
this.field_22351_H *= p_22330_5_;
this.field_22350_I *= p_22330_5_;
@@ -3506,7 +3539,7 @@
@@ -3485,7 +3518,7 @@
var27 = p_22330_1_.func_211_a(this.field_1772_a, p_22330_2_, p_22330_3_, p_22330_4_, 4);
this.func_1231_e(p_22330_1_, (double)p_22330_2_, (double)p_22330_3_, (double)p_22330_4_, var27);
@ -347,7 +347,7 @@
{
this.field_22351_H *= p_22330_5_;
this.field_22350_I *= p_22330_5_;
@@ -3629,7 +3662,7 @@
@@ -3608,7 +3641,7 @@
var27 = p_22330_1_.func_211_a(this.field_1772_a, p_22330_2_, p_22330_3_, p_22330_4_, 5);
this.func_1236_f(p_22330_1_, (double)p_22330_2_, (double)p_22330_3_, (double)p_22330_4_, var27);
@ -356,7 +356,7 @@
{
this.field_22351_H *= p_22330_5_;
this.field_22350_I *= p_22330_5_;
@@ -3653,7 +3686,7 @@
@@ -3632,7 +3665,7 @@
return var8;
}
@ -365,7 +365,7 @@
{
if (p_35924_1_ == 0)
{
@@ -3735,7 +3768,7 @@
@@ -3714,7 +3747,7 @@
var28 = p_4152_1_.func_211_a(this.field_1772_a, p_4152_2_, p_4152_3_, p_4152_4_, 2);
this.func_1220_c(p_4152_1_, (double)p_4152_2_, (double)p_4152_3_, (double)p_4152_4_, var28);
@ -374,7 +374,7 @@
{
var8.func_987_a(var18 * p_4152_5_, var21 * p_4152_6_, var24 * p_4152_7_);
this.func_1220_c(p_4152_1_, (double)p_4152_2_, (double)p_4152_3_, (double)p_4152_4_, 38);
@@ -3751,7 +3784,7 @@
@@ -3730,7 +3763,7 @@
var28 = p_4152_1_.func_211_a(this.field_1772_a, p_4152_2_, p_4152_3_, p_4152_4_, 3);
this.func_1225_d(p_4152_1_, (double)p_4152_2_, (double)p_4152_3_, (double)p_4152_4_, var28);
@ -383,7 +383,7 @@
{
var8.func_987_a(var18 * p_4152_5_, var21 * p_4152_6_, var24 * p_4152_7_);
this.func_1225_d(p_4152_1_, (double)p_4152_2_, (double)p_4152_3_, (double)p_4152_4_, 38);
@@ -3767,7 +3800,7 @@
@@ -3746,7 +3779,7 @@
var28 = p_4152_1_.func_211_a(this.field_1772_a, p_4152_2_, p_4152_3_, p_4152_4_, 4);
this.func_1231_e(p_4152_1_, (double)p_4152_2_, (double)p_4152_3_, (double)p_4152_4_, var28);
@ -392,7 +392,7 @@
{
var8.func_987_a(var19 * p_4152_5_, var22 * p_4152_6_, var25 * p_4152_7_);
this.func_1231_e(p_4152_1_, (double)p_4152_2_, (double)p_4152_3_, (double)p_4152_4_, 38);
@@ -3783,7 +3816,7 @@
@@ -3762,7 +3795,7 @@
var28 = p_4152_1_.func_211_a(this.field_1772_a, p_4152_2_, p_4152_3_, p_4152_4_, 5);
this.func_1236_f(p_4152_1_, (double)p_4152_2_, (double)p_4152_3_, (double)p_4152_4_, var28);
@ -401,7 +401,7 @@
{
var8.func_987_a(var19 * p_4152_5_, var22 * p_4152_6_, var25 * p_4152_7_);
this.func_1236_f(p_4152_1_, (double)p_4152_2_, (double)p_4152_3_, (double)p_4152_4_, 38);
@@ -5291,6 +5324,10 @@
@@ -5270,6 +5303,10 @@
p_1227_1_.func_213_a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
@ -412,7 +412,7 @@
}
else
{
@@ -5347,6 +5384,17 @@
@@ -5326,6 +5363,17 @@
public static boolean func_1219_a(int p_1219_0_)
{