HD patching complete? Clean up mod info data, Dummy field for dummy mods

This commit is contained in:
Christian Weeks 2012-05-14 01:38:53 -04:00
parent d48213b444
commit a01711361d
15 changed files with 418 additions and 45 deletions

View file

@ -20,6 +20,7 @@ import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
@ -56,6 +57,7 @@ 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;
@ -114,10 +116,13 @@ public class FMLClientHandler implements IFMLSidedHandler
private NetClientHandler networkClient;
private ModContainer animationCallbackMod;
// Cached lookups
private static HashMap<String, ArrayList<OverrideInfo>> overrideInfo = new HashMap<String, ArrayList<OverrideInfo>>();
private static HashMap<Integer, BlockRenderInfo> blockModelIds = new HashMap<Integer, BlockRenderInfo>();
private static HashMap<KeyBinding, ModContainer> keyBindings = new HashMap<KeyBinding, ModContainer>();
private HashMap<String, ArrayList<OverrideInfo>> overrideInfo = new HashMap<String, ArrayList<OverrideInfo>>();
private HashMap<Integer, BlockRenderInfo> blockModelIds = new HashMap<Integer, BlockRenderInfo>();
private HashMap<KeyBinding, ModContainer> keyBindings = new HashMap<KeyBinding, ModContainer>();
private HashSet<OverrideInfo> animationSet = new HashSet<OverrideInfo>();
/**
* Called to start the whole game off from
@ -715,6 +720,13 @@ public class FMLClientHandler implements IFMLSidedHandler
}
public void registerTextureOverrides(RenderEngine renderer) {
for (ModContainer mod : Loader.getModList()) {
registerAnimatedTexturesFor(mod);
}
for (OverrideInfo animationOverride : animationSet) {
renderer.func_1066_a(animationOverride.textureFX);
}
for (String fileToOverride : overrideInfo.keySet()) {
for (OverrideInfo override : overrideInfo.get(fileToOverride)) {
try
@ -731,6 +743,16 @@ public class FMLClientHandler implements IFMLSidedHandler
}
}
/**
* @param mod
*/
private void registerAnimatedTexturesFor(ModContainer mod)
{
this.animationCallbackMod=mod;
mod.requestAnimations();
this.animationCallbackMod=null;
}
public String getObjectName(Object instance) {
String objectName;
if (instance instanceof Item) {
@ -789,4 +811,22 @@ public class FMLClientHandler implements IFMLSidedHandler
this.networkClient.func_847_a(packet);
}
}
/**
* @param anim
*/
public void addAnimation(TextureFX anim)
{
if (animationCallbackMod==null) {
return;
}
OverrideInfo info=new OverrideInfo();
info.index=anim.field_1126_b;
info.imageIndex=anim.field_1128_f;
info.textureFX=anim;
if (animationSet.contains(info)) {
animationSet.remove(info);
}
animationSet.add(info);
}
}

View file

@ -14,6 +14,8 @@
package cpw.mods.fml.client;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import net.minecraft.client.Minecraft;
import net.minecraft.src.FontRenderer;
import net.minecraft.src.GuiButton;
@ -30,6 +32,8 @@ public class GuiModList extends GuiScreen
private GuiScreen mainMenu;
private GuiSlotModList modList;
private int selected = -1;
private ModContainer selectedMod;
/**
* @param guiMainMenu
@ -64,6 +68,15 @@ public class GuiModList extends GuiScreen
{
this.modList.drawScreen(p_571_1_, p_571_2_, p_571_3_);
this.func_548_a(this.field_6451_g, "Mod List", this.field_951_c / 2, 16, 16777215);
if (selectedMod!=null) {
this.func_548_a(this.field_6451_g, selectedMod.getName(), this.field_951_c / 2 + 60, 28, 16777215);
this.func_548_a(this.field_6451_g, String.format("Version %s",selectedMod.getVersion()), this.field_951_c / 2 + 60, 38, 16777215);
if (selectedMod.getMetadata()!=null) {
this.func_548_a(this.field_6451_g, selectedMod.getMetadata().description, this.field_951_c / 2 + 60, 48, 0xFFFFFF);
} else {
this.func_548_a(this.field_6451_g, "No mod information found", this.field_951_c / 2 + 60, 48, 0xDDDDDD);
}
}
super.func_571_a(p_571_1_, p_571_2_, p_571_3_);
}
@ -74,4 +87,26 @@ public class GuiModList extends GuiScreen
FontRenderer getFontRenderer() {
return field_6451_g;
}
/**
* @param var1
*/
public void selectModIndex(int var1)
{
this.selected=var1;
if (var1>=0 && var1<=Loader.getModList().size()) {
this.selectedMod=Loader.getModList().get(selected);
} else {
this.selectedMod=null;
}
}
/**
* @param var1
* @return
*/
public boolean modIndexSelected(int var1)
{
return var1==selected;
}
}

