mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 00:37:52 +00:00
298 lines
13 KiB
Diff
298 lines
13 KiB
Diff
--- ../src-base/minecraft/net/minecraft/client/Minecraft.java
|
|
+++ ../src-work/minecraft/net/minecraft/client/Minecraft.java
|
|
@@ -296,7 +296,6 @@
|
|
this.field_152355_az = (new YggdrasilAuthenticationService(p_i45547_1_.field_178745_a.field_178751_c, UUID.randomUUID().toString())).createMinecraftSessionService();
|
|
this.field_71449_j = p_i45547_1_.field_178745_a.field_178752_a;
|
|
field_147123_G.info("Setting user: " + this.field_71449_j.func_111285_a());
|
|
- field_147123_G.info("(Session ID is " + this.field_71449_j.func_111286_b() + ")");
|
|
this.field_71459_aj = p_i45547_1_.field_178741_d.field_178756_a;
|
|
this.field_71443_c = p_i45547_1_.field_178743_b.field_178764_a > 0 ? p_i45547_1_.field_178743_b.field_178764_a : 1;
|
|
this.field_71440_d = p_i45547_1_.field_178743_b.field_178762_b > 0 ? p_i45547_1_.field_178743_b.field_178762_b : 1;
|
|
@@ -449,7 +448,7 @@
|
|
}
|
|
});
|
|
this.field_71417_B = new MouseHelper();
|
|
- net.minecraftforge.fml.common.ProgressManager.ProgressBar bar= net.minecraftforge.fml.common.ProgressManager.push("Rendering Setup", 9);
|
|
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar= net.minecraftforge.fml.common.ProgressManager.push("Rendering Setup", 5);
|
|
bar.step("GL Setup");
|
|
this.func_71361_d("Pre startup");
|
|
GlStateManager.func_179098_w();
|
|
@@ -491,7 +490,7 @@
|
|
net.minecraftforge.fml.common.ProgressManager.pop(bar);
|
|
net.minecraftforge.fml.client.FMLClientHandler.instance().finishMinecraftLoading();
|
|
this.func_71361_d("Post startup");
|
|
- this.field_71456_v = new GuiIngame(this);
|
|
+ this.field_71456_v = new net.minecraftforge.client.GuiIngameForge(this);
|
|
|
|
if (this.field_71475_ae != null)
|
|
{
|
|
@@ -898,11 +897,6 @@
|
|
|
|
public void func_147108_a(GuiScreen p_147108_1_)
|
|
{
|
|
- if (this.field_71462_r != null)
|
|
- {
|
|
- this.field_71462_r.func_146281_b();
|
|
- }
|
|
-
|
|
if (p_147108_1_ == null && this.field_71441_e == null)
|
|
{
|
|
p_147108_1_ = new GuiMainMenu();
|
|
@@ -912,6 +906,17 @@
|
|
p_147108_1_ = new GuiGameOver();
|
|
}
|
|
|
|
+ GuiScreen old = this.field_71462_r;
|
|
+ net.minecraftforge.client.event.GuiOpenEvent event = new net.minecraftforge.client.event.GuiOpenEvent(p_147108_1_);
|
|
+
|
|
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) return;
|
|
+
|
|
+ p_147108_1_ = event.gui;
|
|
+ if (old != null && p_147108_1_ != old)
|
|
+ {
|
|
+ old.func_146281_b();
|
|
+ }
|
|
+
|
|
if (p_147108_1_ instanceof GuiMainMenu)
|
|
{
|
|
this.field_71474_y.field_74330_P = false;
|
|
@@ -1395,7 +1400,7 @@
|
|
|
|
if (this.field_71441_e.func_180495_p(blockpos).func_177230_c().func_149688_o() != Material.field_151579_a && this.field_71442_b.func_180512_c(blockpos, this.field_71476_x.field_178784_b))
|
|
{
|
|
- this.field_71452_i.func_180532_a(blockpos, this.field_71476_x.field_178784_b);
|
|
+ this.field_71452_i.addBlockHitEffects(blockpos, this.field_71476_x);
|
|
this.field_71439_g.func_71038_i();
|
|
}
|
|
}
|
|
@@ -1475,15 +1480,19 @@
|
|
case 2:
|
|
BlockPos blockpos = this.field_71476_x.func_178782_a();
|
|
|
|
- if (this.field_71441_e.func_180495_p(blockpos).func_177230_c().func_149688_o() != Material.field_151579_a)
|
|
+ if (!this.field_71441_e.func_175623_d(blockpos))
|
|
{
|
|
int i = itemstack != null ? itemstack.field_77994_a : 0;
|
|
|
|
+
|
|
+ boolean result = !net.minecraftforge.event.ForgeEventFactory.onPlayerInteract(field_71439_g, net.minecraftforge.event.entity.player.PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK, this.field_71441_e, blockpos, this.field_71476_x.field_178784_b).isCanceled();
|
|
+ if (result) { //Forge: Kept separate to simplify patch
|
|
if (this.field_71442_b.func_178890_a(this.field_71439_g, this.field_71441_e, itemstack, blockpos, this.field_71476_x.field_178784_b, this.field_71476_x.field_72307_f))
|
|
{
|
|
flag = false;
|
|
this.field_71439_g.func_71038_i();
|
|
}
|
|
+ }
|
|
|
|
if (itemstack == null)
|
|
{
|
|
@@ -1704,6 +1713,8 @@
|
|
|
|
while (Mouse.next())
|
|
{
|
|
+ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue;
|
|
+
|
|
i = Mouse.getEventButton();
|
|
KeyBinding.func_74510_a(i - 100, Mouse.getEventButtonState());
|
|
|
|
@@ -2213,7 +2224,13 @@
|
|
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, true));
|
|
- networkmanager.func_179290_a(new C00PacketLoginStart(this.func_110432_I().func_148256_e()));
|
|
+ com.mojang.authlib.GameProfile gameProfile = this.func_110432_I().func_148256_e();
|
|
+ if (!this.func_110432_I().hasCachedProperties())
|
|
+ {
|
|
+ gameProfile = field_152355_az.fillProfileProperties(gameProfile, true); //Forge: Fill profile properties upon game load. Fixes MC-52974.
|
|
+ this.func_110432_I().setProperties(gameProfile.getProperties());
|
|
+ }
|
|
+ networkmanager.func_179290_a(new C00PacketLoginStart(gameProfile));
|
|
this.field_71453_ak = networkmanager;
|
|
}
|
|
|
|
@@ -2224,6 +2241,8 @@
|
|
|
|
public void func_71353_a(WorldClient p_71353_1_, String p_71353_2_)
|
|
{
|
|
+ if (field_71441_e != null) net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Unload(field_71441_e));
|
|
+
|
|
if (p_71353_1_ == null)
|
|
{
|
|
NetHandlerPlayClient nethandlerplayclient = this.func_147114_u();
|
|
@@ -2237,6 +2256,18 @@
|
|
{
|
|
this.field_71437_Z.func_71263_m();
|
|
this.field_71437_Z.func_175592_a();
|
|
+ if (field_71461_s != null)
|
|
+ {
|
|
+ this.field_71461_s.func_73719_c(I18n.func_135052_a("forge.client.shutdown.internal"));
|
|
+ }
|
|
+ while (!field_71437_Z.func_71241_aa())
|
|
+ {
|
|
+ try
|
|
+ {
|
|
+ Thread.sleep(10);
|
|
+ }
|
|
+ catch (InterruptedException ie) {}
|
|
+ }
|
|
}
|
|
|
|
this.field_71437_Z = null;
|
|
@@ -2368,134 +2399,11 @@
|
|
if (this.field_71476_x != null)
|
|
{
|
|
boolean flag = this.field_71439_g.field_71075_bZ.field_75098_d;
|
|
- int i = 0;
|
|
- boolean flag1 = false;
|
|
- TileEntity tileentity = null;
|
|
- Object object;
|
|
|
|
- if (this.field_71476_x.field_72313_a == MovingObjectPosition.MovingObjectType.BLOCK)
|
|
- {
|
|
- BlockPos blockpos = this.field_71476_x.func_178782_a();
|
|
- Block block = this.field_71441_e.func_180495_p(blockpos).func_177230_c();
|
|
-
|
|
- if (block.func_149688_o() == Material.field_151579_a)
|
|
- {
|
|
- return;
|
|
- }
|
|
-
|
|
- object = block.func_180665_b(this.field_71441_e, blockpos);
|
|
-
|
|
- if (object == null)
|
|
- {
|
|
- return;
|
|
- }
|
|
-
|
|
- if (flag && GuiScreen.func_146271_m())
|
|
- {
|
|
- tileentity = this.field_71441_e.func_175625_s(blockpos);
|
|
- }
|
|
-
|
|
- Block block1 = object instanceof ItemBlock && !block.func_149648_K() ? Block.func_149634_a((Item)object) : block;
|
|
- i = block1.func_176222_j(this.field_71441_e, blockpos);
|
|
- flag1 = ((Item)object).func_77614_k();
|
|
- }
|
|
- else
|
|
- {
|
|
- if (this.field_71476_x.field_72313_a != MovingObjectPosition.MovingObjectType.ENTITY || this.field_71476_x.field_72308_g == null || !flag)
|
|
- {
|
|
- return;
|
|
- }
|
|
-
|
|
- if (this.field_71476_x.field_72308_g instanceof EntityPainting)
|
|
- {
|
|
- object = Items.field_151159_an;
|
|
- }
|
|
- else if (this.field_71476_x.field_72308_g instanceof EntityLeashKnot)
|
|
- {
|
|
- object = Items.field_151058_ca;
|
|
- }
|
|
- else if (this.field_71476_x.field_72308_g instanceof EntityItemFrame)
|
|
- {
|
|
- EntityItemFrame entityitemframe = (EntityItemFrame)this.field_71476_x.field_72308_g;
|
|
- ItemStack itemstack = entityitemframe.func_82335_i();
|
|
-
|
|
- if (itemstack == null)
|
|
- {
|
|
- object = Items.field_151160_bD;
|
|
- }
|
|
- else
|
|
- {
|
|
- object = itemstack.func_77973_b();
|
|
- i = itemstack.func_77960_j();
|
|
- flag1 = true;
|
|
- }
|
|
- }
|
|
- else if (this.field_71476_x.field_72308_g instanceof EntityMinecart)
|
|
- {
|
|
- EntityMinecart entityminecart = (EntityMinecart)this.field_71476_x.field_72308_g;
|
|
-
|
|
- switch (Minecraft.SwitchEnumMinecartType.field_178901_b[entityminecart.func_180456_s().ordinal()])
|
|
- {
|
|
- case 1:
|
|
- object = Items.field_151109_aJ;
|
|
- break;
|
|
- case 2:
|
|
- object = Items.field_151108_aI;
|
|
- break;
|
|
- case 3:
|
|
- object = Items.field_151142_bV;
|
|
- break;
|
|
- case 4:
|
|
- object = Items.field_151140_bW;
|
|
- break;
|
|
- case 5:
|
|
- object = Items.field_151095_cc;
|
|
- break;
|
|
- default:
|
|
- object = Items.field_151143_au;
|
|
- }
|
|
- }
|
|
- else if (this.field_71476_x.field_72308_g instanceof EntityBoat)
|
|
- {
|
|
- object = Items.field_151124_az;
|
|
- }
|
|
- else if (this.field_71476_x.field_72308_g instanceof EntityArmorStand)
|
|
- {
|
|
- object = Items.field_179565_cj;
|
|
- }
|
|
- else
|
|
- {
|
|
- object = Items.field_151063_bx;
|
|
- i = EntityList.func_75619_a(this.field_71476_x.field_72308_g);
|
|
- flag1 = true;
|
|
-
|
|
- if (!EntityList.field_75627_a.containsKey(Integer.valueOf(i)))
|
|
- {
|
|
- return;
|
|
- }
|
|
- }
|
|
- }
|
|
-
|
|
InventoryPlayer inventoryplayer = this.field_71439_g.field_71071_by;
|
|
|
|
- if (tileentity == null)
|
|
- {
|
|
- inventoryplayer.func_146030_a((Item)object, i, flag1, flag);
|
|
- }
|
|
- else
|
|
- {
|
|
- NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
|
- tileentity.func_145841_b(nbttagcompound1);
|
|
- ItemStack itemstack1 = new ItemStack((Item)object, 1, i);
|
|
- itemstack1.func_77983_a("BlockEntityTag", nbttagcompound1);
|
|
- NBTTagCompound nbttagcompound = new NBTTagCompound();
|
|
- NBTTagList nbttaglist = new NBTTagList();
|
|
- nbttaglist.func_74742_a(new NBTTagString("(+NBT)"));
|
|
- nbttagcompound.func_74782_a("Lore", nbttaglist);
|
|
- itemstack1.func_77983_a("display", nbttagcompound);
|
|
- inventoryplayer.func_70299_a(inventoryplayer.field_70461_c, itemstack1);
|
|
- }
|
|
-
|
|
+ if (!net.minecraftforge.common.ForgeHooks.onPickBlock(this.field_71476_x, this.field_71439_g, this.field_71441_e)) return;
|
|
+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions
|
|
if (flag)
|
|
{
|
|
int j = this.field_71439_g.field_71069_bz.field_75151_b.size() - 9 + inventoryplayer.field_70461_c;
|
|
@@ -2751,8 +2659,11 @@
|
|
p_70001_1_.func_152767_b("gl_max_texture_size", Integer.valueOf(func_71369_N()));
|
|
}
|
|
|
|
+ //Forge: Adds a optimization to the getGLMaximumTextureSize, only calculate it once.
|
|
+ private static int max_texture_size = -1;
|
|
public static int func_71369_N()
|
|
{
|
|
+ if (max_texture_size != -1) return max_texture_size;
|
|
for (int i = 16384; i > 0; i >>= 1)
|
|
{
|
|
GL11.glTexImage2D(GL11.GL_PROXY_TEXTURE_2D, 0, GL11.GL_RGBA, i, i, 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, (ByteBuffer)null);
|
|
@@ -2760,6 +2671,7 @@
|
|
|
|
if (j != 0)
|
|
{
|
|
+ max_texture_size = i;
|
|
return i;
|
|
}
|
|
}
|