Inital 1.8 patch update. 'It compiles!'

This commit is contained in:
Lex Manos 2014-09-19 17:24:36 -07:00
parent ebb91ba280
commit 1ac0c5d87f
104 changed files with 1300 additions and 1790 deletions

View file

@ -1,27 +1,21 @@
--- ../src-base/minecraft/net/minecraft/block/Block.java --- ../src-base/minecraft/net/minecraft/block/Block.java
+++ ../src-work/minecraft/net/minecraft/block/Block.java +++ ../src-work/minecraft/net/minecraft/block/Block.java
@@ -1,5 +1,6 @@ @@ -39,7 +39,7 @@
package net.minecraft.block;
+import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Iterator;
@@ -32,7 +33,7 @@
public class Block public class Block
{ {
- public static final RegistryNamespaced field_149771_c = new RegistryNamespacedDefaultedByKey("air"); private static final ResourceLocation field_176230_a = new ResourceLocation("air");
+ public static final RegistryNamespaced field_149771_c = GameData.getBlockRegistry(); - public static final RegistryNamespacedDefaultedByKey field_149771_c = new RegistryNamespacedDefaultedByKey(field_176230_a);
+ public static final RegistryNamespacedDefaultedByKey field_149771_c = cpw.mods.fml.common.registry.GameData.getBlockRegistry();
public static final ObjectIntIdentityMap field_176229_d = new ObjectIntIdentityMap();
private CreativeTabs field_149772_a; private CreativeTabs field_149772_a;
protected String field_149768_d;
public static final Block.SoundType field_149769_e = new Block.SoundType("stone", 1.0F, 1.0F); public static final Block.SoundType field_149769_e = new Block.SoundType("stone", 1.0F, 1.0F);
@@ -102,6 +103,8 @@ @@ -124,6 +124,9 @@
protected IIcon field_149761_L; private String field_149770_b;
private static final String __OBFID = "CL_00000199"; private static final String __OBFID = "CL_00000199";
+ public final cpw.mods.fml.common.registry.RegistryDelegate<Block> delegate = + public final cpw.mods.fml.common.registry.RegistryDelegate<Block> delegate =
+ ((cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry)field_149771_c).getDelegate(this, Block.class); + ((cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry)field_149771_c).getDelegate(this, Block.class);
+
public static int func_149682_b(Block p_149682_0_) public static int func_149682_b(Block p_149682_0_)
{ {
return field_149771_c.func_148757_b(p_149682_0_); return field_149771_c.func_148757_b(p_149682_0_);

View file

@ -1,17 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/ClientBrandRetriever.java --- ../src-base/minecraft/net/minecraft/client/ClientBrandRetriever.java
+++ ../src-work/minecraft/net/minecraft/client/ClientBrandRetriever.java +++ ../src-work/minecraft/net/minecraft/client/ClientBrandRetriever.java
@@ -1,5 +1,6 @@ @@ -10,6 +10,6 @@
package net.minecraft.client;
+import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -10,6 +11,6 @@
public static String getClientModName() public static String getClientModName()
{ {
- return "vanilla"; - return "vanilla";
+ return FMLCommonHandler.instance().getModName(); + return cpw.mods.fml.common.FMLCommonHandler.instance().getModName();
} }
} }

View file

@ -1,26 +1,26 @@
--- ../src-base/minecraft/net/minecraft/client/LoadingScreenRenderer.java --- ../src-base/minecraft/net/minecraft/client/LoadingScreenRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/LoadingScreenRenderer.java +++ ../src-work/minecraft/net/minecraft/client/LoadingScreenRenderer.java
@@ -1,5 +1,6 @@ @@ -139,6 +139,10 @@
package net.minecraft.client; GlStateManager.func_179086_m(16640);
+import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.Gui;
@@ -138,6 +139,8 @@
GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
} }
+ if (!FMLClientHandler.instance().handleLoadingScreen(scaledresolution)) + try
+ { + {
Tessellator tessellator = Tessellator.field_78398_a; + if (!cpw.mods.fml.client.FMLClientHandler.instance().handleLoadingScreen(scaledresolution)) //FML Don't render while FML's pre-screen is rendering
+ {
Tessellator tessellator = Tessellator.func_178181_a();
WorldRenderer worldrenderer = tessellator.func_178180_c();
this.field_73725_b.func_110434_K().func_110577_a(Gui.field_110325_k); this.field_73725_b.func_110434_K().func_110577_a(Gui.field_110325_k);
float f = 32.0F; @@ -177,6 +181,12 @@
@@ -175,6 +178,7 @@ GlStateManager.func_179120_a(770, 771, 1, 0);
OpenGlHelper.func_148821_a(770, 771, 1, 0); this.field_73725_b.field_71466_p.func_175063_a(this.field_73726_c, (float)((l - this.field_73725_b.field_71466_p.func_78256_a(this.field_73726_c)) / 2), (float)(i1 / 2 - 4 - 16), 16777215);
this.field_73725_b.field_71466_p.func_78261_a(this.field_73726_c, (l - this.field_73725_b.field_71466_p.func_78256_a(this.field_73726_c)) / 2, i1 / 2 - 4 - 16, 16777215); this.field_73725_b.field_71466_p.func_175063_a(this.field_73727_a, (float)((l - this.field_73725_b.field_71466_p.func_78256_a(this.field_73727_a)) / 2), (float)(i1 / 2 - 4 + 8), 16777215);
this.field_73725_b.field_71466_p.func_78261_a(this.field_73727_a, (l - this.field_73725_b.field_71466_p.func_78256_a(this.field_73727_a)) / 2, i1 / 2 - 4 + 8, 16777215);
+ } + }
+ }
+ catch (java.io.IOException e)
+ {
+ com.google.common.base.Throwables.propagate(e);
+ } //FML End
this.field_146588_g.func_147609_e(); this.field_146588_g.func_147609_e();
if (OpenGlHelper.func_148822_b()) if (OpenGlHelper.func_148822_b())

View file

@ -1,125 +1,106 @@
--- ../src-base/minecraft/net/minecraft/client/Minecraft.java --- ../src-base/minecraft/net/minecraft/client/Minecraft.java
+++ ../src-work/minecraft/net/minecraft/client/Minecraft.java +++ ../src-work/minecraft/net/minecraft/client/Minecraft.java
@@ -9,6 +9,9 @@ @@ -410,7 +410,7 @@
import com.google.common.util.concurrent.ListenableFutureTask;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.StartupQuery;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.util.concurrent.GenericFutureListener;
@@ -169,6 +172,8 @@
import org.lwjgl.opengl.PixelFormat;
import org.lwjgl.util.glu.GLU;
+import com.google.common.collect.MapDifference;
+
@SideOnly(Side.CLIENT)
public class Minecraft implements IPlayerUsage
{
@@ -344,21 +349,23 @@
File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt");
System.out.println(p_71377_1_.func_71502_e());
+ int retVal;
if (p_71377_1_.func_71497_f() != null)
{
System.out.println("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_1_.func_71497_f());
- System.exit(-1);
+ retVal = -1;
}
else if (p_71377_1_.func_147149_a(file2))
{
System.out.println("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath());
- System.exit(-1);
+ retVal = -1;
}
else
{
System.out.println("#@?@# Game crashed! Crash report could not be saved. #@?@#");
- System.exit(-2);
+ retVal = -2;
}
+ FMLCommonHandler.instance().handleExit(retVal);
}
public void func_71367_a(String p_71367_1_, int p_71367_2_)
@@ -471,7 +478,7 @@
this.field_110451_am = new SimpleReloadableResourceManager(this.field_110452_an); this.field_110451_am = new SimpleReloadableResourceManager(this.field_110452_an);
this.field_135017_as = new LanguageManager(this.field_110452_an, this.field_71474_y.field_74363_ab); this.field_135017_as = new LanguageManager(this.field_110452_an, this.field_71474_y.field_74363_ab);
this.field_110451_am.func_110542_a(this.field_135017_as); this.field_110451_am.func_110542_a(this.field_135017_as);
- this.func_110436_a(); - this.func_110436_a();
+ FMLClientHandler.instance().beginMinecraftLoading(this, this.field_110449_ao, this.field_110451_am); + cpw.mods.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.field_110449_ao, this.field_110451_am);
this.field_71446_o = new TextureManager(this.field_110451_am); this.field_71446_o = new TextureManager(this.field_110451_am);
this.field_110451_am.func_110542_a(this.field_71446_o); this.field_110451_am.func_110542_a(this.field_71446_o);
this.field_152350_aA = new SkinManager(this.field_71446_o, new File(this.field_110446_Y, "skins"), this.field_152355_az); this.func_180510_a(this.field_71446_o);
@@ -532,12 +539,13 @@ @@ -482,12 +482,13 @@
this.field_71446_o.func_130088_a(TextureMap.field_110576_c, new TextureMap(1, "textures/items")); this.field_71458_u = new GuiAchievement(this);
GL11.glViewport(0, 0, this.field_71443_c, this.field_71440_d); GlStateManager.func_179083_b(0, 0, this.field_71443_c, this.field_71440_d);
this.field_71452_i = new EffectRenderer(this.field_71441_e, this.field_71446_o); this.field_71452_i = new EffectRenderer(this.field_71441_e, this.field_71446_o);
+ FMLClientHandler.instance().finishMinecraftLoading(); + cpw.mods.fml.client.FMLClientHandler.instance().finishMinecraftLoading();
this.func_71361_d("Post startup"); this.func_71361_d("Post startup");
this.field_71456_v = new GuiIngame(this); this.field_71456_v = new GuiIngame(this);
if (this.field_71475_ae != null) if (this.field_71475_ae != null)
{ {
- this.func_147108_a(new GuiConnecting(new GuiMainMenu(), this, this.field_71475_ae, this.field_71477_af)); - this.func_147108_a(new GuiConnecting(new GuiMainMenu(), this, this.field_71475_ae, this.field_71477_af));
+ FMLClientHandler.instance().connectToServerAtStartup(this.field_71475_ae, this.field_71477_af); + cpw.mods.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.field_71475_ae, this.field_71477_af);
} }
else else
{ {
@@ -553,6 +561,7 @@ @@ -503,6 +504,7 @@
this.func_71352_k(); this.func_71352_k();
} }
+ FMLClientHandler.instance().onInitializationComplete(); + cpw.mods.fml.client.FMLClientHandler.instance().onInitializationComplete();
try try
{ {
Display.setVSyncEnabled(this.field_71474_y.field_74352_v); Display.setVSyncEnabled(this.field_71474_y.field_74352_v);
@@ -971,9 +980,11 @@ @@ -681,21 +683,23 @@
File file2 = new File(file1, "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-client.txt");
Bootstrap.func_179870_a(p_71377_1_.func_71502_e());
+ int retVal;
if (p_71377_1_.func_71497_f() != null)
{
Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + p_71377_1_.func_71497_f());
- System.exit(-1);
+ retVal = -1;
}
else if (p_71377_1_.func_147149_a(file2))
{
Bootstrap.func_179870_a("#@!@# Game crashed! Crash report saved to: #@!@# " + file2.getAbsolutePath());
- System.exit(-1);
+ retVal = -1;
}
else
{
Bootstrap.func_179870_a("#@?@# Game crashed! Crash report could not be saved. #@?@#");
- System.exit(-2);
+ retVal = -2;
}
+ cpw.mods.fml.common.FMLCommonHandler.instance().handleExit(retVal);
}
public boolean func_152349_b()
@@ -1034,9 +1038,11 @@
if (!this.field_71454_w) if (!this.field_71454_w)
{ {
+ FMLCommonHandler.instance().onRenderTickStart(this.field_71428_T.field_74281_c); + cpw.mods.fml.common.FMLCommonHandler.instance().onRenderTickStart(this.field_71428_T.field_74281_c);
this.field_71424_I.func_76318_c("gameRenderer"); this.field_71424_I.func_76318_c("gameRenderer");
this.field_71460_t.func_78480_b(this.field_71428_T.field_74281_c); this.field_71460_t.func_78480_b(this.field_71428_T.field_74281_c);
this.field_71424_I.func_76319_b(); this.field_71424_I.func_76319_b();
+ FMLCommonHandler.instance().onRenderTickEnd(this.field_71428_T.field_74281_c); + cpw.mods.fml.common.FMLCommonHandler.instance().onRenderTickEnd(this.field_71428_T.field_74281_c);
} }
GL11.glFlush(); this.field_71424_I.func_76319_b();
@@ -1555,6 +1566,8 @@ @@ -1591,6 +1597,8 @@
--this.field_71467_ac; --this.field_71467_ac;
} }
+ FMLCommonHandler.instance().onPreClientTick(); + cpw.mods.fml.common.FMLCommonHandler.instance().onPreClientTick();
+ +
this.field_71424_I.func_76320_a("gui"); this.field_71424_I.func_76320_a("gui");
if (!this.field_71445_n) if (!this.field_71445_n)
@@ -1699,6 +1712,7 @@ @@ -1744,6 +1752,7 @@
this.field_71462_r.func_146274_d(); this.field_71462_r.func_146274_d();
} }
} }
+ FMLCommonHandler.instance().fireMouseInput(); + cpw.mods.fml.common.FMLCommonHandler.instance().fireMouseInput();
} }
if (this.field_71429_W > 0) if (this.field_71429_W > 0)
@@ -1836,6 +1850,7 @@ @@ -1920,6 +1929,7 @@
} }
} }
} }
+ FMLCommonHandler.instance().fireKeyInput(); + cpw.mods.fml.common.FMLCommonHandler.instance().fireKeyInput();
} }
for (j = 0; j < 9; ++j) for (i = 0; i < 9; ++i)
@@ -2026,12 +2041,15 @@ @@ -2120,12 +2130,15 @@
this.field_71453_ak.func_74428_b(); this.field_71453_ak.func_74428_b();
} }
+ FMLCommonHandler.instance().onPostClientTick(); + cpw.mods.fml.common.FMLCommonHandler.instance().onPostClientTick();
+ +
this.field_71424_I.func_76319_b(); this.field_71424_I.func_76319_b();
this.field_71423_H = func_71386_F(); this.field_71423_H = func_71386_F();
@ -127,15 +108,15 @@
public void func_71371_a(String p_71371_1_, String p_71371_2_, WorldSettings p_71371_3_) public void func_71371_a(String p_71371_1_, String p_71371_2_, WorldSettings p_71371_3_)
{ {
+ FMLClientHandler.instance().startIntegratedServer(p_71371_1_, p_71371_2_, p_71371_3_); + cpw.mods.fml.client.FMLClientHandler.instance().startIntegratedServer(p_71371_1_, p_71371_2_, p_71371_3_);
this.func_71403_a((WorldClient)null); this.func_71403_a((WorldClient)null);
System.gc(); System.gc();
ISaveHandler isavehandler = this.field_71469_aa.func_75804_a(p_71371_1_, false); ISaveHandler isavehandler = this.field_71469_aa.func_75804_a(p_71371_1_, false);
@@ -2067,6 +2085,12 @@ @@ -2161,6 +2174,12 @@
while (!this.field_71437_Z.func_71200_ad()) while (!this.field_71437_Z.func_71200_ad())
{ {
+ if (!StartupQuery.check()) + if (!cpw.mods.fml.common.StartupQuery.check())
+ { + {
+ func_71403_a(null); + func_71403_a(null);
+ func_147108_a(null); + func_147108_a(null);
@ -144,11 +125,20 @@
String s2 = this.field_71437_Z.func_71195_b_(); String s2 = this.field_71437_Z.func_71195_b_();
if (s2 != null) if (s2 != null)
@@ -2142,6 +2166,7 @@ @@ -2186,7 +2205,7 @@
this.field_110448_aq.func_148529_f(); SocketAddress socketaddress = this.field_71437_Z.func_147137_ag().func_151270_a();
NetworkManager networkmanager = NetworkManager.func_150722_a(socketaddress);
networkmanager.func_150719_a(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null));
- networkmanager.func_179290_a(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN));
+ networkmanager.func_179290_a(new C00Handshake(47, socketaddress.toString(), 0, EnumConnectionState.LOGIN, true));
networkmanager.func_179290_a(new C00PacketLoginStart(this.func_110432_I().func_148256_e()));
this.field_71453_ak = networkmanager;
}
@@ -2237,6 +2256,7 @@
this.func_71351_a((ServerData)null); this.func_71351_a((ServerData)null);
this.field_71455_al = false; this.field_71455_al = false;
+ FMLClientHandler.instance().handleClientWorldClosing(this.field_71441_e); + cpw.mods.fml.client.FMLClientHandler.instance().handleClientWorldClosing(this.field_71441_e);
} }
this.field_147127_av.func_147690_c(); this.field_147127_av.func_147690_c();

View file

@ -1,14 +1,14 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiButton.java --- ../src-base/minecraft/net/minecraft/client/gui/GuiButton.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiButton.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiButton.java
@@ -23,6 +23,7 @@ @@ -22,6 +22,7 @@
public boolean field_146125_m; public boolean field_146125_m;
protected boolean field_146123_n; protected boolean field_146123_n;
private static final String __OBFID = "CL_00000668"; private static final String __OBFID = "CL_00000668";
+ public int packedFGColour; + public int packedFGColour; //FML
public GuiButton(int p_i1020_1_, int p_i1020_2_, int p_i1020_3_, String p_i1020_4_) public GuiButton(int p_i1020_1_, int p_i1020_2_, int p_i1020_3_, String p_i1020_4_)
{ {
@@ -76,8 +77,12 @@ @@ -75,8 +76,12 @@
this.func_146119_b(p_146112_1_, p_146112_2_, p_146112_3_); this.func_146119_b(p_146112_1_, p_146112_2_, p_146112_3_);
int l = 14737632; int l = 14737632;

View file

@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java --- ../src-base/minecraft/net/minecraft/client/gui/GuiCreateWorld.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiCreateWorld.java
@@ -211,6 +211,8 @@ @@ -213,6 +213,8 @@
} }
} }

View file

@ -1,21 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiIngame.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngame.java
@@ -1,5 +1,6 @@
package net.minecraft.client.gui;
+import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.awt.Color;
@@ -314,6 +315,11 @@
this.func_73731_b(fontrenderer, s, k - fontrenderer.func_78256_a(s) - 2, 2, 14737632);
s = "Allocated memory: " + j5 * 100L / i5 + "% (" + j5 / 1024L / 1024L + "MB)";
this.func_73731_b(fontrenderer, s, k - fontrenderer.func_78256_a(s) - 2, 12, 14737632);
+ int offset = 22;
+ for (String brd : FMLCommonHandler.instance().getBrandings(false))
+ {
+ this.func_73731_b(fontrenderer, brd, k - fontrenderer.func_78256_a(brd) - 2, offset+=10, 14737632);
+ }
j3 = MathHelper.func_76128_c(this.field_73839_d.field_71439_g.field_70165_t);
k3 = MathHelper.func_76128_c(this.field_73839_d.field_71439_g.field_70163_u);
int l3 = MathHelper.func_76128_c(this.field_73839_d.field_71439_g.field_70161_v);

View file

@ -1,30 +1,23 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiIngameMenu.java --- ../src-base/minecraft/net/minecraft/client/gui/GuiIngameMenu.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngameMenu.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiIngameMenu.java
@@ -1,5 +1,6 @@ @@ -30,8 +30,9 @@
package net.minecraft.client.gui;
+import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.achievement.GuiAchievements;
@@ -29,8 +30,9 @@
this.field_146292_n.add(new GuiButton(4, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 24 + b0, I18n.func_135052_a("menu.returnToGame", new Object[0]))); this.field_146292_n.add(new GuiButton(4, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 24 + b0, I18n.func_135052_a("menu.returnToGame", new Object[0])));
this.field_146292_n.add(new GuiButton(0, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 96 + b0, 98, 20, I18n.func_135052_a("menu.options", new Object[0]))); this.field_146292_n.add(new GuiButton(0, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 96 + b0, 98, 20, I18n.func_135052_a("menu.options", new Object[0])));
+ this.field_146292_n.add(new GuiButton(12, this.field_146294_l / 2 + 2, this.field_146295_m / 4 + 96 + b0, 98, 20, "Mod Options...")); + this.field_146292_n.add(new GuiButton(12, this.field_146294_l / 2 + 2, this.field_146295_m / 4 + 96 + b0, 98, 20, I18n.func_135052_a("fml.menu.modoptions")));
GuiButton guibutton; GuiButton guibutton;
- this.field_146292_n.add(guibutton = new GuiButton(7, this.field_146294_l / 2 + 2, this.field_146295_m / 4 + 96 + b0, 98, 20, I18n.func_135052_a("menu.shareToLan", new Object[0]))); - this.field_146292_n.add(guibutton = new GuiButton(7, this.field_146294_l / 2 + 2, this.field_146295_m / 4 + 96 + b0, 98, 20, I18n.func_135052_a("menu.shareToLan", new Object[0])));
+ this.field_146292_n.add(guibutton = new GuiButton(7, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 72 + b0, 200, 20, I18n.func_135052_a("menu.shareToLan", new Object[0]))); + this.field_146292_n.add(guibutton = new GuiButton(7, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 72 + b0, 200, 20, I18n.func_135052_a("menu.shareToLan", new Object[0])));
this.field_146292_n.add(new GuiButton(5, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 48 + b0, 98, 20, I18n.func_135052_a("gui.achievements", new Object[0]))); this.field_146292_n.add(new GuiButton(5, this.field_146294_l / 2 - 100, this.field_146295_m / 4 + 48 + b0, 98, 20, I18n.func_135052_a("gui.achievements", new Object[0])));
this.field_146292_n.add(new GuiButton(6, this.field_146294_l / 2 + 2, this.field_146295_m / 4 + 48 + b0, 98, 20, I18n.func_135052_a("gui.stats", new Object[0]))); this.field_146292_n.add(new GuiButton(6, this.field_146294_l / 2 + 2, this.field_146295_m / 4 + 48 + b0, 98, 20, I18n.func_135052_a("gui.stats", new Object[0])));
guibutton.field_146124_l = this.field_146297_k.func_71356_B() && !this.field_146297_k.func_71401_C().func_71344_c(); guibutton.field_146124_l = this.field_146297_k.func_71356_B() && !this.field_146297_k.func_71401_C().func_71344_c();
@@ -64,6 +66,10 @@ @@ -65,6 +66,10 @@
break; break;
case 7: case 7:
this.field_146297_k.func_147108_a(new GuiShareToLan(this)); this.field_146297_k.func_147108_a(new GuiShareToLan(this));
+ break; + break;
+ case 12: + case 12:
+ FMLClientHandler.instance().showInGameModOptions(this); + cpw.mods.fml.client.FMLClientHandler.instance().showInGameModOptions(this);
+ break; + break;
} }
} }

View file

@ -1,68 +1,39 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiMainMenu.java --- ../src-base/minecraft/net/minecraft/client/gui/GuiMainMenu.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiMainMenu.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiMainMenu.java
@@ -1,5 +1,7 @@ @@ -198,6 +198,11 @@
package net.minecraft.client.gui;
+import cpw.mods.fml.client.GuiModList;
+import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.BufferedReader;
@@ -9,6 +11,7 @@
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
+import java.util.List;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
@@ -29,6 +32,9 @@
import org.lwjgl.opengl.GLContext;
import org.lwjgl.util.glu.Project;
+import com.google.common.base.Strings;
+import com.google.common.collect.Lists;
+
@SideOnly(Side.CLIENT)
public class GuiMainMenu extends GuiScreen implements GuiYesNoCallback
{
@@ -190,7 +196,13 @@
{
this.field_146292_n.add(new GuiButton(1, this.field_146294_l / 2 - 100, p_73969_1_, I18n.func_135052_a("menu.singleplayer", new Object[0]))); this.field_146292_n.add(new GuiButton(1, this.field_146294_l / 2 - 100, p_73969_1_, I18n.func_135052_a("menu.singleplayer", new Object[0])));
this.field_146292_n.add(new GuiButton(2, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.func_135052_a("menu.multiplayer", new Object[0]))); this.field_146292_n.add(new GuiButton(2, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 1, I18n.func_135052_a("menu.multiplayer", new Object[0])));
- this.field_146292_n.add(new GuiButton(14, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.func_135052_a("menu.online", new Object[0]))); this.field_146292_n.add(this.field_175372_K = new GuiButton(14, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.func_135052_a("menu.online", new Object[0])));
+ GuiButton realmsButton = new GuiButton(14, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.func_135052_a("menu.online", new Object[0])); + GuiButton fmlModButton = new GuiButton(6, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, I18n.func_135052_a("fml.menu.mods"));
+ GuiButton fmlModButton = new GuiButton(6, this.field_146294_l / 2 - 100, p_73969_1_ + p_73969_2_ * 2, "Mods");
+ fmlModButton.field_146128_h = this.field_146294_l / 2 + 2; + fmlModButton.field_146128_h = this.field_146294_l / 2 + 2;
+ realmsButton.field_146120_f = 98; + field_175372_K.field_146120_f = 98;
+ fmlModButton.field_146120_f = 98; + fmlModButton.field_146120_f = 98;
+ this.field_146292_n.add(realmsButton);
+ this.field_146292_n.add(fmlModButton); + this.field_146292_n.add(fmlModButton);
} }
private void func_73972_b(int p_73972_1_, int p_73972_2_) private void func_73972_b(int p_73972_1_, int p_73972_2_)
@@ -238,6 +250,11 @@ @@ -245,6 +250,11 @@
this.field_146297_k.func_71400_g(); this.field_146297_k.func_71400_g();
} }
+ if (p_146284_1_.field_146127_k == 6) + if (p_146284_1_.field_146127_k == 6)
+ { + {
+ this.field_146297_k.func_147108_a(new GuiModList(this)); + this.field_146297_k.func_147108_a(new cpw.mods.fml.client.GuiModList(this));
+ } + }
+ +
if (p_146284_1_.field_146127_k == 11) if (p_146284_1_.field_146127_k == 11)
{ {
this.field_146297_k.func_71371_a("Demo_World", "Demo_World", DemoWorldServer.field_73071_a); this.field_146297_k.func_71371_a("Demo_World", "Demo_World", DemoWorldServer.field_73071_a);
@@ -481,7 +498,15 @@ @@ -492,7 +502,15 @@
s = s + " Demo"; s = s + " Demo";
} }
- this.func_73731_b(this.field_146289_q, s, 2, this.field_146295_m - 10, -1); - this.func_73731_b(this.field_146289_q, s, 2, this.field_146295_m - 10, -1);
+ List<String> brandings = Lists.reverse(FMLCommonHandler.instance().getBrandings(true)); + java.util.List<String> brandings = com.google.common.collect.Lists.reverse(cpw.mods.fml.common.FMLCommonHandler.instance().getBrandings(true));
+ for (int i = 0; i < brandings.size(); i++) + for (int i = 0; i < brandings.size(); i++)
+ { + {
+ String brd = brandings.get(i); + String brd = brandings.get(i);
+ if (!Strings.isNullOrEmpty(brd)) + if (!com.google.common.base.Strings.isNullOrEmpty(brd))
+ { + {
+ this.func_73731_b(this.field_146289_q, brd, 2, this.field_146295_m - ( 10 + i * (this.field_146289_q.field_78288_b + 1)), 16777215); + this.func_73731_b(this.field_146289_q, brd, 2, this.field_146295_m - ( 10 + i * (this.field_146289_q.field_78288_b + 1)), 16777215);
+ } + }

View file

@ -1,27 +1,19 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiMultiplayer.java --- ../src-base/minecraft/net/minecraft/client/gui/GuiMultiplayer.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiMultiplayer.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiMultiplayer.java
@@ -2,6 +2,7 @@ @@ -41,6 +41,7 @@
import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
+import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
@@ -40,6 +41,7 @@
public GuiMultiplayer(GuiScreen p_i1040_1_) public GuiMultiplayer(GuiScreen p_i1040_1_)
{ {
this.field_146798_g = p_i1040_1_; this.field_146798_g = p_i1040_1_;
+ FMLClientHandler.instance().setupServerList(); + cpw.mods.fml.client.FMLClientHandler.instance().setupServerList();
} }
public void func_73866_w_() public void func_73866_w_()
@@ -366,7 +368,7 @@ @@ -373,7 +374,7 @@
private void func_146791_a(ServerData p_146791_1_) private void func_146791_a(ServerData p_146791_1_)
{ {
- this.field_146297_k.func_147108_a(new GuiConnecting(this, this.field_146297_k, p_146791_1_)); - this.field_146297_k.func_147108_a(new GuiConnecting(this, this.field_146297_k, p_146791_1_));
+ FMLClientHandler.instance().connectToServer(this, p_146791_1_); + cpw.mods.fml.client.FMLClientHandler.instance().connectToServer(this, p_146791_1_);
} }
public void func_146790_a(int p_146790_1_) public void func_146790_a(int p_146790_1_)

View file

@ -0,0 +1,12 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiOverlayDebug.java
@@ -170,6 +170,9 @@
long l = j - k;
ArrayList arraylist = Lists.newArrayList(new String[] {String.format("Java: %s %dbit", new Object[]{System.getProperty("java.version"), Integer.valueOf(this.field_175242_a.func_147111_S() ? 64 : 32)}), String.format("Mem: % 2d%% %03d/%03dMB", new Object[]{Long.valueOf(l * 100L / i), Long.valueOf(func_175240_a(l)), Long.valueOf(func_175240_a(i))}), String.format("Allocated: % 2d%% %03dMB", new Object[]{Long.valueOf(j * 100L / i), Long.valueOf(func_175240_a(j))}), "", String.format("Display: %dx%d (%s)", new Object[]{Integer.valueOf(Display.getWidth()), Integer.valueOf(Display.getHeight()), GL11.glGetString(GL11.GL_VENDOR)}), GL11.glGetString(GL11.GL_RENDERER), GL11.glGetString(GL11.GL_VERSION)});
+ arraylist.add("");
+ arraylist.addAll(cpw.mods.fml.common.FMLCommonHandler.instance().getBrandings(false));
+
if (this.func_175236_d())
{
return arraylist;

View file

@ -1,18 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/gui/GuiSelectWorld.java --- ../src-base/minecraft/net/minecraft/client/gui/GuiSelectWorld.java
+++ ../src-work/minecraft/net/minecraft/client/gui/GuiSelectWorld.java +++ ../src-work/minecraft/net/minecraft/client/gui/GuiSelectWorld.java
@@ -1,5 +1,6 @@ @@ -187,7 +187,7 @@
package net.minecraft.client.gui;
+import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.text.DateFormat;
@@ -179,7 +180,7 @@
if (this.field_146297_k.func_71359_d().func_90033_f(s)) if (this.field_146297_k.func_71359_d().func_90033_f(s))
{ {
- this.field_146297_k.func_71371_a(s, s1, (WorldSettings)null); - this.field_146297_k.func_71371_a(s, s1, (WorldSettings)null);
+ FMLClientHandler.instance().tryLoadExistingWorld(this, s, s1); + cpw.mods.fml.client.FMLClientHandler.instance().tryLoadExistingWorld(this, s, s1);
} }
} }
} }

View file