View file

@ -16,7 +16,7 @@ public abstract class GuiScrollingList
protected final int top;
protected final int bottom;
private final int right;
private final int left;
protected final int left;
protected final int slotHeight;
private int scrollUpActionId;
private int scrollDownActionId;
@ -140,9 +140,10 @@ public abstract class GuiScrollingList
this.mouseY = mouseY;
this.drawBackground();
int listLength = this.getSize();
int scrollBarXStart = this.listWidth / 2 + 124;
int scrollBarXStart = this.listWidth -6;
int scrollBarXEnd = scrollBarXStart + 6;
int var9;
int boxLeft = this.left;
int boxRight = scrollBarXStart-1;
int var10;
int var11;
int var13;
@ -156,21 +157,19 @@ public abstract class GuiScrollingList
if (mouseY >= this.top && mouseY <= this.bottom)
{
int var8 = this.listWidth / 2 - 110;
var9 = this.listWidth / 2 + 110;
var10 = mouseY - this.top - this.field_27261_r + (int)this.scrollDistance - 4;
var11 = var10 / this.slotHeight;
if (mouseX >= var8 && mouseX <= var9 && var11 >= 0 && var10 >= 0 && var11 < listLength)
if (mouseX >= boxLeft && mouseX <= boxRight && var11 >= 0 && var10 >= 0 && var11 < listLength)
{
boolean var12 = var11 == this.selectedIndex && System.currentTimeMillis() - this.lastClickTime < 250L;
this.elementClicked(var11, var12);
this.selectedIndex = var11;
this.lastClickTime = System.currentTimeMillis();
}
else if (mouseX >= var8 && mouseX <= var9 && var10 < 0)
else if (mouseX >= boxLeft && mouseX <= boxRight && var10 < 0)
{
this.func_27255_a(mouseX - var8, mouseY - this.top + (int)this.scrollDistance - 4);
this.func_27255_a(mouseX - boxLeft, mouseY - this.top + (int)this.scrollDistance - 4);
var7 = false;
}
@ -261,12 +260,12 @@ public abstract class GuiScrollingList
var18.func_983_a((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / var17), (double)((float)(this.top + (int)this.scrollDistance) / var17));
var18.func_983_a((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / var17), (double)((float)(this.top + (int)this.scrollDistance) / var17));
var18.func_982_a();
var9 = this.listWidth / 2 - 92 - 16;
// boxRight = this.listWidth / 2 - 92 - 16;
var10 = this.top + 4 - (int)this.scrollDistance;
if (this.field_27262_q)
{
this.func_27260_a(var9, var10, var18);
this.func_27260_a(boxRight, var10, var18);
}
int var14;
@ -280,8 +279,8 @@ public abstract class GuiScrollingList
{
if (this.field_25123_p && this.isSelected(var11))
{
var14 = this.listWidth / 2 - 110;
int var15 = this.listWidth / 2 + 110;
var14 = boxLeft;
int var15 = boxRight;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_TEXTURE_2D);
var18.func_977_b();
@ -299,7 +298,7 @@ public abstract class GuiScrollingList
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
this.drawSlot(var11, var9, var19, var13, var18);
this.drawSlot(var11, boxRight, var19, var13, var18);
}
}

