ForgePatch/patches/minecraft/net/minecraft/client/Minecraft.java.patch
LexManos ca72710937 Initial 1.13.2 update. Major thing to note is that Dimensions have been completely revamped.
DimensionType is not unique per Dimension. See DimensionManager for more details.
Vanilla now has a chunk loading system, so Forge's will need to be deprecated/adapted.
2019-02-14 15:08:53 -08:00

398 lines
20 KiB
Diff

--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -322,7 +322,6 @@
this.field_152355_az = (new YggdrasilAuthenticationService(this.field_110453_aa, UUID.randomUUID().toString())).createMinecraftSessionService();
this.field_71449_j = p_i45547_1_.field_178745_a.field_178752_a;
field_147123_G.info("Setting user: {}", (Object)this.field_71449_j.func_111285_a());
- field_147123_G.debug("(Session ID is {})", (Object)this.field_71449_j.func_111286_b());
this.field_71459_aj = p_i45547_1_.field_178741_d.field_178756_a;
this.field_147129_ai = func_147122_X();
this.field_71437_Z = null;
@@ -409,9 +408,11 @@
this.field_135017_as = new LanguageManager(this.field_71474_y.field_74363_ab);
this.field_110451_am.func_199006_a(this.field_135017_as);
this.field_71474_y.func_198017_a(this.field_110448_aq);
+ net.minecraftforge.fml.client.ClientModLoader.begin(this, this.field_110448_aq, this.field_110451_am, this.field_195554_ax);
this.func_110436_a();
this.field_71446_o = new TextureManager(this.field_110451_am);
this.field_110451_am.func_199006_a(this.field_71446_o);
+ //net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(this.textureManager);
this.field_195558_d.func_198098_h();
this.func_147108_a(new GuiScreenLoading());
this.func_195547_ap();
@@ -429,6 +430,8 @@
this.field_110451_am.func_199006_a(new GrassColorReloadListener());
this.field_110451_am.func_199006_a(new FoliageColorReloadListener());
+ try (net.minecraftforge.fml.common.progress.ProgressBar bar = net.minecraftforge.fml.common.progress.StartupProgressManager.start("Rendering Setup", 5, true)) {
+ bar.step("GL Setup");
this.field_195558_d.func_198076_a("Startup");
GlStateManager.func_179098_w();
GlStateManager.func_179103_j(7425);
@@ -442,19 +445,24 @@
GlStateManager.func_179096_D();
GlStateManager.func_179128_n(5888);
this.field_195558_d.func_198076_a("Post startup");
+ bar.step("Loading Texture Map");
this.field_147128_au = new TextureMap("textures");
this.field_147128_au.func_147633_a(this.field_71474_y.field_151442_I);
this.field_71446_o.func_110580_a(TextureMap.field_110575_b, this.field_147128_au);
this.field_71446_o.func_110577_a(TextureMap.field_110575_b);
this.field_147128_au.func_174937_a(false, this.field_71474_y.field_151442_I > 0);
+ bar.step("Loading Model Manager");
this.field_175617_aL = new ModelManager(this.field_147128_au);
this.field_110451_am.func_199006_a(this.field_175617_aL);
this.field_184127_aH = BlockColors.func_186723_a();
this.field_184128_aI = ItemColors.func_186729_a(this.field_184127_aH);
+ bar.step("Loading Item Renderer");
this.field_175621_X = new ItemRenderer(this.field_71446_o, this.field_175617_aL, this.field_184128_aI);
this.field_175616_W = new RenderManager(this.field_71446_o, this.field_175621_X);
this.field_175620_Y = new FirstPersonRenderer(this);
this.field_110451_am.func_199006_a(this.field_175621_X);
+ bar.step("Loading Entity Renderer");
+ //net.minecraftforge.fml.client.SplashProgress.pause();
this.field_71460_t = new GameRenderer(this, this.field_110451_am);
this.field_110451_am.func_199006_a(this.field_71460_t);
this.field_175618_aM = new BlockRendererDispatcher(this.field_175617_aL.func_174954_c(), this.field_184127_aH);
@@ -465,7 +473,10 @@
this.field_110451_am.func_199006_a(this.field_193995_ae);
GlStateManager.func_179083_b(0, 0, this.field_195558_d.func_198109_k(), this.field_195558_d.func_198091_l());
this.field_71452_i = new ParticleManager(this.field_71441_e, this.field_71446_o);
- this.field_71456_v = new GuiIngame(this);
+ //net.minecraftforge.fml.client.SplashProgress.resume();
+ }; // Forge: end progress bar
+ net.minecraftforge.fml.client.ClientModLoader.end();
+ this.field_71456_v = new net.minecraftforge.client.GuiIngameForge(this);
if (this.field_71475_ae != null) {
this.func_147108_a(new GuiConnecting(new GuiMainMenu(), this, this.field_71475_ae, this.field_71477_af));
} else {
@@ -474,6 +485,7 @@
this.field_184132_p = new DebugRenderer(this);
GLFW.glfwSetErrorCallback(this::func_195545_a).free();
+ net.minecraftforge.fml.client.ClientModLoader.complete();
if (this.field_71474_y.field_74353_u && !this.field_195558_d.func_198113_j()) {
this.field_195558_d.func_198077_g();
}
@@ -489,7 +501,7 @@
});
List<String> list = Lists.newArrayList();
GLFWErrorCallback glfwerrorcallback = GLFW.glfwSetErrorCallback((p_211100_1_, p_211100_2_) -> {
- list.add(String.format("GLFW error during init: [0x%X]%s", p_211100_1_, p_211100_2_));
+ list.add(String.format("GLFW error during init: [0x%X] %s", p_211100_1_, GLFWErrorCallback.getDescription(p_211100_2_)));
});
if (!GLFW.glfwInit()) {
throw new IllegalStateException("Failed to initialize GLFW, errors: " + Joiner.on(",").join(list));
@@ -599,7 +611,7 @@
Bootstrap.func_179870_a(p_71377_1_.func_71502_e());
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);
+ net.minecraftforge.fml.server.ServerLifecycleHooks.handleExit(-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);
@@ -614,6 +626,7 @@
return this.field_71474_y.field_211842_aO;
}
+ @Deprecated // Forge: Use selective refreshResources method in FMLClientHandler
public void func_110436_a() {
this.field_110448_aq.func_198983_a();
List<IResourcePack> list = this.field_110448_aq.func_198980_d().stream().map(ResourcePackInfo::func_195796_e).collect(Collectors.toList());
@@ -668,16 +681,20 @@
}
public void func_147108_a(@Nullable 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();
} else if (p_147108_1_ == null && this.field_71439_g.func_110143_aJ() <= 0.0F) {
p_147108_1_ = new GuiGameOver((ITextComponent)null);
}
+ 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.getGui();
+ if (old != null && p_147108_1_ != old)
+ old.func_146281_b();
+
if (p_147108_1_ instanceof GuiMainMenu || p_147108_1_ instanceof GuiMultiplayer) {
this.field_71474_y.field_74330_P = false;
this.field_71456_v.func_146158_b().func_146231_a(true);
@@ -761,7 +778,7 @@
GLFW.glfwPollEvents();
long i1 = Util.func_211178_c() - l;
this.field_71424_I.func_76318_c("sound");
- this.field_147127_av.func_147691_a(this.field_71439_g, this.field_71428_T.field_194147_b);
+ this.field_147127_av.setListener(this.func_175606_aa(), this.field_71428_T.field_194147_b); //Forge: MC-46445 Spectator mode particles and sounds computed from where you have been before
this.field_71424_I.func_76319_b();
this.field_71424_I.func_76320_a("render");
GlStateManager.func_179094_E();
@@ -771,11 +788,13 @@
GlStateManager.func_179098_w();
this.field_71424_I.func_76319_b();
if (!this.field_71454_w) {
+ net.minecraftforge.fml.hooks.BasicEventHooks.onRenderTickStart(this.field_71428_T.field_194147_b);
this.field_71424_I.func_76318_c("gameRenderer");
this.field_71460_t.func_195458_a(this.field_71445_n ? this.field_193996_ah : this.field_71428_T.field_194147_b, i, p_195542_1_);
this.field_71424_I.func_76318_c("toasts");
this.field_193034_aS.func_195625_a();
this.field_71424_I.func_76319_b();
+ net.minecraftforge.fml.hooks.BasicEventHooks.onRenderTickEnd(this.field_71428_T.field_194147_b);
}
this.field_71424_I.func_76319_b();
@@ -994,8 +1013,8 @@
if (this.field_71429_W <= 0 && !this.field_71439_g.func_184587_cr()) {
if (p_147115_1_ && this.field_71476_x != null && this.field_71476_x.field_72313_a == RayTraceResult.Type.BLOCK) {
BlockPos blockpos = this.field_71476_x.func_178782_a();
- if (!this.field_71441_e.func_180495_p(blockpos).func_196958_f() && 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);
+ if (!this.field_71441_e.func_175623_d(blockpos) && this.field_71442_b.func_180512_c(blockpos, this.field_71476_x.field_178784_b)) {
+ this.field_71452_i.addBlockHitEffects(blockpos, this.field_71476_x);
this.field_71439_g.func_184609_a(EnumHand.MAIN_HAND);
}
@@ -1020,7 +1039,7 @@
break;
case BLOCK:
BlockPos blockpos = this.field_71476_x.func_178782_a();
- if (!this.field_71441_e.func_180495_p(blockpos).func_196958_f()) {
+ if (!this.field_71441_e.func_175623_d(blockpos)) {
this.field_71442_b.func_180511_b(blockpos, this.field_71476_x.field_178784_b);
break;
}
@@ -1030,6 +1049,7 @@
}
this.field_71439_g.func_184821_cY();
+ net.minecraftforge.common.ForgeHooks.onEmptyLeftClick(this.field_71439_g);
}
this.field_71439_g.func_184609_a(EnumHand.MAIN_HAND);
@@ -1060,7 +1080,7 @@
break;
case BLOCK:
BlockPos blockpos = this.field_71476_x.func_178782_a();
- if (!this.field_71441_e.func_180495_p(blockpos).func_196958_f()) {
+ if (!this.field_71441_e.func_180495_p(blockpos).isAir(field_71441_e, blockpos)) {
int i = itemstack.func_190916_E();
EnumActionResult enumactionresult = this.field_71442_b.func_187099_a(this.field_71439_g, this.field_71441_e, blockpos, this.field_71476_x.field_178784_b, this.field_71476_x.field_72307_f, enumhand);
if (enumactionresult == EnumActionResult.SUCCESS) {
@@ -1079,6 +1099,9 @@
}
}
+ if (itemstack.func_190926_b() && (this.field_71476_x == null || this.field_71476_x.field_72313_a == RayTraceResult.Type.MISS))
+ net.minecraftforge.common.ForgeHooks.onEmptyClick(this.field_71439_g, enumhand);
+
if (!itemstack.func_190926_b() && this.field_71442_b.func_187101_a(this.field_71439_g, this.field_71441_e, enumhand) == EnumActionResult.SUCCESS) {
this.field_71460_t.field_78516_c.func_187460_a(enumhand);
return;
@@ -1098,6 +1121,8 @@
--this.field_71467_ac;
}
+ net.minecraftforge.fml.hooks.BasicEventHooks.onPreClientTick();
+
this.field_71424_I.func_76320_a("gui");
if (!this.field_71445_n) {
this.field_71456_v.func_73831_a();
@@ -1220,6 +1245,8 @@
this.field_71424_I.func_76318_c("keyboard");
this.field_195559_v.func_204870_b();
this.field_71424_I.func_76319_b();
+
+ net.minecraftforge.fml.hooks.BasicEventHooks.onPostClientTick();
}
private void func_184117_aA() {
@@ -1396,8 +1423,14 @@
NetworkManager networkmanager = NetworkManager.func_150722_a(socketaddress);
networkmanager.func_150719_a(new NetHandlerLoginClient(networkmanager, this, (GuiScreen)null, (p_209507_0_) -> {
}));
+ net.minecraftforge.fml.network.NetworkHooks.registerClientLoginChannel(networkmanager);
networkmanager.func_179290_a(new CPacketHandshake(socketaddress.toString(), 0, EnumConnectionState.LOGIN));
- networkmanager.func_179290_a(new CPacketLoginStart(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 CPacketLoginStart(gameProfile));
this.field_71453_ak = networkmanager;
}
@@ -1411,6 +1444,7 @@
}
public void func_205055_a(@Nullable WorldClient p_205055_1_, GuiScreen p_205055_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_205055_1_ == null) {
NetHandlerPlayClient nethandlerplayclient = this.func_147114_u();
if (nethandlerplayclient != null) {
@@ -1447,6 +1481,7 @@
}
TileEntityRendererDispatcher.field_147556_a.func_147543_a(p_205055_1_);
+ net.minecraftforge.client.MinecraftForgeClient.clearRenderCache();
if (p_205055_1_ != null) {
if (!this.field_71455_al) {
AuthenticationService authenticationservice = new YggdrasilAuthenticationService(this.field_110453_aa, UUID.randomUUID().toString());
@@ -1493,6 +1528,7 @@
EntityPlayerSP entityplayersp = this.field_71439_g;
this.field_71439_g = this.field_71442_b.func_199681_a(this.field_71441_e, this.field_71439_g == null ? new StatisticsManager() : this.field_71439_g.func_146107_m(), this.field_71439_g == null ? new RecipeBookClient(new RecipeManager()) : this.field_71439_g.func_199507_B());
this.field_71439_g.func_184212_Q().func_187218_a(entityplayersp.func_184212_Q().func_187231_c());
+ this.field_71439_g.updateSyncFields(entityplayersp); // Forge: fix MC-10657
this.field_71439_g.field_71093_bK = p_212315_1_;
this.field_175622_Z = this.field_71439_g;
this.field_71439_g.func_70065_x();
@@ -1532,110 +1568,8 @@
private void func_147112_ai() {
if (this.field_71476_x != null && this.field_71476_x.field_72313_a != RayTraceResult.Type.MISS) {
- boolean flag = this.field_71439_g.field_71075_bZ.field_75098_d;
- TileEntity tileentity = null;
- ItemStack itemstack;
- if (this.field_71476_x.field_72313_a == RayTraceResult.Type.BLOCK) {
- BlockPos blockpos = this.field_71476_x.func_178782_a();
- IBlockState iblockstate = this.field_71441_e.func_180495_p(blockpos);
- Block block = iblockstate.func_177230_c();
- if (iblockstate.func_196958_f()) {
- return;
- }
-
- itemstack = block.func_185473_a(this.field_71441_e, blockpos, iblockstate);
- if (itemstack.func_190926_b()) {
- return;
- }
-
- if (flag && GuiScreen.func_146271_m() && block.func_149716_u()) {
- tileentity = this.field_71441_e.func_175625_s(blockpos);
- }
- } else {
- if (this.field_71476_x.field_72313_a != RayTraceResult.Type.ENTITY || this.field_71476_x.field_72308_g == null || !flag) {
- return;
- }
-
- if (this.field_71476_x.field_72308_g instanceof EntityPainting) {
- itemstack = new ItemStack(Items.field_151159_an);
- } else if (this.field_71476_x.field_72308_g instanceof EntityLeashKnot) {
- itemstack = new ItemStack(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 itemstack1 = entityitemframe.func_82335_i();
- if (itemstack1.func_190926_b()) {
- itemstack = new ItemStack(Items.field_151160_bD);
- } else {
- itemstack = itemstack1.func_77946_l();
- }
- } else if (this.field_71476_x.field_72308_g instanceof EntityMinecart) {
- EntityMinecart entityminecart = (EntityMinecart)this.field_71476_x.field_72308_g;
- Item item;
- switch(entityminecart.func_184264_v()) {
- case FURNACE:
- item = Items.field_151109_aJ;
- break;
- case CHEST:
- item = Items.field_151108_aI;
- break;
- case TNT:
- item = Items.field_151142_bV;
- break;
- case HOPPER:
- item = Items.field_151140_bW;
- break;
- case COMMAND_BLOCK:
- item = Items.field_151095_cc;
- break;
- default:
- item = Items.field_151143_au;
- }
-
- itemstack = new ItemStack(item);
- } else if (this.field_71476_x.field_72308_g instanceof EntityBoat) {
- itemstack = new ItemStack(((EntityBoat)this.field_71476_x.field_72308_g).func_184455_j());
- } else if (this.field_71476_x.field_72308_g instanceof EntityArmorStand) {
- itemstack = new ItemStack(Items.field_179565_cj);
- } else if (this.field_71476_x.field_72308_g instanceof EntityEnderCrystal) {
- itemstack = new ItemStack(Items.field_185158_cP);
- } else {
- ItemSpawnEgg itemspawnegg = ItemSpawnEgg.func_200889_b(this.field_71476_x.field_72308_g.func_200600_R());
- if (itemspawnegg == null) {
- return;
- }
-
- itemstack = new ItemStack(itemspawnegg);
- }
- }
-
- if (itemstack.func_190926_b()) {
- String s = "";
- if (this.field_71476_x.field_72313_a == RayTraceResult.Type.BLOCK) {
- s = IRegistry.field_212618_g.func_177774_c(this.field_71441_e.func_180495_p(this.field_71476_x.func_178782_a()).func_177230_c()).toString();
- } else if (this.field_71476_x.field_72313_a == RayTraceResult.Type.ENTITY) {
- s = IRegistry.field_212629_r.func_177774_c(this.field_71476_x.field_72308_g.func_200600_R()).toString();
- }
-
- field_147123_G.warn("Picking on: [{}] {} gave null item", this.field_71476_x.field_72313_a, s);
- } else {
- InventoryPlayer inventoryplayer = this.field_71439_g.field_71071_by;
- if (tileentity != null) {
- this.func_184119_a(itemstack, tileentity);
- }
-
- int i = inventoryplayer.func_184429_b(itemstack);
- if (flag) {
- inventoryplayer.func_184434_a(itemstack);
- this.field_71442_b.func_78761_a(this.field_71439_g.func_184586_b(EnumHand.MAIN_HAND), 36 + inventoryplayer.field_70461_c);
- } else if (i != -1) {
- if (InventoryPlayer.func_184435_e(i)) {
- inventoryplayer.field_70461_c = i;
- } else {
- this.field_71442_b.func_187100_a(i);
- }
- }
-
- }
+ net.minecraftforge.common.ForgeHooks.onPickBlock(this.field_71476_x, this.field_71439_g, this.field_71441_e);
+ // We delete this code wholly instead of commenting it out, to make sure we detect changes in it between MC versions
}
}
@@ -1712,6 +1646,7 @@
return field_71432_P;
}
+ @Deprecated // Forge: Use selective scheduleResourceRefresh method in FMLClientHandler
public ListenableFuture<Object> func_175603_A() {
return this.func_152344_a(this::func_110436_a);
}
@@ -1871,6 +1806,8 @@
}
public MusicTicker.MusicType func_147109_W() {
+ MusicTicker.MusicType type = this.field_71441_e == null || this.field_71441_e.field_73011_w == null ? null : this.field_71441_e.field_73011_w.getMusicType();
+ if (type != null) return type;
if (this.field_71462_r instanceof GuiWinGame) {
return MusicTicker.MusicType.CREDITS;
} else if (this.field_71439_g == null) {
@@ -2010,4 +1947,12 @@
public FontResourceManager func_211500_ak() {
return this.field_211501_aD;
}
+
+ public ItemColors getItemColors() {
+ return this.field_184128_aI;
+ }
+
+ public SearchTreeManager getSearchTreeManager() {
+ return this.field_193995_ae;
+ }
}