@ -1,31 +1,23 @@
--- ../src-base/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java --- ../src-base/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java
+++ ../src-work/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java +++ ../src-work/minecraft/net/minecraft/client/gui/ServerListEntryNormal.java
@@ -2,6 +2,7 @@ @@ -84,7 +84,7 @@
boolean flag2 = this.field_148301_e.field_82821_f < 47;
import com.google.common.base.Charsets;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
@@ -83,7 +84,7 @@
boolean flag2 = this.field_148301_e.field_82821_f < 5;
boolean flag3 = flag1 || flag2; boolean flag3 = flag1 || flag2;
this.field_148300_d.field_71466_p.func_78276_b(this.field_148301_e.field_78847_a, p_148279_2_ + 32 + 3, p_148279_3_ + 1, 16777215); this.field_148300_d.field_71466_p.func_78276_b(this.field_148301_e.field_78847_a, p_180790_2_ + 32 + 3, p_180790_3_ + 1, 16777215);
- List list = this.field_148300_d.field_71466_p.func_78271_c(this.field_148301_e.field_78843_d, p_148279_4_ - 32 - 2); - List list = this.field_148300_d.field_71466_p.func_78271_c(this.field_148301_e.field_78843_d, p_180790_4_ - 32 - 2);
+ List list = this.field_148300_d.field_71466_p.func_78271_c(FMLClientHandler.instance().fixDescription(this.field_148301_e.field_78843_d), p_148279_4_ - 48 - 2); + List list = this.field_148300_d.field_71466_p.func_78271_c(cpw.mods.fml.client.FMLClientHandler.instance().fixDescription(this.field_148301_e.field_78843_d), p_180790_4_ - 48 - 2);
for (int l1 = 0; l1 < Math.min(list.size(), 2); ++l1) for (int l1 = 0; l1 < Math.min(list.size(), 2); ++l1)
{ {
@@ -174,6 +175,11 @@ @@ -178,6 +178,11 @@
int k2 = p_148279_7_ - p_148279_2_; int k2 = p_180790_6_ - p_180790_2_;
int l2 = p_148279_8_ - p_148279_3_; int l2 = p_180790_7_ - p_180790_3_;
+ String tooltip = FMLClientHandler.instance().enhanceServerListEntry(this, this.field_148301_e, p_148279_2_, p_148279_4_, p_148279_3_, k2, l2); + String tooltip = cpw.mods.fml.client.FMLClientHandler.instance().enhanceServerListEntry(this, this.field_148301_e, p_180790_2_, p_180790_4_, p_180790_3_, k2, l2);
+ if (tooltip != null) + if (tooltip != null)
+ { + {
+ this.field_148303_c.func_146793_a(tooltip); + this.field_148303_c.func_146793_a(tooltip);
+ } else + } else
if (k2 >= p_148279_4_ - 15 && k2 <= p_148279_4_ - 5 && l2 >= 0 && l2 <= 8) if (k2 >= p_180790_4_ - 15 && k2 <= p_180790_4_ - 5 && l2 >= 0 && l2 <= 8)
{ {
this.field_148303_c.func_146793_a(s1); this.field_148303_c.func_146793_a(s1);

View file

@ -1,41 +1,14 @@
--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java --- ../src-base/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java
+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java +++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java
@@ -5,6 +5,9 @@ @@ -92,7 +92,10 @@
import com.mojang.authlib.exceptions.InvalidCredentialsException;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.util.concurrent.Future;
@@ -23,6 +26,7 @@
import net.minecraft.network.login.server.S00PacketDisconnect;
import net.minecraft.network.login.server.S01PacketEncryptionRequest;
import net.minecraft.network.login.server.S02PacketLoginSuccess;
+import net.minecraft.network.play.client.C17PacketCustomPayload;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.CryptManager;
import net.minecraft.util.IChatComponent;
@@ -100,7 +104,7 @@
public void func_147390_a(S02PacketLoginSuccess p_147390_1_)
{ {
- this.field_147393_d.func_150723_a(EnumConnectionState.PLAY); this.field_175091_e = p_147390_1_.func_179730_a();
+ FMLNetworkHandler.fmlClientHandshake(this.field_147393_d); this.field_147393_d.func_150723_a(EnumConnectionState.PLAY);
- this.field_147393_d.func_150719_a(new NetHandlerPlayClient(this.field_147394_b, this.field_147395_c, this.field_147393_d, this.field_175091_e));
+ cpw.mods.fml.common.network.internal.FMLNetworkHandler.fmlClientHandshake(this.field_147393_d);
+ NetHandlerPlayClient nhpc = new NetHandlerPlayClient(this.field_147394_b, this.field_147395_c, this.field_147393_d, this.field_175091_e);
+ this.field_147393_d.func_150719_a(nhpc);
+ cpw.mods.fml.client.FMLClientHandler.instance().setPlayClient(nhpc);
} }
public void func_147231_a(IChatComponent p_147231_1_) public void func_147231_a(IChatComponent p_147231_1_)
@@ -114,7 +118,10 @@
if (p_147232_2_ == EnumConnectionState.PLAY)
{
- this.field_147393_d.func_150719_a(new NetHandlerPlayClient(this.field_147394_b, this.field_147395_c, this.field_147393_d));
+ NetHandlerPlayClient nhpc = new NetHandlerPlayClient(this.field_147394_b, this.field_147395_c, this.field_147393_d);
+ this.field_147393_d.func_150719_a(nhpc);
+ FMLClientHandler.instance().setPlayClient(nhpc);
+
}
}

View file

@ -1,18 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/network/OldServerPinger.java --- ../src-base/minecraft/net/minecraft/client/network/OldServerPinger.java
+++ ../src-work/minecraft/net/minecraft/client/network/OldServerPinger.java +++ ../src-work/minecraft/net/minecraft/client/network/OldServerPinger.java
@@ -4,6 +4,7 @@ @@ -148,6 +148,7 @@
import com.google.common.base.Splitter;
import com.google.common.collect.Iterables;
import com.mojang.authlib.GameProfile;
+import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.bootstrap.Bootstrap;
@@ -147,6 +148,7 @@
p_147224_1_.func_147407_a((String)null); p_147224_1_.func_147407_a((String)null);
} }
+ FMLClientHandler.instance().bindServerListData(p_147224_1_, serverstatusresponse); + cpw.mods.fml.client.FMLClientHandler.instance().bindServerListData(p_147224_1_, serverstatusresponse);
networkmanager.func_150725_a(new C01PacketPing(Minecraft.func_71386_F()), new GenericFutureListener[0]); this.field_175092_e = Minecraft.func_71386_F();
networkmanager.func_179290_a(new C01PacketPing(this.field_175092_e));
this.field_147403_d = true; this.field_147403_d = true;
}

View file