View file

@ -33,7 +33,7 @@ public class GuiSlotModList extends GuiScrollingList
public GuiSlotModList(GuiModList parent)
{
super(parent.getMinecraftInstance(), parent.field_951_c, parent.field_950_d, 32, parent.field_950_d - 65 + 4, 10, 18);
super(parent.getMinecraftInstance(), 120, parent.field_950_d, 32, parent.field_950_d - 65 + 4, 10, 18);
this.parent=parent;
}
@ -46,14 +46,13 @@ public class GuiSlotModList extends GuiScrollingList
@Override
protected void elementClicked(int var1, boolean var2)
{
// TODO Auto-generated method stub
this.parent.selectModIndex(var1);
}
@Override
protected boolean isSelected(int var1)
{
return false;
return this.parent.modIndexSelected(var1);
}
@Override
@ -73,14 +72,7 @@ public class GuiSlotModList extends GuiScrollingList
{
ModContainer mc=Loader.getModList().get(listIndex);
ModMetadata meta=mc.getMetadata();
if (meta!=null) {
this.parent.func_548_a(this.parent.getFontRenderer(), meta.name, this.parent.field_951_c / 2, var3 + 1, 16777215);
this.parent.func_548_a(this.parent.getFontRenderer(), meta.description, this.parent.field_951_c / 2, var3 + this.parent.getFontRenderer().field_41063_b +1, 16777215);
this.parent.func_548_a(this.parent.getFontRenderer(), mc.getName(), this.parent.field_951_c / 2, var3 + this.parent.getFontRenderer().field_41063_b *2 +2, 16777215);
} else {
this.parent.func_548_a(this.parent.getFontRenderer(), mc.getName(), this.parent.field_951_c / 2, var3 + 1, 16777215);
this.parent.func_548_a(this.parent.getFontRenderer(), "Mod information not found", this.parent.field_951_c / 2, var3 + 1, 16777215);
}
this.parent.func_547_b(this.parent.getFontRenderer(), mc.getName(), this.left+3, var3 + 3, 16777215);
}
}

View file

@ -14,9 +14,30 @@
package cpw.mods.fml.client;
import net.minecraft.src.TextureFX;
class OverrideInfo
{
public String texture;
public String override;
public int index;
public int imageIndex;
public TextureFX textureFX;
@Override
public boolean equals(Object obj)
{
try {
OverrideInfo inf=(OverrideInfo) obj;
return index==inf.index && imageIndex==inf.imageIndex;
} catch (Exception e) {
return false;
}
}
@Override
public int hashCode()
{
return index+imageIndex;
}
}

View file

@ -16,6 +16,7 @@ import java.util.Map;
import java.util.Random;
import net.minecraft.client.Minecraft;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.IConsoleHandler;
import cpw.mods.fml.common.ICraftingHandler;
import cpw.mods.fml.common.IDispenseHandler;
@ -45,6 +46,23 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
return true;
}
/**
* @param renderers
*/
public final void onRenderHarvest(Map renderers)
{
addRenderer((Map<Class<? extends Entity>,Render>)renderers);
}
/**
*
*/
public final void onRegisterAnimations()
{
registerAnimation(FMLClientHandler.instance().getClient());
}
@Override
public final void onCrafting(Object... craftingParameters)
{
@ -402,13 +420,4 @@ public abstract class BaseMod implements IWorldGenerator, IPickupNotifier, IDisp
}
/**
* @param renderers
*/
public void onRenderHarvest(Map renderers)
{
addRenderer((Map<Class<? extends Entity>,Render>)renderers);
}
}

View file

@ -13,7 +13,9 @@
package net.minecraft.src;
import java.awt.image.BufferedImage;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
@ -31,6 +33,8 @@ import cpw.mods.fml.common.modloader.ModLoaderModContainer;
public class ModLoader
{
// TODO dirty workaround for millinaire
public static final Map<String,Map<String,String>> languageProperties=Collections.emptyMap();
/**
* Not used on the server.
*
@ -60,12 +64,14 @@ public class ModLoader
return 0;
}
@Deprecated
public static void addAllRenderers(Map<Class<? extends Entity>, Render> renderers)
{
}
public static void addAnimation(TextureFX anim)
{
FMLClientHandler.instance().addAnimation(anim);
}
/**

View file

@ -383,4 +383,22 @@ public class FMLModContainer implements ModContainer
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see cpw.mods.fml.common.ModContainer#requestAnimations()
*/
@Override
public void requestAnimations()
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see cpw.mods.fml.common.ModContainer#getVersion()
*/
@Override
public String getVersion()
{
// TODO Auto-generated method stub
return null;
}
}

View file

@ -233,4 +233,12 @@ public interface ModContainer
*
*/
void gatherRenderers(Map renderers);
/**
*
*/
void requestAnimations();
/**
* @return
*/
String getVersion();
}

View file

@ -665,4 +665,22 @@ public class ModLoaderModContainer implements ModContainer
{
mod.onRenderHarvest(renderers);
}
/* (non-Javadoc)
* @see cpw.mods.fml.common.ModContainer#requestAnimations()
*/
@Override
public void requestAnimations()
{
mod.onRegisterAnimations();
}
/* (non-Javadoc)
* @see cpw.mods.fml.common.ModContainer#getVersion()
*/
@Override
public String getVersion()
{
return mod!=null ? mod.getVersion() : "Not available";
}
}

View file