@ -1,102 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/RenderBlocks.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/RenderBlocks.java
@@ -40,6 +40,7 @@
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
+import net.minecraft.src.FMLRenderAccessLibrary;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFlowerPot;
import net.minecraft.util.Direction;
@@ -245,7 +246,53 @@
{
p_147805_1_.func_149719_a(this.field_147845_a, p_147805_2_, p_147805_3_, p_147805_4_);
this.func_147775_a(p_147805_1_);
- return l == 0 ? this.func_147784_q(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 4 ? this.func_147721_p(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 31 ? this.func_147742_r(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 1 ? this.func_147746_l(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 40 ? this.func_147774_a((BlockDoublePlant)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 2 ? this.func_147791_c(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 20 ? this.func_147726_j(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 11 ? this.func_147735_a((BlockFence)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 39 ? this.func_147779_s(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 5 ? this.func_147788_h(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 13 ? this.func_147755_t(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 9 ? this.func_147766_a((BlockRailBase)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 19 ? this.func_147724_m(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 23 ? this.func_147783_o(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 6 ? this.func_147796_n(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 3 ? this.func_147801_a((BlockFire)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 8 ? this.func_147794_i(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 7 ? this.func_147760_u(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 10 ? this.func_147722_a((BlockStairs)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 27 ? this.func_147802_a((BlockDragonEgg)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 32 ? this.func_147807_a((BlockWall)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 12 ? this.func_147790_e(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 29 ? this.func_147723_f(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 30 ? this.func_147756_g(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 14 ? this.func_147773_v(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 15 ? this.func_147759_a((BlockRedstoneRepeater)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 36 ? this.func_147748_a((BlockRedstoneDiode)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 37 ? this.func_147781_a((BlockRedstoneComparator)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 16 ? this.func_147731_b(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_, false) : (l == 17 ? this.func_147809_c(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_, true) : (l == 18 ? this.func_147767_a((BlockPane)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 41 ? this.func_147733_k(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 21 ? this.func_147776_a((BlockFenceGate)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 24 ? this.func_147785_a((BlockCauldron)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 33 ? this.func_147752_a((BlockFlowerPot)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 35 ? this.func_147725_a((BlockAnvil)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 25 ? this.func_147741_a((BlockBrewingStand)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 26 ? this.func_147743_a((BlockEndPortalFrame)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 28 ? this.func_147772_a((BlockCocoa)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 34 ? this.func_147797_a((BlockBeacon)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : (l == 38 ? this.func_147803_a((BlockHopper)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) : false))))))))))))))))))))))))))))))))))))))));
+
+ switch (l)
+ {
+ //regex: ' : \(l == ([\d]+) \?' replace: ';\ncase \1: return' ::: IMPORTANT: REMEMBER THIS ON FIRST line!
+ case 0 : return this.func_147784_q(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 4: return this.func_147721_p(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 31: return this.func_147742_r(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 1: return this.func_147746_l(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 40: return this.func_147774_a((BlockDoublePlant)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 2: return this.func_147791_c(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 20: return this.func_147726_j(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 11: return this.func_147735_a((BlockFence)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 39: return this.func_147779_s(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 5: return this.func_147788_h(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 13: return this.func_147755_t(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 9: return this.func_147766_a((BlockRailBase)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 19: return this.func_147724_m(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 23: return this.func_147783_o(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 6: return this.func_147796_n(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 3: return this.func_147801_a((BlockFire)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 8: return this.func_147794_i(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 7: return this.func_147760_u(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 10: return this.func_147722_a((BlockStairs)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 27: return this.func_147802_a((BlockDragonEgg)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 32: return this.func_147807_a((BlockWall)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 12: return this.func_147790_e(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 29: return this.func_147723_f(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 30: return this.func_147756_g(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 14: return this.func_147773_v(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 15: return this.func_147759_a((BlockRedstoneRepeater)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 36: return this.func_147748_a((BlockRedstoneDiode)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 37: return this.func_147781_a((BlockRedstoneComparator)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 16: return this.func_147731_b(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_, false) ;
+ case 17: return this.func_147809_c(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_, true) ;
+ case 18: return this.func_147767_a((BlockPane)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 41: return this.func_147733_k(p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 21: return this.func_147776_a((BlockFenceGate)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 24: return this.func_147785_a((BlockCauldron)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 33: return this.func_147752_a((BlockFlowerPot)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 35: return this.func_147725_a((BlockAnvil)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 25: return this.func_147741_a((BlockBrewingStand)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 26: return this.func_147743_a((BlockEndPortalFrame)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 28: return this.func_147772_a((BlockCocoa)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 34: return this.func_147797_a((BlockBeacon)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_) ;
+ case 38: return this.func_147803_a((BlockHopper)p_147805_1_, p_147805_2_, p_147805_3_, p_147805_4_);
+ default: return FMLRenderAccessLibrary.renderWorldBlock(this, field_147845_a, p_147805_2_, p_147805_3_, p_147805_4_, p_147805_1_, l);
+ }
}
}
@@ -8089,6 +8136,10 @@
this.func_147799_a((BlockHopper)p_147800_1_, 0, 0, 0, 0, true);
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
}
+ else
+ {
+ FMLRenderAccessLibrary.renderInventoryBlock(this, p_147800_1_, p_147800_2_, j);
+ }
}
else
{
@@ -8147,7 +8198,24 @@
public static boolean func_147739_a(int p_147739_0_)
{
- return p_147739_0_ == 0 ? true : (p_147739_0_ == 31 ? true : (p_147739_0_ == 39 ? true : (p_147739_0_ == 13 ? true : (p_147739_0_ == 10 ? true : (p_147739_0_ == 11 ? true : (p_147739_0_ == 27 ? true : (p_147739_0_ == 22 ? true : (p_147739_0_ == 21 ? true : (p_147739_0_ == 16 ? true : (p_147739_0_ == 26 ? true : (p_147739_0_ == 32 ? true : (p_147739_0_ == 34 ? true : (p_147739_0_ == 35 ? true : (p_147739_0_ == -1 ? false : false))))))))))))));
+ switch (p_147739_0_)
+ {
+ case 0 : return true ;
+ case 31: return true ;
+ case 39: return true ;
+ case 13: return true ;
+ case 10: return true ;
+ case 11: return true ;
+ case 27: return true ;
+ case 22: return true ;
+ case 21: return true ;
+ case 16: return true ;
+ case 26: return true ;
+ case 32: return true ;
+ case 34: return true ;
+ case 35: return true ;
+ default: return FMLRenderAccessLibrary.renderItemAsFull3DBlock(p_147739_0_);
+ }
}
public IIcon func_147793_a(Block p_147793_1_, IBlockAccess p_147793_2_, int p_147793_3_, int p_147793_4_, int p_147793_5_, int p_147793_6_)

View file

@ -1,18 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java --- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java +++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java
@@ -1,5 +1,6 @@ @@ -48,7 +48,7 @@
package net.minecraft.client.renderer.entity;
+import cpw.mods.fml.common.registry.VillagerRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelVillager;
@@ -53,7 +54,7 @@
case 4: case 4:
return field_110906_m; return field_110906_m;
default: default:
- return field_110903_f; - return field_110903_f;
+ return VillagerRegistry.getVillagerSkin(p_110775_1_.func_70946_n(), field_110903_f); + return cpw.mods.fml.common.registry.VillagerRegistry.getVillagerSkin(p_110775_1_.func_70946_n(), field_110903_f);
} }
} }

View file

@ -1,19 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/resources/LanguageManager.java --- ../src-base/minecraft/net/minecraft/client/resources/LanguageManager.java
+++ ../src-work/minecraft/net/minecraft/client/resources/LanguageManager.java +++ ../src-work/minecraft/net/minecraft/client/resources/LanguageManager.java
@@ -3,6 +3,8 @@ @@ -83,6 +83,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+
+import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.IOException;
@@ -83,6 +85,7 @@
} }
field_135049_a.func_135022_a(p_110549_1_, arraylist); field_135049_a.func_135022_a(p_110549_1_, arraylist);
+ LanguageRegistry.instance().mergeLanguageTable(field_135049_a.field_135032_a, this.field_135048_c); + cpw.mods.fml.common.registry.LanguageRegistry.instance().mergeLanguageTable(field_135049_a.field_135032_a, this.field_135048_c);
StringTranslate.func_135063_a(field_135049_a.field_135032_a); StringTranslate.func_135063_a(field_135049_a.field_135032_a);
} }

View file

@ -1,19 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/settings/GameSettings.java --- ../src-base/minecraft/net/minecraft/client/settings/GameSettings.java
+++ ../src-work/minecraft/net/minecraft/client/settings/GameSettings.java +++ ../src-work/minecraft/net/minecraft/client/settings/GameSettings.java
@@ -2,6 +2,8 @@ @@ -1067,6 +1067,7 @@
import com.google.common.collect.Maps;
import com.google.gson.Gson;
+
+import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.BufferedReader;
@@ -1049,6 +1051,7 @@
public void func_74303_b() public void func_74303_b()
{ {
+ if (FMLClientHandler.instance().isLoading()) return; + if (cpw.mods.fml.client.FMLClientHandler.instance().isLoading()) return;
try try
{ {
PrintWriter printwriter = new PrintWriter(new FileWriter(this.field_74354_ai)); PrintWriter printwriter = new PrintWriter(new FileWriter(this.field_74354_ai));

View file

@ -1,17 +1,10 @@
--- ../src-base/minecraft/net/minecraft/crash/CrashReport.java --- ../src-base/minecraft/net/minecraft/crash/CrashReport.java
+++ ../src-work/minecraft/net/minecraft/crash/CrashReport.java +++ ../src-work/minecraft/net/minecraft/crash/CrashReport.java
@@ -1,5 +1,6 @@ @@ -126,6 +126,7 @@
package net.minecraft.crash;
+import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.File;
@@ -140,6 +141,7 @@
return IntCache.func_85144_b(); return IntCache.func_85144_b();
} }
}); });
+ FMLCommonHandler.instance().enhanceCrashReport(this, this.field_85061_c); + cpw.mods.fml.common.FMLCommonHandler.instance().enhanceCrashReport(this, this.field_85061_c);
} }
public String func_71501_a() public String func_71501_a()

View file

@ -1,28 +1,6 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityList.java --- ../src-base/minecraft/net/minecraft/entity/EntityList.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityList.java +++ ../src-work/minecraft/net/minecraft/entity/EntityList.java
@@ -5,6 +5,7 @@ @@ -153,9 +153,10 @@
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
+
import net.minecraft.entity.ai.EntityMinecartMobSpawner;
import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
@@ -63,9 +64,13 @@
import net.minecraft.stats.StatBase;
import net.minecraft.stats.StatList;
import net.minecraft.world.World;
+
+import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import cpw.mods.fml.common.FMLLog;
+
public class EntityList
{
private static final Logger field_151516_b = LogManager.getLogger();
@@ -145,9 +150,10 @@
p_75615_0_.func_82580_o("Type"); p_75615_0_.func_82580_o("Type");
} }
@ -34,18 +12,17 @@
if (oclass != null) if (oclass != null)
{ {
@@ -161,7 +167,17 @@ @@ -169,7 +170,17 @@
if (entity != null) if (entity != null)
{ {
- entity.func_70020_e(p_75615_0_);
+ try + try
+ { + {
+ entity.func_70020_e(p_75615_0_); entity.func_70020_e(p_75615_0_);
+ } + }
+ catch (Exception e) + catch (Exception e)
+ { + {
+ FMLLog.log(Level.ERROR, e, + cpw.mods.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e,
+ "An Entity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", + "An Entity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author",
+ p_75615_0_.func_74779_i("id"), oclass.getName()); + p_75615_0_.func_74779_i("id"), oclass.getName());
+ entity = null; + entity = null;

View file

@ -1,22 +1,10 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityTracker.java --- ../src-base/minecraft/net/minecraft/entity/EntityTracker.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java +++ ../src-work/minecraft/net/minecraft/entity/EntityTracker.java
@@ -39,6 +39,8 @@ @@ -58,6 +58,8 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import cpw.mods.fml.common.registry.EntityRegistry;
+
public class EntityTracker
{
private static final Logger field_151249_a = LogManager.getLogger();
@@ -56,6 +58,11 @@
public void func_72786_a(Entity p_72786_1_) public void func_72786_a(Entity p_72786_1_)
{ {
+ if (EntityRegistry.instance().tryTrackingEntity(this, p_72786_1_)) + if (cpw.mods.fml.common.registry.EntityRegistry.instance().tryTrackingEntity(this, p_72786_1_)) return;
+ {
+ return;
+ }
+ +
if (p_72786_1_ instanceof EntityPlayerMP) if (p_72786_1_ instanceof EntityPlayerMP)
{ {

View file

@ -1,15 +1,6 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java --- ../src-base/minecraft/net/minecraft/entity/EntityTrackerEntry.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java +++ ../src-work/minecraft/net/minecraft/entity/EntityTrackerEntry.java
@@ -57,6 +57,8 @@ @@ -388,6 +388,14 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
+
public class EntityTrackerEntry
{
private static final Logger field_151262_p = LogManager.getLogger();
@@ -377,6 +379,14 @@
this.field_73138_k = this.field_73132_a.field_70181_x; this.field_73138_k = this.field_73132_a.field_70181_x;
this.field_73135_l = this.field_73132_a.field_70179_y; this.field_73135_l = this.field_73132_a.field_70179_y;
@ -18,22 +9,19 @@
+ int posZ = MathHelper.func_76128_c(this.field_73132_a.field_70161_v * 32.0D); + int posZ = MathHelper.func_76128_c(this.field_73132_a.field_70161_v * 32.0D);
+ if (posX != this.field_73128_d || posY != this.field_73129_e || posZ != this.field_73126_f) + if (posX != this.field_73128_d || posY != this.field_73129_e || posZ != this.field_73126_f)
+ { + {
+ FMLNetworkHandler.makeEntitySpawnAdjustment(this.field_73132_a, p_73117_1_, this.field_73128_d, this.field_73129_e, this.field_73126_f); + cpw.mods.fml.common.network.internal.FMLNetworkHandler.makeEntitySpawnAdjustment(this.field_73132_a, p_73117_1_, this.field_73128_d, this.field_73129_e, this.field_73126_f);
+ } + }
+ +
if (this.field_73143_t && !(packet instanceof S0FPacketSpawnMob)) if (this.field_73143_t && !(packet instanceof S0FPacketSpawnMob))
{ {
p_73117_1_.field_71135_a.func_147359_a(new S12PacketEntityVelocity(this.field_73132_a.func_145782_y(), this.field_73132_a.field_70159_w, this.field_73132_a.field_70181_x, this.field_73132_a.field_70179_y)); p_73117_1_.field_71135_a.func_147359_a(new S12PacketEntityVelocity(this.field_73132_a.func_145782_y(), this.field_73132_a.field_70159_w, this.field_73132_a.field_70181_x, this.field_73132_a.field_70179_y));
@@ -456,6 +466,12 @@ @@ -474,6 +482,9 @@
field_151262_p.warn("Fetching addPacket for removed entity"); field_151262_p.warn("Fetching addPacket for removed entity");
} }
+ Packet pkt = FMLNetworkHandler.getEntitySpawningPacket(this.field_73132_a); + Packet pkt = cpw.mods.fml.common.network.internal.FMLNetworkHandler.getEntitySpawningPacket(this.field_73132_a);
+ if (pkt != null) return pkt;
+ +
+ if (pkt != null)
+ {
+ return pkt;
+ }
if (this.field_73132_a instanceof EntityItem) if (this.field_73132_a instanceof EntityItem)
{ {
return new S0EPacketSpawnObject(this.field_73132_a, 2, 1); return new S0EPacketSpawnObject(this.field_73132_a, 2, 1);

View file

@ -1,20 +1,10 @@
--- ../src-base/minecraft/net/minecraft/entity/item/EntityItem.java --- ../src-base/minecraft/net/minecraft/entity/item/EntityItem.java
+++ ../src-work/minecraft/net/minecraft/entity/item/EntityItem.java +++ ../src-work/minecraft/net/minecraft/entity/item/EntityItem.java
@@ -17,6 +17,8 @@ @@ -366,6 +366,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import cpw.mods.fml.common.FMLCommonHandler;
+
public class EntityItem extends Entity
{
private static final Logger field_145803_d = LogManager.getLogger();
@@ -325,6 +327,8 @@
} }
} }
+ FMLCommonHandler.instance().firePlayerItemPickupEvent(p_70100_1_, this); + cpw.mods.fml.common.FMLCommonHandler.instance().firePlayerItemPickupEvent(p_70100_1_, this);
+ if (!this.func_174814_R())
this.field_70170_p.func_72956_a(p_70100_1_, "random.pop", 0.2F, ((this.field_70146_Z.nextFloat() - this.field_70146_Z.nextFloat()) * 0.7F + 1.0F) * 2.0F); {
p_70100_1_.func_71001_a(this, i); this.field_70170_p.func_72956_a(p_70100_1_, "random.pop", 0.2F, ((this.field_70146_Z.nextFloat() - this.field_70146_Z.nextFloat()) * 0.7F + 1.0F) * 2.0F);

View file

@ -1,8 +1,8 @@
--- ../src-base/minecraft/net/minecraft/entity/monster/EntitySlime.java --- ../src-base/minecraft/net/minecraft/entity/monster/EntitySlime.java
+++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySlime.java +++ ../src-work/minecraft/net/minecraft/entity/monster/EntitySlime.java
@@ -247,7 +247,7 @@ @@ -271,7 +271,7 @@
{ {
Chunk chunk = this.field_70170_p.func_72938_d(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.field_70161_v)); Chunk chunk = this.field_70170_p.func_175726_f(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), 0, MathHelper.func_76128_c(this.field_70161_v)));
- if (this.field_70170_p.func_72912_H().func_76067_t() == WorldType.field_77138_c && this.field_70146_Z.nextInt(4) != 1) - if (this.field_70170_p.func_72912_H().func_76067_t() == WorldType.field_77138_c && this.field_70146_Z.nextInt(4) != 1)
+ if (this.field_70170_p.func_72912_H().func_76067_t().handleSlimeSpawnReduction(field_70146_Z, field_70170_p)) + if (this.field_70170_p.func_72912_H().func_76067_t().handleSlimeSpawnReduction(field_70146_Z, field_70170_p))

File diff suppressed because one or more lines are too long

View file

@ -1,40 +1,41 @@
--- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayer.java --- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayer.java
+++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayer.java +++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayer.java
@@ -2,6 +2,9 @@ @@ -200,6 +200,7 @@
import com.google.common.base.Charsets;
import com.mojang.authlib.GameProfile;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Collection;
@@ -193,6 +196,7 @@
public void func_70071_h_() public void func_70071_h_()
{ {
+ FMLCommonHandler.instance().onPlayerPreTick(this); + cpw.mods.fml.common.FMLCommonHandler.instance().onPlayerPreTick(this);
if (this.field_71074_e != null) this.field_70145_X = this.func_175149_v();
if (this.func_175149_v())
@@ -344,6 +345,7 @@
{ {
ItemStack itemstack = this.field_71071_by.func_70448_g(); this.func_70107_b(d3, this.field_70163_u, d4);
@@ -316,6 +320,7 @@
this.field_71100_bB.func_75118_a(this);
this.func_71064_a(StatList.field_75948_k, 1);
} }
+ FMLCommonHandler.instance().onPlayerPostTick(this); + cpw.mods.fml.common.FMLCommonHandler.instance().onPlayerPostTick(this);
} }
public int func_82145_z() public int func_82145_z()
@@ -2031,6 +2036,11 @@ @@ -2139,6 +2141,22 @@
} this.field_175153_bG = p_175150_1_;
} }
+ /**
+ * Opens a GUI with this player, uses FML's IGuiHandler system.
+ * Allows for extension by modders.
+ *
+ * @param mod The mod trying to open a GUI
+ * @param modGuiId GUI ID
+ * @param world Current World
+ * @param x Passed directly to IGuiHandler, data meaningless Typically world X position
+ * @param y Passed directly to IGuiHandler, data meaningless Typically world Y position
+ * @param z Passed directly to IGuiHandler, data meaningless Typically world Z position
+ */
+ public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) + public void openGui(Object mod, int modGuiId, World world, int x, int y, int z)
+ { + {
+ FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z); + cpw.mods.fml.common.network.internal.FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z);
+ } + }
+ +
public static enum EnumStatus public static enum EnumChatVisibility
{ {
OK, FULL(0, "options.chat.visibility.full"),

View file

@ -1,17 +1,10 @@
--- ../src-base/minecraft/net/minecraft/inventory/SlotCrafting.java --- ../src-base/minecraft/net/minecraft/inventory/SlotCrafting.java
+++ ../src-work/minecraft/net/minecraft/inventory/SlotCrafting.java +++ ../src-work/minecraft/net/minecraft/inventory/SlotCrafting.java
@@ -1,5 +1,6 @@ @@ -113,6 +113,7 @@
package net.minecraft.inventory;
+import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -103,6 +104,7 @@
public void func_82870_a(EntityPlayer p_82870_1_, ItemStack p_82870_2_) public void func_82870_a(EntityPlayer p_82870_1_, ItemStack p_82870_2_)
{ {
+ FMLCommonHandler.instance().firePlayerCraftingEvent(p_82870_1_, p_82870_2_, field_75239_a); + cpw.mods.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(p_82870_1_, p_82870_2_, field_75239_a);
this.func_75208_c(p_82870_2_); this.func_75208_c(p_82870_2_);
ItemStack[] aitemstack = CraftingManager.func_77594_a().func_180303_b(this.field_75239_a, p_82870_1_.field_70170_p);
for (int i = 0; i < this.field_75239_a.func_70302_i_(); ++i)

View file

@ -1,18 +0,0 @@
--- ../src-base/minecraft/net/minecraft/inventory/SlotFurnace.java
+++ ../src-work/minecraft/net/minecraft/inventory/SlotFurnace.java
@@ -1,5 +1,6 @@
package net.minecraft.inventory;
+import cpw.mods.fml.common.FMLCommonHandler;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
@@ -83,6 +84,8 @@
this.field_75228_b = 0;
+ FMLCommonHandler.instance().firePlayerSmeltedEvent(field_75229_a, p_75208_1_);
+
if (p_75208_1_.func_77973_b() == Items.field_151042_j)
{
this.field_75229_a.func_71064_a(AchievementList.field_76016_k, 1);

View file

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java
+++ ../src-work/minecraft/net/minecraft/inventory/SlotFurnaceOutput.java
@@ -83,6 +83,8 @@
this.field_75228_b = 0;
+ cpw.mods.fml.common.FMLCommonHandler.instance().firePlayerSmeltedEvent(field_75229_a, p_75208_1_);
+
if (p_75208_1_.func_77973_b() == Items.field_151042_j)
{
this.field_75229_a.func_71029_a(AchievementList.field_76016_k);

View file

@ -1,29 +1,21 @@
--- ../src-base/minecraft/net/minecraft/item/Item.java --- ../src-base/minecraft/net/minecraft/item/Item.java
+++ ../src-work/minecraft/net/minecraft/item/Item.java +++ ../src-work/minecraft/net/minecraft/item/Item.java
@@ -3,6 +3,8 @@ @@ -47,7 +47,7 @@
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.google.common.collect.Sets;
+
+import cpw.mods.fml.common.registry.GameData;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.HashSet;
@@ -46,7 +48,7 @@
public class Item public class Item
{ {
- public static final RegistryNamespaced field_150901_e = new RegistryNamespaced(); - public static final RegistryNamespaced field_150901_e = new RegistryNamespaced();
+ public static final RegistryNamespaced field_150901_e = GameData.getItemRegistry(); + public static final RegistryNamespaced field_150901_e = cpw.mods.fml.common.registry.GameData.getItemRegistry();
private static final Map field_179220_a = Maps.newHashMap();
protected static final UUID field_111210_e = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF"); protected static final UUID field_111210_e = UUID.fromString("CB3F55D3-645C-4F38-A497-9C13A33DB5CF");
private CreativeTabs field_77701_a; private CreativeTabs field_77701_a;
protected static Random field_77697_d = new Random(); @@ -61,6 +61,9 @@
@@ -62,6 +64,8 @@ private String field_77774_bZ;
protected String field_111218_cA;
private static final String __OBFID = "CL_00000041"; private static final String __OBFID = "CL_00000041";
+ public final cpw.mods.fml.common.registry.RegistryDelegate<Item> delegate = + public final cpw.mods.fml.common.registry.RegistryDelegate<Item> delegate =
+ ((cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry)field_150901_e).getDelegate(this, Item.class); + ((cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry)field_150901_e).getDelegate(this, Item.class);
+
public static int func_150891_b(Item p_150891_0_) public static int func_150891_b(Item p_150891_0_)
{ {
return p_150891_0_ == null ? 0 : field_150901_e.func_148757_b(p_150891_0_); return p_150891_0_ == null ? 0 : field_150901_e.func_148757_b(p_150891_0_);

View file

@ -1,11 +1,11 @@
--- ../src-base/minecraft/net/minecraft/item/ItemEmptyMap.java --- ../src-base/minecraft/net/minecraft/item/ItemEmptyMap.java
+++ ../src-work/minecraft/net/minecraft/item/ItemEmptyMap.java +++ ../src-work/minecraft/net/minecraft/item/ItemEmptyMap.java
@@ -25,7 +25,7 @@ @@ -24,7 +24,7 @@
int i = 128 * (1 << mapdata.field_76197_d); p_77659_2_.func_72823_a(s, mapdata);
mapdata.field_76201_a = (int)(Math.round(p_77659_3_.field_70165_t / (double)i) * (long)i); mapdata.field_76197_d = 0;
mapdata.field_76199_b = (int)(Math.round(p_77659_3_.field_70161_v / (double)i) * (long)i); mapdata.func_176054_a(p_77659_3_.field_70165_t, p_77659_3_.field_70161_v, mapdata.field_76197_d);
- mapdata.field_76200_c = (byte)p_77659_2_.field_73011_w.field_76574_g; - mapdata.field_76200_c = (byte)p_77659_2_.field_73011_w.func_177502_q();
+ mapdata.field_76200_c = p_77659_2_.field_73011_w.field_76574_g; + mapdata.field_76200_c = p_77659_2_.field_73011_w.func_177502_q();
mapdata.func_76185_a(); mapdata.func_76185_a();
--p_77659_1_.field_77994_a; --p_77659_1_.field_77994_a;

View file

@ -1,11 +1,11 @@
--- ../src-base/minecraft/net/minecraft/item/ItemMap.java --- ../src-base/minecraft/net/minecraft/item/ItemMap.java
+++ ../src-work/minecraft/net/minecraft/item/ItemMap.java +++ ../src-work/minecraft/net/minecraft/item/ItemMap.java
@@ -57,7 +57,7 @@ @@ -58,7 +58,7 @@
int i = 128 * (1 << mapdata.field_76197_d); mapdata = new MapData(s);
mapdata.field_76201_a = Math.round((float)p_77873_2_.func_72912_H().func_76079_c() / (float)i) * i; mapdata.field_76197_d = 3;
mapdata.field_76199_b = Math.round((float)(p_77873_2_.func_72912_H().func_76074_e() / i)) * i; mapdata.func_176054_a((double)p_77873_2_.func_72912_H().func_76079_c(), (double)p_77873_2_.func_72912_H().func_76074_e(), mapdata.field_76197_d);
- mapdata.field_76200_c = (byte)p_77873_2_.field_73011_w.field_76574_g; - mapdata.field_76200_c = (byte)p_77873_2_.field_73011_w.func_177502_q();
+ mapdata.field_76200_c = p_77873_2_.field_73011_w.field_76574_g; + mapdata.field_76200_c = p_77873_2_.field_73011_w.func_177502_q();
mapdata.func_76185_a(); mapdata.func_76185_a();
p_77873_2_.func_72823_a(s, mapdata); p_77873_2_.func_72823_a(s, mapdata);
} }

View file

@ -1,23 +1,23 @@
--- ../src-base/minecraft/net/minecraft/item/ItemStack.java --- ../src-base/minecraft/net/minecraft/item/ItemStack.java
+++ ../src-work/minecraft/net/minecraft/item/ItemStack.java +++ ../src-work/minecraft/net/minecraft/item/ItemStack.java
@@ -45,6 +45,7 @@ @@ -52,6 +52,7 @@
private EntityItemFrame field_82843_f; private boolean field_179551_k;
private static final String __OBFID = "CL_00000043"; private static final String __OBFID = "CL_00000043";
+ private cpw.mods.fml.common.registry.RegistryDelegate<Item> delegate; + private cpw.mods.fml.common.registry.RegistryDelegate<Item> delegate;
public ItemStack(Block p_i1876_1_) public ItemStack(Block p_i1876_1_)
{ {
this(p_i1876_1_, 1); this(p_i1876_1_, 1);
@@ -72,7 +73,7 @@ @@ -83,7 +84,7 @@
this.field_179553_i = false;
public ItemStack(Item p_i1881_1_, int p_i1881_2_, int p_i1881_3_) this.field_179550_j = null;
{ this.field_179551_k = false;
- this.field_151002_e = p_i1881_1_; - this.field_151002_e = p_i1881_1_;
+ func_150996_a(p_i1881_1_); + this.func_150996_a(p_i1881_1_);
this.field_77994_a = p_i1881_2_; this.field_77994_a = p_i1881_2_;
this.field_77991_e = p_i1881_3_; this.field_77991_e = p_i1881_3_;
@@ -106,7 +107,7 @@ @@ -123,7 +124,7 @@
public Item func_77973_b() public Item func_77973_b()
{ {
@ -25,17 +25,22 @@
+ return this.delegate != null ? this.delegate.get() : null; + return this.delegate != null ? this.delegate.get() : null;
} }
@SideOnly(Side.CLIENT) public boolean func_179546_a(EntityPlayer p_179546_1_, World p_179546_2_, BlockPos p_179546_3_, EnumFacing p_179546_4_, float p_179546_5_, float p_179546_6_, float p_179546_7_)
@@ -164,7 +165,7 @@ @@ -172,11 +173,11 @@
public void func_77963_c(NBTTagCompound p_77963_1_)
{ {
- this.field_151002_e = Item.func_150899_d(p_77963_1_.func_74765_d("id")); if (p_77963_1_.func_150297_b("id", 8))
+ func_150996_a(Item.func_150899_d(p_77963_1_.func_74765_d("id"))); {
this.field_77994_a = p_77963_1_.func_74771_c("Count"); - this.field_151002_e = Item.func_111206_d(p_77963_1_.func_74779_i("id"));
this.field_77991_e = p_77963_1_.func_74765_d("Damage"); + this.func_150996_a(Item.func_111206_d(p_77963_1_.func_74779_i("id")));
}
else
{
- this.field_151002_e = Item.func_150899_d(p_77963_1_.func_74765_d("id"));
+ this.func_150996_a(Item.func_150899_d(p_77963_1_.func_74765_d("id")));
}
@@ -744,6 +745,7 @@ this.field_77994_a = p_77963_1_.func_74771_c("Count");
@@ -870,6 +871,7 @@
public void func_150996_a(Item p_150996_1_) public void func_150996_a(Item p_150996_1_)
{ {

View file

@ -1,42 +1,33 @@
--- ../src-base/minecraft/net/minecraft/network/NetworkManager.java --- ../src-base/minecraft/net/minecraft/network/NetworkManager.java
+++ ../src-work/minecraft/net/minecraft/network/NetworkManager.java +++ ../src-work/minecraft/net/minecraft/network/NetworkManager.java
@@ -2,6 +2,8 @@ @@ -175,7 +175,7 @@
import com.google.common.collect.Queues;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
+
+import cpw.mods.fml.common.network.internal.FMLProxyPacket;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.bootstrap.Bootstrap;
@@ -142,7 +144,7 @@
final EnumConnectionState enumconnectionstate = EnumConnectionState.func_150752_a(p_150732_1_); final EnumConnectionState enumconnectionstate = EnumConnectionState.func_150752_a(p_150732_1_);
final EnumConnectionState enumconnectionstate1 = (EnumConnectionState)this.field_150746_k.attr(field_150739_c).get(); final EnumConnectionState enumconnectionstate1 = (EnumConnectionState)this.field_150746_k.attr(field_150739_c).get();
- if (enumconnectionstate1 != enumconnectionstate) - if (enumconnectionstate1 != enumconnectionstate)
+ if (enumconnectionstate1 != enumconnectionstate && !( p_150732_1_ instanceof FMLProxyPacket)) + if (enumconnectionstate1 != enumconnectionstate && !( p_150732_1_ instanceof cpw.mods.fml.common.network.internal.FMLProxyPacket))
{ {
field_150735_g.debug("Disabled auto read"); field_150735_g.debug("Disabled auto read");
this.field_150746_k.config().setAutoRead(false); this.field_150746_k.config().setAutoRead(false);
@@ -150,7 +152,7 @@ @@ -183,7 +183,7 @@
if (this.field_150746_k.eventLoop().inEventLoop()) if (this.field_150746_k.eventLoop().inEventLoop())
{ {
- if (enumconnectionstate != enumconnectionstate1) - if (enumconnectionstate != enumconnectionstate1)
+ if (enumconnectionstate != enumconnectionstate1 && !( p_150732_1_ instanceof FMLProxyPacket)) + if (enumconnectionstate != enumconnectionstate1 && !( p_150732_1_ instanceof cpw.mods.fml.common.network.internal.FMLProxyPacket))
{ {
this.func_150723_a(enumconnectionstate); this.func_150723_a(enumconnectionstate);
} }
@@ -164,7 +166,7 @@ @@ -204,7 +204,7 @@
private static final String __OBFID = "CL_00001241"; private static final String __OBFID = "CL_00001243";
public void run() public void run()
{ {
- if (enumconnectionstate != enumconnectionstate1) - if (enumconnectionstate != enumconnectionstate1)
+ if (enumconnectionstate != enumconnectionstate1 && !( p_150732_1_ instanceof FMLProxyPacket)) + if (enumconnectionstate != enumconnectionstate1 && !( p_150732_1_ instanceof cpw.mods.fml.common.network.internal.FMLProxyPacket))
{ {
NetworkManager.this.func_150723_a(enumconnectionstate); NetworkManager.this.func_150723_a(enumconnectionstate);
} }
@@ -315,6 +317,11 @@ @@ -409,6 +409,11 @@
this.channelRead0(p_channelRead0_1_, (Packet)p_channelRead0_2_); this.channelRead0(p_channelRead0_1_, (Packet)p_channelRead0_2_);
} }

View file

@ -1,20 +1,11 @@
--- ../src-base/minecraft/net/minecraft/network/NetworkSystem.java --- ../src-base/minecraft/net/minecraft/network/NetworkSystem.java
+++ ../src-work/minecraft/net/minecraft/network/NetworkSystem.java +++ ../src-work/minecraft/net/minecraft/network/NetworkSystem.java
@@ -1,6 +1,8 @@ @@ -110,7 +110,7 @@
package net.minecraft.network;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
+
+import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.bootstrap.ServerBootstrap;
@@ -84,7 +86,7 @@
; ;
} }
- p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(NetworkManager.field_152462_h)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(NetworkManager.field_152462_h)); - p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(30)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(EnumPacketDirection.CLIENTBOUND));
+ p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(FMLNetworkHandler.READ_TIMEOUT)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(NetworkManager.field_152462_h)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(NetworkManager.field_152462_h)); + p_initChannel_1_.pipeline().addLast("timeout", new ReadTimeoutHandler(cpw.mods.fml.common.network.internal.FMLNetworkHandler.READ_TIMEOUT)).addLast("legacy_query", new PingResponseHandler(NetworkSystem.this)).addLast("splitter", new MessageDeserializer2()).addLast("decoder", new MessageDeserializer(EnumPacketDirection.SERVERBOUND)).addLast("prepender", new MessageSerializer2()).addLast("encoder", new MessageSerializer(EnumPacketDirection.CLIENTBOUND));
NetworkManager networkmanager = new NetworkManager(false); NetworkManager networkmanager = new NetworkManager(EnumPacketDirection.SERVERBOUND);
NetworkSystem.this.field_151272_f.add(networkmanager); NetworkSystem.this.field_151272_f.add(networkmanager);
p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager); p_initChannel_1_.pipeline().addLast("packet_handler", networkmanager);

View file

@ -1,27 +1,18 @@
--- ../src-base/minecraft/net/minecraft/network/ServerStatusResponse.java --- ../src-base/minecraft/net/minecraft/network/ServerStatusResponse.java
+++ ../src-work/minecraft/net/minecraft/network/ServerStatusResponse.java +++ ../src-work/minecraft/net/minecraft/network/ServerStatusResponse.java
@@ -8,6 +8,8 @@ @@ -233,6 +233,7 @@
import com.google.gson.JsonSerializationContext;
import com.google.gson.JsonSerializer;
import com.mojang.authlib.GameProfile;
+import cpw.mods.fml.client.FMLClientHandler;
+import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import java.lang.reflect.Type;
import java.util.UUID;
import net.minecraft.util.IChatComponent;
@@ -233,6 +235,7 @@
serverstatusresponse.func_151320_a(JsonUtils.func_151200_h(jsonobject, "favicon")); serverstatusresponse.func_151320_a(JsonUtils.func_151200_h(jsonobject, "favicon"));
} }
+ FMLClientHandler.instance().captureAdditionalData(serverstatusresponse, jsonobject); + cpw.mods.fml.client.FMLClientHandler.instance().captureAdditionalData(serverstatusresponse, jsonobject);
return serverstatusresponse; return serverstatusresponse;
} }
@@ -260,6 +263,7 @@ @@ -260,6 +261,7 @@
jsonobject.addProperty("favicon", p_serialize_1_.func_151316_d()); jsonobject.addProperty("favicon", p_serialize_1_.func_151316_d());
} }
+ FMLNetworkHandler.enhanceStatusQuery(jsonobject); + cpw.mods.fml.common.network.internal.FMLNetworkHandler.enhanceStatusQuery(jsonobject);
return jsonobject; return jsonobject;
} }

View file

@ -1,31 +0,0 @@
--- ../src-base/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java
+++ ../src-work/minecraft/net/minecraft/network/play/server/S3FPacketCustomPayload.java
@@ -27,23 +27,24 @@
this.field_149172_a = p_i45190_1_;
this.field_149171_b = p_i45190_2_;
- if (p_i45190_2_.length >= 1048576)
+ //TODO: Remove this when FML protocol is re-written. To restore vanilla compatibility.
+ if (p_i45190_2_.length > 0x1FFF9A) // Max size of ANY MC packet is 0x1FFFFF minus max size of this packet (101)
{
- throw new IllegalArgumentException("Payload may not be larger than 1048576 bytes");
+ throw new IllegalArgumentException("Payload may not be larger than 2097050 bytes");
}
}
public void func_148837_a(PacketBuffer p_148837_1_) throws IOException
{
this.field_149172_a = p_148837_1_.func_150789_c(20);
- this.field_149171_b = new byte[p_148837_1_.readUnsignedShort()];
+ this.field_149171_b = new byte[cpw.mods.fml.common.network.ByteBufUtils.readVarShort(p_148837_1_)];
p_148837_1_.readBytes(this.field_149171_b);
}
public void func_148840_b(PacketBuffer p_148840_1_) throws IOException
{
p_148840_1_.func_150785_a(this.field_149172_a);
- p_148840_1_.writeShort(this.field_149171_b.length);
+ cpw.mods.fml.common.network.ByteBufUtils.writeVarShort(p_148840_1_, this.field_149171_b.length);
p_148840_1_.writeBytes(this.field_149171_b);
}

View file

@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/realms/RealmsConnect.java --- ../src-base/minecraft/net/minecraft/realms/RealmsConnect.java
+++ ../src-work/minecraft/net/minecraft/realms/RealmsConnect.java +++ ../src-work/minecraft/net/minecraft/realms/RealmsConnect.java
@@ -40,6 +40,7 @@ @@ -39,6 +39,7 @@
try try
{ {
@ -8,3 +8,12 @@
inetaddress = InetAddress.getByName(p_connect_1_); inetaddress = InetAddress.getByName(p_connect_1_);
if (RealmsConnect.this.aborted) if (RealmsConnect.this.aborted)
@@ -60,7 +61,7 @@
return;
}
- RealmsConnect.this.connection.func_179290_a(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN));
+ RealmsConnect.this.connection.func_179290_a(new C00Handshake(47, p_connect_1_, p_connect_2_, EnumConnectionState.LOGIN, true));
if (RealmsConnect.this.aborted)
{

View file

@ -1,118 +1,106 @@
--- ../src-base/minecraft/net/minecraft/server/MinecraftServer.java --- ../src-base/minecraft/net/minecraft/server/MinecraftServer.java
+++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java +++ ../src-work/minecraft/net/minecraft/server/MinecraftServer.java
@@ -5,6 +5,11 @@ @@ -399,7 +399,7 @@
import com.mojang.authlib.GameProfileRepository;
import com.mojang.authlib.minecraft.MinecraftSessionService;
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.Loader;
+import cpw.mods.fml.common.LoaderState;
+import cpw.mods.fml.common.StartupQuery;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
@@ -343,7 +348,7 @@
public void func_71260_j() public void func_71260_j()
{ {
- if (!this.field_71290_O) - if (!this.field_71290_O)
+ if (!this.field_71290_O && Loader.instance().hasReachedState(LoaderState.SERVER_STARTED) && !field_71316_v) // make sure the save is valid and we don't save twice + if (!this.field_71290_O && cpw.mods.fml.common.Loader.instance().hasReachedState(cpw.mods.fml.common.LoaderState.SERVER_STARTED) && !field_71316_v) // make sure the save is valid and we don't save twice
{ {
field_147145_h.info("Stopping server"); field_147145_h.info("Stopping server");
@@ -394,6 +399,7 @@ @@ -456,6 +456,7 @@
{ {
if (this.func_71197_b()) if (this.func_71197_b())
{ {
+ FMLCommonHandler.instance().handleServerStarted(); + cpw.mods.fml.common.FMLCommonHandler.instance().handleServerStarted();
long i = func_130071_aq(); this.field_175591_ab = func_130071_aq();
long l = 0L; long i = 0L;
this.field_147147_p.func_151315_a(new ChatComponentText(this.field_71286_C)); this.field_147147_p.func_151315_a(new ChatComponentText(this.field_71286_C));
@@ -438,12 +444,20 @@ @@ -500,12 +501,20 @@
Thread.sleep(Math.max(1L, 50L - l)); Thread.sleep(Math.max(1L, 50L - i));
this.field_71296_Q = true; this.field_71296_Q = true;
} }
+ FMLCommonHandler.instance().handleServerStopping(); + cpw.mods.fml.common.FMLCommonHandler.instance().handleServerStopping();
+ FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions + cpw.mods.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions
} }
else else
{ {
+ FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions + cpw.mods.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions
this.func_71228_a((CrashReport)null); this.func_71228_a((CrashReport)null);
} }
} }
+ catch (StartupQuery.AbortedException e) + catch (cpw.mods.fml.common.StartupQuery.AbortedException e)
+ { + {
+ // ignore silently + // ignore silently
+ FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions + cpw.mods.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions
+ } + }
catch (Throwable throwable1) catch (Throwable throwable1)
{ {
field_147145_h.error("Encountered an unexpected exception", throwable1); field_147145_h.error("Encountered an unexpected exception", throwable1);
@@ -469,6 +483,7 @@ @@ -531,6 +540,7 @@
field_147145_h.error("We were unable to save this crash report to disk."); field_147145_h.error("We were unable to save this crash report to disk.");
} }
+ FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions + cpw.mods.fml.common.FMLCommonHandler.instance().expectServerStopped(); // has to come before finalTick to avoid race conditions
this.func_71228_a(crashreport); this.func_71228_a(crashreport);
} }
finally finally
@@ -484,6 +499,8 @@ @@ -546,6 +556,8 @@
} }
finally finally
{ {
+ FMLCommonHandler.instance().handleServerStopped(); + cpw.mods.fml.common.FMLCommonHandler.instance().handleServerStopped();
+ this.field_71316_v = true; + this.field_71316_v = true;
this.func_71240_o(); this.func_71240_o();
} }
} }
@@ -529,6 +546,7 @@ @@ -591,6 +603,7 @@
public void func_71217_p() public void func_71217_p()
{ {
long i = System.nanoTime(); long i = System.nanoTime();
+ FMLCommonHandler.instance().onPreServerTick(); + cpw.mods.fml.common.FMLCommonHandler.instance().onPreServerTick();
++this.field_71315_w; ++this.field_71315_w;
if (this.field_71295_T) if (this.field_71295_T)
@@ -582,6 +600,7 @@ @@ -644,6 +657,7 @@
this.field_71304_b.func_76319_b(); this.field_71304_b.func_76319_b();
this.field_71304_b.func_76319_b(); this.field_71304_b.func_76319_b();
+ FMLCommonHandler.instance().onPostServerTick(); + cpw.mods.fml.common.FMLCommonHandler.instance().onPostServerTick();
} }
public void func_71190_q() public void func_71190_q()
@@ -608,6 +627,7 @@ @@ -686,6 +700,7 @@
} }
this.field_71304_b.func_76320_a("tick"); this.field_71304_b.func_76320_a("tick");
+ FMLCommonHandler.instance().onPreWorldTick(worldserver); + cpw.mods.fml.common.FMLCommonHandler.instance().onPreWorldTick(worldserver);
CrashReport crashreport; CrashReport crashreport;
try try
@@ -632,6 +652,7 @@ @@ -710,6 +725,7 @@
throw new ReportedException(crashreport); throw new ReportedException(crashreport);
} }
+ FMLCommonHandler.instance().onPostWorldTick(worldserver); + cpw.mods.fml.common.FMLCommonHandler.instance().onPostWorldTick(worldserver);
this.field_71304_b.func_76319_b(); this.field_71304_b.func_76319_b();
this.field_71304_b.func_76320_a("tracker"); this.field_71304_b.func_76320_a("tracker");
worldserver.func_73039_n().func_72788_a(); worldserver.func_73039_n().func_72788_a();
@@ -663,6 +684,7 @@ @@ -741,6 +757,7 @@
public void func_71256_s() public void func_71256_s()
{ {
+ StartupQuery.reset(); + cpw.mods.fml.common.StartupQuery.reset();
(new Thread("Server thread") this.field_175590_aa = new Thread(this, "Server thread");
{ this.field_175590_aa.start();
private static final String __OBFID = "CL_00001418"; }
@@ -715,7 +737,7 @@ @@ -787,7 +804,7 @@
public String getServerModName() public String getServerModName()
{ {
- return "vanilla"; - return "vanilla";
+ return FMLCommonHandler.instance().getModName(); + return cpw.mods.fml.common.FMLCommonHandler.instance().getModName();
} }
public CrashReport func_71230_b(CrashReport p_71230_1_) public CrashReport func_71230_b(CrashReport p_71230_1_)

View file

@ -1,13 +1,6 @@
--- ../src-base/minecraft/net/minecraft/server/dedicated/DedicatedServer.java --- ../src-base/minecraft/net/minecraft/server/dedicated/DedicatedServer.java
+++ ../src-work/minecraft/net/minecraft/server/dedicated/DedicatedServer.java +++ ../src-work/minecraft/net/minecraft/server/dedicated/DedicatedServer.java
@@ -1,5 +1,6 @@ @@ -49,6 +49,7 @@
package net.minecraft.server.dedicated;
+import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.BufferedReader;
@@ -48,6 +49,7 @@
private boolean field_71338_p; private boolean field_71338_p;
private WorldSettings.GameType field_71337_q; private WorldSettings.GameType field_71337_q;
private boolean field_71335_s; private boolean field_71335_s;
@ -15,37 +8,37 @@
private static final String __OBFID = "CL_00001784"; private static final String __OBFID = "CL_00001784";
public DedicatedServer(File p_i1508_1_) public DedicatedServer(File p_i1508_1_)
@@ -112,6 +114,8 @@ @@ -113,6 +114,8 @@
field_155771_h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); field_155771_h.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
} }
+ FMLCommonHandler.instance().onServerStart(this); + cpw.mods.fml.common.FMLCommonHandler.instance().onServerStart(this);
+ +
field_155771_h.info("Loading properties"); field_155771_h.info("Loading properties");
this.field_71340_o = new PropertyManager(new File("server.properties")); this.field_71340_o = new PropertyManager(new File("server.properties"));
this.field_154332_n = new ServerEula(new File("eula.txt")); this.field_154332_n = new ServerEula(new File("eula.txt"));
@@ -203,6 +207,7 @@ @@ -204,6 +207,7 @@
} }
else else
{ {
+ FMLCommonHandler.instance().onServerStarted(); + cpw.mods.fml.common.FMLCommonHandler.instance().onServerStarted();
this.func_152361_a(new DedicatedPlayerList(this)); this.func_152361_a(new DedicatedPlayerList(this));
long j = System.nanoTime(); long j = System.nanoTime();
@@ -248,6 +253,7 @@ @@ -250,6 +254,7 @@
this.func_71191_d((this.func_71207_Z() + 8) / 16 * 16); this.func_71191_d((this.func_71207_Z() + 8) / 16 * 16);
this.func_71191_d(MathHelper.func_76125_a(this.func_71207_Z(), 64, 256)); this.func_71191_d(MathHelper.func_76125_a(this.func_71207_Z(), 64, 256));
this.field_71340_o.func_73667_a("max-build-height", Integer.valueOf(this.func_71207_Z())); this.field_71340_o.func_73667_a("max-build-height", Integer.valueOf(this.func_71207_Z()));
+ if (!FMLCommonHandler.instance().handleServerAboutToStart(this)) { return false; } + if (!cpw.mods.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false;
field_155771_h.info("Preparing level \"" + this.func_71270_I() + "\""); field_155771_h.info("Preparing level \"" + this.func_71270_I() + "\"");
this.func_71247_a(this.func_71270_I(), this.func_71270_I(), k, worldtype, s2); this.func_71247_a(this.func_71270_I(), this.func_71270_I(), k, worldtype, s2);
long i1 = System.nanoTime() - j; long i1 = System.nanoTime() - j;
@@ -268,7 +274,7 @@ @@ -278,7 +283,7 @@
this.field_71339_n.func_72602_a(); thread1.start();
} }
- return true; - return true;
+ return FMLCommonHandler.instance().handleServerStarting(this); + return cpw.mods.fml.common.FMLCommonHandler.instance().handleServerStarting(this);
} }
} }
} }

View file

@ -1,14 +1,6 @@
--- ../src-base/minecraft/net/minecraft/server/gui/MinecraftServerGui.java --- ../src-base/minecraft/net/minecraft/server/gui/MinecraftServerGui.java
+++ ../src-work/minecraft/net/minecraft/server/gui/MinecraftServerGui.java +++ ../src-work/minecraft/net/minecraft/server/gui/MinecraftServerGui.java
@@ -13,6 +13,7 @@ @@ -79,6 +79,7 @@
import java.awt.event.FocusEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
+import java.util.concurrent.CountDownLatch;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JPanel;
@@ -79,6 +80,7 @@
System.exit(0); System.exit(0);
} }
}); });
@ -16,19 +8,17 @@
} }
public MinecraftServerGui(DedicatedServer p_i2362_1_) public MinecraftServerGui(DedicatedServer p_i2362_1_)
@@ -164,8 +166,15 @@ @@ -164,8 +165,13 @@
return jpanel; return jpanel;
} }
+ private CountDownLatch latch = new CountDownLatch(1); + private java.util.concurrent.CountDownLatch latch = new java.util.concurrent.CountDownLatch(1);
public void func_164247_a(final JTextArea p_164247_1_, final JScrollPane p_164247_2_, final String p_164247_3_) public void func_164247_a(final JTextArea p_164247_1_, final JScrollPane p_164247_2_, final String p_164247_3_)
{ {
+ try + try
+ { + {
+ latch.await(); + latch.await();
+ } catch (InterruptedException e) + } catch (InterruptedException e){} //Prevent logging until after constructor has ended.
+ {
+ }
if (!SwingUtilities.isEventDispatchThread()) if (!SwingUtilities.isEventDispatchThread())
{ {
SwingUtilities.invokeLater(new Runnable() SwingUtilities.invokeLater(new Runnable()

View file

@ -1,21 +1,14 @@
--- ../src-base/minecraft/net/minecraft/server/integrated/IntegratedServer.java --- ../src-base/minecraft/net/minecraft/server/integrated/IntegratedServer.java
+++ ../src-work/minecraft/net/minecraft/server/integrated/IntegratedServer.java +++ ../src-work/minecraft/net/minecraft/server/integrated/IntegratedServer.java
@@ -1,5 +1,6 @@ @@ -144,9 +144,10 @@
package net.minecraft.server.integrated;
+import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.File;
@@ -105,9 +106,10 @@
this.func_71245_h(true); this.func_71245_h(true);
field_147148_h.info("Generating keypair"); field_147148_h.info("Generating keypair");
this.func_71253_a(CryptManager.func_75891_b()); this.func_71253_a(CryptManager.func_75891_b());
+ if (!FMLCommonHandler.instance().handleServerAboutToStart(this)) { return false; } + if (!cpw.mods.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false;
this.func_71247_a(this.func_71270_I(), this.func_71221_J(), this.field_71350_m.func_77160_d(), this.field_71350_m.func_77165_h(), this.field_71350_m.func_82749_j()); this.func_71247_a(this.func_71270_I(), this.func_71221_J(), this.field_71350_m.func_77160_d(), this.field_71350_m.func_77165_h(), this.field_71350_m.func_82749_j());
this.func_71205_p(this.func_71214_G() + " - " + this.field_71305_c[0].func_72912_H().func_76065_j()); this.func_71205_p(this.func_71214_G() + " - " + this.field_71305_c[0].func_72912_H().func_76065_j());
- return true; - return true;
+ return FMLCommonHandler.instance().handleServerStarting(this); + return cpw.mods.fml.common.FMLCommonHandler.instance().handleServerStarting(this);
} }
public void func_71217_p() public void func_71217_p()

View file

@ -1,15 +1,6 @@
--- ../src-base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java --- ../src-base/minecraft/net/minecraft/server/management/ServerConfigurationManager.java
+++ ../src-work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java +++ ../src-work/minecraft/net/minecraft/server/management/ServerConfigurationManager.java
@@ -4,6 +4,8 @@ @@ -103,7 +103,7 @@
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.mojang.authlib.GameProfile;
+
+import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.io.File;
@@ -98,7 +100,7 @@
this.field_72405_c = 8; this.field_72405_c = 8;
} }
@ -18,24 +9,24 @@
{ {
GameProfile gameprofile = p_72355_2_.func_146103_bH(); GameProfile gameprofile = p_72355_2_.func_146103_bH();
PlayerProfileCache playerprofilecache = this.field_72400_f.func_152358_ax(); PlayerProfileCache playerprofilecache = this.field_72400_f.func_152358_ax();
@@ -119,7 +121,7 @@ @@ -125,7 +125,7 @@
WorldServer worldserver = this.field_72400_f.func_71218_a(p_72355_2_.field_71093_bK); WorldInfo worldinfo = worldserver.func_72912_H();
ChunkCoordinates chunkcoordinates = worldserver.func_72861_E(); BlockPos blockpos = worldserver.func_175694_M();
this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, worldserver); this.func_72381_a(p_72355_2_, (EntityPlayerMP)null, worldserver);
- NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.field_72400_f, p_72355_1_, p_72355_2_); - NetHandlerPlayServer nethandlerplayserver = new NetHandlerPlayServer(this.field_72400_f, p_72355_1_, p_72355_2_);
+ p_72355_2_.field_71135_a = nethandlerplayserver; + p_72355_2_.field_71135_a = nethandlerplayserver;
nethandlerplayserver.func_147359_a(new S01PacketJoinGame(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldserver.func_72912_H().func_76093_s(), worldserver.field_73011_w.field_76574_g, worldserver.field_73013_u, this.func_72352_l(), worldserver.func_72912_H().func_76067_t())); nethandlerplayserver.func_147359_a(new S01PacketJoinGame(p_72355_2_.func_145782_y(), p_72355_2_.field_71134_c.func_73081_b(), worldinfo.func_76093_s(), worldserver.field_73011_w.func_177502_q(), worldserver.func_175659_aa(), this.func_72352_l(), worldinfo.func_76067_t(), worldserver.func_82736_K().func_82766_b("reducedDebugInfo")));
nethandlerplayserver.func_147359_a(new S3FPacketCustomPayload("MC|Brand", this.func_72365_p().getServerModName().getBytes(Charsets.UTF_8))); nethandlerplayserver.func_147359_a(new S3FPacketCustomPayload("MC|Brand", (new PacketBuffer(Unpooled.buffer())).func_180714_a(this.func_72365_p().getServerModName())));
nethandlerplayserver.func_147359_a(new S05PacketSpawnPosition(chunkcoordinates.field_71574_a, chunkcoordinates.field_71572_b, chunkcoordinates.field_71573_c)); nethandlerplayserver.func_147359_a(new S41PacketServerDifficulty(worldinfo.func_176130_y(), worldinfo.func_176123_z()));
@@ -161,6 +163,7 @@ @@ -168,6 +168,7 @@
p_72355_2_.func_71116_b(); p_72355_2_.func_71116_b();
+ FMLCommonHandler.instance().firePlayerLoggedIn(p_72355_2_); + cpw.mods.fml.common.FMLCommonHandler.instance().firePlayerLoggedIn(p_72355_2_);
if (nbttagcompound != null && nbttagcompound.func_150297_b("Riding", 10)) if (nbttagcompound != null && nbttagcompound.func_150297_b("Riding", 10))
{ {
Entity entity = EntityList.func_75615_a(nbttagcompound.func_74775_l("Riding"), worldserver); Entity entity = EntityList.func_75615_a(nbttagcompound.func_74775_l("Riding"), worldserver);
@@ -250,6 +253,8 @@ @@ -283,6 +284,8 @@
protected void func_72391_b(EntityPlayerMP p_72391_1_) protected void func_72391_b(EntityPlayerMP p_72391_1_)
{ {
@ -44,27 +35,27 @@
this.field_72412_k.func_75753_a(p_72391_1_); this.field_72412_k.func_75753_a(p_72391_1_);
StatisticsFile statisticsfile = (StatisticsFile)this.field_148547_k.get(p_72391_1_.func_110124_au()); StatisticsFile statisticsfile = (StatisticsFile)this.field_148547_k.get(p_72391_1_.func_110124_au());
@@ -281,6 +286,7 @@ @@ -315,6 +318,7 @@
public void func_72367_e(EntityPlayerMP p_72367_1_) public void func_72367_e(EntityPlayerMP p_72367_1_)
{ {
+ FMLCommonHandler.instance().firePlayerLoggedOut(p_72367_1_); + cpw.mods.fml.common.FMLCommonHandler.instance().firePlayerLoggedOut(p_72367_1_);
p_72367_1_.func_71029_a(StatList.field_75947_j); p_72367_1_.func_71029_a(StatList.field_75947_j);
this.func_72391_b(p_72367_1_); this.func_72391_b(p_72367_1_);
WorldServer worldserver = p_72367_1_.func_71121_q(); WorldServer worldserver = p_72367_1_.func_71121_q();
@@ -436,6 +442,7 @@ @@ -473,6 +477,7 @@
this.field_72404_b.add(entityplayermp1); this.field_177454_f.put(entityplayermp1.func_110124_au(), entityplayermp1);
entityplayermp1.func_71116_b(); entityplayermp1.func_71116_b();
entityplayermp1.func_70606_j(entityplayermp1.func_110143_aJ()); entityplayermp1.func_70606_j(entityplayermp1.func_110143_aJ());
+ FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp1); + cpw.mods.fml.common.FMLCommonHandler.instance().firePlayerRespawnEvent(entityplayermp1);
return entityplayermp1; return entityplayermp1;
} }
@@ -461,6 +468,7 @@ @@ -498,6 +503,7 @@
PotionEffect potioneffect = (PotionEffect)iterator.next(); PotionEffect potioneffect = (PotionEffect)iterator.next();
p_72356_1_.field_71135_a.func_147359_a(new S1DPacketEntityEffect(p_72356_1_.func_145782_y(), potioneffect)); p_72356_1_.field_71135_a.func_147359_a(new S1DPacketEntityEffect(p_72356_1_.func_145782_y(), potioneffect));
} }
+ FMLCommonHandler.instance().firePlayerChangedDimensionEvent(p_72356_1_, j, p_72356_2_); + cpw.mods.fml.common.FMLCommonHandler.instance().firePlayerChangedDimensionEvent(p_72356_1_, j, p_72356_2_);
} }
public void func_82448_a(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_) public void func_82448_a(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_)

View file

@ -1,20 +1,13 @@
--- ../src-base/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java --- ../src-base/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java
+++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java +++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerHandshakeTCP.java
@@ -1,5 +1,6 @@ @@ -23,6 +23,14 @@
package net.minecraft.server.network;
+import cpw.mods.fml.common.FMLCommonHandler;
import io.netty.util.concurrent.GenericFutureListener;
import net.minecraft.network.EnumConnectionState;
import net.minecraft.network.NetworkManager;
@@ -24,6 +25,14 @@
public void func_147383_a(C00Handshake p_147383_1_) public void func_147383_a(C00Handshake p_147383_1_)
{ {
+ if (!FMLCommonHandler.instance().shouldAllowPlayerLogins()) + if (!cpw.mods.fml.common.FMLCommonHandler.instance().shouldAllowPlayerLogins())
+ { + {
+ ChatComponentText chatcomponenttext = new ChatComponentText("Server is still starting! Please wait before reconnecting."); + ChatComponentText chatcomponenttext = new ChatComponentText("Server is still starting! Please wait before reconnecting.");
+ this.field_147386_b.func_150725_a(new S00PacketDisconnect(chatcomponenttext), new GenericFutureListener[0]); + this.field_147386_b.func_179290_a(new S00PacketDisconnect(chatcomponenttext));
+ this.field_147386_b.func_150718_a(chatcomponenttext); + this.field_147386_b.func_150718_a(chatcomponenttext);
+ return; + return;
+ } + }

View file

@ -1,29 +1,20 @@
--- ../src-base/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java --- ../src-base/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java
+++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java +++ ../src-work/minecraft/net/minecraft/server/network/NetHandlerLoginServer.java
@@ -3,6 +3,8 @@ @@ -62,7 +62,7 @@
import com.google.common.base.Charsets;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.exceptions.AuthenticationUnavailableException;
+
+import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
import io.netty.util.concurrent.GenericFutureListener;
import java.math.BigInteger;
import java.security.PrivateKey;
@@ -58,7 +60,7 @@
this.func_147326_c(); this.func_147326_c();
} }
- if (this.field_147336_h++ == 600) - if (this.field_147336_h++ == 600)
+ if (this.field_147336_h++ == FMLNetworkHandler.LOGIN_TIMEOUT) + if (this.field_147336_h++ == cpw.mods.fml.common.network.internal.FMLNetworkHandler.LOGIN_TIMEOUT)
{ {
this.func_147322_a("Took too long to log in"); this.func_147322_a("Took too long to log in");
} }
@@ -96,7 +98,7 @@ @@ -113,7 +113,7 @@
{ }
this.field_147328_g = NetHandlerLoginServer.LoginState.ACCEPTED;
this.field_147333_a.func_150725_a(new S02PacketLoginSuccess(this.field_147337_i), new GenericFutureListener[0]); this.field_147333_a.func_179290_a(new S02PacketLoginSuccess(this.field_147337_i));
- this.field_147327_f.func_71203_ab().func_72355_a(this.field_147333_a, this.field_147327_f.func_71203_ab().func_148545_a(this.field_147337_i)); - this.field_147327_f.func_71203_ab().func_72355_a(this.field_147333_a, this.field_147327_f.func_71203_ab().func_148545_a(this.field_147337_i));
+ FMLNetworkHandler.fmlServerHandshake(this.field_147327_f.func_71203_ab(), this.field_147333_a, this.field_147327_f.func_71203_ab().func_148545_a(this.field_147337_i)); + cpw.mods.fml.common.network.internal.FMLNetworkHandler.fmlServerHandshake(this.field_147327_f.func_71203_ab(), this.field_147333_a, this.field_147327_f.func_71203_ab().func_148545_a(this.field_147337_i));
} }
} }

View file

@ -1,28 +1,6 @@
--- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java --- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java
@@ -1,10 +1,12 @@ @@ -89,9 +89,10 @@
package net.minecraft.tileentity;
+import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.Callable;
+
import net.minecraft.block.Block;
import net.minecraft.block.BlockJukebox;
import net.minecraft.crash.CrashReportCategory;
@@ -12,6 +14,8 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.world.World;
+
+import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@@ -87,9 +91,10 @@
{ {
TileEntity tileentity = null; TileEntity tileentity = null;
@ -34,29 +12,29 @@
if (oclass != null) if (oclass != null)
{ {
@@ -103,7 +108,17 @@ @@ -109,7 +110,17 @@
}
if (tileentity != null) else
{ {
+ try + try
+ { + {
tileentity.func_145839_a(p_145827_0_); field_145852_a.warn("Skipping BlockEntity with id " + p_145827_0_.func_74779_i("id"));
+ } + }
+ catch (Exception ex) + catch (Exception ex)
+ { + {
+ FMLLog.log(Level.ERROR, ex, + cpw.mods.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, ex,
+ "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author", + "A TileEntity %s(%s) has thrown an exception during loading, its state cannot be restored. Report this to the mod author",
+ p_145827_0_.func_74779_i("id"), oclass.getName()); + p_145827_0_.func_74779_i("id"), oclass.getName());
+ tileentity = null; + tileentity = null;
+ } + }
} }
else
{ return tileentity;
@@ -137,7 +152,6 @@ @@ -141,7 +152,6 @@
} }
} }
- @SideOnly(Side.CLIENT) - @SideOnly(Side.CLIENT)
public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_) public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_)
{ {
double d3 = (double)this.field_145851_c + 0.5D - p_145835_1_; double d3 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_;

View file

@ -1,13 +1,6 @@
--- ../src-base/minecraft/net/minecraft/tileentity/TileEntityFurnace.java --- ../src-base/minecraft/net/minecraft/tileentity/TileEntityFurnace.java
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java +++ ../src-work/minecraft/net/minecraft/tileentity/TileEntityFurnace.java
@@ -1,5 +1,6 @@ @@ -348,7 +348,15 @@
package net.minecraft.tileentity;
+import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
@@ -322,7 +323,15 @@
} }
} }
@ -20,7 +13,7 @@
+ if (item == Items.field_151129_at) return 20000; + if (item == Items.field_151129_at) return 20000;
+ if (item == Item.func_150898_a(Blocks.field_150345_g)) return 100; + if (item == Item.func_150898_a(Blocks.field_150345_g)) return 100;
+ if (item == Items.field_151072_bj) return 2400; + if (item == Items.field_151072_bj) return 2400;
+ return GameRegistry.getFuelValue(p_145952_0_); + return cpw.mods.fml.common.registry.GameRegistry.getFuelValue(p_145952_0_);
} }
} }