@ -0,0 +1,78 @@
--- ../src-base/minecraft/net/minecraft/src/TextureCompassFX.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src-work/minecraft/net/minecraft/src/TextureCompassFX.java 0000-00-00 00:00:00.000000000 -0000
@@ -8,7 +8,7 @@
public class TextureCompassFX extends TextureFX
{
private Minecraft field_4231_g;
- private int[] field_4230_h = new int[256];
+ private int[] field_4230_h;
private double field_4229_i;
private double field_4228_j;
@@ -17,13 +17,17 @@
super(Item.field_4025_aO.func_27009_a(0));
this.field_4231_g = p_i617_1_;
this.field_1128_f = 1;
-
+ setup();
+ }
+ public void setup()
+ {
+ field_4230_h = new int[textureGridSize];
try
{
- BufferedImage var2 = ImageIO.read(Minecraft.class.getResource("/gui/items.png"));
- int var3 = this.field_1126_b % 16 * 16;
- int var4 = this.field_1126_b / 16 * 16;
- var2.getRGB(var3, var4, 16, 16, this.field_4230_h, 0, 16);
+ BufferedImage var2 = ImageIO.read(field_4231_g.field_6298_C.field_6534_a.func_6481_a("/gui/items.png"));
+ int var3 = this.field_1126_b % 16 * textureLength;
+ int var4 = this.field_1126_b / 16 * textureLength;
+ var2.getRGB(var3, var4, textureLength, textureLength, this.field_4230_h, 0, textureLength);
}
catch (IOException var5)
{
@@ -33,7 +37,10 @@
public void func_783_a()
{
- for (int var1 = 0; var1 < 256; ++var1)
+ if (field_4230_h.length!=textureGridSize) {
+ setup();
+ }
+ for (int var1 = 0; var1 < textureGridSize; ++var1)
{
int var2 = this.field_4230_h[var1] >> 24 & 255;
int var3 = this.field_4230_h[var1] >> 16 & 255;
@@ -110,11 +117,11 @@
int var19;
int var18;
- for (var9 = -4; var9 <= 4; ++var9)
+ for (var9 = -(textureLength >> 2); var9 <= (textureLength >> 2); ++var9)
{
- var10 = (int)(8.5D + var26 * (double)var9 * 0.3D);
- var11 = (int)(7.5D - var24 * (double)var9 * 0.3D * 0.5D);
- var12 = var11 * 16 + var10;
+ var10 = (int)((textureLength >> 1) + 0.5D + var26 * (double)var9 * 0.3D);
+ var11 = (int)((textureLength >> 1) - 0.5D - var24 * (double)var9 * 0.3D * 0.5D);
+ var12 = var11 * textureLength + var10;
var13 = 100;
var14 = 100;
var15 = 100;
@@ -136,11 +143,11 @@
this.field_1127_a[var12 * 4 + 3] = (byte)var16;
}
- for (var9 = -8; var9 <= 16; ++var9)
+ for (var9 = -(textureLength>>2); var9 <= textureLength; ++var9)
{
- var10 = (int)(8.5D + var24 * (double)var9 * 0.3D);
- var11 = (int)(7.5D + var26 * (double)var9 * 0.3D * 0.5D);
- var12 = var11 * 16 + var10;
+ var10 = (int)((textureLength >> 1) + 0.5D + var24 * (double)var9 * 0.3D);
+ var11 = (int)((textureLength >> 1) - 0.5D + var26 * (double)var9 * 0.3D * 0.5D);
+ var12 = var11 * textureLength + var10;
var13 = var9 >= 0 ? 255 : 100;
var14 = var9 >= 0 ? 20 : 100;
var15 = var9 >= 0 ? 20 : 100;

View file

@ -1,10 +1,10 @@
--- ../src-base/minecraft/net/minecraft/src/TextureFlamesFX.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src-work/minecraft/net/minecraft/src/TextureFlamesFX.java 0000-00-00 00:00:00.000000000 -0000
@@ -12,35 +12,41 @@
@@ -12,35 +12,46 @@
public void func_783_a()
{
+ int fireLength = textureLength + textureLength << 2;
+ int fireLength = textureLength + (textureLength >> 2);
+ int fireGridSize = fireLength * textureLength;
+ if (field_1132_h.length != fireGridSize) {
+ field_1133_g = new float[fireGridSize];
@ -15,13 +15,19 @@
int var6;
- for (int var1 = 0; var1 < 16; ++var1)
+ float fireFactor1 = 3.0F + (float)(textureLength >> 4);
+
+ float fireFactor2 = 1.07F - (textureLength >> 4) *0.01F;
+
+ for (int var1 = 0; var1 < textureLength; ++var1)
{
- for (int var2 = 0; var2 < 20; ++var2)
+ for (int var2 = 0; var2 < fireLength; ++var2)
{
var3 = 18;
- var3 = 18;
- var4 = this.field_1133_g[var1 + (var2 + 1) % 20 * 16] * (float)var3;
+ var3 = fireLength - 2;//(textureLength >> 3);
+
+ var4 = this.field_1133_g[var1 + (var2 + 1) % fireLength * textureLength] * (float)var3;
for (int var5 = var1 - 1; var5 <= var1 + 1; ++var5)
@ -40,17 +46,17 @@
}
- this.field_1132_h[var1 + var2 * 16] = var4 / ((float)var3 * 1.0600001F);
+ this.field_1132_h[var1 + var2 * textureLength] = var4 / ((float)var3 * 1.0600001F);
+ this.field_1132_h[var1 + var2 * textureLength] = var4 / ((float)var3 * fireFactor2);
- if (var2 >= 19)
+ if (var2 >= fireLength - textureLength << 4)
+ if (var2 >= fireLength - (textureLength >> 4))
{
- this.field_1132_h[var1 + var2 * 16] = (float)(Math.random() * Math.random() * Math.random() * 4.0D + Math.random() * 0.10000000149011612D + 0.20000000298023224D);
+ this.field_1132_h[var1 + var2 * textureLength] = (float)(Math.random() * Math.random() * Math.random() * 4.0D + Math.random() * 0.10000000149011612D + 0.20000000298023224D);
+ this.field_1132_h[var1 + var2 * textureLength] = (float)(Math.random() * Math.random() * Math.random() * fireFactor1 + Math.random() * 0.1F + 0.2F);
}
}
}
@@ -49,7 +55,7 @@
@@ -49,7 +60,7 @@
this.field_1132_h = this.field_1133_g;
this.field_1133_g = var13;

View file

@ -71,7 +71,7 @@
+ for (var2 = 0; var2 < textureGridSize; ++var2)
{
- var3 = this.field_1143_g[var2 - this.field_1139_k / 3 * 16 & 255] * 2.0F;
+ var3 = this.field_1143_g[var2 - this.field_1139_k / 3 * textureLength & textureGridSizeMask] * 2.0F;
+ var3 = this.field_1143_g[(var2 - this.field_1139_k / 3 * textureLength) & textureGridSizeMask] * 2.0F;
if (var3 > 1.0F)
{

View file

@ -0,0 +1,68 @@
--- ../src-base/minecraft/net/minecraft/src/TexturePortalFX.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src-work/minecraft/net/minecraft/src/TexturePortalFX.java 0000-00-00 00:00:00.000000000 -0000
@@ -5,28 +5,34 @@
public class TexturePortalFX extends TextureFX
{
private int field_4227_g = 0;
- private byte[][] field_4226_h = new byte[32][1024];
+ private byte[][] field_4226_h;
public TexturePortalFX()
{
super(Block.field_4047_bf.field_378_bb);
+ setupPortalTextures();
+ }
+
+ private void setupPortalTextures()
+ {
+ field_4226_h = new byte[32][textureGridSize << 4];
Random var1 = new Random(100L);
for (int var2 = 0; var2 < 32; ++var2)
{
- for (int var3 = 0; var3 < 16; ++var3)
+ for (int var3 = 0; var3 < textureLength; ++var3)
{
- for (int var4 = 0; var4 < 16; ++var4)
+ for (int var4 = 0; var4 < textureLength; ++var4)
{
float var5 = 0.0F;
int var6;
for (var6 = 0; var6 < 2; ++var6)
{
- float var7 = (float)(var6 * 16) * 0.5F;
- float var8 = (float)(var6 * 16) * 0.5F;
- float var9 = ((float)var3 - var7) / 16.0F * 2.0F;
- float var10 = ((float)var4 - var8) / 16.0F * 2.0F;
+ float var7 = (float)(var6 * textureLength) * 0.5F;
+ float var8 = (float)(var6 * textureLength) * 0.5F;
+ float var9 = ((float)var3 - var7) / (float)textureLength * 2.0F;
+ float var10 = ((float)var4 - var8) / (float)textureLength * 2.0F;
if (var9 < -1.0F)
{
@@ -60,7 +66,7 @@
int var13 = (int)(var5 * var5 * 200.0F + 55.0F);
int var14 = (int)(var5 * var5 * var5 * var5 * 255.0F);
int var15 = (int)(var5 * 100.0F + 155.0F);
- int var16 = var4 * 16 + var3;
+ int var16 = var4 * textureLength + var3;
this.field_4226_h[var2][var16 * 4 + 0] = (byte)var13;
this.field_4226_h[var2][var16 * 4 + 1] = (byte)var14;
this.field_4226_h[var2][var16 * 4 + 2] = (byte)var6;
@@ -72,10 +78,13 @@
public void func_783_a()
{
+ if (field_4226_h[0].length!=textureLength) {
+ setupPortalTextures();
+ }
++this.field_4227_g;
byte[] var1 = this.field_4226_h[this.field_4227_g & 31];
- for (int var2 = 0; var2 < 256; ++var2)
+ for (int var2 = 0; var2 < textureGridSize; ++var2)
{
int var3 = var1[var2 * 4 + 0] & 255;
int var4 = var1[var2 * 4 + 1] & 255;

View file

@ -0,0 +1,75 @@
--- ../src-base/minecraft/net/minecraft/src/TextureWatchFX.java 0000-00-00 00:00:00.000000000 -0000
+++ ../src-work/minecraft/net/minecraft/src/TextureWatchFX.java 0000-00-00 00:00:00.000000000 -0000
@@ -18,15 +18,21 @@
super(Item.field_4023_aQ.func_27009_a(0));
this.field_4225_g = p_i364_1_;
this.field_1128_f = 1;
-
+ setup();
+ }
+
+ public void setup()
+ {
+ field_4224_h = new int[textureGridSize];
+ field_4223_i = new int[textureGridSize];
try
{
- BufferedImage var2 = ImageIO.read(Minecraft.class.getResource("/gui/items.png"));
- int var3 = this.field_1126_b % 16 * 16;
- int var4 = this.field_1126_b / 16 * 16;
- var2.getRGB(var3, var4, 16, 16, this.field_4224_h, 0, 16);
- var2 = ImageIO.read(Minecraft.class.getResource("/misc/dial.png"));
- var2.getRGB(0, 0, 16, 16, this.field_4223_i, 0, 16);
+ BufferedImage var2 = ImageIO.read(field_4225_g.field_6298_C.field_6534_a.func_6481_a("/gui/items.png"));
+ int var3 = this.field_1126_b % 16 * textureLength;
+ int var4 = this.field_1126_b / 16 * textureLength;
+ var2.getRGB(var3, var4, textureLength, textureLength, this.field_4224_h, 0, textureLength);
+ var2 = ImageIO.read(field_4225_g.field_6298_C.field_6534_a.func_6481_a("/misc/dial.png"));
+ var2.getRGB(0, 0, textureLength, textureLength, this.field_4223_i, 0, textureLength);
}
catch (IOException var5)
{
@@ -36,6 +42,9 @@
public void func_783_a()
{
+ if (field_4224_h.length!=textureGridSize) {
+ setup();
+ }
double var1 = 0.0D;
if (this.field_4225_g.field_6324_e != null && this.field_4225_g.field_6322_g != null)
@@ -71,13 +80,14 @@
var22 = 1.0D;
}
+ int textureLengthMask = textureLength - 1;
this.field_4221_k += var22 * 0.1D;
this.field_4221_k *= 0.8D;
this.field_4222_j += this.field_4221_k;
double var5 = Math.sin(this.field_4222_j);
double var7 = Math.cos(this.field_4222_j);
- for (int var9 = 0; var9 < 256; ++var9)
+ for (int var9 = 0; var9 < textureGridSize; ++var9)
{
int var10 = this.field_4224_h[var9] >> 24 & 255;
int var11 = this.field_4224_h[var9] >> 16 & 255;
@@ -86,12 +96,12 @@
if (var11 == var13 && var12 == 0 && var13 > 0)
{
- double var14 = -((double)(var9 % 16) / 15.0D - 0.5D);
- double var16 = (double)(var9 / 16) / 15.0D - 0.5D;
+ double var14 = -((double)(var9 % textureLength) / textureLengthMask - 0.5D);
+ double var16 = (double)(var9 / textureLength) / textureLengthMask - 0.5D;
int var18 = var11;
- int var19 = (int)((var14 * var7 + var16 * var5 + 0.5D) * 16.0D);
- int var20 = (int)((var16 * var7 - var14 * var5 + 0.5D) * 16.0D);
- int var21 = (var19 & 15) + (var20 & 15) * 16;
+ int var19 = (int)((var14 * var7 + var16 * var5 + 0.5D) * textureLength);
+ int var20 = (int)((var16 * var7 - var14 * var5 + 0.5D) * textureLength);
+ int var21 = (var19 & textureLengthMask) + (var20 & textureLengthMask) * textureLength;
var10 = this.field_4223_i[var21] >> 24 & 255;
var11 = (this.field_4223_i[var21] >> 16 & 255) * var11 / 255;
var12 = (this.field_4223_i[var21] >> 8 & 255) * var18 / 255;