View file

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/util/MessageSerializer.java
+++ ../src-work/minecraft/net/minecraft/util/MessageSerializer.java
@@ -49,7 +49,7 @@
{
if (p_encode_2_ instanceof S0CPacketSpawnPlayer)
{
- p_encode_2_ = p_encode_2_;
+ //p_encode_2_ = p_encode_2_; FML: Kill warning
}
p_encode_2_.func_148840_b(packetbuffer);

View file

@ -1,13 +1,26 @@
--- ../src-base/minecraft/net/minecraft/util/ResourceLocation.java --- ../src-base/minecraft/net/minecraft/util/ResourceLocation.java
+++ ../src-work/minecraft/net/minecraft/util/ResourceLocation.java +++ ../src-work/minecraft/net/minecraft/util/ResourceLocation.java
@@ -1,10 +1,7 @@ @@ -1,7 +1,5 @@
package net.minecraft.util; package net.minecraft.util;
-import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly; -import cpw.mods.fml.relauncher.SideOnly;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
-@SideOnly(Side.CLIENT)
public class ResourceLocation public class ResourceLocation
{ @@ -22,7 +20,6 @@
private final String field_110626_a; this(0, func_177516_a(p_i1293_1_));
}
- @SideOnly(Side.CLIENT)
public ResourceLocation(String p_i1292_1_, String p_i1292_2_)
{
this(0, new String[] {p_i1292_1_, p_i1292_2_});
@@ -51,7 +48,6 @@
return this.field_110625_b;
}
- @SideOnly(Side.CLIENT)
public String func_110624_b()
{
return this.field_110626_a;

View file

@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/world/World.java --- ../src-base/minecraft/net/minecraft/world/World.java
+++ ../src-work/minecraft/net/minecraft/world/World.java +++ ../src-work/minecraft/net/minecraft/world/World.java
@@ -1800,14 +1800,14 @@ @@ -1626,8 +1626,6 @@
} }
} }
@ -8,16 +8,17 @@
- -
if (!this.field_147483_b.isEmpty()) if (!this.field_147483_b.isEmpty())
{ {
this.field_147482_g.removeAll(this.field_147483_b); this.field_175730_i.removeAll(this.field_147483_b);
@@ -1635,6 +1633,8 @@
this.field_147483_b.clear(); this.field_147483_b.clear();
} }
+ this.field_147481_N = false; + this.field_147481_N = false; //FML Move below remove to prevent CMEs
+ +
this.field_72984_F.func_76318_c("pendingBlockEntities"); this.field_72984_F.func_76318_c("pendingBlockEntities");
if (!this.field_147484_a.isEmpty()) if (!this.field_147484_a.isEmpty())
@@ -3598,7 +3598,7 @@ @@ -3429,7 +3429,7 @@
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public double func_72919_O() public double func_72919_O()
{ {
@ -25,4 +26,4 @@
+ return this.field_72986_A.func_76067_t().getHorizon(this); + return this.field_72986_A.func_76067_t().getHorizon(this);
} }
public CrashReportCategory func_72914_a(CrashReport p_72914_1_) public void func_175715_c(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_)

View file

@ -1,13 +1,19 @@
--- ../src-base/minecraft/net/minecraft/world/WorldProvider.java --- ../src-base/minecraft/net/minecraft/world/WorldProvider.java
+++ ../src-work/minecraft/net/minecraft/world/WorldProvider.java +++ ../src-work/minecraft/net/minecraft/world/WorldProvider.java
@@ -50,20 +50,12 @@ @@ -52,26 +52,12 @@
protected void func_76572_b() protected void func_76572_b()
{ {
- if (this.field_76579_a.func_72912_H().func_76067_t() == WorldType.field_77138_c) - WorldType worldtype = this.field_76579_a.func_72912_H().func_76067_t();
-
- if (worldtype == WorldType.field_77138_c)
- { - {
- FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.func_82651_a(this.field_76579_a.func_72912_H().func_82571_y()); - FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.func_82651_a(this.field_76579_a.func_72912_H().func_82571_y());
- this.field_76578_c = new WorldChunkManagerHell(BiomeGenBase.func_150568_d(flatgeneratorinfo.func_82648_a()), 0.5F); - this.field_76578_c = new WorldChunkManagerHell(BiomeGenBase.func_180276_a(flatgeneratorinfo.func_82648_a(), BiomeGenBase.field_180279_ad), 0.5F);
- }
- else if (worldtype == WorldType.field_180272_g)
- {
- this.field_76578_c = new WorldChunkManagerHell(BiomeGenBase.field_76772_c, 0.0F);
- } - }
- else - else
- { - {
@ -18,12 +24,12 @@
public IChunkProvider func_76555_c() public IChunkProvider func_76555_c()
{ {
- return (IChunkProvider)(this.field_76577_b == WorldType.field_77138_c ? new ChunkProviderFlat(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c) : new ChunkProviderGenerate(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r())); - return (IChunkProvider)(this.field_76577_b == WorldType.field_77138_c ? new ChunkProviderFlat(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c) : (this.field_76577_b == WorldType.field_180272_g ? new ChunkProviderDebug(this.field_76579_a) : (this.field_76577_b == WorldType.field_180271_f ? new ChunkProviderGenerate(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c) : new ChunkProviderGenerate(this.field_76579_a, this.field_76579_a.func_72905_C(), this.field_76579_a.func_72912_H().func_76089_r(), this.field_82913_c))));
+ return field_76577_b.getChunkGenerator(field_76579_a, field_82913_c); + return field_76577_b.getChunkGenerator(field_76579_a, field_82913_c);
} }
public boolean func_76566_a(int p_76566_1_, int p_76566_2_) public boolean func_76566_a(int p_76566_1_, int p_76566_2_)
@@ -179,19 +171,19 @@ @@ -177,13 +163,13 @@
public int func_76557_i() public int func_76557_i()
{ {
@ -31,13 +37,6 @@
+ return this.field_76577_b.getMinimumSpawnHeight(this.field_76579_a); + return this.field_76577_b.getMinimumSpawnHeight(this.field_76579_a);
} }
@SideOnly(Side.CLIENT)
public boolean func_76564_j()
{
- return this.field_76577_b != WorldType.field_77138_c && !this.field_76576_e;
+ return this.field_76577_b.hasVoidParticles(this.field_76576_e);
}
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public double func_76565_k() public double func_76565_k()
{ {

View file

@ -1,41 +1,32 @@
--- ../src-base/minecraft/net/minecraft/world/WorldType.java --- ../src-base/minecraft/net/minecraft/world/WorldType.java
+++ ../src-work/minecraft/net/minecraft/world/WorldType.java +++ ../src-work/minecraft/net/minecraft/world/WorldType.java
@@ -1,5 +1,14 @@ @@ -114,4 +114,53 @@
package net.minecraft.world;
+import java.util.Random;
+
+import net.minecraft.world.biome.BiomeGenBase;
+import net.minecraft.world.biome.WorldChunkManager;
+import net.minecraft.world.biome.WorldChunkManagerHell;
+import net.minecraft.world.chunk.IChunkProvider;
+import net.minecraft.world.gen.ChunkProviderFlat;
+import net.minecraft.world.gen.ChunkProviderGenerate;
+import net.minecraft.world.gen.FlatGeneratorInfo;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -112,4 +121,70 @@
this.field_151361_l = true; this.field_151361_l = true;
return this; return this;
} }
+ +
+ public WorldChunkManager getChunkManager(World world) + public net.minecraft.world.biome.WorldChunkManager getChunkManager(World world)
+ { + {
+ if (this == field_77138_c) + if (this == field_77138_c)
+ { + {
+ FlatGeneratorInfo flatgeneratorinfo = FlatGeneratorInfo.func_82651_a(world.func_72912_H().func_82571_y()); + net.minecraft.world.gen.FlatGeneratorInfo flatgeneratorinfo = net.minecraft.world.gen.FlatGeneratorInfo.func_82651_a(world.func_72912_H().func_82571_y());
+ return new WorldChunkManagerHell(BiomeGenBase.func_150568_d(flatgeneratorinfo.func_82648_a()), 0.5F); + return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.func_180276_a(flatgeneratorinfo.func_82648_a(), net.minecraft.world.biome.BiomeGenBase.field_180279_ad), 0.5F);
+ }
+ else if (this == field_180272_g)
+ {
+ return new net.minecraft.world.biome.WorldChunkManagerHell(net.minecraft.world.biome.BiomeGenBase.field_76772_c, 0.0F);
+ } + }
+ else + else
+ { + {
+ return new WorldChunkManager(world); + return new net.minecraft.world.biome.WorldChunkManager(world);
+ } + }
+ } + }
+ +
+ public IChunkProvider getChunkGenerator(World world, String generatorOptions) + public net.minecraft.world.chunk.IChunkProvider getChunkGenerator(World world, String generatorOptions)
+ { + {
+ return (this == field_77138_c ? new ChunkProviderFlat(world, world.func_72905_C(), world.func_72912_H().func_76089_r(), generatorOptions) : new ChunkProviderGenerate(world, world.func_72905_C(), world.func_72912_H().func_76089_r())); + if (this == field_77138_c) return new net.minecraft.world.gen.ChunkProviderFlat(world, world.func_72905_C(), world.func_72912_H().func_76089_r(), generatorOptions);
+ if (this == field_180272_g) return new net.minecraft.world.gen.ChunkProviderDebug(world);
+ return new net.minecraft.world.gen.ChunkProviderGenerate(world, world.func_72905_C(), world.func_72912_H().func_76089_r(), generatorOptions);
+ } + }
+ +
+ public int getMinimumSpawnHeight(World world) + public int getMinimumSpawnHeight(World world)
@ -48,35 +39,12 @@
+ return this == field_77138_c ? 0.0D : 63.0D; + return this == field_77138_c ? 0.0D : 63.0D;
+ } + }
+ +
+ public boolean hasVoidParticles(boolean flag)
+ {
+ return this != field_77138_c && !flag;
+ }
+
+ public double voidFadeMagnitude() + public double voidFadeMagnitude()
+ { + {
+ return this == field_77138_c ? 1.0D : 0.03125D; + return this == field_77138_c ? 1.0D : 0.03125D;
+ } + }
+ +
+/* public BiomeGenBase[] getBiomesForWorldType() { + public boolean handleSlimeSpawnReduction(java.util.Random random, World world)
+ return biomesForWorldType;
+ }
+
+ public void addNewBiome(BiomeGenBase biome)
+ {
+ Set<BiomeGenBase> newBiomesForWorld = Sets.newLinkedHashSet(Arrays.asList(biomesForWorldType));
+ newBiomesForWorld.add(biome);
+ biomesForWorldType = newBiomesForWorld.toArray(new BiomeGenBase[0]);
+ }
+
+ public void removeBiome(BiomeGenBase biome)
+ {
+ Set<BiomeGenBase> newBiomesForWorld = Sets.newLinkedHashSet(Arrays.asList(biomesForWorldType));
+ newBiomesForWorld.remove(biome);
+ biomesForWorldType = newBiomesForWorld.toArray(new BiomeGenBase[0]);
+ }
+*/
+ public boolean handleSlimeSpawnReduction(Random random, World world)
+ { + {
+ return this == field_77138_c ? random.nextInt(4) != 1 : false; + return this == field_77138_c ? random.nextInt(4) != 1 : false;
+ } + }

View file

@ -1,65 +1,41 @@
--- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java --- ../src-base/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java
+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java +++ ../src-work/minecraft/net/minecraft/world/chunk/storage/AnvilChunkLoader.java
@@ -9,6 +9,7 @@ @@ -287,11 +287,20 @@
import java.util.Iterator; Entity entity = (Entity)iterator.next();
import java.util.List;
import java.util.Set;
+
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
@@ -24,9 +25,13 @@
import net.minecraft.world.chunk.NibbleArray;
import net.minecraft.world.storage.IThreadedFileIO;
import net.minecraft.world.storage.ThreadedFileIOBase;
+
+import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import cpw.mods.fml.common.FMLLog;
+
public class AnvilChunkLoader implements IChunkLoader, IThreadedFileIO
{
private static final Logger field_151505_a = LogManager.getLogger();
@@ -260,11 +265,20 @@
Entity entity = (Entity)iterator1.next();
nbttagcompound1 = new NBTTagCompound(); nbttagcompound1 = new NBTTagCompound();
- if (entity.func_70039_c(nbttagcompound1))
+ try + try
+ {
if (entity.func_70039_c(nbttagcompound1))
{ {
- p_75820_1_.field_76644_m = true; p_75820_1_.func_177409_g(true);
- nbttaglist2.func_74742_a(nbttagcompound1); nbttaglist1.func_74742_a(nbttagcompound1);
+ if (entity.func_70039_c(nbttagcompound1))
+ {
+ p_75820_1_.field_76644_m = true;
+ nbttaglist2.func_74742_a(nbttagcompound1);
+ }
} }
+ }
+ catch (Exception e) + catch (Exception e)
+ { + {
+ FMLLog.log(Level.ERROR, e, + cpw.mods.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e,
+ "An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author", + "An Entity type %s has thrown an exception trying to write state. It will not persist. Report this to the mod author",
+ entity.getClass().getName()); + entity.getClass().getName());
+ } + }
} }
} }
@@ -276,8 +290,16 @@ @@ -303,8 +312,17 @@
{ {
TileEntity tileentity = (TileEntity)iterator1.next(); TileEntity tileentity = (TileEntity)iterator.next();
nbttagcompound1 = new NBTTagCompound(); nbttagcompound1 = new NBTTagCompound();
+ try { + try
+ {
tileentity.func_145841_b(nbttagcompound1); tileentity.func_145841_b(nbttagcompound1);
nbttaglist3.func_74742_a(nbttagcompound1); nbttaglist2.func_74742_a(nbttagcompound1);
+ } + }
+ catch (Exception e) + catch (Exception e)
+ { + {
+ FMLLog.log(Level.ERROR, e, + cpw.mods.fml.common.FMLLog.log(org.apache.logging.log4j.Level.ERROR, e,
+ "A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author", + "A TileEntity type %s has throw an exception trying to write state. It will not persist. Report this to the mod author",
+ tileentity.getClass().getName()); + tileentity.getClass().getName());
+ } + }
} }
p_75820_3_.func_74782_a("TileEntities", nbttaglist3); p_75820_3_.func_74782_a("TileEntities", nbttaglist2);

View file

@ -1,18 +1,10 @@
--- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderServer.java --- ../src-base/minecraft/net/minecraft/world/gen/ChunkProviderServer.java
+++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderServer.java +++ ../src-work/minecraft/net/minecraft/world/gen/ChunkProviderServer.java
@@ -1,6 +1,7 @@ @@ -209,6 +209,7 @@
package net.minecraft.world.gen;
import com.google.common.collect.Lists;
+import cpw.mods.fml.common.registry.GameRegistry;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
@@ -216,6 +217,7 @@
if (this.field_73246_d != null) if (this.field_73246_d != null)
{ {
this.field_73246_d.func_73153_a(p_73153_1_, p_73153_2_, p_73153_3_); this.field_73246_d.func_73153_a(p_73153_1_, p_73153_2_, p_73153_3_);
+ GameRegistry.generateWorld(p_73153_2_, p_73153_3_, field_73251_h, field_73246_d, p_73153_1_); + cpw.mods.fml.common.registry.GameRegistry.generateWorld(p_73153_2_, p_73153_3_, field_73251_h, field_73246_d, p_73153_1_);
chunk.func_76630_e(); chunk.func_76630_e();
} }
} }

View file

@ -1,30 +1,21 @@
--- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java --- ../src-base/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java
+++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java +++ ../src-work/minecraft/net/minecraft/world/gen/structure/StructureVillagePieces.java
@@ -4,6 +4,8 @@ @@ -59,6 +59,8 @@
import java.util.Iterator;
import java.util.List;
import java.util.Random;
+
+import cpw.mods.fml.common.registry.VillagerRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.passive.EntityVillager;
@@ -50,6 +52,8 @@
arraylist.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field2.class, 3, MathHelper.func_76136_a(p_75084_0_, 2 + p_75084_1_, 4 + p_75084_1_ * 2))); arraylist.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.Field2.class, 3, MathHelper.func_76136_a(p_75084_0_, 2 + p_75084_1_, 4 + p_75084_1_ * 2)));
arraylist.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House2.class, 15, MathHelper.func_76136_a(p_75084_0_, 0, 1 + p_75084_1_))); arraylist.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House2.class, 15, MathHelper.func_76136_a(p_75084_0_, 0, 1 + p_75084_1_)));
arraylist.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House3.class, 8, MathHelper.func_76136_a(p_75084_0_, 0 + p_75084_1_, 3 + p_75084_1_ * 2))); arraylist.add(new StructureVillagePieces.PieceWeight(StructureVillagePieces.House3.class, 8, MathHelper.func_76136_a(p_75084_0_, 0 + p_75084_1_, 3 + p_75084_1_ * 2)));
+ VillagerRegistry.addExtraVillageComponents(arraylist, p_75084_0_, p_75084_1_); + cpw.mods.fml.common.registry.VillagerRegistry.addExtraVillageComponents(arraylist, p_75084_0_, p_75084_1_);
+ +
Iterator iterator = arraylist.iterator(); Iterator iterator = arraylist.iterator();
while (iterator.hasNext()) while (iterator.hasNext())
@@ -123,6 +127,10 @@ @@ -132,6 +134,10 @@
{ {
object = StructureVillagePieces.House3.func_74921_a(p_75083_0_, p_75083_2_, p_75083_3_, p_75083_4_, p_75083_5_, p_75083_6_, p_75083_7_, p_75083_8_); object = StructureVillagePieces.House3.func_175849_a(p_176065_0_, p_176065_2_, p_176065_3_, p_176065_4_, p_176065_5_, p_176065_6_, p_176065_7_, p_176065_8_);
} }
+ else + else
+ { + {
+ object = VillagerRegistry.getVillageComponent(p_75083_1_, p_75083_0_ , p_75083_2_, p_75083_3_, p_75083_4_, p_75083_5_, p_75083_6_, p_75083_7_, p_75083_8_); + object = cpw.mods.fml.common.registry.VillagerRegistry.getVillageComponent(p_176065_1_, p_176065_0_ , p_176065_2_, p_176065_3_, p_176065_4_, p_176065_5_, p_176065_6_, p_176065_7_, p_176065_8_);
+ } + }
return (StructureVillagePieces.Village)object; return (StructureVillagePieces.Village)object;

View file

@ -1,43 +1,34 @@
--- ../src-base/minecraft/net/minecraft/world/storage/MapData.java --- ../src-base/minecraft/net/minecraft/world/storage/MapData.java
+++ ../src-work/minecraft/net/minecraft/world/storage/MapData.java +++ ../src-work/minecraft/net/minecraft/world/storage/MapData.java
@@ -10,7 +10,7 @@ @@ -22,7 +22,7 @@
import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.*;
import net.minecraft.world.World;
import net.minecraft.world.WorldSavedData;
@@ -18,7 +18,7 @@
{ {
public int field_76201_a; public int field_76201_a;
public int field_76199_b; public int field_76199_b;
- public byte field_76200_c; - public byte field_76200_c;
+ public int field_76200_c; + public int field_76200_c; //FML byte -> int
public byte field_76197_d; public byte field_76197_d;
public byte[] field_76198_e = new byte[16384]; public byte[] field_76198_e = new byte[16384];
public List field_76196_g = new ArrayList(); public List field_76196_g = Lists.newArrayList();
@@ -33,7 +33,17 @@ @@ -46,7 +46,17 @@
public void func_76184_a(NBTTagCompound p_76184_1_) public void func_76184_a(NBTTagCompound p_76184_1_)
{ {
- this.field_76200_c = p_76184_1_.func_74771_c("dimension"); - this.field_76200_c = p_76184_1_.func_74771_c("dimension");
+ NBTBase dimension = p_76184_1_.func_74781_a("dimension"); + net.minecraft.nbt.NBTBase dimension = p_76184_1_.func_74781_a("dimension");
+ +
+ if (dimension instanceof NBTTagByte) + if (dimension instanceof net.minecraft.nbt.NBTTagByte)
+ { + {
+ this.field_76200_c = ((NBTTagByte)dimension).func_150290_f(); + this.field_76200_c = ((net.minecraft.nbt.NBTTagByte)dimension).func_150290_f();
+ } + }
+ else + else
+ { + {
+ this.field_76200_c = ((NBTTagInt)dimension).func_150287_d(); + this.field_76200_c = ((net.minecraft.nbt.NBTTagInt)dimension).func_150287_d();
+ } + }
+ +
this.field_76201_a = p_76184_1_.func_74762_e("xCenter"); this.field_76201_a = p_76184_1_.func_74762_e("xCenter");
this.field_76199_b = p_76184_1_.func_74762_e("zCenter"); this.field_76199_b = p_76184_1_.func_74762_e("zCenter");
this.field_76197_d = p_76184_1_.func_74771_c("scale"); this.field_76197_d = p_76184_1_.func_74771_c("scale");
@@ -84,7 +94,7 @@ @@ -87,7 +97,7 @@
public void func_76187_b(NBTTagCompound p_76187_1_) public void func_76187_b(NBTTagCompound p_76187_1_)
{ {

View file

@ -1,16 +1,6 @@
--- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java --- ../src-base/minecraft/net/minecraft/world/storage/SaveHandler.java
+++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java +++ ../src-work/minecraft/net/minecraft/world/storage/SaveHandler.java
@@ -6,6 +6,9 @@ @@ -107,20 +107,29 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
+
+import cpw.mods.fml.common.FMLCommonHandler;
+import cpw.mods.fml.common.StartupQuery;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
@@ -107,20 +110,29 @@
NBTTagCompound nbttagcompound; NBTTagCompound nbttagcompound;
NBTTagCompound nbttagcompound1; NBTTagCompound nbttagcompound1;
@ -22,12 +12,11 @@
{ {
nbttagcompound = CompressedStreamTools.func_74796_a(new FileInputStream(file1)); nbttagcompound = CompressedStreamTools.func_74796_a(new FileInputStream(file1));
nbttagcompound1 = nbttagcompound.func_74775_l("Data"); nbttagcompound1 = nbttagcompound.func_74775_l("Data");
- return new WorldInfo(nbttagcompound1);
+ worldInfo = new WorldInfo(nbttagcompound1); + worldInfo = new WorldInfo(nbttagcompound1);
+ FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); + cpw.mods.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound);
+ return worldInfo; return new WorldInfo(nbttagcompound1);
} }
+ catch (StartupQuery.AbortedException e) + catch (cpw.mods.fml.common.StartupQuery.AbortedException e)
+ { + {
+ throw e; + throw e;
+ } + }
@ -37,40 +26,39 @@
} }
} }
+ FMLCommonHandler.instance().confirmBackupLevelDatUse(this); + cpw.mods.fml.common.FMLCommonHandler.instance().confirmBackupLevelDatUse(this);
file1 = new File(this.field_75770_b, "level.dat_old"); file1 = new File(this.field_75770_b, "level.dat_old");
if (file1.exists()) if (file1.exists())
@@ -129,8 +141,14 @@ @@ -129,7 +138,13 @@
{ {
nbttagcompound = CompressedStreamTools.func_74796_a(new FileInputStream(file1)); nbttagcompound = CompressedStreamTools.func_74796_a(new FileInputStream(file1));
nbttagcompound1 = nbttagcompound.func_74775_l("Data"); nbttagcompound1 = nbttagcompound.func_74775_l("Data");
- return new WorldInfo(nbttagcompound1); - return new WorldInfo(nbttagcompound1);
+ worldInfo = new WorldInfo(nbttagcompound1); + worldInfo = new WorldInfo(nbttagcompound1);
+ FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound); + cpw.mods.fml.common.FMLCommonHandler.instance().handleWorldDataLoad(this, worldInfo, nbttagcompound);
+ return worldInfo; + return worldInfo;
} + }
+ catch (StartupQuery.AbortedException e) + catch (cpw.mods.fml.common.StartupQuery.AbortedException e)
+ { + {
+ throw e; + throw e;
+ } }
catch (Exception exception) catch (Exception exception)
{ {
exception.printStackTrace(); @@ -146,6 +161,8 @@
@@ -146,6 +164,8 @@
NBTTagCompound nbttagcompound2 = new NBTTagCompound(); NBTTagCompound nbttagcompound2 = new NBTTagCompound();
nbttagcompound2.func_74782_a("Data", nbttagcompound1); nbttagcompound2.func_74782_a("Data", nbttagcompound1);
+ FMLCommonHandler.instance().handleWorldDataSave(this, p_75755_1_, nbttagcompound2); + cpw.mods.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, p_75755_1_, nbttagcompound2);
+ +
try try
{ {
File file1 = new File(this.field_75770_b, "level.dat_new"); File file1 = new File(this.field_75770_b, "level.dat_new");
@@ -184,6 +204,8 @@ @@ -184,6 +201,8 @@
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.func_74782_a("Data", nbttagcompound); nbttagcompound1.func_74782_a("Data", nbttagcompound);
+ FMLCommonHandler.instance().handleWorldDataSave(this, p_75761_1_, nbttagcompound1); + cpw.mods.fml.common.FMLCommonHandler.instance().handleWorldDataSave(this, p_75761_1_, nbttagcompound1);
+ +
try try
{ {

View file

@ -1,26 +1,14 @@
--- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java --- ../src-base/minecraft/net/minecraft/world/storage/WorldInfo.java
+++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java +++ ../src-work/minecraft/net/minecraft/world/storage/WorldInfo.java
@@ -2,8 +2,11 @@ @@ -52,6 +52,7 @@
private int field_176155_J;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+
+import java.util.Map;
import java.util.concurrent.Callable;
import net.minecraft.crash.CrashReportCategory;
+import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.GameRules;
@@ -36,6 +39,7 @@
private boolean field_76110_t;
private boolean field_76109_u;
private GameRules field_82577_x; private GameRules field_82577_x;
+ private Map<String, NBTBase> additionalProperties;
private static final String __OBFID = "CL_00000587"; private static final String __OBFID = "CL_00000587";
+ private java.util.Map<String, net.minecraft.nbt.NBTBase> additionalProperties;
protected WorldInfo() protected WorldInfo()
@@ -532,4 +536,24 @@ {
@@ -803,4 +804,24 @@
} }
}); });
} }
@ -31,7 +19,7 @@
+ * Used by Forge to store the dimensions available to a world + * Used by Forge to store the dimensions available to a world
+ * @param additionalProperties + * @param additionalProperties
+ */ + */
+ public void setAdditionalProperties(Map<String,NBTBase> additionalProperties) + public void setAdditionalProperties(java.util.Map<String,net.minecraft.nbt.NBTBase> additionalProperties)
+ { + {
+ // one time set for this + // one time set for this
+ if (this.additionalProperties == null) + if (this.additionalProperties == null)
@ -40,7 +28,7 @@
+ } + }
+ } + }
+ +
+ public NBTBase getAdditionalProperty(String additionalProperty) + public net.minecraft.nbt.NBTBase getAdditionalProperty(String additionalProperty)
+ { + {
+ return this.additionalProperties!=null? this.additionalProperties.get(additionalProperty) : null; + return this.additionalProperties!=null? this.additionalProperties.get(additionalProperty) : null;
+ } + }

View file

@ -14,6 +14,7 @@ package cpw.mods.fml.client;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
@ -26,7 +27,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiIngameMenu; import net.minecraft.client.gui.GuiIngameMenu;
import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiMainMenu;
@ -130,10 +131,8 @@ public class FMLClientHandler implements IFMLSidedHandler
private DummyModContainer optifineContainer; private DummyModContainer optifineContainer;
@SuppressWarnings("unused")
private boolean guiLoaded; private boolean guiLoaded;
@SuppressWarnings("unused")
private boolean serverIsRunning; private boolean serverIsRunning;
private MissingModsException modsMissing; private MissingModsException modsMissing;
@ -152,7 +151,6 @@ public class FMLClientHandler implements IFMLSidedHandler
private List<IResourcePack> resourcePackList; private List<IResourcePack> resourcePackList;
@SuppressWarnings("unused")
private IReloadableResourceManager resourceManager; private IReloadableResourceManager resourceManager;
private Map<String, IResourcePack> resourcePackMap; private Map<String, IResourcePack> resourcePackMap;
@ -301,7 +299,7 @@ public class FMLClientHandler implements IFMLSidedHandler
// Reload resources // Reload resources
client.refreshResources(); client.refreshResources();
RenderingRegistry.instance().loadEntityRenderers((Map<Class<? extends Entity>, Render>)RenderManager.instance.entityRenderMap); //RenderingRegistry.instance().loadEntityRenderers((Map<Class<? extends Entity>, Render>)Minecraft.getMinecraft().func_175598_ae().entityRenderMap);
guiFactories = HashBiMap.create(); guiFactories = HashBiMap.create();
for (ModContainer mc : Loader.instance().getActiveModList()) for (ModContainer mc : Loader.instance().getActiveModList())
{ {
@ -326,7 +324,6 @@ public class FMLClientHandler implements IFMLSidedHandler
client.gameSettings.loadOptions(); //Reload options to load any mod added keybindings. client.gameSettings.loadOptions(); //Reload options to load any mod added keybindings.
} }
@SuppressWarnings("unused")
public void extendModList() public void extendModList()
{ {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -463,16 +460,16 @@ public class FMLClientHandler implements IFMLSidedHandler
{ {
if (Thread.interrupted()) throw new InterruptedException(); if (Thread.interrupted()) throw new InterruptedException();
client.loadingScreen.resetProgresAndWorkingMessage(""); client.loadingScreen.displayLoadingString("");
Thread.sleep(50); Thread.sleep(50);
} }
client.loadingScreen.resetProgresAndWorkingMessage(""); // make sure the blank screen is being drawn at the end client.loadingScreen.displayLoadingString(""); // make sure the blank screen is being drawn at the end
} }
} }
public boolean handleLoadingScreen(ScaledResolution scaledResolution) public boolean handleLoadingScreen(ScaledResolution scaledResolution) throws IOException
{ {
if (client.currentScreen instanceof GuiNotification) if (client.currentScreen instanceof GuiNotification)
{ {
@ -497,7 +494,7 @@ public class FMLClientHandler implements IFMLSidedHandler
return client.theWorld; return client.theWorld;
} }
public EntityClientPlayerMP getClientPlayerEntity() public EntityPlayerSP getClientPlayerEntity()
{ {
return client.thePlayer; return client.thePlayer;
} }
@ -630,7 +627,6 @@ public class FMLClientHandler implements IFMLSidedHandler
public void startIntegratedServer(String id, String name, WorldSettings settings) public void startIntegratedServer(String id, String name, WorldSettings settings)
{ {
playClientBlock = new CountDownLatch(1);
} }
public File getSavesDir() public File getSavesDir()
@ -774,10 +770,10 @@ public class FMLClientHandler implements IFMLSidedHandler
return null; return null;
} }
this.client.getTextureManager().bindTexture(iconSheet); this.client.getTextureManager().bindTexture(iconSheet);
Gui.func_146110_a(x + width - 18, y + 10, 0, (float)idx, 16, 16, 256.0f, 256.0f); Gui.drawModalRectWithCustomSizedTexture(x + width - 18, y + 10, 0, (float)idx, 16, 16, 256.0f, 256.0f);
if (blocked) if (blocked)
{ {
Gui.func_146110_a(x + width - 18, y + 10, 0, 80, 16, 16, 256.0f, 256.0f); Gui.drawModalRectWithCustomSizedTexture(x + width - 18, y + 10, 0, 80, 16, 16, 256.0f, 256.0f);
} }
return relativeMouseX > width - 15 && relativeMouseX < width && relativeMouseY > 10 && relativeMouseY < 26 ? tooltip : null; return relativeMouseX > width - 15 && relativeMouseX < width && relativeMouseY > 10 && relativeMouseY < 26 ? tooltip : null;
@ -795,7 +791,7 @@ public class FMLClientHandler implements IFMLSidedHandler
ServerData serverData = new ServerData("Command Line", host+":"+port); ServerData serverData = new ServerData("Command Line", host+":"+port);
try try
{ {
osp.func_147224_a(serverData); osp.ping(serverData);
startupConnectionData.await(30, TimeUnit.SECONDS); startupConnectionData.await(30, TimeUnit.SECONDS);
} }
catch (Exception e) catch (Exception e)
@ -817,46 +813,20 @@ public class FMLClientHandler implements IFMLSidedHandler
{ {
showGuiScreen(new GuiConnecting(guiMultiplayer, client, serverEntry)); showGuiScreen(new GuiConnecting(guiMultiplayer, client, serverEntry));
} }
playClientBlock = new CountDownLatch(1);
} }
public void connectToRealmsServer(String host, int port) public void connectToRealmsServer(String host, int port){}
{
playClientBlock = new CountDownLatch(1);
}
private CountDownLatch playClientBlock;
public void setPlayClient(NetHandlerPlayClient netHandlerPlayClient) public void setPlayClient(NetHandlerPlayClient netHandlerPlayClient)
{ {
if (playClientBlock == null)
playClientBlock = new CountDownLatch(1);
playClientBlock.countDown();
this.currentPlayClient = new WeakReference<NetHandlerPlayClient>(netHandlerPlayClient); this.currentPlayClient = new WeakReference<NetHandlerPlayClient>(netHandlerPlayClient);
} }
@Override
public void waitForPlayClient()
{
boolean gotIt = false;
try
{
gotIt = playClientBlock.await(5,TimeUnit.SECONDS);
} catch (InterruptedException e)
{
}
if (!gotIt)
{
throw new RuntimeException("Timeout waiting for client thread to catch up!");
}
}
@Override @Override
public void fireNetRegistrationEvent(EventBus bus, NetworkManager manager, Set<String> channelSet, String channel, Side side) public void fireNetRegistrationEvent(EventBus bus, NetworkManager manager, Set<String> channelSet, String channel, Side side)
{ {
if (side == Side.CLIENT) if (side == Side.CLIENT)
{ {
waitForPlayClient();
bus.post(new FMLNetworkEvent.CustomPacketRegistrationEvent<NetHandlerPlayClient>(manager, channelSet, channel, side, NetHandlerPlayClient.class)); bus.post(new FMLNetworkEvent.CustomPacketRegistrationEvent<NetHandlerPlayClient>(manager, channelSet, channel, side, NetHandlerPlayClient.class));
} }
else else

View file

@ -27,6 +27,7 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.texture.DynamicTexture; import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
@ -106,7 +107,7 @@ public class GuiModList extends GuiScreen
} }
@Override @Override
protected void actionPerformed(GuiButton button) { protected void actionPerformed(GuiButton button) throws IOException {
if (button.enabled) if (button.enabled)
{ {
switch (button.id) switch (button.id)
@ -193,12 +194,13 @@ public class GuiModList extends GuiScreen
cachedLogoDimensions.width *= scale; cachedLogoDimensions.width *= scale;
cachedLogoDimensions.height *= scale; cachedLogoDimensions.height *= scale;
int top = 32; int top = 32;
Tessellator tess = Tessellator.instance; Tessellator tess = Tessellator.func_178181_a();
tess.startDrawingQuads(); WorldRenderer world = tess.func_178180_c();
tess.addVertexWithUV(offset, top + cachedLogoDimensions.height, zLevel, 0, 1); world.func_178970_b();
tess.addVertexWithUV(offset + cachedLogoDimensions.width, top + cachedLogoDimensions.height, zLevel, 1, 1); world.func_178985_a(offset, top + cachedLogoDimensions.height, zLevel, 0, 1);
tess.addVertexWithUV(offset + cachedLogoDimensions.width, top, zLevel, 1, 0); world.func_178985_a(offset + cachedLogoDimensions.width, top + cachedLogoDimensions.height, zLevel, 1, 1);
tess.addVertexWithUV(offset, top, zLevel, 0, 0); world.func_178985_a(offset + cachedLogoDimensions.width, top, zLevel, 1, 0);
world.func_178985_a(offset, top, zLevel, 0, 0);
tess.draw(); tess.draw();
shifty += 65; shifty += 65;
@ -209,7 +211,7 @@ public class GuiModList extends GuiScreen
; ;
} }
} }
this.fontRendererObj.drawStringWithShadow(selectedMod.getMetadata().name, offset, shifty, 0xFFFFFF); this.fontRendererObj.func_175063_a(selectedMod.getMetadata().name, offset, shifty, 0xFFFFFF);
shifty += 12; shifty += 12;
shifty = drawLine(String.format("Version: %s (%s)", selectedMod.getDisplayVersion(), selectedMod.getVersion()), offset, shifty); shifty = drawLine(String.format("Version: %s (%s)", selectedMod.getDisplayVersion(), selectedMod.getVersion()), offset, shifty);

View file

@ -50,7 +50,7 @@ public class GuiOldSaveLoadConfirm extends GuiYesNo implements GuiYesNoCallback
for (k = 0; k < this.labelList.size(); ++k) for (k = 0; k < this.labelList.size(); ++k)
{ {
((GuiLabel)this.labelList.get(k)).func_146159_a(this.mc, p_73863_1_, p_73863_2_); ((GuiLabel)this.labelList.get(k)).drawLabel(this.mc, p_73863_1_, p_73863_2_);
} }
} }
@Override @Override

View file

@ -19,6 +19,7 @@ import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
@ -263,7 +264,8 @@ public abstract class GuiScrollingList
} }
this.applyScrollLimits(); this.applyScrollLimits();
Tessellator var18 = Tessellator.instance; Tessellator tess = Tessellator.func_178181_a();
WorldRenderer worldr = tess.func_178180_c();
if (this.client.theWorld != null) if (this.client.theWorld != null)
{ {
this.drawGradientRect(this.left, this.top, this.right, this.bottom, -1072689136, -804253680); this.drawGradientRect(this.left, this.top, this.right, this.bottom, -1072689136, -804253680);
@ -275,20 +277,20 @@ public abstract class GuiScrollingList
this.client.renderEngine.bindTexture(Gui.optionsBackground); this.client.renderEngine.bindTexture(Gui.optionsBackground);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float var17 = 32.0F; float var17 = 32.0F;
var18.startDrawingQuads(); worldr.func_178970_b();
var18.setColorOpaque_I(2105376); worldr.func_178991_c(2105376);
var18.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / var17), (double)((float)(this.bottom + (int)this.scrollDistance) / var17)); worldr.func_178985_a((double)this.left, (double)this.bottom, 0.0D, (double)((float)this.left / var17), (double)((float)(this.bottom + (int)this.scrollDistance) / var17));
var18.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / var17), (double)((float)(this.bottom + (int)this.scrollDistance) / var17)); worldr.func_178985_a((double)this.right, (double)this.bottom, 0.0D, (double)((float)this.right / var17), (double)((float)(this.bottom + (int)this.scrollDistance) / var17));
var18.addVertexWithUV((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / var17), (double)((float)(this.top + (int)this.scrollDistance) / var17)); worldr.func_178985_a((double)this.right, (double)this.top, 0.0D, (double)((float)this.right / var17), (double)((float)(this.top + (int)this.scrollDistance) / var17));
var18.addVertexWithUV((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / var17), (double)((float)(this.top + (int)this.scrollDistance) / var17)); worldr.func_178985_a((double)this.left, (double)this.top, 0.0D, (double)((float)this.left / var17), (double)((float)(this.top + (int)this.scrollDistance) / var17));
var18.draw(); tess.draw();
} }
// boxRight = this.listWidth / 2 - 92 - 16; // boxRight = this.listWidth / 2 - 92 - 16;
var10 = this.top + 4 - (int)this.scrollDistance; var10 = this.top + 4 - (int)this.scrollDistance;
if (this.field_27262_q) if (this.field_27262_q)
{ {
this.func_27260_a(boxRight, var10, var18); this.func_27260_a(boxRight, var10, tess);
} }
int var14; int var14;
@ -306,22 +308,22 @@ public abstract class GuiScrollingList
int var15 = boxRight; int var15 = boxRight;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_TEXTURE_2D);
var18.startDrawingQuads(); worldr.func_178970_b();
var18.setColorOpaque_I(8421504); worldr.func_178991_c(8421504);
var18.addVertexWithUV((double)var14, (double)(var19 + var13 + 2), 0.0D, 0.0D, 1.0D); worldr.func_178985_a((double)var14, (double)(var19 + var13 + 2), 0.0D, 0.0D, 1.0D);
var18.addVertexWithUV((double)var15, (double)(var19 + var13 + 2), 0.0D, 1.0D, 1.0D); worldr.func_178985_a((double)var15, (double)(var19 + var13 + 2), 0.0D, 1.0D, 1.0D);
var18.addVertexWithUV((double)var15, (double)(var19 - 2), 0.0D, 1.0D, 0.0D); worldr.func_178985_a((double)var15, (double)(var19 - 2), 0.0D, 1.0D, 0.0D);
var18.addVertexWithUV((double)var14, (double)(var19 - 2), 0.0D, 0.0D, 0.0D); worldr.func_178985_a((double)var14, (double)(var19 - 2), 0.0D, 0.0D, 0.0D);
var18.setColorOpaque_I(0); worldr.func_178991_c(0);
var18.addVertexWithUV((double)(var14 + 1), (double)(var19 + var13 + 1), 0.0D, 0.0D, 1.0D); worldr.func_178985_a((double)(var14 + 1), (double)(var19 + var13 + 1), 0.0D, 0.0D, 1.0D);
var18.addVertexWithUV((double)(var15 - 1), (double)(var19 + var13 + 1), 0.0D, 1.0D, 1.0D); worldr.func_178985_a((double)(var15 - 1), (double)(var19 + var13 + 1), 0.0D, 1.0D, 1.0D);
var18.addVertexWithUV((double)(var15 - 1), (double)(var19 - 1), 0.0D, 1.0D, 0.0D); worldr.func_178985_a((double)(var15 - 1), (double)(var19 - 1), 0.0D, 1.0D, 0.0D);
var18.addVertexWithUV((double)(var14 + 1), (double)(var19 - 1), 0.0D, 0.0D, 0.0D); worldr.func_178985_a((double)(var14 + 1), (double)(var19 - 1), 0.0D, 0.0D, 0.0D);
var18.draw(); tess.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_TEXTURE_2D);
} }
this.drawSlot(var11, boxRight, var19, var13, var18); this.drawSlot(var11, boxRight, var19, var13, tess);
} }
} }
@ -337,22 +339,22 @@ public abstract class GuiScrollingList
GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_TEXTURE_2D);
var18.startDrawingQuads(); worldr.func_178970_b();
var18.setColorRGBA_I(0, 0); worldr.func_178974_a(0, 0);
var18.addVertexWithUV((double)this.left, (double)(this.top + var20), 0.0D, 0.0D, 1.0D); worldr.func_178985_a((double)this.left, (double)(this.top + var20), 0.0D, 0.0D, 1.0D);
var18.addVertexWithUV((double)this.right, (double)(this.top + var20), 0.0D, 1.0D, 1.0D); worldr.func_178985_a((double)this.right, (double)(this.top + var20), 0.0D, 1.0D, 1.0D);
var18.setColorRGBA_I(0, 255); worldr.func_178974_a(0, 255);
var18.addVertexWithUV((double)this.right, (double)this.top, 0.0D, 1.0D, 0.0D); worldr.func_178985_a((double)this.right, (double)this.top, 0.0D, 1.0D, 0.0D);
var18.addVertexWithUV((double)this.left, (double)this.top, 0.0D, 0.0D, 0.0D); worldr.func_178985_a((double)this.left, (double)this.top, 0.0D, 0.0D, 0.0D);
var18.draw(); tess.draw();
var18.startDrawingQuads(); worldr.func_178970_b();
var18.setColorRGBA_I(0, 255); worldr.func_178974_a(0, 255);
var18.addVertexWithUV((double)this.left, (double)this.bottom, 0.0D, 0.0D, 1.0D); worldr.func_178985_a((double)this.left, (double)this.bottom, 0.0D, 0.0D, 1.0D);
var18.addVertexWithUV((double)this.right, (double)this.bottom, 0.0D, 1.0D, 1.0D); worldr.func_178985_a((double)this.right, (double)this.bottom, 0.0D, 1.0D, 1.0D);
var18.setColorRGBA_I(0, 0); worldr.func_178974_a(0, 0);
var18.addVertexWithUV((double)this.right, (double)(this.bottom - var20), 0.0D, 1.0D, 0.0D); worldr.func_178985_a((double)this.right, (double)(this.bottom - var20), 0.0D, 1.0D, 0.0D);
var18.addVertexWithUV((double)this.left, (double)(this.bottom - var20), 0.0D, 0.0D, 0.0D); worldr.func_178985_a((double)this.left, (double)(this.bottom - var20), 0.0D, 0.0D, 0.0D);
var18.draw(); tess.draw();
var19 = this.getContentHeight() - (this.bottom - this.top - 4); var19 = this.getContentHeight() - (this.bottom - this.top - 4);
if (var19 > 0) if (var19 > 0)
@ -376,27 +378,27 @@ public abstract class GuiScrollingList
var14 = this.top; var14 = this.top;
} }
var18.startDrawingQuads(); worldr.func_178970_b();
var18.setColorRGBA_I(0, 255); worldr.func_178974_a(0, 255);
var18.addVertexWithUV((double)scrollBarXStart, (double)this.bottom, 0.0D, 0.0D, 1.0D); worldr.func_178985_a((double)scrollBarXStart, (double)this.bottom, 0.0D, 0.0D, 1.0D);
var18.addVertexWithUV((double)scrollBarXEnd, (double)this.bottom, 0.0D, 1.0D, 1.0D); worldr.func_178985_a((double)scrollBarXEnd, (double)this.bottom, 0.0D, 1.0D, 1.0D);
var18.addVertexWithUV((double)scrollBarXEnd, (double)this.top, 0.0D, 1.0D, 0.0D); worldr.func_178985_a((double)scrollBarXEnd, (double)this.top, 0.0D, 1.0D, 0.0D);
var18.addVertexWithUV((double)scrollBarXStart, (double)this.top, 0.0D, 0.0D, 0.0D); worldr.func_178985_a((double)scrollBarXStart, (double)this.top, 0.0D, 0.0D, 0.0D);
var18.draw(); tess.draw();
var18.startDrawingQuads(); worldr.func_178970_b();
var18.setColorRGBA_I(8421504, 255); worldr.func_178974_a(8421504, 255);
var18.addVertexWithUV((double)scrollBarXStart, (double)(var14 + var13), 0.0D, 0.0D, 1.0D); worldr.func_178985_a((double)scrollBarXStart, (double)(var14 + var13), 0.0D, 0.0D, 1.0D);
var18.addVertexWithUV((double)scrollBarXEnd, (double)(var14 + var13), 0.0D, 1.0D, 1.0D); worldr.func_178985_a((double)scrollBarXEnd, (double)(var14 + var13), 0.0D, 1.0D, 1.0D);
var18.addVertexWithUV((double)scrollBarXEnd, (double)var14, 0.0D, 1.0D, 0.0D); worldr.func_178985_a((double)scrollBarXEnd, (double)var14, 0.0D, 1.0D, 0.0D);
var18.addVertexWithUV((double)scrollBarXStart, (double)var14, 0.0D, 0.0D, 0.0D); worldr.func_178985_a((double)scrollBarXStart, (double)var14, 0.0D, 0.0D, 0.0D);
var18.draw(); tess.draw();
var18.startDrawingQuads(); worldr.func_178970_b();
var18.setColorRGBA_I(12632256, 255); worldr.func_178974_a(12632256, 255);
var18.addVertexWithUV((double)scrollBarXStart, (double)(var14 + var13 - 1), 0.0D, 0.0D, 1.0D); worldr.func_178985_a((double)scrollBarXStart, (double)(var14 + var13 - 1), 0.0D, 0.0D, 1.0D);
var18.addVertexWithUV((double)(scrollBarXEnd - 1), (double)(var14 + var13 - 1), 0.0D, 1.0D, 1.0D); worldr.func_178985_a((double)(scrollBarXEnd - 1), (double)(var14 + var13 - 1), 0.0D, 1.0D, 1.0D);
var18.addVertexWithUV((double)(scrollBarXEnd - 1), (double)var14, 0.0D, 1.0D, 0.0D); worldr.func_178985_a((double)(scrollBarXEnd - 1), (double)var14, 0.0D, 1.0D, 0.0D);
var18.addVertexWithUV((double)scrollBarXStart, (double)var14, 0.0D, 0.0D, 0.0D); worldr.func_178985_a((double)scrollBarXStart, (double)var14, 0.0D, 0.0D, 0.0D);
var18.draw(); tess.draw();
} }
this.func_27257_b(mouseX, mouseY); this.func_27257_b(mouseX, mouseY);
@ -408,17 +410,18 @@ public abstract class GuiScrollingList
private void overlayBackground(int p_22239_1_, int p_22239_2_, int p_22239_3_, int p_22239_4_) private void overlayBackground(int p_22239_1_, int p_22239_2_, int p_22239_3_, int p_22239_4_)
{ {
Tessellator var5 = Tessellator.instance; Tessellator var5 = Tessellator.func_178181_a();
WorldRenderer worldr = var5.func_178180_c();
this.client.renderEngine.bindTexture(Gui.optionsBackground); this.client.renderEngine.bindTexture(Gui.optionsBackground);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float var6 = 32.0F; float var6 = 32.0F;
var5.startDrawingQuads(); worldr.func_178970_b();
var5.setColorRGBA_I(4210752, p_22239_4_); worldr.func_178974_a(4210752, p_22239_4_);
var5.addVertexWithUV(0.0D, (double)p_22239_2_, 0.0D, 0.0D, (double)((float)p_22239_2_ / var6)); worldr.func_178985_a(0.0D, (double)p_22239_2_, 0.0D, 0.0D, (double)((float)p_22239_2_ / var6));
var5.addVertexWithUV((double)this.listWidth + 30, (double)p_22239_2_, 0.0D, (double)((float)(this.listWidth + 30) / var6), (double)((float)p_22239_2_ / var6)); worldr.func_178985_a((double)this.listWidth + 30, (double)p_22239_2_, 0.0D, (double)((float)(this.listWidth + 30) / var6), (double)((float)p_22239_2_ / var6));
var5.setColorRGBA_I(4210752, p_22239_3_); worldr.func_178974_a(4210752, p_22239_3_);
var5.addVertexWithUV((double)this.listWidth + 30, (double)p_22239_1_, 0.0D, (double)((float)(this.listWidth + 30) / var6), (double)((float)p_22239_1_ / var6)); worldr.func_178985_a((double)this.listWidth + 30, (double)p_22239_1_, 0.0D, (double)((float)(this.listWidth + 30) / var6), (double)((float)p_22239_1_ / var6));
var5.addVertexWithUV(0.0D, (double)p_22239_1_, 0.0D, 0.0D, (double)((float)p_22239_1_ / var6)); worldr.func_178985_a(0.0D, (double)p_22239_1_, 0.0D, 0.0D, (double)((float)p_22239_1_ / var6));
var5.draw(); var5.draw();
} }
@ -437,14 +440,15 @@ public abstract class GuiScrollingList
GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_ALPHA_TEST);
OpenGlHelper.glBlendFunc(770, 771, 1, 0); OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glShadeModel(GL11.GL_SMOOTH);
Tessellator tessellator = Tessellator.instance; Tessellator tessellator = Tessellator.func_178181_a();
tessellator.startDrawingQuads(); WorldRenderer worldrenderer = tessellator.func_178180_c();
tessellator.setColorRGBA_F(f1, f2, f3, f); worldrenderer.func_178970_b();
tessellator.addVertex((double)par3, (double)par2, 0.0D); worldrenderer.func_178960_a(f1, f2, f3, f);
tessellator.addVertex((double)par1, (double)par2, 0.0D); worldrenderer.func_178984_b((double)par3, (double)par2, 0.0D);
tessellator.setColorRGBA_F(f5, f6, f7, f4); worldrenderer.func_178984_b((double)par1, (double)par2, 0.0D);
tessellator.addVertex((double)par1, (double)par4, 0.0D); worldrenderer.func_178960_a(f5, f6, f7, f4);
tessellator.addVertex((double)par3, (double)par4, 0.0D); worldrenderer.func_178984_b((double)par1, (double)par4, 0.0D);
worldrenderer.func_178984_b((double)par3, (double)par4, 0.0D);
tessellator.draw(); tessellator.draw();
GL11.glShadeModel(GL11.GL_FLAT); GL11.glShadeModel(GL11.GL_FLAT);
GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_BLEND);

View file

@ -45,8 +45,8 @@ public class GuiButtonExt extends GuiButton
{ {
if (this.visible) if (this.visible)
{ {
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
int k = this.getHoverState(this.field_146123_n); int k = this.getHoverState(this.hovered);
GuiUtils.drawContinuousTexturedBox(buttonTextures, this.xPosition, this.yPosition, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.zLevel); GuiUtils.drawContinuousTexturedBox(buttonTextures, this.xPosition, this.yPosition, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
this.mouseDragged(mc, mouseX, mouseY); this.mouseDragged(mc, mouseX, mouseY);
int color = 14737632; int color = 14737632;
@ -59,19 +59,19 @@ public class GuiButtonExt extends GuiButton
{ {
color = 10526880; color = 10526880;
} }
else if (this.field_146123_n) else if (this.hovered)
{ {
color = 16777120; color = 16777120;
} }
String buttonText = this.displayString; String buttonText = this.displayString;
int strWidth = mc.fontRenderer.getStringWidth(buttonText); int strWidth = mc.fontRendererObj.getStringWidth(buttonText);
int ellipsisWidth = mc.fontRenderer.getStringWidth("..."); int ellipsisWidth = mc.fontRendererObj.getStringWidth("...");
if (strWidth > width - 6 && strWidth > ellipsisWidth) if (strWidth > width - 6 && strWidth > ellipsisWidth)
buttonText = mc.fontRenderer.trimStringToWidth(buttonText, width - 6 - ellipsisWidth).trim() + "..."; buttonText = mc.fontRendererObj.trimStringToWidth(buttonText, width - 6 - ellipsisWidth).trim() + "...";
this.drawCenteredString(mc.fontRenderer, buttonText, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, color); this.drawCenteredString(mc.fontRendererObj, buttonText, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, color);
} }
} }
} }

View file

@ -31,7 +31,7 @@ public class GuiCheckBox extends GuiButton
this.isChecked = isChecked; this.isChecked = isChecked;
this.boxWidth = 11; this.boxWidth = 11;
this.height = 11; this.height = 11;
this.width = this.boxWidth + 2 + Minecraft.getMinecraft().fontRenderer.getStringWidth(displayString); this.width = this.boxWidth + 2 + Minecraft.getMinecraft().fontRendererObj.getStringWidth(displayString);
} }
@Override @Override
@ -39,7 +39,7 @@ public class GuiCheckBox extends GuiButton
{ {
if (this.visible) if (this.visible)
{ {
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.boxWidth && mouseY < this.yPosition + this.height; this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.boxWidth && mouseY < this.yPosition + this.height;
GuiUtils.drawContinuousTexturedBox(buttonTextures, this.xPosition, this.yPosition, 0, 46, this.boxWidth, this.height, 200, 20, 2, 3, 2, 2, this.zLevel); GuiUtils.drawContinuousTexturedBox(buttonTextures, this.xPosition, this.yPosition, 0, 46, this.boxWidth, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
this.mouseDragged(mc, mouseX, mouseY); this.mouseDragged(mc, mouseX, mouseY);
int color = 14737632; int color = 14737632;
@ -54,9 +54,9 @@ public class GuiCheckBox extends GuiButton
} }
if (this.isChecked) if (this.isChecked)
this.drawCenteredString(mc.fontRenderer, "x", this.xPosition + this.boxWidth / 2 + 1, this.yPosition + 1, 14737632); this.drawCenteredString(mc.fontRendererObj, "x", this.xPosition + this.boxWidth / 2 + 1, this.yPosition + 1, 14737632);
this.drawString(mc.fontRenderer, displayString, xPosition + this.boxWidth + 2, yPosition + 2, color); this.drawString(mc.fontRendererObj, displayString, xPosition + this.boxWidth + 2, yPosition + 2, color);
} }
} }

View file

@ -15,6 +15,7 @@ package cpw.mods.fml.client.config;
import static cpw.mods.fml.client.config.GuiUtils.RESET_CHAR; import static cpw.mods.fml.client.config.GuiUtils.RESET_CHAR;
import static cpw.mods.fml.client.config.GuiUtils.UNDO_CHAR; import static cpw.mods.fml.client.config.GuiUtils.UNDO_CHAR;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -193,12 +194,12 @@ public class GuiConfig extends GuiScreen
this.needsRefresh = false; this.needsRefresh = false;
} }
int undoGlyphWidth = mc.fontRenderer.getStringWidth(UNDO_CHAR) * 2; int undoGlyphWidth = mc.fontRendererObj.getStringWidth(UNDO_CHAR) * 2;
int resetGlyphWidth = mc.fontRenderer.getStringWidth(RESET_CHAR) * 2; int resetGlyphWidth = mc.fontRendererObj.getStringWidth(RESET_CHAR) * 2;
int doneWidth = Math.max(mc.fontRenderer.getStringWidth(I18n.format("gui.done")) + 20, 100); int doneWidth = Math.max(mc.fontRendererObj.getStringWidth(I18n.format("gui.done")) + 20, 100);
int undoWidth = mc.fontRenderer.getStringWidth(" " + I18n.format("fml.configgui.tooltip.undoChanges")) + undoGlyphWidth + 20; int undoWidth = mc.fontRendererObj.getStringWidth(" " + I18n.format("fml.configgui.tooltip.undoChanges")) + undoGlyphWidth + 20;
int resetWidth = mc.fontRenderer.getStringWidth(" " + I18n.format("fml.configgui.tooltip.resetToDefault")) + resetGlyphWidth + 20; int resetWidth = mc.fontRendererObj.getStringWidth(" " + I18n.format("fml.configgui.tooltip.resetToDefault")) + resetGlyphWidth + 20;
int checkWidth = mc.fontRenderer.getStringWidth(I18n.format("fml.configgui.applyGlobally")) + 13; int checkWidth = mc.fontRendererObj.getStringWidth(I18n.format("fml.configgui.applyGlobally")) + 13;
int buttonWidthHalf = (doneWidth + 5 + undoWidth + 5 + resetWidth + 5 + checkWidth) / 2; int buttonWidthHalf = (doneWidth + 5 + undoWidth + 5 + resetWidth + 5 + checkWidth) / 2;
this.buttonList.add(new GuiButtonExt(2000, this.width / 2 - buttonWidthHalf, this.height - 29, doneWidth, 20, I18n.format("gui.done"))); this.buttonList.add(new GuiButtonExt(2000, this.width / 2 - buttonWidthHalf, this.height - 29, doneWidth, 20, I18n.format("gui.done")));
this.buttonList.add(this.btnDefaultAll = new GuiUnicodeGlyphButton(2001, this.width / 2 - buttonWidthHalf + doneWidth + 5 + undoWidth + 5, this.buttonList.add(this.btnDefaultAll = new GuiUnicodeGlyphButton(2001, this.width / 2 - buttonWidthHalf + doneWidth + 5 + undoWidth + 5,
@ -281,7 +282,7 @@ public class GuiConfig extends GuiScreen
} }
@Override @Override
protected void mouseClicked(int x, int y, int mouseEvent) protected void mouseClicked(int x, int y, int mouseEvent) throws IOException
{ {
if (mouseEvent != 0 || !this.entryList.func_148179_a(x, y, mouseEvent)) if (mouseEvent != 0 || !this.entryList.func_148179_a(x, y, mouseEvent))
{ {
@ -291,11 +292,11 @@ public class GuiConfig extends GuiScreen
} }
@Override @Override
protected void mouseMovedOrUp(int x, int y, int mouseEvent) protected void mouseReleased(int x, int y, int mouseEvent)
{ {
if (mouseEvent != 0 || !this.entryList.func_148181_b(x, y, mouseEvent)) if (mouseEvent != 0 || !this.entryList.func_148181_b(x, y, mouseEvent))
{ {
super.mouseMovedOrUp(x, y, mouseEvent); super.mouseReleased(x, y, mouseEvent);
} }
} }
@ -325,10 +326,10 @@ public class GuiConfig extends GuiScreen
if (title2 != null) if (title2 != null)
{ {
int strWidth = mc.fontRenderer.getStringWidth(title2); int strWidth = mc.fontRendererObj.getStringWidth(title2);
int elipsisWidth = mc.fontRenderer.getStringWidth("..."); int elipsisWidth = mc.fontRendererObj.getStringWidth("...");
if (strWidth > width - 6 && strWidth > elipsisWidth) if (strWidth > width - 6 && strWidth > elipsisWidth)
title2 = mc.fontRenderer.trimStringToWidth(title2, width - 6 - elipsisWidth).trim() + "..."; title2 = mc.fontRendererObj.trimStringToWidth(title2, width - 6 - elipsisWidth).trim() + "...";
this.drawCenteredString(this.fontRendererObj, title2, this.width / 2, 18, 16777215); this.drawCenteredString(this.fontRendererObj, title2, this.width / 2, 18, 16777215);
} }
@ -337,16 +338,16 @@ public class GuiConfig extends GuiScreen
super.drawScreen(mouseX, mouseY, partialTicks); super.drawScreen(mouseX, mouseY, partialTicks);
this.entryList.drawScreenPost(mouseX, mouseY, partialTicks); this.entryList.drawScreenPost(mouseX, mouseY, partialTicks);
if (this.undoHoverChecker.checkHover(mouseX, mouseY)) if (this.undoHoverChecker.checkHover(mouseX, mouseY))
this.drawToolTip(this.mc.fontRenderer.listFormattedStringToWidth(I18n.format("fml.configgui.tooltip.undoAll"), 300), mouseX, mouseY); this.drawToolTip(this.mc.fontRendererObj.listFormattedStringToWidth(I18n.format("fml.configgui.tooltip.undoAll"), 300), mouseX, mouseY);
if (this.resetHoverChecker.checkHover(mouseX, mouseY)) if (this.resetHoverChecker.checkHover(mouseX, mouseY))
this.drawToolTip(this.mc.fontRenderer.listFormattedStringToWidth(I18n.format("fml.configgui.tooltip.resetAll"), 300), mouseX, mouseY); this.drawToolTip(this.mc.fontRendererObj.listFormattedStringToWidth(I18n.format("fml.configgui.tooltip.resetAll"), 300), mouseX, mouseY);
if (this.checkBoxHoverChecker.checkHover(mouseX, mouseY)) if (this.checkBoxHoverChecker.checkHover(mouseX, mouseY))
this.drawToolTip(this.mc.fontRenderer.listFormattedStringToWidth(I18n.format("fml.configgui.tooltip.applyGlobally"), 300), mouseX, mouseY); this.drawToolTip(this.mc.fontRendererObj.listFormattedStringToWidth(I18n.format("fml.configgui.tooltip.applyGlobally"), 300), mouseX, mouseY);
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public void drawToolTip(List stringList, int x, int y) public void drawToolTip(List stringList, int x, int y)
{ {
this.func_146283_a(stringList, x, y); this.drawHoveringText(stringList, x, y);
} }
} }

View file

@ -96,9 +96,9 @@ public class GuiConfigEntries extends GuiListExtended
// protects against language keys that are not defined in the .lang file // protects against language keys that are not defined in the .lang file
if (!I18n.format(configElement.getLanguageKey()).equals(configElement.getLanguageKey())) if (!I18n.format(configElement.getLanguageKey()).equals(configElement.getLanguageKey()))
length = mc.fontRenderer.getStringWidth(I18n.format(configElement.getLanguageKey())); length = mc.fontRendererObj.getStringWidth(I18n.format(configElement.getLanguageKey()));
else else
length = mc.fontRenderer.getStringWidth(configElement.getName()); length = mc.fontRendererObj.getStringWidth(configElement.getName());
if (length > this.maxLabelTextWidth) if (length > this.maxLabelTextWidth)
this.maxLabelTextWidth = length; this.maxLabelTextWidth = length;
@ -575,10 +575,10 @@ public class GuiConfigEntries extends GuiListExtended
} }
@Override @Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, Tessellator tessellator, int mouseX, int mouseY, boolean isSelected) public void func_180790_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
{ {
this.btnValue.packedFGColour = GuiUtils.getColorCode(this.configElement.getValidValues()[currentIndex].charAt(0), true); this.btnValue.packedFGColour = GuiUtils.getColorCode(this.configElement.getValidValues()[currentIndex].charAt(0), true);
super.drawEntry(slotIndex, x, y, listWidth, slotHeight, tessellator, mouseX, mouseY, isSelected); super.func_180790_a(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected);
} }
@Override @Override
@ -927,9 +927,9 @@ public class GuiConfigEntries extends GuiListExtended
public abstract void valueButtonPressed(int slotIndex); public abstract void valueButtonPressed(int slotIndex);
@Override @Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, Tessellator tessellator, int mouseX, int mouseY, boolean isSelected) public void func_180790_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
{ {
super.drawEntry(slotIndex, x, y, listWidth, slotHeight, tessellator, mouseX, mouseY, isSelected); super.func_180790_a(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected);
this.btnValue.width = this.owningEntryList.controlWidth; this.btnValue.width = this.owningEntryList.controlWidth;
this.btnValue.xPosition = this.owningScreen.entryList.controlX; this.btnValue.xPosition = this.owningScreen.entryList.controlX;
this.btnValue.yPosition = y; this.btnValue.yPosition = y;
@ -945,7 +945,7 @@ public class GuiConfigEntries extends GuiListExtended
{ {
if (this.btnValue.mousePressed(this.mc, x, y)) if (this.btnValue.mousePressed(this.mc, x, y))
{ {
btnValue.func_146113_a(mc.getSoundHandler()); btnValue.playPressSound(mc.getSoundHandler());
valueButtonPressed(index); valueButtonPressed(index);
updateValueButtonText(); updateValueButtonText();
return true; return true;
@ -1205,15 +1205,15 @@ public class GuiConfigEntries extends GuiListExtended
{ {
super(owningScreen, owningEntryList, configElement); super(owningScreen, owningEntryList, configElement);
beforeValue = configElement.get().toString(); beforeValue = configElement.get().toString();
this.textFieldValue = new GuiTextField(this.mc.fontRenderer, this.owningEntryList.controlX + 1, 0, this.owningEntryList.controlWidth - 3, 16); this.textFieldValue = new GuiTextField(10, this.mc.fontRendererObj, this.owningEntryList.controlX + 1, 0, this.owningEntryList.controlWidth - 3, 16);
this.textFieldValue.setMaxStringLength(10000); this.textFieldValue.setMaxStringLength(10000);
this.textFieldValue.setText(configElement.get().toString()); this.textFieldValue.setText(configElement.get().toString());
} }
@Override @Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, Tessellator tessellator, int mouseX, int mouseY, boolean isSelected) public void func_180790_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
{ {
super.drawEntry(slotIndex, x, y, listWidth, slotHeight, tessellator, mouseX, mouseY, isSelected); super.func_180790_a(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected);
this.textFieldValue.xPosition = this.owningEntryList.controlX + 2; this.textFieldValue.xPosition = this.owningEntryList.controlX + 2;
this.textFieldValue.yPosition = y + 1; this.textFieldValue.yPosition = y + 1;
this.textFieldValue.width = this.owningEntryList.controlWidth - 4; this.textFieldValue.width = this.owningEntryList.controlWidth - 4;
@ -1350,14 +1350,14 @@ public class GuiConfigEntries extends GuiListExtended
} }
@Override @Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, Tessellator tessellator, int mouseX, int mouseY, boolean isSelected) public void func_180790_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
{ {
this.btnSelectCategory.xPosition = listWidth / 2 - 150; this.btnSelectCategory.xPosition = listWidth / 2 - 150;
this.btnSelectCategory.yPosition = y; this.btnSelectCategory.yPosition = y;
this.btnSelectCategory.enabled = enabled(); this.btnSelectCategory.enabled = enabled();
this.btnSelectCategory.drawButton(this.mc, mouseX, mouseY); this.btnSelectCategory.drawButton(this.mc, mouseX, mouseY);
super.drawEntry(slotIndex, x, y, listWidth, slotHeight, tessellator, mouseX, mouseY, isSelected); super.func_180790_a(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected);
} }
@Override @Override
@ -1376,7 +1376,7 @@ public class GuiConfigEntries extends GuiListExtended
{ {
if (this.btnSelectCategory.mousePressed(this.mc, x, y)) if (this.btnSelectCategory.mousePressed(this.mc, x, y))
{ {
btnSelectCategory.func_146113_a(mc.getSoundHandler()); btnSelectCategory.playPressSound(mc.getSoundHandler());
Minecraft.getMinecraft().displayGuiScreen(childScreen); Minecraft.getMinecraft().displayGuiScreen(childScreen);
return true; return true;
} }
@ -1532,30 +1532,30 @@ public class GuiConfigEntries extends GuiListExtended
comment = I18n.format(configElement.getLanguageKey() + ".tooltip").replace("\\n", "\n"); comment = I18n.format(configElement.getLanguageKey() + ".tooltip").replace("\\n", "\n");
if (!comment.equals(configElement.getLanguageKey() + ".tooltip")) if (!comment.equals(configElement.getLanguageKey() + ".tooltip"))
toolTip = new ArrayList<String>(this.mc.fontRenderer.listFormattedStringToWidth( toolTip = new ArrayList<String>(this.mc.fontRendererObj.listFormattedStringToWidth(
EnumChatFormatting.GREEN + name + "\n" + EnumChatFormatting.YELLOW + comment, 300)); EnumChatFormatting.GREEN + name + "\n" + EnumChatFormatting.YELLOW + comment, 300));
else if (configElement.getComment() != null && !configElement.getComment().trim().isEmpty()) else if (configElement.getComment() != null && !configElement.getComment().trim().isEmpty())
toolTip = new ArrayList<String>(this.mc.fontRenderer.listFormattedStringToWidth( toolTip = new ArrayList<String>(this.mc.fontRendererObj.listFormattedStringToWidth(
EnumChatFormatting.GREEN + name + "\n" + EnumChatFormatting.YELLOW + configElement.getComment(), 300)); EnumChatFormatting.GREEN + name + "\n" + EnumChatFormatting.YELLOW + configElement.getComment(), 300));
else else
toolTip = new ArrayList<String>(this.mc.fontRenderer.listFormattedStringToWidth( toolTip = new ArrayList<String>(this.mc.fontRendererObj.listFormattedStringToWidth(
EnumChatFormatting.GREEN + name + "\n" + EnumChatFormatting.RED + "No tooltip defined.", 300)); EnumChatFormatting.GREEN + name + "\n" + EnumChatFormatting.RED + "No tooltip defined.", 300));
if ((configElement.getType() == ConfigGuiType.INTEGER if ((configElement.getType() == ConfigGuiType.INTEGER
&& (Integer.valueOf(configElement.getMinValue().toString()) != Integer.MIN_VALUE || Integer.valueOf(configElement.getMaxValue().toString()) != Integer.MAX_VALUE)) && (Integer.valueOf(configElement.getMinValue().toString()) != Integer.MIN_VALUE || Integer.valueOf(configElement.getMaxValue().toString()) != Integer.MAX_VALUE))
|| (configElement.getType() == ConfigGuiType.DOUBLE || (configElement.getType() == ConfigGuiType.DOUBLE
&& (Double.valueOf(configElement.getMinValue().toString()) != -Double.MAX_VALUE || Double.valueOf(configElement.getMaxValue().toString()) != Double.MAX_VALUE))) && (Double.valueOf(configElement.getMinValue().toString()) != -Double.MAX_VALUE || Double.valueOf(configElement.getMaxValue().toString()) != Double.MAX_VALUE)))
toolTip.addAll(this.mc.fontRenderer.listFormattedStringToWidth( toolTip.addAll(this.mc.fontRendererObj.listFormattedStringToWidth(
EnumChatFormatting.AQUA + I18n.format("fml.configgui.tooltip.defaultNumeric", configElement.getMinValue(), configElement.getMaxValue(), configElement.getDefault()), 300)); EnumChatFormatting.AQUA + I18n.format("fml.configgui.tooltip.defaultNumeric", configElement.getMinValue(), configElement.getMaxValue(), configElement.getDefault()), 300));
else if (configElement.getType() != ConfigGuiType.CONFIG_CATEGORY) else if (configElement.getType() != ConfigGuiType.CONFIG_CATEGORY)
toolTip.addAll(this.mc.fontRenderer.listFormattedStringToWidth(EnumChatFormatting.AQUA + I18n.format("fml.configgui.tooltip.default", configElement.getDefault()),300)); toolTip.addAll(this.mc.fontRendererObj.listFormattedStringToWidth(EnumChatFormatting.AQUA + I18n.format("fml.configgui.tooltip.default", configElement.getDefault()),300));
if (configElement.requiresMcRestart() || owningScreen.allRequireMcRestart) if (configElement.requiresMcRestart() || owningScreen.allRequireMcRestart)
toolTip.add(EnumChatFormatting.RED + "[" + I18n.format("fml.configgui.gameRestartTitle") + "]"); toolTip.add(EnumChatFormatting.RED + "[" + I18n.format("fml.configgui.gameRestartTitle") + "]");
} }
@Override @Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, Tessellator tessellator, int mouseX, int mouseY, boolean isSelected) public void func_180790_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
{ {
boolean isChanged = isChanged(); boolean isChanged = isChanged();
@ -1564,10 +1564,10 @@ public class GuiConfigEntries extends GuiListExtended
String label = (!isValidValue ? EnumChatFormatting.RED.toString() : String label = (!isValidValue ? EnumChatFormatting.RED.toString() :
(isChanged ? EnumChatFormatting.WHITE.toString() : EnumChatFormatting.GRAY.toString())) (isChanged ? EnumChatFormatting.WHITE.toString() : EnumChatFormatting.GRAY.toString()))
+ (isChanged ? EnumChatFormatting.ITALIC.toString() : "") + this.name; + (isChanged ? EnumChatFormatting.ITALIC.toString() : "") + this.name;
this.mc.fontRenderer.drawString( this.mc.fontRendererObj.drawString(
label, label,
this.owningScreen.entryList.labelX, this.owningScreen.entryList.labelX,
y + slotHeight / 2 - this.mc.fontRenderer.FONT_HEIGHT / 2, y + slotHeight / 2 - this.mc.fontRendererObj.FONT_HEIGHT / 2,
16777215); 16777215);
} }
@ -1609,13 +1609,13 @@ public class GuiConfigEntries extends GuiListExtended
{ {
if (this.btnDefault.mousePressed(this.mc, x, y)) if (this.btnDefault.mousePressed(this.mc, x, y))
{ {
btnDefault.func_146113_a(mc.getSoundHandler()); btnDefault.playPressSound(mc.getSoundHandler());
setToDefault(); setToDefault();
return true; return true;
} }
else if (this.btnUndoChanges.mousePressed(this.mc, x, y)) else if (this.btnUndoChanges.mousePressed(this.mc, x, y))
{ {
btnUndoChanges.func_146113_a(mc.getSoundHandler()); btnUndoChanges.playPressSound(mc.getSoundHandler());
undoChanges(); undoChanges();
return true; return true;
} }
@ -1652,6 +1652,9 @@ public class GuiConfigEntries extends GuiListExtended
@Override @Override
public abstract boolean saveConfigElement(); public abstract boolean saveConfigElement();
@Override
public void func_178011_a(int p_178011_1_, int p_178011_2_, int p_178011_3_){}
@Override @Override
public boolean enabled() public boolean enabled()
{ {
@ -1661,7 +1664,7 @@ public class GuiConfigEntries extends GuiListExtended
@Override @Override
public int getLabelWidth() public int getLabelWidth()
{ {
return this.mc.fontRenderer.getStringWidth(this.name); return this.mc.fontRendererObj.getStringWidth(this.name);
} }
@Override @Override

View file

@ -12,6 +12,7 @@
package cpw.mods.fml.client.config; package cpw.mods.fml.client.config;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
@ -21,7 +22,6 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import static cpw.mods.fml.client.config.GuiUtils.RESET_CHAR; import static cpw.mods.fml.client.config.GuiUtils.RESET_CHAR;
import static cpw.mods.fml.client.config.GuiUtils.UNDO_CHAR; import static cpw.mods.fml.client.config.GuiUtils.UNDO_CHAR;
@ -69,13 +69,13 @@ public class GuiEditArray extends GuiScreen
"\n" + EnumChatFormatting.AQUA, configElement.getDefault(), configElement.getMinValue(), configElement.getMaxValue()); "\n" + EnumChatFormatting.AQUA, configElement.getDefault(), configElement.getMinValue(), configElement.getMaxValue());
if (!comment.equals(configElement.getLanguageKey() + ".tooltip")) if (!comment.equals(configElement.getLanguageKey() + ".tooltip"))
toolTip = mc.fontRenderer.listFormattedStringToWidth( toolTip = mc.fontRendererObj.listFormattedStringToWidth(
EnumChatFormatting.GREEN + propName + "\n" + EnumChatFormatting.YELLOW + comment, 300); EnumChatFormatting.GREEN + propName + "\n" + EnumChatFormatting.YELLOW + comment, 300);
else if (configElement.getComment() != null && !configElement.getComment().trim().isEmpty()) else if (configElement.getComment() != null && !configElement.getComment().trim().isEmpty())
toolTip = mc.fontRenderer.listFormattedStringToWidth( toolTip = mc.fontRendererObj.listFormattedStringToWidth(
EnumChatFormatting.GREEN + propName + "\n" + EnumChatFormatting.YELLOW + configElement.getComment(), 300); EnumChatFormatting.GREEN + propName + "\n" + EnumChatFormatting.YELLOW + configElement.getComment(), 300);
else else
toolTip = mc.fontRenderer.listFormattedStringToWidth( toolTip = mc.fontRendererObj.listFormattedStringToWidth(
EnumChatFormatting.GREEN + propName + "\n" + EnumChatFormatting.RED + "No tooltip defined.", 300); EnumChatFormatting.GREEN + propName + "\n" + EnumChatFormatting.RED + "No tooltip defined.", 300);
if (parentScreen instanceof GuiConfig) if (parentScreen instanceof GuiConfig)
@ -103,11 +103,11 @@ public class GuiEditArray extends GuiScreen
{ {
this.entryList = new GuiEditArrayEntries(this, this.mc, this.configElement, this.beforeValues, this.currentValues); this.entryList = new GuiEditArrayEntries(this, this.mc, this.configElement, this.beforeValues, this.currentValues);
int undoGlyphWidth = mc.fontRenderer.getStringWidth(UNDO_CHAR) * 2; int undoGlyphWidth = mc.fontRendererObj.getStringWidth(UNDO_CHAR) * 2;
int resetGlyphWidth = mc.fontRenderer.getStringWidth(RESET_CHAR) * 2; int resetGlyphWidth = mc.fontRendererObj.getStringWidth(RESET_CHAR) * 2;
int doneWidth = Math.max(mc.fontRenderer.getStringWidth(I18n.format("gui.done")) + 20, 100); int doneWidth = Math.max(mc.fontRendererObj.getStringWidth(I18n.format("gui.done")) + 20, 100);
int undoWidth = mc.fontRenderer.getStringWidth(" " + I18n.format("fml.configgui.tooltip.undoChanges")) + undoGlyphWidth + 20; int undoWidth = mc.fontRendererObj.getStringWidth(" " + I18n.format("fml.configgui.tooltip.undoChanges")) + undoGlyphWidth + 20;
int resetWidth = mc.fontRenderer.getStringWidth(" " + I18n.format("fml.configgui.tooltip.resetToDefault")) + resetGlyphWidth + 20; int resetWidth = mc.fontRendererObj.getStringWidth(" " + I18n.format("fml.configgui.tooltip.resetToDefault")) + resetGlyphWidth + 20;
int buttonWidthHalf = (doneWidth + 5 + undoWidth + 5 + resetWidth) / 2; int buttonWidthHalf = (doneWidth + 5 + undoWidth + 5 + resetWidth) / 2;
this.buttonList.add(btnDone = new GuiButtonExt(2000, this.width / 2 - buttonWidthHalf, this.height - 29, doneWidth, 20, I18n.format("gui.done"))); this.buttonList.add(btnDone = new GuiButtonExt(2000, this.width / 2 - buttonWidthHalf, this.height - 29, doneWidth, 20, I18n.format("gui.done")));
this.buttonList.add(btnDefault = new GuiUnicodeGlyphButton(2001, this.width / 2 - buttonWidthHalf + doneWidth + 5 + undoWidth + 5, this.buttonList.add(btnDefault = new GuiUnicodeGlyphButton(2001, this.width / 2 - buttonWidthHalf + doneWidth + 5 + undoWidth + 5,
@ -144,7 +144,7 @@ public class GuiEditArray extends GuiScreen
} }
@Override @Override
protected void mouseClicked(int x, int y, int mouseEvent) protected void mouseClicked(int x, int y, int mouseEvent) throws IOException
{ {
if (mouseEvent != 0 || !this.entryList.func_148179_a(x, y, mouseEvent)) if (mouseEvent != 0 || !this.entryList.func_148179_a(x, y, mouseEvent))
{ {
@ -154,11 +154,11 @@ public class GuiEditArray extends GuiScreen
} }
@Override @Override
protected void mouseMovedOrUp(int x, int y, int mouseEvent) protected void mouseReleased(int x, int y, int mouseEvent)
{ {
if (mouseEvent != 0 || !this.entryList.func_148181_b(x, y, mouseEvent)) if (mouseEvent != 0 || !this.entryList.func_148181_b(x, y, mouseEvent))
{ {
super.mouseMovedOrUp(x, y, mouseEvent); super.mouseReleased(x, y, mouseEvent);
} }
} }
@ -204,6 +204,6 @@ public class GuiEditArray extends GuiScreen
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public void drawToolTip(List stringList, int x, int y) public void drawToolTip(List stringList, int x, int y)
{ {
this.func_146283_a(stringList, x, y); this.drawHoveringText(stringList, x, y);
} }
} }

View file

@ -405,7 +405,7 @@ public class GuiEditArrayEntries extends GuiListExtended
public StringEntry(GuiEditArray owningScreen, GuiEditArrayEntries owningEntryList, IConfigElement configElement, Object value) public StringEntry(GuiEditArray owningScreen, GuiEditArrayEntries owningEntryList, IConfigElement configElement, Object value)
{ {
super(owningScreen, owningEntryList, configElement); super(owningScreen, owningEntryList, configElement);
this.textFieldValue = new GuiTextField(owningEntryList.mc.fontRenderer, owningEntryList.width / 4 + 1, 0, owningEntryList.controlWidth - 3, 16); this.textFieldValue = new GuiTextField(0, owningEntryList.mc.fontRendererObj, owningEntryList.width / 4 + 1, 0, owningEntryList.controlWidth - 3, 16);
this.textFieldValue.setMaxStringLength(10000); this.textFieldValue.setMaxStringLength(10000);
this.textFieldValue.setText(value.toString()); this.textFieldValue.setText(value.toString());
this.isValidated = configElement.getValidationPattern() != null; this.isValidated = configElement.getValidationPattern() != null;
@ -420,9 +420,9 @@ public class GuiEditArrayEntries extends GuiListExtended
} }
@Override @Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, Tessellator tessellator, int mouseX, int mouseY, boolean isSelected) public void func_180790_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
{ {
super.drawEntry(slotIndex, x, y, listWidth, slotHeight, tessellator, mouseX, mouseY, isSelected); super.func_180790_a(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected);
if (configElement.isListLengthFixed() || slotIndex != owningEntryList.listEntries.size() - 1) if (configElement.isListLengthFixed() || slotIndex != owningEntryList.listEntries.size() - 1)
{ {
this.textFieldValue.setVisible(true); this.textFieldValue.setVisible(true);
@ -486,9 +486,9 @@ public class GuiEditArrayEntries extends GuiListExtended
} }
@Override @Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, Tessellator tessellator, int mouseX, int mouseY, boolean isSelected) public void func_180790_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
{ {
super.drawEntry(slotIndex, x, y, listWidth, slotHeight, tessellator, mouseX, mouseY, isSelected); super.func_180790_a(slotIndex, x, y, listWidth, slotHeight, mouseX, mouseY, isSelected);
this.btnValue.xPosition = listWidth / 4; this.btnValue.xPosition = listWidth / 4;
this.btnValue.yPosition = y; this.btnValue.yPosition = y;
@ -507,7 +507,7 @@ public class GuiEditArrayEntries extends GuiListExtended
{ {
if (this.btnValue.mousePressed(owningEntryList.mc, x, y)) if (this.btnValue.mousePressed(owningEntryList.mc, x, y))
{ {
btnValue.func_146113_a(owningEntryList.mc.getSoundHandler()); btnValue.playPressSound(owningEntryList.mc.getSoundHandler());
value = !value; value = !value;
owningEntryList.recalculateState(); owningEntryList.recalculateState();
return true; return true;
@ -564,13 +564,13 @@ public class GuiEditArrayEntries extends GuiListExtended
} }
@Override @Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, Tessellator tessellator, int mouseX, int mouseY, boolean isSelected) public void func_180790_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
{ {
if (this.getValue() != null && this.isValidated) if (this.getValue() != null && this.isValidated)
owningEntryList.mc.fontRenderer.drawString( owningEntryList.mc.fontRendererObj.drawString(
isValidValue ? EnumChatFormatting.GREEN + VALID : EnumChatFormatting.RED + INVALID, isValidValue ? EnumChatFormatting.GREEN + VALID : EnumChatFormatting.RED + INVALID,
listWidth / 4 - owningEntryList.mc.fontRenderer.getStringWidth(VALID) - 2, listWidth / 4 - owningEntryList.mc.fontRendererObj.getStringWidth(VALID) - 2,
y + slotHeight / 2 - owningEntryList.mc.fontRenderer.FONT_HEIGHT / 2, y + slotHeight / 2 - owningEntryList.mc.fontRendererObj.FONT_HEIGHT / 2,
16777215); 16777215);
int half = listWidth / 2; int half = listWidth / 2;
@ -610,14 +610,14 @@ public class GuiEditArrayEntries extends GuiListExtended
{ {
if (this.btnAddNewEntryAbove.mousePressed(owningEntryList.mc, x, y)) if (this.btnAddNewEntryAbove.mousePressed(owningEntryList.mc, x, y))
{ {
btnAddNewEntryAbove.func_146113_a(owningEntryList.mc.getSoundHandler()); btnAddNewEntryAbove.playPressSound(owningEntryList.mc.getSoundHandler());
owningEntryList.addNewEntry(index); owningEntryList.addNewEntry(index);
owningEntryList.recalculateState(); owningEntryList.recalculateState();
return true; return true;
} }
else if (this.btnRemoveEntry.mousePressed(owningEntryList.mc, x, y)) else if (this.btnRemoveEntry.mousePressed(owningEntryList.mc, x, y))
{ {
btnRemoveEntry.func_146113_a(owningEntryList.mc.getSoundHandler()); btnRemoveEntry.playPressSound(owningEntryList.mc.getSoundHandler());
owningEntryList.removeEntry(index); owningEntryList.removeEntry(index);
owningEntryList.recalculateState(); owningEntryList.recalculateState();
return true; return true;
@ -656,6 +656,9 @@ public class GuiEditArrayEntries extends GuiListExtended
{ {
return null; return null;
} }
@Override
public void func_178011_a(int p_178011_1_, int p_178011_2_, int p_178011_3_){}
} }
public static interface IArrayEntry extends GuiListExtended.IGuiListEntry public static interface IArrayEntry extends GuiListExtended.IGuiListEntry

View file

@ -68,13 +68,13 @@ public class GuiSelectString extends GuiScreen
"\n" + EnumChatFormatting.AQUA, configElement.getDefault(), configElement.getMinValue(), configElement.getMaxValue()); "\n" + EnumChatFormatting.AQUA, configElement.getDefault(), configElement.getMinValue(), configElement.getMaxValue());
if (!comment.equals(configElement.getLanguageKey() + ".tooltip")) if (!comment.equals(configElement.getLanguageKey() + ".tooltip"))
toolTip = mc.fontRenderer.listFormattedStringToWidth( toolTip = mc.fontRendererObj.listFormattedStringToWidth(
EnumChatFormatting.GREEN + propName + "\n" + EnumChatFormatting.YELLOW + comment, 300); EnumChatFormatting.GREEN + propName + "\n" + EnumChatFormatting.YELLOW + comment, 300);
else if (configElement.getComment() != null && !configElement.getComment().trim().isEmpty()) else if (configElement.getComment() != null && !configElement.getComment().trim().isEmpty())
toolTip = mc.fontRenderer.listFormattedStringToWidth( toolTip = mc.fontRendererObj.listFormattedStringToWidth(
EnumChatFormatting.GREEN + propName + "\n" + EnumChatFormatting.YELLOW + configElement.getComment(), 300); EnumChatFormatting.GREEN + propName + "\n" + EnumChatFormatting.YELLOW + configElement.getComment(), 300);
else else
toolTip = mc.fontRenderer.listFormattedStringToWidth( toolTip = mc.fontRendererObj.listFormattedStringToWidth(
EnumChatFormatting.GREEN + propName + "\n" + EnumChatFormatting.RED + "No tooltip defined.", 300); EnumChatFormatting.GREEN + propName + "\n" + EnumChatFormatting.RED + "No tooltip defined.", 300);
if (parentScreen instanceof GuiConfig) if (parentScreen instanceof GuiConfig)
@ -98,11 +98,11 @@ public class GuiSelectString extends GuiScreen
{ {
this.entriesList = new GuiSelectStringEntries(this, this.mc, this.configElement, this.selectableValues); this.entriesList = new GuiSelectStringEntries(this, this.mc, this.configElement, this.selectableValues);
int undoGlyphWidth = mc.fontRenderer.getStringWidth(UNDO_CHAR) * 2; int undoGlyphWidth = mc.fontRendererObj.getStringWidth(UNDO_CHAR) * 2;
int resetGlyphWidth = mc.fontRenderer.getStringWidth(RESET_CHAR) * 2; int resetGlyphWidth = mc.fontRendererObj.getStringWidth(RESET_CHAR) * 2;
int doneWidth = Math.max(mc.fontRenderer.getStringWidth(I18n.format("gui.done")) + 20, 100); int doneWidth = Math.max(mc.fontRendererObj.getStringWidth(I18n.format("gui.done")) + 20, 100);
int undoWidth = mc.fontRenderer.getStringWidth(" " + I18n.format("fml.configgui.tooltip.undoChanges")) + undoGlyphWidth + 20; int undoWidth = mc.fontRendererObj.getStringWidth(" " + I18n.format("fml.configgui.tooltip.undoChanges")) + undoGlyphWidth + 20;
int resetWidth = mc.fontRenderer.getStringWidth(" " + I18n.format("fml.configgui.tooltip.resetToDefault")) + resetGlyphWidth + 20; int resetWidth = mc.fontRendererObj.getStringWidth(" " + I18n.format("fml.configgui.tooltip.resetToDefault")) + resetGlyphWidth + 20;
int buttonWidthHalf = (doneWidth + 5 + undoWidth + 5 + resetWidth) / 2; int buttonWidthHalf = (doneWidth + 5 + undoWidth + 5 + resetWidth) / 2;
this.buttonList.add(btnDone = new GuiButtonExt(2000, this.width / 2 - buttonWidthHalf, this.height - 29, doneWidth, 20, I18n.format("gui.done"))); this.buttonList.add(btnDone = new GuiButtonExt(2000, this.width / 2 - buttonWidthHalf, this.height - 29, doneWidth, 20, I18n.format("gui.done")));
this.buttonList.add(btnDefault = new GuiUnicodeGlyphButton(2001, this.width / 2 - buttonWidthHalf + doneWidth + 5 + undoWidth + 5, this.buttonList.add(btnDefault = new GuiUnicodeGlyphButton(2001, this.width / 2 - buttonWidthHalf + doneWidth + 5 + undoWidth + 5,
@ -139,11 +139,11 @@ public class GuiSelectString extends GuiScreen
} }
@Override @Override
protected void mouseMovedOrUp(int x, int y, int mouseEvent) protected void mouseReleased(int x, int y, int mouseEvent)
{ {
if (mouseEvent != 0 || !this.entriesList.func_148181_b(x, y, mouseEvent)) if (mouseEvent != 0 || !this.entriesList.func_148181_b(x, y, mouseEvent))
{ {
super.mouseMovedOrUp(x, y, mouseEvent); super.mouseReleased(x, y, mouseEvent);
} }
} }
@ -172,6 +172,6 @@ public class GuiSelectString extends GuiScreen
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public void drawToolTip(List stringList, int x, int y) public void drawToolTip(List stringList, int x, int y)
{ {
this.func_146283_a(stringList, x, y); this.drawHoveringText(stringList, x, y);
} }
} }

View file

@ -61,8 +61,8 @@ public class GuiSelectStringEntries extends GuiListExtended
for (Entry<Object, String> entry : sortedList) for (Entry<Object, String> entry : sortedList)
{ {
listEntries.add(new ListEntry(this, entry)); listEntries.add(new ListEntry(this, entry));
if (mc.fontRenderer.getStringWidth(entry.getValue()) > maxEntryWidth) if (mc.fontRendererObj.getStringWidth(entry.getValue()) > maxEntryWidth)
maxEntryWidth = mc.fontRenderer.getStringWidth(entry.getValue()); maxEntryWidth = mc.fontRendererObj.getStringWidth(entry.getValue());
if (owningScreen.currentValue.equals(entry.getKey())) if (owningScreen.currentValue.equals(entry.getKey()))
{ {
@ -170,9 +170,9 @@ public class GuiSelectStringEntries extends GuiListExtended
} }
@Override @Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, Tessellator tessellator, int mouseX, int mouseY, boolean isSelected) public void func_180790_a(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
{ {
owningList.mc.fontRenderer.drawString(value.getValue(), x + 1, y, slotIndex == owningList.selectedIndex ? 16777215 : 14737632); owningList.mc.fontRendererObj.drawString(value.getValue(), x + 1, y, slotIndex == owningList.selectedIndex ? 16777215 : 14737632);
} }
@Override @Override
@ -190,6 +190,9 @@ public class GuiSelectStringEntries extends GuiListExtended
{ {
return value.getKey(); return value.getKey();
} }
@Override
public void func_178011_a(int p_178011_1_, int p_178011_2_, int p_178011_3_){}
} }
public static interface IGuiSelectStringListEntry extends GuiListExtended.IGuiListEntry public static interface IGuiSelectStringListEntry extends GuiListExtended.IGuiListEntry

View file

@ -38,8 +38,8 @@ public class GuiUnicodeGlyphButton extends GuiButtonExt
{ {
if (this.visible) if (this.visible)
{ {
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height; this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
int k = this.getHoverState(this.field_146123_n); int k = this.getHoverState(this.hovered);
GuiUtils.drawContinuousTexturedBox(buttonTextures, this.xPosition, this.yPosition, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.zLevel); GuiUtils.drawContinuousTexturedBox(buttonTextures, this.xPosition, this.yPosition, 0, 46 + k * 20, this.width, this.height, 200, 20, 2, 3, 2, 2, this.zLevel);
this.mouseDragged(mc, mouseX, mouseY); this.mouseDragged(mc, mouseX, mouseY);
int color = 14737632; int color = 14737632;
@ -52,31 +52,31 @@ public class GuiUnicodeGlyphButton extends GuiButtonExt
{ {
color = 10526880; color = 10526880;
} }
else if (this.field_146123_n) else if (this.hovered)
{ {
color = 16777120; color = 16777120;
} }
String buttonText = this.displayString; String buttonText = this.displayString;
int glyphWidth = (int) (mc.fontRenderer.getStringWidth(glyph) * glyphScale); int glyphWidth = (int) (mc.fontRendererObj.getStringWidth(glyph) * glyphScale);
int strWidth = mc.fontRenderer.getStringWidth(buttonText); int strWidth = mc.fontRendererObj.getStringWidth(buttonText);
int elipsisWidth = mc.fontRenderer.getStringWidth("..."); int elipsisWidth = mc.fontRendererObj.getStringWidth("...");
int totalWidth = strWidth + glyphWidth; int totalWidth = strWidth + glyphWidth;
if (totalWidth > width - 6 && totalWidth > elipsisWidth) if (totalWidth > width - 6 && totalWidth > elipsisWidth)
buttonText = mc.fontRenderer.trimStringToWidth(buttonText, width - 6 - elipsisWidth).trim() + "..."; buttonText = mc.fontRendererObj.trimStringToWidth(buttonText, width - 6 - elipsisWidth).trim() + "...";
strWidth = mc.fontRenderer.getStringWidth(buttonText); strWidth = mc.fontRendererObj.getStringWidth(buttonText);
totalWidth = glyphWidth + strWidth; totalWidth = glyphWidth + strWidth;
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glScalef(glyphScale, glyphScale, 1.0F); GL11.glScalef(glyphScale, glyphScale, 1.0F);
this.drawCenteredString(mc.fontRenderer, glyph, this.drawCenteredString(mc.fontRendererObj, glyph,
(int) (((this.xPosition + (this.width / 2) - (strWidth / 2)) / glyphScale) - (glyphWidth / (2 * glyphScale)) + 2), (int) (((this.xPosition + (this.width / 2) - (strWidth / 2)) / glyphScale) - (glyphWidth / (2 * glyphScale)) + 2),
(int) (((this.yPosition + ((this.height - 8) / glyphScale) / 2) - 1) / glyphScale), color); (int) (((this.yPosition + ((this.height - 8) / glyphScale) / 2) - 1) / glyphScale), color);
GL11.glPopMatrix(); GL11.glPopMatrix();
this.drawCenteredString(mc.fontRenderer, buttonText, (int) (this.xPosition + (this.width / 2) + (glyphWidth / glyphScale)), this.drawCenteredString(mc.fontRendererObj, buttonText, (int) (this.xPosition + (this.width / 2) + (glyphWidth / glyphScale)),
this.yPosition + (this.height - 8) / 2, color); this.yPosition + (this.height - 8) / 2, color);
} }
} }

View file

@ -15,6 +15,7 @@ package cpw.mods.fml.client.config;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
@ -182,12 +183,13 @@ public class GuiUtils
{ {
float var7 = 0.00390625F; float var7 = 0.00390625F;
float var8 = 0.00390625F; float var8 = 0.00390625F;
Tessellator tessellator = Tessellator.instance; Tessellator tessellator = Tessellator.func_178181_a();
tessellator.startDrawingQuads(); WorldRenderer worldr = tessellator.func_178180_c();
tessellator.addVertexWithUV((x + 0), (y + height), zLevel, ((u + 0) * var7), ((v + height) * var8)); worldr.func_178970_b();
tessellator.addVertexWithUV((x + width), (y + height), zLevel, ((u + width) * var7), ((v + height) * var8)); worldr.func_178985_a((x + 0), (y + height), zLevel, ((u + 0) * var7), ((v + height) * var8));
tessellator.addVertexWithUV((x + width), (y + 0), zLevel, ((u + width) * var7), ((v + 0) * var8)); worldr.func_178985_a((x + width), (y + height), zLevel, ((u + width) * var7), ((v + height) * var8));
tessellator.addVertexWithUV((x + 0), (y + 0), zLevel, ((u + 0) * var7), ((v + 0) * var8)); worldr.func_178985_a((x + width), (y + 0), zLevel, ((u + width) * var7), ((v + 0) * var8));
worldr.func_178985_a((x + 0), (y + 0), zLevel, ((u + 0) * var7), ((v + 0) * var8));
tessellator.draw(); tessellator.draw();
} }

View file

@ -1,28 +0,0 @@
/*
* Forge Mod Loader
* Copyright (c) 2012-2013 cpw.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* cpw - implementation
*/
package cpw.mods.fml.client.registry;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
public interface ISimpleBlockRenderingHandler
{
public abstract void renderInventoryBlock(Block block, int metadata, int modelId, RenderBlocks renderer);
public abstract boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer);
public abstract boolean shouldRender3DInInventory(int modelId);
public abstract int getRenderId();
}

View file

@ -16,7 +16,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderBiped; import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.entity.RenderManager;
@ -35,23 +35,8 @@ public class RenderingRegistry
{ {
private static final RenderingRegistry INSTANCE = new RenderingRegistry(); private static final RenderingRegistry INSTANCE = new RenderingRegistry();
private int nextRenderId = 42;
private Map<Integer, ISimpleBlockRenderingHandler> blockRenderers = Maps.newHashMap();
private List<EntityRendererInfo> entityRenderers = Lists.newArrayList(); private List<EntityRendererInfo> entityRenderers = Lists.newArrayList();
/**
* Add a new armour prefix to the RenderPlayer
*
* @param armor
*/
public static int addNewArmourRendererPrefix(String armor)
{
RenderBiped.bipedArmorFilenamePrefix = ObjectArrays.concat(RenderBiped.bipedArmorFilenamePrefix, armor);
return RenderBiped.bipedArmorFilenamePrefix.length - 1;
}
/** /**
* Register an entity rendering handler. This will, after mod initialization, be inserted into the main * Register an entity rendering handler. This will, after mod initialization, be inserted into the main
* render map for entities * render map for entities
@ -64,37 +49,6 @@ public class RenderingRegistry
instance().entityRenderers.add(new EntityRendererInfo(entityClass, renderer)); instance().entityRenderers.add(new EntityRendererInfo(entityClass, renderer));
} }
/**
* Register a simple block rendering handler
*
* @param handler
*/
public static void registerBlockHandler(ISimpleBlockRenderingHandler handler)
{
instance().blockRenderers.put(handler.getRenderId(), handler);
}
/**
* Register the simple block rendering handler
* This version will not call getRenderId on the passed in handler, instead using the supplied ID, so you
* can easily re-use the same rendering handler for multiple IDs
*
* @param renderId
* @param handler
*/
public static void registerBlockHandler(int renderId, ISimpleBlockRenderingHandler handler)
{
instance().blockRenderers.put(renderId, handler);
}
/**
* Get the next available renderId from the block render ID list
*/
public static int getNextAvailableRenderId()
{
return instance().nextRenderId++;
}
@Deprecated public static RenderingRegistry instance() @Deprecated public static RenderingRegistry instance()
{ {
return INSTANCE; return INSTANCE;
@ -111,32 +65,13 @@ public class RenderingRegistry
private Render renderer; private Render renderer;
} }
public boolean renderWorldBlock(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, Block block, int modelId) /*
{
if (!blockRenderers.containsKey(modelId)) { return false; }
ISimpleBlockRenderingHandler bri = blockRenderers.get(modelId);
return bri.renderWorldBlock(world, x, y, z, block, modelId, renderer);
}
public void renderInventoryBlock(RenderBlocks renderer, Block block, int metadata, int modelID)
{
if (!blockRenderers.containsKey(modelID)) { return; }
ISimpleBlockRenderingHandler bri = blockRenderers.get(modelID);
bri.renderInventoryBlock(block, metadata, modelID, renderer);
}
public boolean renderItemAsFull3DBlock(int modelId)
{
ISimpleBlockRenderingHandler bri = blockRenderers.get(modelId);
return bri != null && bri.shouldRender3DInInventory(modelId);
}
public void loadEntityRenderers(Map<Class<? extends Entity>, Render> rendererMap) public void loadEntityRenderers(Map<Class<? extends Entity>, Render> rendererMap)
{ {
for (EntityRendererInfo info : entityRenderers) for (EntityRendererInfo info : entityRenderers)
{ {
rendererMap.put(info.target, info.renderer); rendererMap.put(info.target, info.renderer);
info.renderer.setRenderManager(RenderManager.instance); info.renderer.setRenderManager(Minecraft.getMinecraft().func_175598_ae());
} }
} }*/
} }

View file

@ -580,11 +580,6 @@ public class FMLCommonHandler
return sidedDelegate.getClientPlayHandler(); return sidedDelegate.getClientPlayHandler();
} }
public void waitForPlayClient()
{
sidedDelegate.waitForPlayClient();
}
public void fireNetRegistrationEvent(NetworkManager manager, Set<String> channelSet, String channel, Side side) public void fireNetRegistrationEvent(NetworkManager manager, Set<String> channelSet, String channel, Side side)
{ {
sidedDelegate.fireNetRegistrationEvent(bus(), manager, channelSet, channel, side); sidedDelegate.fireNetRegistrationEvent(bus(), manager, channelSet, channel, side);

View file

@ -54,8 +54,6 @@ public interface IFMLSidedHandler
INetHandler getClientPlayHandler(); INetHandler getClientPlayHandler();
void waitForPlayClient();
void fireNetRegistrationEvent(EventBus bus, NetworkManager manager, Set<String> channelSet, String channel, Side side); void fireNetRegistrationEvent(EventBus bus, NetworkManager manager, Set<String> channelSet, String channel, Side side);
boolean shouldAllowPlayerLogins(); boolean shouldAllowPlayerLogins();

View file

@ -105,7 +105,7 @@ import cpw.mods.fml.relauncher.Side;
*/ */
public class Loader public class Loader
{ {
public static final String MC_VERSION = "1.7.10"; public static final String MC_VERSION = "1.8";
private static final Splitter DEPENDENCYPARTSPLITTER = Splitter.on(":").omitEmptyStrings().trimResults(); private static final Splitter DEPENDENCYPARTSPLITTER = Splitter.on(":").omitEmptyStrings().trimResults();
private static final Splitter DEPENDENCYSPLITTER = Splitter.on(";").omitEmptyStrings().trimResults(); private static final Splitter DEPENDENCYSPLITTER = Splitter.on(";").omitEmptyStrings().trimResults();
/** /**

View file

@ -49,7 +49,6 @@ public enum LoaderState
private Class<? extends FMLStateEvent> eventClass; private Class<? extends FMLStateEvent> eventClass;
@SuppressWarnings("unused")
private String name; private String name;
private LoaderState(String name, Class<? extends FMLStateEvent> event) private LoaderState(String name, Class<? extends FMLStateEvent> event)

View file

@ -34,7 +34,6 @@ import cpw.mods.fml.common.versioning.VersionParser;
public class MetadataCollection public class MetadataCollection
{ {
@SuppressWarnings("unused")
private String modListVersion; private String modListVersion;
private ModMetadata[] modList; private ModMetadata[] modList;
private Map<String, ModMetadata> metadatas = Maps.newHashMap(); private Map<String, ModMetadata> metadatas = Maps.newHashMap();

View file

@ -22,7 +22,6 @@ import cpw.mods.fml.common.versioning.VersionParser;
public class ModAPIManager { public class ModAPIManager {
public static final ModAPIManager INSTANCE = new ModAPIManager(); public static final ModAPIManager INSTANCE = new ModAPIManager();
@SuppressWarnings("unused")
private ModAPITransformer transformer; private ModAPITransformer transformer;
private ASMDataTable dataTable; private ASMDataTable dataTable;
private Map<String,APIContainer> apiContainers; private Map<String,APIContainer> apiContainers;

View file

@ -27,9 +27,7 @@ public class ModAnnotation
{ {
public class EnumHolder public class EnumHolder
{ {
@SuppressWarnings("unused")
private String desc; private String desc;
@SuppressWarnings("unused")
private String value; private String value;
public EnumHolder(String desc, String value) public EnumHolder(String desc, String value)

View file

@ -19,7 +19,6 @@ public class ModAnnotationVisitor extends AnnotationVisitor
{ {
private ASMModParser discoverer; private ASMModParser discoverer;
private boolean array; private boolean array;
@SuppressWarnings("unused")
private String name; private String name;
private boolean isSubAnnotation; private boolean isSubAnnotation;

View file

@ -33,7 +33,6 @@ public class EventBus implements IEventExceptionHandler
{ {
ListenerList.resize(busID + 1); ListenerList.resize(busID + 1);
exceptionHandler = this; exceptionHandler = this;
register(this);
} }
public EventBus(@Nonnull IEventExceptionHandler handler) public EventBus(@Nonnull IEventExceptionHandler handler)

View file

@ -144,14 +144,7 @@ public class ByteBufUtils {
public static void writeItemStack(ByteBuf to, ItemStack stack) public static void writeItemStack(ByteBuf to, ItemStack stack)
{ {
PacketBuffer pb = new PacketBuffer(to); PacketBuffer pb = new PacketBuffer(to);
try pb.writeItemStackToBuffer(stack);
{
pb.writeItemStackToBuffer(stack);
} catch (IOException e)
{
// Unpossible?
throw Throwables.propagate(e);
}
} }
/** /**
@ -182,14 +175,7 @@ public class ByteBufUtils {
public static void writeTag(ByteBuf to, NBTTagCompound tag) public static void writeTag(ByteBuf to, NBTTagCompound tag)
{ {
PacketBuffer pb = new PacketBuffer(to); PacketBuffer pb = new PacketBuffer(to);
try pb.writeNBTTagCompoundToBuffer(tag);
{
pb.writeNBTTagCompoundToBuffer(tag);
} catch (IOException e)
{
// Unpossible?
throw Throwables.propagate(e);
}
} }
/** /**

View file

@ -42,7 +42,7 @@ public class FMLEventChannel {
if (msg.handler() instanceof NetHandlerPlayServer) if (msg.handler() instanceof NetHandlerPlayServer)
{ {
NetHandlerPlayServer server = (NetHandlerPlayServer) msg.handler(); NetHandlerPlayServer server = (NetHandlerPlayServer) msg.handler();
event = new FMLNetworkEvent.ServerCustomPacketEvent(server.func_147362_b(), msg); event = new FMLNetworkEvent.ServerCustomPacketEvent(server.getNetworkManager(), msg);
} }
return event; return event;
} }
@ -61,7 +61,7 @@ public class FMLEventChannel {
else if (msg.handler() instanceof NetHandlerPlayServer) else if (msg.handler() instanceof NetHandlerPlayServer)
{ {
NetHandlerPlayServer server = (NetHandlerPlayServer) msg.handler(); NetHandlerPlayServer server = (NetHandlerPlayServer) msg.handler();
event = new FMLNetworkEvent.ServerCustomPacketEvent(server.func_147362_b(), msg); event = new FMLNetworkEvent.ServerCustomPacketEvent(server.getNetworkManager(), msg);
} }
return event; return event;
} }

View file

@ -8,9 +8,14 @@ import io.netty.channel.ChannelHandler.Sharable;
import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageCodec; import io.netty.handler.codec.MessageToMessageCodec;
import io.netty.util.AttributeKey; import io.netty.util.AttributeKey;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.List; import java.util.List;
import net.minecraft.network.PacketBuffer;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.network.internal.FMLProxyPacket; import cpw.mods.fml.common.network.internal.FMLProxyPacket;
@ -43,13 +48,13 @@ public abstract class FMLIndexedMessageToMessageCodec<A> extends MessageToMessag
@Override @Override
protected final void encode(ChannelHandlerContext ctx, A msg, List<Object> out) throws Exception protected final void encode(ChannelHandlerContext ctx, A msg, List<Object> out) throws Exception
{ {
ByteBuf buffer = Unpooled.buffer(); PacketBuffer buffer = new PacketBuffer(Unpooled.buffer());
@SuppressWarnings("unchecked") // Stupid unnecessary cast I can't seem to kill @SuppressWarnings("unchecked") // Stupid unnecessary cast I can't seem to kill
Class<? extends A> clazz = (Class<? extends A>) msg.getClass(); Class<? extends A> clazz = (Class<? extends A>) msg.getClass();
byte discriminator = types.get(clazz); byte discriminator = types.get(clazz);
buffer.writeByte(discriminator); buffer.writeByte(discriminator);
encodeInto(ctx, msg, buffer); encodeInto(ctx, msg, buffer);
FMLProxyPacket proxy = new FMLProxyPacket(buffer.copy(), ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get()); FMLProxyPacket proxy = new FMLProxyPacket(buffer/*.copy()*/, ctx.channel().attr(NetworkRegistry.FML_CHANNEL).get());
WeakReference<FMLProxyPacket> ref = ctx.attr(INBOUNDPACKETTRACKER).get().get(); WeakReference<FMLProxyPacket> ref = ctx.attr(INBOUNDPACKETTRACKER).get().get();
FMLProxyPacket old = ref == null ? null : ref.get(); FMLProxyPacket old = ref == null ? null : ref.get();
if (old != null) if (old != null)

View file

@ -13,7 +13,6 @@ import cpw.mods.fml.relauncher.Side;
public class FMLNetworkEvent<T extends INetHandler> extends Event { public class FMLNetworkEvent<T extends INetHandler> extends Event {
public final T handler; public final T handler;
public final NetworkManager manager; public final NetworkManager manager;
@SuppressWarnings("unused")
private final Class<T> type; private final Class<T> type;
FMLNetworkEvent(T thing, Class<T> type, NetworkManager manager) FMLNetworkEvent(T thing, Class<T> type, NetworkManager manager)

View file

@ -9,6 +9,8 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import net.minecraft.network.PacketBuffer;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
@ -25,7 +27,7 @@ public abstract class FMLHandshakeMessage {
public static FMLProxyPacket makeCustomChannelRegistration(Set<String> channels) public static FMLProxyPacket makeCustomChannelRegistration(Set<String> channels)
{ {
String salutation = Joiner.on('\0').join(Iterables.concat(Arrays.asList("FML|HS","FML"),channels)); String salutation = Joiner.on('\0').join(Iterables.concat(Arrays.asList("FML|HS","FML"),channels));
FMLProxyPacket proxy = new FMLProxyPacket(Unpooled.wrappedBuffer(salutation.getBytes(Charsets.UTF_8)), "REGISTER"); FMLProxyPacket proxy = new FMLProxyPacket(new PacketBuffer(Unpooled.wrappedBuffer(salutation.getBytes(Charsets.UTF_8))), "REGISTER");
return proxy; return proxy;
} }
public static class ServerHello extends FMLHandshakeMessage { public static class ServerHello extends FMLHandshakeMessage {

View file

@ -151,7 +151,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
void clientListenForServerHandshake() void clientListenForServerHandshake()
{ {
manager.setConnectionState(EnumConnectionState.PLAY); manager.setConnectionState(EnumConnectionState.PLAY);
FMLCommonHandler.instance().waitForPlayClient(); //FMLCommonHandler.instance().waitForPlayClient();
this.netHandler = FMLCommonHandler.instance().getClientPlayHandler(); this.netHandler = FMLCommonHandler.instance().getClientPlayHandler();
this.state = ConnectionState.AWAITING_HANDSHAKE; this.state = ConnectionState.AWAITING_HANDSHAKE;
} }
@ -235,7 +235,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
} }
else else
{ {
manager.scheduleOutboundPacket(new S40PacketDisconnect(chatcomponenttext), new GenericFutureListener<Future<?>>() manager.func_179288_a(new S40PacketDisconnect(chatcomponenttext), new GenericFutureListener<Future<?>>()
{ {
@Override @Override
public void operationComplete(Future<?> result) public void operationComplete(Future<?> result)
@ -345,7 +345,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
public void sendProxy(FMLProxyPacket msg) public void sendProxy(FMLProxyPacket msg)
{ {
manager.scheduleOutboundPacket(msg); manager.func_179290_a(msg);
} }
public void rejectHandshake(String result) public void rejectHandshake(String result)
@ -455,7 +455,7 @@ public class NetworkDispatcher extends SimpleChannelInboundHandler<Packet> imple
public void abortClientHandshake(String type) public void abortClientHandshake(String type)
{ {
FMLLog.log(Level.INFO, "Aborting client handshake \"%s\"", type); FMLLog.log(Level.INFO, "Aborting client handshake \"%s\"", type);
FMLCommonHandler.instance().waitForPlayClient(); //FMLCommonHandler.instance().waitForPlayClient();
completeClientSideConnection(ConnectionType.valueOf(type)); completeClientSideConnection(ConnectionType.valueOf(type));
} }

View file

@ -4,9 +4,10 @@ import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler; import io.netty.channel.SimpleChannelInboundHandler;
import java.util.List; import java.util.List;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import net.minecraft.client.entity.EntityClientPlayerMP; import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving; import net.minecraft.entity.EntityLiving;
@ -93,7 +94,7 @@ public class EntitySpawnHandler extends SimpleChannelInboundHandler<FMLMessage.E
entity.serverPosY = spawnMsg.rawY; entity.serverPosY = spawnMsg.rawY;
entity.serverPosZ = spawnMsg.rawZ; entity.serverPosZ = spawnMsg.rawZ;
EntityClientPlayerMP clientPlayer = FMLClientHandler.instance().getClientPlayerEntity(); EntityPlayerSP clientPlayer = FMLClientHandler.instance().getClientPlayerEntity();
if (entity instanceof IThrowableEntity) if (entity instanceof IThrowableEntity)
{ {
Entity thrower = clientPlayer.getEntityId() == spawnMsg.throwerId ? clientPlayer : wc.getEntityByID(spawnMsg.throwerId); Entity thrower = clientPlayer.getEntityId() == spawnMsg.throwerId ? clientPlayer : wc.getEntityByID(spawnMsg.throwerId);

View file

@ -85,7 +85,7 @@ public class FMLNetworkHandler
embeddedChannel.writeOutbound(openGui); embeddedChannel.writeOutbound(openGui);
entityPlayerMP.openContainer = remoteGuiContainer; entityPlayerMP.openContainer = remoteGuiContainer;
entityPlayerMP.openContainer.windowId = windowId; entityPlayerMP.openContainer.windowId = windowId;
entityPlayerMP.openContainer.addCraftingToCrafters(entityPlayerMP); entityPlayerMP.openContainer.onCraftGuiOpened(entityPlayerMP);
} }
} }
else if (FMLCommonHandler.instance().getSide().equals(Side.CLIENT)) else if (FMLCommonHandler.instance().getSide().equals(Side.CLIENT))

View file

@ -22,32 +22,28 @@ import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.handshake.NetworkDispatcher; import cpw.mods.fml.common.network.handshake.NetworkDispatcher;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
public class FMLProxyPacket extends Packet { public class FMLProxyPacket implements Packet {
final String channel; final String channel;
private Side target; private Side target;
private final ByteBuf payload; private final PacketBuffer payload;
private INetHandler netHandler; private INetHandler netHandler;
private NetworkDispatcher dispatcher; private NetworkDispatcher dispatcher;
private static Multiset<String> badPackets = ConcurrentHashMultiset.create(); private static Multiset<String> badPackets = ConcurrentHashMultiset.create();
private static int packetCountWarning = Integers.parseInt(System.getProperty("fml.badPacketCounter", "100"), 100); private static int packetCountWarning = Integers.parseInt(System.getProperty("fml.badPacketCounter", "100"), 100);
private FMLProxyPacket(byte[] payload, String channel)
{
this(Unpooled.wrappedBuffer(payload), channel);
}
public FMLProxyPacket(S3FPacketCustomPayload original) public FMLProxyPacket(S3FPacketCustomPayload original)
{ {
this(original.func_149168_d(), original.func_149169_c()); this(original.func_180735_b(), original.func_149169_c());
this.target = Side.CLIENT; this.target = Side.CLIENT;
} }
public FMLProxyPacket(C17PacketCustomPayload original) public FMLProxyPacket(C17PacketCustomPayload original)
{ {
this(original.func_149558_e(), original.func_149559_c()); this(original.func_180760_b(), original.func_149559_c());
this.target = Side.SERVER; this.target = Side.SERVER;
} }
public FMLProxyPacket(ByteBuf payload, String channel) public FMLProxyPacket(PacketBuffer payload, String channel)
{ {
this.channel = channel; this.channel = channel;
this.payload = payload; this.payload = payload;
@ -117,12 +113,12 @@ public class FMLProxyPacket extends Packet {
} }
public Packet toC17Packet() public Packet toC17Packet()
{ {
return new C17PacketCustomPayload(channel, payload.array()); return new C17PacketCustomPayload(channel, payload);
} }
public Packet toS3FPacket() public Packet toS3FPacket()
{ {
return new S3FPacketCustomPayload(channel, payload.array()); return new S3FPacketCustomPayload(channel, payload);
} }
public void setTarget(Side target) public void setTarget(Side target)

View file

@ -8,10 +8,14 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.apache.commons.lang3.Validate;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.util.ObjectIntIdentityMap; import net.minecraft.util.ObjectIntIdentityMap;
import net.minecraft.util.RegistryNamespaced; import net.minecraft.util.RegistryNamespaced;
import net.minecraft.util.RegistryNamespacedDefaultedByKey;
import net.minecraft.util.ResourceLocation;
import com.google.common.collect.BiMap; import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap; import com.google.common.collect.HashBiMap;
@ -20,9 +24,9 @@ import com.google.common.collect.ImmutableMap;
import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.functions.GenericIterableFactory; import cpw.mods.fml.common.functions.GenericIterableFactory;
public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced { public class FMLControlledNamespacedRegistry<I> extends RegistryNamespacedDefaultedByKey {
private final Class<I> superType; private final Class<I> superType;
private String optionalDefaultName; private Object optionalDefaultKey;
private I optionalDefaultObject; private I optionalDefaultObject;
private int maxId; private int maxId;
private int minId; private int minId;
@ -33,11 +37,12 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
private BiMap<String, I> persistentSubstitutions; private BiMap<String, I> persistentSubstitutions;
private BiMap<String, I> activeSubstitutions = HashBiMap.create(); private BiMap<String, I> activeSubstitutions = HashBiMap.create();
FMLControlledNamespacedRegistry(String optionalDefault, int maxIdValue, int minIdValue, Class<I> type, char discriminator) FMLControlledNamespacedRegistry(Object defaultKey, int maxIdValue, int minIdValue, Class<I> type, char discriminator)
{ {
super(defaultKey);
this.superType = type; this.superType = type;
this.discriminator = discriminator; this.discriminator = discriminator;
this.optionalDefaultName = optionalDefault; this.optionalDefaultKey = defaultKey;
this.maxId = maxIdValue; this.maxId = maxIdValue;
this.minId = minIdValue; this.minId = minIdValue;
} }
@ -47,24 +52,29 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
for (I obj : typeSafeIterable()) for (I obj : typeSafeIterable())
{ {
int id = getId(obj); int id = getId(obj);
String name = getNameForObject(obj); Object name = func_177774_c(obj);
// name lookup failed -> obj is not in the obj<->name map
if (name == null) throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, doesn't yield a name.", type, obj, id));
ResourceLocation loc = (name instanceof ResourceLocation) ? (ResourceLocation)name : null;
String nameS = (name instanceof String) ? (String)name : (loc != null ? name.toString() : null);
if (loc == null && nameS == null) throw new IllegalStateException(String.format("Registry entry for %s %s name is invalid, must be a String or ResourceLocation %s", type, obj, name));
// id lookup failed -> obj is not in the obj<->id map // id lookup failed -> obj is not in the obj<->id map
if (id < 0) throw new IllegalStateException(String.format("Registry entry for %s %s, name %s, doesn't yield an id.", type, obj, name)); if (id < 0) throw new IllegalStateException(String.format("Registry entry for %s %s, name %s, doesn't yield an id.", type, obj, name));
// id is too high // id is too high
if (id > maxId) throw new IllegalStateException(String.format("Registry entry for %s %s, name %s uses the too large id %d.", type, obj, name)); if (id > maxId) throw new IllegalStateException(String.format("Registry entry for %s %s, name %s uses the too large id %d.", type, obj, name));
// name lookup failed -> obj is not in the obj<->name map
if (name == null) throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, doesn't yield a name.", type, obj, id));
// empty name // empty name
if (name.isEmpty()) throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, yields an empty name.", type, obj, id)); if (name.toString().isEmpty()) throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, yields an empty name.", type, obj, id));
// non-prefixed name // non-prefixed name
if (name.indexOf(':') == -1) throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, has the non-prefixed name %s.", type, obj, id, name)); if (name.toString().indexOf(':') == -1) throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, has the non-prefixed name %s.", type, obj, id, name));
// id -> obj lookup is inconsistent // id -> obj lookup is inconsistent
if (getRaw(id) != obj) throw new IllegalStateException(String.format("Registry entry for id %d, name %s, doesn't yield the expected %s %s.", id, name, type, obj)); if (getRaw(id) != obj) throw new IllegalStateException(String.format("Registry entry for id %d, name %s, doesn't yield the expected %s %s.", id, name, type, obj));
// name -> obj lookup is inconsistent // name -> obj lookup is inconsistent
if (!(activeSubstitutions.containsKey(name) || activeSubstitutions.containsValue(name)) && getRaw(name) != obj ) throw new IllegalStateException(String.format("Registry entry for name %s, id %d, doesn't yield the expected %s %s.", name, id, type, obj)); if (!(activeSubstitutions.containsKey(name) || activeSubstitutions.containsValue(name)) && getRaw(nameS) != obj ) throw new IllegalStateException(String.format("Registry entry for name %s, id %d, doesn't yield the expected %s %s.", name, id, type, obj));
// name -> id lookup is inconsistent // name -> id lookup is inconsistent
if (!(activeSubstitutions.containsKey(name) || activeSubstitutions.containsValue(name)) && getId(name) != id) throw new IllegalStateException(String.format("Registry entry for name %s doesn't yield the expected id %d.", name, id)); if (!(activeSubstitutions.containsKey(name) || activeSubstitutions.containsValue(name)) && getId(nameS) != id) throw new IllegalStateException(String.format("Registry entry for name %s doesn't yield the expected id %d.", name, id));
// id isn't marked as unavailable // id isn't marked as unavailable
if (!availabilityMap.get(id)) throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, name %s, marked as empty.", type, obj, id, name)); if (!availabilityMap.get(id)) throw new IllegalStateException(String.format("Registry entry for %s %s, id %d, name %s, marked as empty.", type, obj, id, name));
// entry is blocked, thus should be empty // entry is blocked, thus should be empty
@ -72,7 +82,7 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
if (obj instanceof ItemBlock) if (obj instanceof ItemBlock)
{ {
Block block = ((ItemBlock) obj).field_150939_a; Block block = ((ItemBlock) obj).blockInstance;
// verify matching block entry // verify matching block entry
if (iBlockRegistry.getId(block) != id) if (iBlockRegistry.getId(block) != id)
@ -90,7 +100,7 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
if (this.superType != registry.superType) throw new IllegalArgumentException("incompatible registry"); if (this.superType != registry.superType) throw new IllegalArgumentException("incompatible registry");
this.discriminator = registry.discriminator; this.discriminator = registry.discriminator;
this.optionalDefaultName = registry.optionalDefaultName; this.optionalDefaultKey = registry.optionalDefaultKey;
this.maxId = registry.maxId; this.maxId = registry.maxId;
this.minId = registry.minId; this.minId = registry.minId;
this.aliases.clear(); this.aliases.clear();
@ -100,7 +110,7 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
for (I thing : registry.typeSafeIterable()) for (I thing : registry.typeSafeIterable())
{ {
addObjectRaw(registry.getId(thing), registry.getNameForObject(thing), thing); addObjectRaw(registry.getId(thing), registry.func_177774_c(thing), thing);
} }
} }
@ -113,9 +123,10 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
*/ */
@Override @Override
@Deprecated @Deprecated
public void addObject(int id, String name, Object thing) public void func_177775_a(int id, Object name, Object thing)
{ {
GameData.getMain().register(thing, name, id); Validate.isInstanceOf(ResourceLocation.class, name);
GameData.getMain().register(thing, name.toString(), id);
} }
/** /**
@ -127,15 +138,15 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
@Deprecated @Deprecated
public void putObject(Object objName, Object obj) public void putObject(Object objName, Object obj)
{ {
String name = (String) objName; String name = objName.toString();
I thing = superType.cast(obj); I thing = superType.cast(obj);
if (name == null) throw new NullPointerException("Can't use a null-name for the registry."); if (name == null) throw new NullPointerException("Can't use a null-name for the registry.");
if (name.isEmpty()) throw new IllegalArgumentException("Can't use an empty name for the registry."); if (name.isEmpty()) throw new IllegalArgumentException("Can't use an empty name for the registry.");
if (thing == null) throw new NullPointerException("Can't add null-object to the registry."); if (thing == null) throw new NullPointerException("Can't add null-object to the registry.");
name = ensureNamespaced(name); name = new ResourceLocation(name).toString();
String existingName = getNameForObject(thing); Object existingName = func_177774_c(thing);
if (existingName == null) if (existingName == null)
{ {
@ -148,7 +159,7 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
else else
{ {
FMLLog.bigWarning("Ignoring putObject(%s, %s), adding alias to %s instead", name, thing, existingName); FMLLog.bigWarning("Ignoring putObject(%s, %s), adding alias to %s instead", name, thing, existingName);
addAlias(name, existingName); addAlias(name, existingName.toString());
} }
} }
@ -161,9 +172,11 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
* @return Registered object of the default object if it wasn't found- * @return Registered object of the default object if it wasn't found-
*/ */
@Override @Override
public I getObject(String name) public I getObject(Object name)
{ {
I object = getRaw(name); I object = null;
if (name instanceof ResourceLocation) object = getRaw((ResourceLocation)name);
if (name instanceof String) object = getRaw((String)name);
return object == null ? this.optionalDefaultObject : object; return object == null ? this.optionalDefaultObject : object;
} }
@ -235,11 +248,22 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
*/ */
public I getRaw(String name) public I getRaw(String name)
{ {
I ret = superType.cast(super.getObject(name)); return getRaw(new ResourceLocation(name));
}
/**
* Get the object identified by the specified name.
*
* @param name Block/Item name.
* @return Block/Item object or null if it wasn't found.
*/
private I getRaw(ResourceLocation loc)
{
I ret = superType.cast(super.getObject(loc));
if (ret == null) // no match, try aliases recursively if (ret == null) // no match, try aliases recursively
{ {
name = aliases.get(name); String name = aliases.get(loc.toString());
if (name != null) return getRaw(name); if (name != null) return getRaw(name);
} }
@ -256,7 +280,7 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
* @return true if a matching entry was found. * @return true if a matching entry was found.
*/ */
@Override @Override
public boolean containsKey(String name) public boolean containsKey(Object name)
{ {
boolean ret = super.containsKey(name); boolean ret = super.containsKey(name);
@ -310,7 +334,7 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
{ {
for (I thing : this.typeSafeIterable()) for (I thing : this.typeSafeIterable())
{ {
idMapping.put(discriminator+getNameForObject(thing), getId(thing)); idMapping.put(discriminator+func_177774_c(thing).toString(), getId(thing));
} }
} }
@ -334,7 +358,7 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
if (name.isEmpty()) throw new IllegalArgumentException(String.format("Can't use an empty name for the registry, object %s.", thing)); if (name.isEmpty()) throw new IllegalArgumentException(String.format("Can't use an empty name for the registry, object %s.", thing));
if (name.indexOf(':') == -1) throw new IllegalArgumentException(String.format("Can't add the name (%s) without a prefix, object %s", name, thing)); if (name.indexOf(':') == -1) throw new IllegalArgumentException(String.format("Can't add the name (%s) without a prefix, object %s", name, thing));
if (thing == null) throw new NullPointerException(String.format("Can't add null-object to the registry, name %s.", name)); if (thing == null) throw new NullPointerException(String.format("Can't add null-object to the registry, name %s.", name));
if (name.equals(optionalDefaultName) && this.optionalDefaultObject == null) if (optionalDefaultKey != null && optionalDefaultKey.toString().equals(name) && this.optionalDefaultObject == null)
{ {
this.optionalDefaultObject = thing; this.optionalDefaultObject = thing;
} }
@ -365,7 +389,7 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
{ {
int foundId = getId(thing); int foundId = getId(thing);
Object otherThing = getRaw(foundId); Object otherThing = getRaw(foundId);
throw new IllegalArgumentException(String.format("The object %s{%x} has been registered twice, using the names %s and %s. (Other object at this id is %s{%x})", thing, System.identityHashCode(thing), getNameForObject(thing), name, otherThing, System.identityHashCode(otherThing))); throw new IllegalArgumentException(String.format("The object %s{%x} has been registered twice, using the names %s and %s. (Other object at this id is %s{%x})", thing, System.identityHashCode(thing), func_177774_c(thing), name, otherThing, System.identityHashCode(otherThing)));
} }
if (GameData.isFrozen(this)) if (GameData.isFrozen(this))
{ {
@ -376,7 +400,7 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
{ {
thing = activeSubstitutions.get(name); thing = activeSubstitutions.get(name);
} }
addObjectRaw(idToUse, name, thing); addObjectRaw(idToUse, new ResourceLocation(name), thing);
FMLLog.finer("Registry add: %s %d %s (req. id %d)", name, idToUse, thing, id); FMLLog.finer("Registry add: %s %d %s (req. id %d)", name, idToUse, thing, id);
return idToUse; return idToUse;
@ -396,9 +420,9 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
{ {
if (!registry.field_148758_b.containsKey(thing)) if (!registry.field_148758_b.containsKey(thing))
{ {
if (!registry.activeSubstitutions.containsKey(getNameForObject(thing))) if (!registry.activeSubstitutions.containsKey(func_177774_c(thing).toString()))
{ {
ret.put(getNameForObject(thing), getId(thing)); ret.put(func_177774_c(thing).toString(), getId(thing));
} }
} }
} }
@ -421,14 +445,14 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
for (int id : ids) for (int id : ids)
{ {
I thing = getRaw(id); I thing = getRaw(id);
FMLLog.finer("Registry: %s %d %s", getNameForObject(thing), id, thing); FMLLog.finer("Registry: %s %d %s", func_177774_c(thing), id, thing);
} }
} }
/** /**
* Version of addObject not using the API restricting overrides. * Version of addObject not using the API restricting overrides.
*/ */
private void addObjectRaw(int id, String name, I thing) private void addObjectRaw(int id, Object name, I thing)
{ {
if (name == null) throw new NullPointerException("The name to be added to the registry is null. This can only happen with a corrupted registry state. Reflection/ASM hackery? Registry bug?"); if (name == null) throw new NullPointerException("The name to be added to the registry is null. This can only happen with a corrupted registry state. Reflection/ASM hackery? Registry bug?");
if (thing == null) throw new NullPointerException("The object to be added to the registry is null. This can only happen with a corrupted registry state. Reflection/ASM hackery? Registry bug?"); if (thing == null) throw new NullPointerException("The object to be added to the registry is null. This can only happen with a corrupted registry state. Reflection/ASM hackery? Registry bug?");
@ -494,4 +518,11 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespaced {
} }
return persistentSubstitutions; return persistentSubstitutions;
} }
@Override
public void func_177776_a()
{
if (this.optionalDefaultKey != null)
Validate.notNull(this.optionalDefaultObject);
}
} }

View file

@ -28,6 +28,7 @@ import net.minecraft.block.Block;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
@ -221,7 +222,7 @@ public class GameData {
static UniqueIdentifier getUniqueName(Block block) static UniqueIdentifier getUniqueName(Block block)
{ {
if (block == null) return null; if (block == null) return null;
String name = getMain().iBlockRegistry.getNameForObject(block); Object name = getMain().iBlockRegistry.func_177774_c(block);
UniqueIdentifier ui = new UniqueIdentifier(name); UniqueIdentifier ui = new UniqueIdentifier(name);
if (customItemStacks.contains(ui.modId, ui.name)) if (customItemStacks.contains(ui.modId, ui.name))
{ {
@ -234,7 +235,7 @@ public class GameData {
static UniqueIdentifier getUniqueName(Item item) static UniqueIdentifier getUniqueName(Item item)
{ {
if (item == null) return null; if (item == null) return null;
String name = getMain().iItemRegistry.getNameForObject(item); Object name = getMain().iItemRegistry.func_177774_c(item);
UniqueIdentifier ui = new UniqueIdentifier(name); UniqueIdentifier ui = new UniqueIdentifier(name);
if (customItemStacks.contains(ui.modId, ui.name)) if (customItemStacks.contains(ui.modId, ui.name))
{ {
@ -260,7 +261,6 @@ public class GameData {
for (Entry<String, Integer> entry : dataList.entrySet()) for (Entry<String, Integer> entry : dataList.entrySet())
{ {
String itemName = entry.getKey(); String itemName = entry.getKey();
@SuppressWarnings("unused")
String realName = itemName.substring(1); String realName = itemName.substring(1);
if (itemName.charAt(0) == '\u0001') // is a block if (itemName.charAt(0) == '\u0001') // is a block
@ -608,7 +608,7 @@ public class GameData {
if (remap.type == Type.BLOCK) if (remap.type == Type.BLOCK)
{ {
currId = getMain().iBlockRegistry.getId((Block) remap.getTarget()); currId = getMain().iBlockRegistry.getId((Block) remap.getTarget());
newName = getMain().iBlockRegistry.getNameForObject(remap.getTarget()); newName = getMain().iBlockRegistry.func_177774_c(remap.getTarget()).toString();
FMLLog.fine("The Block %s is being remapped to %s.", remap.name, newName); FMLLog.fine("The Block %s is being remapped to %s.", remap.name, newName);
newId = gameData.registerBlock((Block) remap.getTarget(), newName, remap.id); newId = gameData.registerBlock((Block) remap.getTarget(), newName, remap.id);
@ -617,7 +617,7 @@ public class GameData {
else else
{ {
currId = getMain().iItemRegistry.getId((Item) remap.getTarget()); currId = getMain().iItemRegistry.getId((Item) remap.getTarget());
newName = getMain().iItemRegistry.getNameForObject(remap.getTarget()); newName = getMain().iItemRegistry.func_177774_c(remap.getTarget()).toString();
FMLLog.fine("The Item %s is being remapped to %s.", remap.name, newName); FMLLog.fine("The Item %s is being remapped to %s.", remap.name, newName);
newId = gameData.registerItem((Item) remap.getTarget(), newName, remap.id); newId = gameData.registerItem((Item) remap.getTarget(), newName, remap.id);
@ -752,7 +752,7 @@ public class GameData {
private GameData() private GameData()
{ {
iBlockRegistry = new FMLControlledNamespacedRegistry<Block>("minecraft:air", MAX_BLOCK_ID, MIN_BLOCK_ID, Block.class,'\u0001'); iBlockRegistry = new FMLControlledNamespacedRegistry<Block>(new ResourceLocation("minecraft:air"), MAX_BLOCK_ID, MIN_BLOCK_ID, Block.class,'\u0001');
iItemRegistry = new FMLControlledNamespacedRegistry<Item>(null, MAX_ITEM_ID, MIN_ITEM_ID, Item.class,'\u0002'); iItemRegistry = new FMLControlledNamespacedRegistry<Item>(null, MAX_ITEM_ID, MIN_ITEM_ID, Item.class,'\u0002');
availabilityMap = new BitSet(MAX_ITEM_ID + 1); availabilityMap = new BitSet(MAX_ITEM_ID + 1);
blockedIds = new HashSet<Integer>(); blockedIds = new HashSet<Integer>();
@ -806,7 +806,7 @@ public class GameData {
{ {
if (item instanceof ItemBlock) // ItemBlock, adjust id and clear the slot already occupied by the corresponding block if (item instanceof ItemBlock) // ItemBlock, adjust id and clear the slot already occupied by the corresponding block
{ {
Block block = ((ItemBlock) item).field_150939_a; Block block = ((ItemBlock) item).blockInstance;
if (idHint != -1 && getMain().blockSubstitutions.containsKey(name)) if (idHint != -1 && getMain().blockSubstitutions.containsKey(name))
{ {
block = getMain().blockSubstitutions.get(name); block = getMain().blockSubstitutions.get(name);
@ -865,7 +865,7 @@ public class GameData {
for (Item item : iItemRegistry.typeSafeIterable()) // find matching ItemBlock for (Item item : iItemRegistry.typeSafeIterable()) // find matching ItemBlock
{ {
if (item instanceof ItemBlock && ((ItemBlock) item).field_150939_a == block) if (item instanceof ItemBlock && ((ItemBlock) item).blockInstance == block)
{ {
itemBlock = (ItemBlock) item; itemBlock = (ItemBlock) item;
break; break;
@ -967,8 +967,8 @@ public class GameData {
private void verifyItemBlockName(ItemBlock item) private void verifyItemBlockName(ItemBlock item)
{ {
String blockName = iBlockRegistry.getNameForObject(item.field_150939_a); Object blockName = iBlockRegistry.func_177774_c(item.blockInstance);
String itemName = iItemRegistry.getNameForObject(item); Object itemName = iItemRegistry.func_177774_c(item);
if (blockName != null && !blockName.equals(itemName)) if (blockName != null && !blockName.equals(itemName))
{ {

View file

@ -33,6 +33,7 @@ import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.chunk.IChunkProvider;
@ -257,17 +258,17 @@ public class GameRegistry
public static void addSmelting(Block input, ItemStack output, float xp) public static void addSmelting(Block input, ItemStack output, float xp)
{ {
FurnaceRecipes.smelting().func_151393_a(input, output, xp); FurnaceRecipes.instance().addSmeltingRecipeForBlock(input, output, xp);
} }
public static void addSmelting(Item input, ItemStack output, float xp) public static void addSmelting(Item input, ItemStack output, float xp)
{ {
FurnaceRecipes.smelting().func_151396_a(input, output, xp); FurnaceRecipes.instance().addSmelting(input, output, xp);
} }
public static void addSmelting(ItemStack input, ItemStack output, float xp) public static void addSmelting(ItemStack input, ItemStack output, float xp)
{ {
FurnaceRecipes.smelting().func_151394_a(input, output, xp); FurnaceRecipes.instance().addSmeltingRecipe(input, output, xp);
} }
public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id) public static void registerTileEntity(Class<? extends TileEntity> tileEntityClass, String id)
@ -385,6 +386,25 @@ public class GameRegistry
this.name = parts[1]; this.name = parts[1];
} }
public UniqueIdentifier(Object obj)
{
if (obj instanceof String)
{
String[] parts = ((String)obj).split(":");
this.modId = parts[0];
this.name = parts[1];
}
else if (obj instanceof ResourceLocation)
{
this.modId = ((ResourceLocation)obj).getResourceDomain();
this.name = ((ResourceLocation)obj).getResourcePath();
}
else
{
throw new IllegalArgumentException("UniqueIdentifier must be a String or ResourceLocation, was " + obj.getClass());
}
}
@Override @Override
public boolean equals(Object obj) public boolean equals(Object obj)
{ {

View file

@ -46,8 +46,9 @@ class ObjectHolderRef {
} }
else else
{ {
this.injectedObject = isBlock ? GameData.getBlockRegistry().getNameForObject(existing) : Object tmp = isBlock ? GameData.getBlockRegistry().func_177774_c(existing) :
isItem ? GameData.getItemRegistry().getNameForObject(existing) : null; isItem ? GameData.getItemRegistry().func_177774_c(existing) : null;
this.injectedObject = tmp != null ? tmp.toString() : null;
} }
} catch (Exception e) } catch (Exception e)
{ {

View file

@ -12,6 +12,8 @@
package cpw.mods.fml.common.registry; package cpw.mods.fml.common.registry;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
@ -19,8 +21,16 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
import org.apache.commons.lang3.Validate;
import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.passive.EntityVillager.*;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Tuple; import net.minecraft.util.Tuple;
import net.minecraft.village.MerchantRecipeList; import net.minecraft.village.MerchantRecipeList;
@ -45,12 +55,16 @@ public class VillagerRegistry
{ {
private static final VillagerRegistry INSTANCE = new VillagerRegistry(); private static final VillagerRegistry INSTANCE = new VillagerRegistry();
private Multimap<Integer, IVillageTradeHandler> tradeHandlers = ArrayListMultimap.create();
private Map<Class<?>, IVillageCreationHandler> villageCreationHandlers = Maps.newHashMap(); private Map<Class<?>, IVillageCreationHandler> villageCreationHandlers = Maps.newHashMap();
private List<Integer> newVillagerIds = Lists.newArrayList(); private List<Integer> newVillagerIds = Lists.newArrayList();
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
private Map<Integer, ResourceLocation> newVillagers; private Map<Integer, ResourceLocation> newVillagers;
private VillagerRegistry()
{
init();
}
/** /**
* Allow access to the {@link net.minecraft.world.gen.structure.StructureVillagePieces} array controlling new village * Allow access to the {@link net.minecraft.world.gen.structure.StructureVillagePieces} array controlling new village
* creation so you can insert your own new village pieces * creation so you can insert your own new village pieces
@ -83,29 +97,11 @@ public class VillagerRegistry
* @param p1 * @param p1
* @param p2 * @param p2
* @param p3 * @param p3
* @param p4 * @param facing
* @param p5 * @param p5
*/ */
Object buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, @SuppressWarnings("rawtypes") List pieces, Random random, int p1, Object buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, @SuppressWarnings("rawtypes") List pieces, Random random, int p1,
int p2, int p3, int p4, int p5); int p2, int p3, EnumFacing facing, int p5);
}
/**
* Allow access to the {@link MerchantRecipeList} for a villager type for manipulation
*
* @author cpw
*
*/
public interface IVillageTradeHandler
{
/**
* Called to allow changing the content of the {@link MerchantRecipeList} for the villager
* supplied during creation
*
* @param villager
* @param recipeList
*/
void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random);
} }
public static VillagerRegistry instance() public static VillagerRegistry instance()
@ -152,17 +148,6 @@ public class VillagerRegistry
villageCreationHandlers.put(handler.getComponentClass(), handler); villageCreationHandlers.put(handler.getComponentClass(), handler);
} }
/**
* Register a new villager trading handler for the specified villager type
*
* @param villagerId
* @param handler
*/
public void registerVillageTradeHandler(int villagerId, IVillageTradeHandler handler)
{
tradeHandlers.put(villagerId, handler);
}
/** /**
* Callback to setup new villager types * Callback to setup new villager types
* *
@ -188,21 +173,6 @@ public class VillagerRegistry
{ {
return Collections.unmodifiableCollection(instance().newVillagerIds); return Collections.unmodifiableCollection(instance().newVillagerIds);
} }
/**
* Callback to handle trade setup for villagers
*
* @param recipeList
* @param villager
* @param villagerType
* @param random
*/
public static void manageVillagerTrades(MerchantRecipeList recipeList, EntityVillager villager, int villagerType, Random random)
{
for (IVillageTradeHandler handler : instance().tradeHandlers.get(villagerType))
{
handler.manipulateTradesForVillager(villager, recipeList, random);
}
}
public static void addExtraVillageComponents(@SuppressWarnings("rawtypes") ArrayList components, Random random, int i) public static void addExtraVillageComponents(@SuppressWarnings("rawtypes") ArrayList components, Random random, int i)
{ {
@ -215,36 +185,311 @@ public class VillagerRegistry
} }
public static Object getVillageComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, @SuppressWarnings("rawtypes") List pieces, Random random, public static Object getVillageComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, @SuppressWarnings("rawtypes") List pieces, Random random,
int p1, int p2, int p3, int p4, int p5) int p1, int p2, int p3, EnumFacing facing, int p5)
{ {
return instance().villageCreationHandlers.get(villagePiece.villagePieceClass).buildComponent(villagePiece, startPiece, pieces, random, p1, p2, p3, p4, p5); return instance().villageCreationHandlers.get(villagePiece.villagePieceClass).buildComponent(villagePiece, startPiece, pieces, random, p1, p2, p3, facing, p5);
} }
public void register(VillagerProfession prof)
@SuppressWarnings("unchecked") {
public static void addEmeraldBuyRecipe(EntityVillager villager, MerchantRecipeList list, Random random, Item item, float chance, int min, int max) //blah
}
private boolean hasInit = false;
private List<VillagerProfession> professions = Lists.newArrayList();
//This field is moved from EntityVillager over to here.
//It is nasty I know but it's vanilla.
private static final ITradeList[][][][] vanillaTrades =
{ {
if (min > 0 && max > 0)
{ {
EntityVillager.villagersSellingList.put(item, new Tuple(min, max)); {
} {
EntityVillager.func_146091_a(list, item, random, chance); new EmeraldForItems(Items.wheat, new PriceInfo(18, 22)),
} new EmeraldForItems(Items.potato, new PriceInfo(15, 19)),
new EmeraldForItems(Items.carrot, new PriceInfo(15, 19)),
@SuppressWarnings("unchecked") new ListItemForEmeralds(Items.bread, new PriceInfo(-4, -2))
public static void addEmeraldSellRecipe(EntityVillager villager, MerchantRecipeList list, Random random, Item item, float chance, int min, int max) },
{ {
if (min > 0 && max > 0) new EmeraldForItems(Item.getItemFromBlock(Blocks.pumpkin), new PriceInfo(8, 13)),
new ListItemForEmeralds(Items.pumpkin_pie, new PriceInfo(-3, -2))
},
{
new EmeraldForItems(Item.getItemFromBlock(Blocks.melon_block), new PriceInfo(7, 12)),
new ListItemForEmeralds(Items.apple, new PriceInfo(-5, -7))
},
{
new ListItemForEmeralds(Items.cookie, new PriceInfo(-6, -10)),
new ListItemForEmeralds(Items.cake, new PriceInfo(1, 1))
}
},
{
{
new EmeraldForItems(Items.string, new PriceInfo(15, 20)),
new EmeraldForItems(Items.coal, new PriceInfo(16, 24)),
new ItemAndEmeraldToItem(Items.fish, new PriceInfo(6, 6), Items.field_179566_aV, new PriceInfo(6, 6))
},
{
new ListEnchantedItemForEmeralds(Items.fishing_rod, new PriceInfo(7, 8))
}
},
{
{
new EmeraldForItems(Item.getItemFromBlock(Blocks.wool), new PriceInfo(16, 22)),
new ListItemForEmeralds(Items.shears, new PriceInfo(3, 4))
},
{
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 0), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 1), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 2), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 3), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 4), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 5), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 6), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 7), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 8), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 9), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 10), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 11), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 12), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 13), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 14), new PriceInfo(1, 2)),
new ListItemForEmeralds(new ItemStack(Blocks.wool, 1, 15), new PriceInfo(1, 2))
}
},
{
{
new EmeraldForItems(Items.string, new PriceInfo(15, 20)),
new ListItemForEmeralds(Items.arrow, new PriceInfo(-12, -8))
},
{
new ListItemForEmeralds(Items.bow, new PriceInfo(2, 3)),
new ItemAndEmeraldToItem(Item.getItemFromBlock(Blocks.gravel), new PriceInfo(10, 10), Items.flint, new PriceInfo(6, 10))
}
}
},
{ {
EntityVillager.blacksmithSellingList.put(item, new Tuple(min, max)); {
{
new EmeraldForItems(Items.paper, new PriceInfo(24, 36)),
new ListEnchantedBookForEmeralds()
},
{
new EmeraldForItems(Items.book, new PriceInfo(8, 10)),
new ListItemForEmeralds(Items.compass, new PriceInfo(10, 12)),
new ListItemForEmeralds(Item.getItemFromBlock(Blocks.bookshelf), new PriceInfo(3, 4))
},
{
new EmeraldForItems(Items.written_book, new PriceInfo(2, 2)),
new ListItemForEmeralds(Items.clock, new PriceInfo(10, 12)),
new ListItemForEmeralds(Item.getItemFromBlock(Blocks.glass), new PriceInfo(-5, -3))
},
{
new ListEnchantedBookForEmeralds()
},
{
new ListEnchantedBookForEmeralds()
},
{
new ListItemForEmeralds(Items.name_tag, new PriceInfo(20, 22))
}
}
},
{
{
{
new EmeraldForItems(Items.rotten_flesh, new PriceInfo(36, 40)),
new EmeraldForItems(Items.gold_ingot, new PriceInfo(8, 10))
},
{
new ListItemForEmeralds(Items.redstone, new PriceInfo(-4, -1)),
new ListItemForEmeralds(new ItemStack(Items.dye, 1, EnumDyeColor.BLUE.func_176767_b()),
new PriceInfo(-2, -1))
},
{
new ListItemForEmeralds(Items.ender_eye, new PriceInfo(7, 11)),
new ListItemForEmeralds(Item.getItemFromBlock(Blocks.glowstone), new PriceInfo(-3, -1))
},
{
new ListItemForEmeralds(Items.experience_bottle, new PriceInfo(3, 11))
}
}
},
{
{
{
new EmeraldForItems(Items.coal, new PriceInfo(16, 24)),
new ListItemForEmeralds(Items.iron_helmet, new PriceInfo(4, 6))
},
{
new EmeraldForItems(Items.iron_ingot, new PriceInfo(7, 9)),
new ListItemForEmeralds(Items.iron_chestplate, new PriceInfo(10, 14))
},
{
new EmeraldForItems(Items.diamond, new PriceInfo(3, 4)),
new ListEnchantedItemForEmeralds(Items.diamond_chestplate, new PriceInfo(16, 19))
},
{
new ListItemForEmeralds(Items.chainmail_boots, new PriceInfo(5, 7)),
new ListItemForEmeralds(Items.chainmail_leggings, new PriceInfo(9, 11)),
new ListItemForEmeralds(Items.chainmail_helmet, new PriceInfo(5, 7)),
new ListItemForEmeralds(Items.chainmail_chestplate, new PriceInfo(11, 15))
}
},
{
{
new EmeraldForItems(Items.coal, new PriceInfo(16, 24)),
new ListItemForEmeralds(Items.iron_axe, new PriceInfo(6, 8))
},
{
new EmeraldForItems(Items.iron_ingot, new PriceInfo(7, 9)),
new ListEnchantedItemForEmeralds(Items.iron_sword, new PriceInfo(9, 10))
},
{
new EmeraldForItems(Items.diamond, new PriceInfo(3, 4)),
new ListEnchantedItemForEmeralds(Items.diamond_sword, new PriceInfo(12, 15)),
new ListEnchantedItemForEmeralds(Items.diamond_axe, new PriceInfo(9, 12))
}
},
{
{
new EmeraldForItems(Items.coal, new PriceInfo(16, 24)),
new ListEnchantedItemForEmeralds(Items.iron_shovel, new PriceInfo(5, 7))
},
{
new EmeraldForItems(Items.iron_ingot, new PriceInfo(7, 9)),
new ListEnchantedItemForEmeralds(Items.iron_pickaxe, new PriceInfo(9, 11))
},
{
new EmeraldForItems(Items.diamond, new PriceInfo(3, 4)),
new ListEnchantedItemForEmeralds(Items.diamond_pickaxe, new PriceInfo(12, 15))
}
}
},
{
{
{
new EmeraldForItems(Items.porkchop, new PriceInfo(14, 18)),
new EmeraldForItems(Items.chicken, new PriceInfo(14, 18))
},
{
new EmeraldForItems(Items.coal, new PriceInfo(16, 24)),
new ListItemForEmeralds(Items.cooked_porkchop, new PriceInfo(-7, -5)),
new ListItemForEmeralds(Items.cooked_chicken, new PriceInfo(-8, -6))
}
},
{
{
new EmeraldForItems(Items.leather, new PriceInfo(9, 12)),
new ListItemForEmeralds(Items.leather_leggings, new PriceInfo(2, 4))
},
{
new ListEnchantedItemForEmeralds(Items.leather_chestplate, new PriceInfo(7, 12))
},
{
new ListItemForEmeralds(Items.saddle, new PriceInfo(8, 10))
}
}
}
};
private void init()
{
if (hasInit)
return;
VillagerProfession prof = new VillagerProfession("minecraft:farmer", "minecraft:textures/entity/villager/farmer.png");
{
register(prof);
(new VillagerCareer(prof, "farmer" )).init(vanillaTrades[0][0]);
(new VillagerCareer(prof, "fisherman" )).init(vanillaTrades[0][1]);
(new VillagerCareer(prof, "shepherd" )).init(vanillaTrades[0][2]);
(new VillagerCareer(prof, "fletcher" )).init(vanillaTrades[0][3]);
}
prof = new VillagerProfession("minecraft:librarian", "minecraft:textures/entity/villager/librarian.png");
{
register(prof);
(new VillagerCareer(prof, "librarian")).init(vanillaTrades[1][0]);
}
prof = new VillagerProfession("minecraft:priest", "minecraft:textures/entity/villager/priest.png");
{
register(prof);
(new VillagerCareer(prof, "cleric")).init(vanillaTrades[2][0]);
}
prof = new VillagerProfession("minecraft:smith", "minecraft:textures/entity/villager/smith.png");
{
register(prof);
(new VillagerCareer(prof, "armor" )).init(vanillaTrades[3][0]);
(new VillagerCareer(prof, "weapon")).init(vanillaTrades[3][1]);
(new VillagerCareer(prof, "tool" )).init(vanillaTrades[3][2]);
}
prof = new VillagerProfession("minecraft:butcher", "minecraft:textures/entity/villager/butcher.png");
{
register(prof);
(new VillagerCareer(prof, "butcher")).init(vanillaTrades[4][0]);
(new VillagerCareer(prof, "leather")).init(vanillaTrades[4][1]);
} }
EntityVillager.func_146089_b(list, item, random, chance);
} }
public static void applyRandomTrade(EntityVillager villager, Random rand) public static class VillagerProfession
{ {
int extra = instance().newVillagerIds.size(); private ResourceLocation name;
int trade = rand.nextInt(5 + extra); private ResourceLocation texture;
villager.setProfession(trade < 5 ? trade : instance().newVillagerIds.get(trade - 5)); private List<VillagerCareer> careers = Lists.newArrayList();
public VillagerProfession(String name, String texture)
{
this.name = new ResourceLocation(name);
this.texture = new ResourceLocation(texture);
}
private void register(VillagerCareer career)
{
Validate.isTrue(!careers.contains(career), "Attempted to register career that is already registered.");
Validate.isTrue(career.profession == this, "Attempted to register career for the wrong profession.");
career.id = careers.size();
careers.add(career);
}
} }
public static class VillagerCareer
{
private VillagerProfession profession;
private String name;
private int id;
public VillagerCareer(VillagerProfession parent, String name)
{
this.profession = parent;
this.name = name;
parent.register(this);
}
private VillagerCareer init(EntityVillager.ITradeList[][] traids)
{
return this;
}
@Override
public boolean equals(Object o)
{
if (o == this) return true;
if (!(o instanceof VillagerCareer)) return false;
VillagerCareer oc = (VillagerCareer)o;
return name.equals(oc.name) && profession == oc.profession;
}
}
/**
* Hook called when spawning a Villager, sets it's profession to a random registered profession.
*
* @param entity The new entity
* @param rand The world's RNG
*/
public static void setRandomProfession(EntityVillager entity, Random rand)
{
//TODO: Grab id range from internal registry
entity.setProfession(rand.nextInt(5));
}
//TODO: Figure out a good generic system for this. Put on hold for Patches.
} }

View file

@ -489,7 +489,6 @@ public class CoreModManager {
return null; return null;
} }
@SuppressWarnings("unused")
private static void sortCoreMods() private static void sortCoreMods()
{ {
TopologicalSort.DirectedGraph<FMLPluginWrapper> sortGraph = new TopologicalSort.DirectedGraph<FMLPluginWrapper>(); TopologicalSort.DirectedGraph<FMLPluginWrapper> sortGraph = new TopologicalSort.DirectedGraph<FMLPluginWrapper>();

View file

@ -25,7 +25,6 @@ public class ReflectionHelper
public static class UnableToFindMethodException extends RuntimeException public static class UnableToFindMethodException extends RuntimeException
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@SuppressWarnings("unused")
private String[] methodNames; private String[] methodNames;
public UnableToFindMethodException(String[] methodNames, Exception failed) public UnableToFindMethodException(String[] methodNames, Exception failed)
@ -39,7 +38,6 @@ public class ReflectionHelper
public static class UnableToFindClassException extends RuntimeException public static class UnableToFindClassException extends RuntimeException
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@SuppressWarnings("unused")
private String[] classNames; private String[] classNames;
public UnableToFindClassException(String[] classNames, Exception err) public UnableToFindClassException(String[] classNames, Exception err)
@ -53,7 +51,6 @@ public class ReflectionHelper
public static class UnableToAccessFieldException extends RuntimeException public static class UnableToAccessFieldException extends RuntimeException
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@SuppressWarnings("unused")
private String[] fieldNameList; private String[] fieldNameList;
public UnableToAccessFieldException(String[] fieldNames, Exception e) public UnableToAccessFieldException(String[] fieldNames, Exception e)
@ -66,7 +63,6 @@ public class ReflectionHelper
public static class UnableToFindFieldException extends RuntimeException public static class UnableToFindFieldException extends RuntimeException
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@SuppressWarnings("unused")
private String[] fieldNameList; private String[] fieldNameList;
public UnableToFindFieldException(String[] fieldNameList, Exception e) public UnableToFindFieldException(String[] fieldNameList, Exception e)
{ {

Some files were not shown because too many files have changed in this diff Show more