Most client patches done except the render pipeline.

Someone who has more in depth knowledge of that rendering system will need to do it.
This commit is contained in:
LexManos committed 2018-11-28 22:15:05 -08:00
1 parent b687180e12
commit bf9158172f
109 files changed
+1597 -2275

No files matched your search

@@ -81,7 +81,7 @@
+ private boolean needsBlockModelRefresh = false;
+ public void onGuiClosed() {
+ if (needsBlockModelRefresh) {
+ this.field_74317_L.func_152344_a(() -> net.minecraftforge.client.ForgeHooksClient.refreshResources(this.field_74317_L, net.minecraftforge.client.resource.VanillaResourceType.MODELS));
+ this.field_74317_L.func_152344_a(() -> net.minecraftforge.client.ForgeHooksClient.refreshResources(this.field_74317_L, net.minecraftforge.resource.VanillaResourceType.MODELS));
+ this.needsBlockModelRefresh = false;
+ }
+ }
@@ -1,6 +1,14 @@
--- a/net/minecraft/client/Minecraft.java
+++ b/net/minecraft/client/Minecraft.java
@@ -405,6 +405,7 @@
@@ -318,7 +318,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;
@@ -405,9 +404,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);
@@ -8,15 +16,57 @@
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);
@@ -461,6 +462,7 @@
+ //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();
@@ -425,6 +426,8 @@
this.field_110451_am.func_199006_a(new GrassColorReloadListener());
this.field_110451_am.func_199006_a(new FoliageColorReloadListener());
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("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);
@@ -438,19 +441,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 EntityRenderer(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);
@@ -461,7 +469,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();
+ net.minecraftforge.fml.common.ProgressManager.pop(bar);
+ net.minecraftforge.fml.client.ClientModLoader.end();
this.field_71456_v = new GuiIngame(this);
+ 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));
@@ -470,6 +472,7 @@
} else {
@@ -470,6 +481,7 @@
this.field_184132_p = new DebugRenderer(this);
GLFW.glfwSetErrorCallback(this::func_195545_a).free();
@@ -24,7 +74,7 @@
if (this.field_71474_y.field_74353_u && !this.field_195558_d.func_198113_j()) {
this.field_195558_d.func_198077_g();
}
@@ -485,7 +488,7 @@
@@ -485,7 +497,7 @@
});
List<String> list = Lists.<String>newArrayList();
GLFWErrorCallback glfwerrorcallback = GLFW.glfwSetErrorCallback((p_211100_1_, p_211100_2_) -> {
@@ -33,11 +83,275 @@
});
if (!GLFW.glfwInit()) {
throw new IllegalStateException("Failed to initialize GLFW, errors: " + Joiner.on(",").join(list));
@@ -1392,6 +1395,7 @@
@@ -595,7 +607,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);
@@ -610,6 +622,7 @@
return this.field_71474_y.field_211842_aO;
}
+ @Deprecated // Forge: Use selective refreshResources method in FMLClientHandler
public void func_110436_a() {
List<IResourcePack> list = Lists.<IResourcePack>newArrayList();
this.field_110448_aq.func_198983_a();
@@ -667,16 +680,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);
@@ -760,7 +777,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();
@@ -992,8 +1009,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);
}
@@ -1018,7 +1035,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;
}
@@ -1028,6 +1045,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);
@@ -1077,6 +1095,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;
@@ -1392,8 +1413,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()));
- 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;
}
@@ -1407,6 +1434,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) {
@@ -1443,6 +1471,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());
@@ -1489,6 +1518,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_71354_1_;
this.field_175622_Z = this.field_71439_g;
this.field_71439_g.func_70065_x();
@@ -1528,110 +1558,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 = ((ResourceLocation)Block.field_149771_c.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 = ((ResourceLocation)EntityType.field_200787_a.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
}
}
@@ -1708,6 +1636,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);
}
@@ -1867,6 +1796,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) {
@@ -2006,4 +1937,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;
+ }
}
@@ -46,3 +46,13 @@
public void func_147689_b() {
this.field_147694_f.func_148610_e();
}
@@ -257,4 +273,9 @@
public void func_195478_a(@Nullable ResourceLocation p_195478_1_, @Nullable SoundCategory p_195478_2_) {
this.field_147694_f.func_195855_a(p_195478_1_, p_195478_2_);
}
+
+ @Override
+ public net.minecraftforge.resource.IResourceType getResourceType() {
+ return net.minecraftforge.resource.VanillaResourceType.SOUNDS;
+ }
}
@@ -5,7 +5,7 @@
GuiLanguage.this.field_146454_h.func_135045_a(language);
GuiLanguage.this.field_146451_g.field_74363_ab = language.func_135034_a();
- this.field_148161_k.func_110436_a();
+ net.minecraftforge.client.ForgeHooksClient.refreshResources(GuiLanguage.this.field_146297_k, net.minecraftforge.client.resource.VanillaResourceType.LANGUAGES);
+ net.minecraftforge.client.ForgeHooksClient.refreshResources(GuiLanguage.this.field_146297_k, net.minecraftforge.resource.VanillaResourceType.LANGUAGES);
GuiLanguage.this.field_146289_q.func_78275_b(GuiLanguage.this.field_146454_h.func_135044_b());
GuiLanguage.this.field_146452_r.field_146126_j = I18n.func_135052_a("gui.done");
GuiLanguage.this.field_211832_i.field_146126_j = GuiLanguage.this.field_146451_g.func_74297_c(GameSettings.Options.FORCE_UNICODE_FONT);
@@ -5,7 +5,7 @@
languagemanager.func_135045_a(language);
this.field_191888_F.field_71474_y.field_74363_ab = language.func_135034_a();
- this.field_191888_F.func_110436_a();
+ net.minecraftforge.client.ForgeHooksClient.refreshResources(this.field_191888_F, net.minecraftforge.client.resource.VanillaResourceType.LANGUAGES);
+ net.minecraftforge.client.ForgeHooksClient.refreshResources(this.field_191888_F, net.minecraftforge.resource.VanillaResourceType.LANGUAGES);
this.field_191888_F.field_71466_p.func_78275_b(languagemanager.func_135044_b());
this.field_191888_F.field_71474_y.func_74303_b();
}
@@ -0,0 +1,10 @@
--- a/net/minecraft/client/multiplayer/ChunkProviderClient.java
+++ b/net/minecraft/client/multiplayer/ChunkProviderClient.java
@@ -55,6 +55,7 @@
public Chunk func_73158_c(int p_73158_1_, int p_73158_2_) {
Chunk chunk = new Chunk(this.field_73235_d, p_73158_1_, p_73158_2_, new Biome[256]);
this.field_73236_b.put(ChunkPos.func_77272_a(p_73158_1_, p_73158_2_), chunk);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk));
chunk.func_177417_c(true);
return chunk;
}
@@ -0,0 +1,190 @@
--- a/net/minecraft/client/multiplayer/PlayerControllerMP.java
+++ b/net/minecraft/client/multiplayer/PlayerControllerMP.java
@@ -105,6 +105,8 @@
}
}
+ if (!field_78776_a.field_71439_g.func_184614_ca().onBlockStartBreak(p_187103_1_, field_78776_a.field_71439_g)) return false;
+
World world = this.field_78776_a.field_71441_e;
IBlockState iblockstate = world.func_180495_p(p_187103_1_);
if (!this.field_78776_a.field_71439_g.func_184614_ca().func_77973_b().func_195938_a(iblockstate, world, p_187103_1_, this.field_78776_a.field_71439_g)) {
@@ -116,24 +118,23 @@
} else if (iblockstate.func_196958_f()) {
return false;
} else {
- block.func_176208_a(world, p_187103_1_, iblockstate, this.field_78776_a.field_71439_g);
IFluidState ifluidstate = world.func_204610_c(p_187103_1_);
- boolean flag = world.func_180501_a(p_187103_1_, ifluidstate.func_206883_i(), 11);
- if (flag) {
- block.func_176206_d(world, p_187103_1_, iblockstate);
- }
this.field_178895_c = new BlockPos(this.field_178895_c.func_177958_n(), -1, this.field_178895_c.func_177952_p());
if (!this.field_78779_k.func_77145_d()) {
ItemStack itemstack1 = this.field_78776_a.field_71439_g.func_184614_ca();
+ ItemStack copyBeforeUse = itemstack1.func_77946_l();
if (!itemstack1.func_190926_b()) {
itemstack1.func_179548_a(world, iblockstate, p_187103_1_, this.field_78776_a.field_71439_g);
if (itemstack1.func_190926_b()) {
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_78776_a.field_71439_g, copyBeforeUse, EnumHand.MAIN_HAND);
this.field_78776_a.field_71439_g.func_184611_a(EnumHand.MAIN_HAND, ItemStack.field_190927_a);
}
}
}
+ boolean flag = block.removedByPlayer(iblockstate, world, p_187103_1_, field_78776_a.field_71439_g, false, ifluidstate);
+ if (flag) block.func_176206_d(world, p_187103_1_, iblockstate);
return flag;
}
}
@@ -164,21 +165,25 @@
if (this.field_78779_k.func_77145_d()) {
this.field_78776_a.func_193032_ao().func_193294_a(this.field_78776_a.field_71441_e, p_180511_1_, this.field_78776_a.field_71441_e.func_180495_p(p_180511_1_), 1.0F);
this.field_78774_b.func_147297_a(new CPacketPlayerDigging(CPacketPlayerDigging.Action.START_DESTROY_BLOCK, p_180511_1_, p_180511_2_));
+ if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180511_1_, p_180511_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(this.field_78776_a.field_71439_g, func_78757_d() + 1)).isCanceled())
func_178891_a(this.field_78776_a, this, p_180511_1_, p_180511_2_);
this.field_78781_i = 5;
} else if (!this.field_78778_j || !this.func_178893_a(p_180511_1_)) {
if (this.field_78778_j) {
this.field_78774_b.func_147297_a(new CPacketPlayerDigging(CPacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, this.field_178895_c, p_180511_2_));
}
+ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180511_1_, p_180511_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(this.field_78776_a.field_71439_g, func_78757_d() + 1));
IBlockState iblockstate = this.field_78776_a.field_71441_e.func_180495_p(p_180511_1_);
this.field_78776_a.func_193032_ao().func_193294_a(this.field_78776_a.field_71441_e, p_180511_1_, iblockstate, 0.0F);
this.field_78774_b.func_147297_a(new CPacketPlayerDigging(CPacketPlayerDigging.Action.START_DESTROY_BLOCK, p_180511_1_, p_180511_2_));
boolean flag = !iblockstate.func_196958_f();
if (flag && this.field_78770_f == 0.0F) {
+ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY)
iblockstate.func_196942_a(this.field_78776_a.field_71441_e, p_180511_1_, this.field_78776_a.field_71439_g);
}
+ if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) return true;
if (flag && iblockstate.func_185903_a(this.field_78776_a.field_71439_g, this.field_78776_a.field_71439_g.field_70170_p, p_180511_1_) >= 1.0F) {
this.func_187103_a(p_180511_1_);
} else {
@@ -227,7 +232,7 @@
} else {
this.field_78770_f += iblockstate.func_185903_a(this.field_78776_a.field_71439_g, this.field_78776_a.field_71439_g.field_70170_p, p_180512_1_);
if (this.field_78780_h % 4.0F == 0.0F) {
- SoundType soundtype = block.func_185467_w();
+ SoundType soundtype = iblockstate.getSoundType(field_78776_a.field_71441_e, p_180512_1_, field_78776_a.field_71439_g);
this.field_78776_a.func_147118_V().func_147682_a(new PositionedSoundRecord(soundtype.func_185846_f(), SoundCategory.NEUTRAL, (soundtype.func_185843_a() + 1.0F) / 8.0F, soundtype.func_185847_b() * 0.5F, p_180512_1_));
}
@@ -251,7 +256,8 @@
}
public float func_78757_d() {
- return this.field_78779_k.func_77145_d() ? 5.0F : 4.5F;
+ float attrib = (float)field_78776_a.field_71439_g.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111126_e();
+ return this.field_78779_k.func_77145_d() ? attrib : attrib - 0.5F;
}
public void func_78765_e() {
@@ -268,7 +274,7 @@
ItemStack itemstack = this.field_78776_a.field_71439_g.func_184614_ca();
boolean flag = this.field_85183_f.func_190926_b() && itemstack.func_190926_b();
if (!this.field_85183_f.func_190926_b() && !itemstack.func_190926_b()) {
- flag = itemstack.func_77973_b() == this.field_85183_f.func_77973_b() && ItemStack.func_77970_a(itemstack, this.field_85183_f) && (itemstack.func_77984_f() || itemstack.func_77952_i() == this.field_85183_f.func_77952_i());
+ flag = !this.field_85183_f.shouldCauseBlockBreakReset(itemstack);
}
return p_178893_1_.equals(this.field_178895_c) && flag;
@@ -292,26 +298,45 @@
float f = (float)(p_187099_5_.field_72450_a - (double)p_187099_3_.func_177958_n());
float f1 = (float)(p_187099_5_.field_72448_b - (double)p_187099_3_.func_177956_o());
float f2 = (float)(p_187099_5_.field_72449_c - (double)p_187099_3_.func_177952_p());
+ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks
+ .onRightClickBlock(p_187099_1_, p_187099_6_, p_187099_3_, p_187099_4_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(p_187099_1_, func_78757_d() + 1));
+ if (event.isCanceled()) {
+ // Give the server a chance to fire event as well. That way server event is not dependant on client event.
+ this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2));
+ return event.getCancellationResult();
+ }
if (this.field_78779_k == GameType.SPECTATOR) {
this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2));
return EnumActionResult.SUCCESS;
} else {
- boolean flag = !p_187099_1_.func_184614_ca().func_190926_b() || !p_187099_1_.func_184592_cb().func_190926_b();
+ EnumActionResult ret = itemstack.onItemUseFirst(new ItemUseContext(p_187099_1_, p_187099_1_.func_184586_b(p_187099_6_), p_187099_3_, p_187099_4_, f, f1, f2));
+ if (ret != EnumActionResult.PASS) {
+ // The server needs to process the item use as well. Otherwise onItemUseFirst won't ever be called on the server without causing weird bugs
+ this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2));
+ return ret;
+ }
+ boolean flag = !(p_187099_1_.func_184614_ca().doesSneakBypassUse(p_187099_2_, p_187099_3_, p_187099_1_) && p_187099_1_.func_184592_cb().doesSneakBypassUse(p_187099_2_, p_187099_3_, p_187099_1_));
boolean flag1 = p_187099_1_.func_70093_af() && flag;
- if (!flag1 && p_187099_2_.func_180495_p(p_187099_3_).func_196943_a(p_187099_2_, p_187099_3_, p_187099_1_, p_187099_6_, p_187099_4_, f, f1, f2)) {
+ if (!flag1 || event.getUseBlock() == net.minecraftforge.eventbus.api.Event.Result.ALLOW) {
+ if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY) {
+ if (p_187099_2_.func_180495_p(p_187099_3_).func_196943_a(p_187099_2_, p_187099_3_, p_187099_1_, p_187099_6_, p_187099_4_, f, f1, f2)) {
+ this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2));
+ return EnumActionResult.SUCCESS;
+ }
+ }
+ }
+ if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) {
this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2));
- return EnumActionResult.SUCCESS;
- } else {
- this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2));
if (!itemstack.func_190926_b() && !p_187099_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) {
ItemUseContext itemusecontext = new ItemUseContext(p_187099_1_, p_187099_1_.func_184586_b(p_187099_6_), p_187099_3_, p_187099_4_, f, f1, f2);
EnumActionResult enumactionresult;
+ ItemStack copyForUse = itemstack.func_77946_l();
if (this.field_78779_k.func_77145_d()) {
- int i = itemstack.func_190916_E();
enumactionresult = itemstack.func_196084_a(itemusecontext);
- itemstack.func_190920_e(i);
+ p_187099_1_.func_184611_a(p_187099_6_, copyForUse);
} else {
enumactionresult = itemstack.func_196084_a(itemusecontext);
+ if (itemstack.func_190926_b()) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187099_1_, copyForUse, p_187099_6_);
}
return enumactionresult;
@@ -319,6 +344,7 @@
return EnumActionResult.PASS;
}
}
+ return EnumActionResult.PASS;
}
}
}
@@ -333,11 +359,14 @@
if (p_187101_1_.func_184811_cZ().func_185141_a(itemstack.func_77973_b())) {
return EnumActionResult.PASS;
} else {
+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_187101_1_, p_187101_3_);
+ if (cancelResult != null) return cancelResult;
int i = itemstack.func_190916_E();
ActionResult<ItemStack> actionresult = itemstack.func_77957_a(p_187101_2_, p_187101_1_, p_187101_3_);
ItemStack itemstack1 = actionresult.func_188398_b();
if (itemstack1 != itemstack || itemstack1.func_190916_E() != i) {
p_187101_1_.func_184611_a(p_187101_3_, itemstack1);
+ if (itemstack1.func_190926_b()) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187101_1_, itemstack, p_187101_3_);
}
return actionresult.func_188397_a();
@@ -362,6 +391,9 @@
public EnumActionResult func_187097_a(EntityPlayer p_187097_1_, Entity p_187097_2_, EnumHand p_187097_3_) {
this.func_78750_j();
this.field_78774_b.func_147297_a(new CPacketUseEntity(p_187097_2_, p_187097_3_));
+ if (this.field_78779_k == GameType.SPECTATOR) return EnumActionResult.PASS; // don't fire for spectators to match non-specific EntityInteract
+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntity(p_187097_1_, p_187097_2_, p_187097_3_);
+ if(cancelResult != null) return cancelResult;
return this.field_78779_k == GameType.SPECTATOR ? EnumActionResult.PASS : p_187097_1_.func_190775_a(p_187097_2_, p_187097_3_);
}
@@ -369,6 +401,9 @@
this.func_78750_j();
Vec3d vec3d = new Vec3d(p_187102_3_.field_72307_f.field_72450_a - p_187102_2_.field_70165_t, p_187102_3_.field_72307_f.field_72448_b - p_187102_2_.field_70163_u, p_187102_3_.field_72307_f.field_72449_c - p_187102_2_.field_70161_v);
this.field_78774_b.func_147297_a(new CPacketUseEntity(p_187102_2_, p_187102_4_, vec3d));
+ if (this.field_78779_k == GameType.SPECTATOR) return EnumActionResult.PASS; // don't fire for spectators to match non-specific EntityInteract
+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntityAt(p_187102_1_, p_187102_2_, p_187102_3_, p_187102_4_);
+ if(cancelResult != null) return cancelResult;
return this.field_78779_k == GameType.SPECTATOR ? EnumActionResult.PASS : p_187102_2_.func_184199_a(p_187102_1_, vec3d, p_187102_4_);
}
@@ -1,10 +1,25 @@
--- a/net/minecraft/client/multiplayer/WorldClient.java
+++ b/net/minecraft/client/multiplayer/WorldClient.java
@@ -81,6 +81,7 @@
@@ -69,18 +69,20 @@
private Scoreboard field_200261_M;
public WorldClient(NetHandlerPlayClient p_i45063_1_, WorldSettings p_i45063_2_, int p_i45063_3_, EnumDifficulty p_i45063_4_, Profiler p_i45063_5_) {
- super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), DimensionType.func_186069_a(p_i45063_3_).func_186070_d(), p_i45063_5_, true);
+ super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), net.minecraftforge.common.DimensionManager.createProviderFor(p_i45063_3_), p_i45063_5_, true);
this.field_184158_M = this.field_73012_v.nextInt(12000);
this.field_184157_a = Sets.<ChunkPos>newHashSet();
this.field_200261_M = new Scoreboard();
this.field_73035_a = p_i45063_1_;
this.func_72912_H().func_176144_a(p_i45063_4_);
- this.func_175652_B(new BlockPos(8, 64, 8));
this.field_73011_w.func_76558_a(this);
+ this.func_175652_B(new BlockPos(8, 64, 8)); //Forge: Moved below registerWorld to prevent NPE in our redirect.
this.field_73020_y = this.func_72970_h();
this.field_72988_C = new SaveDataMemoryStorage();
this.func_72966_v();
this.func_72947_a();
+ this.initCapabilities();
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this));
}
public void func_72835_b() {
@@ -1,6 +1,57 @@
--- a/net/minecraft/client/network/NetHandlerPlayClient.java
+++ b/net/minecraft/client/network/NetHandlerPlayClient.java
@@ -1598,6 +1598,7 @@
@@ -654,7 +654,7 @@
Chunk chunk = this.field_147300_g.func_72964_e(p_147263_1_.func_149273_e(), p_147263_1_.func_149271_f());
chunk.func_186033_a(p_147263_1_.func_186946_a(), p_147263_1_.func_149276_g(), p_147263_1_.func_149274_i());
this.field_147300_g.func_147458_c(p_147263_1_.func_149273_e() << 4, 0, p_147263_1_.func_149271_f() << 4, (p_147263_1_.func_149273_e() << 4) + 15, 256, (p_147263_1_.func_149271_f() << 4) + 15);
- if (!p_147263_1_.func_149274_i() || !(this.field_147300_g.field_73011_w instanceof OverworldDimension)) {
+ if (!p_147263_1_.func_149274_i() || this.field_147300_g.field_73011_w.shouldClientCheckLighting()) {
chunk.func_76613_n();
}
@@ -662,7 +662,7 @@
BlockPos blockpos = new BlockPos(nbttagcompound.func_74762_e("x"), nbttagcompound.func_74762_e("y"), nbttagcompound.func_74762_e("z"));
TileEntity tileentity = this.field_147300_g.func_175625_s(blockpos);
if (tileentity != null) {
- tileentity.func_145839_a(nbttagcompound);
+ tileentity.handleUpdateTag(nbttagcompound);
}
}
@@ -727,7 +727,9 @@
public void func_147251_a(SPacketChat p_147251_1_) {
PacketThreadUtil.func_180031_a(p_147251_1_, this, this.field_147299_f);
- this.field_147299_f.field_71456_v.func_191742_a(p_147251_1_.func_192590_c(), p_147251_1_.func_148915_c());
+ net.minecraft.util.text.ITextComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(p_147251_1_.func_192590_c(), p_147251_1_.func_148915_c());
+ if (message == null) return;
+ this.field_147299_f.field_71456_v.func_191742_a(p_147251_1_.func_192590_c(), message);
}
public void func_147279_a(SPacketAnimation p_147279_1_) {
@@ -1008,6 +1010,12 @@
boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock;
if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag || i == 3 && tileentity instanceof TileEntityBeacon || i == 4 && tileentity instanceof TileEntitySkull || i == 6 && tileentity instanceof TileEntityBanner || i == 7 && tileentity instanceof TileEntityStructure || i == 8 && tileentity instanceof TileEntityEndGateway || i == 9 && tileentity instanceof TileEntitySign || i == 10 && tileentity instanceof TileEntityShulkerBox || i == 11 && tileentity instanceof TileEntityBed || i == 5 && tileentity instanceof TileEntityConduit) {
tileentity.func_145839_a(p_147273_1_.func_148857_g());
+ } else {
+ if(tileentity == null) {
+ field_147301_d.error("Received invalid update packet for null tile entity at {} with data: {}", p_147273_1_.func_179823_a(), p_147273_1_.func_148857_g());
+ return;
+ }
+ tileentity.onDataPacket(field_147302_e, p_147273_1_);
}
if (flag && this.field_147299_f.field_71462_r instanceof GuiCommandBlock) {
@@ -1272,7 +1280,7 @@
PacketThreadUtil.func_180031_a(p_147260_1_, this, this.field_147299_f);
Entity entity = this.field_147300_g.func_73045_a(p_147260_1_.func_149426_d());
if (entity instanceof EntityLivingBase) {
- Potion potion = Potion.func_188412_a(p_147260_1_.func_149427_e());
+ Potion potion = Potion.func_188412_a(p_147260_1_.func_149427_e() & 0xFF);
if (potion != null) {
PotionEffect potioneffect = new PotionEffect(potion, p_147260_1_.func_180755_e(), p_147260_1_.func_149428_f(), p_147260_1_.func_186984_g(), p_147260_1_.func_179707_f(), p_147260_1_.func_205527_h());
potioneffect.func_100012_b(p_147260_1_.func_149429_c());
@@ -1598,10 +1606,12 @@
((DebugRendererWorldGenAttempts)this.field_147299_f.field_184132_p.field_201750_j).func_201734_a(packetbuffer.func_179259_c(), packetbuffer.readFloat(), packetbuffer.readFloat(), packetbuffer.readFloat(), packetbuffer.readFloat(), packetbuffer.readFloat());
field_147301_d.warn("Unknown custom packed identifier: {}", (Object)resourcelocation);
} else {
@@ -8,3 +59,8 @@
field_147301_d.warn("Unknown custom packed identifier: {}", (Object)resourcelocation);
}
} finally {
if (packetbuffer != null) {
+ if (false) // Forge: let packet handle releasing buffer
packetbuffer.release();
}
@@ -0,0 +1,27 @@
--- a/net/minecraft/client/particle/Particle.java
+++ b/net/minecraft/client/particle/Particle.java
@@ -253,6 +253,8 @@
public void func_187110_a(double p_187110_1_, double p_187110_3_, double p_187110_5_) {
double d0 = p_187110_3_;
+ double origX = p_187110_1_;
+ double origZ = p_187110_5_;
if (this.field_190017_n && (p_187110_1_ != 0.0D || p_187110_3_ != 0.0D || p_187110_5_ != 0.0D)) {
VoxelShape voxelshape = this.field_187122_b.func_199406_a((Entity)null, this.func_187116_l(), p_187110_1_, p_187110_3_, p_187110_5_);
p_187110_3_ = ShapeUtils.func_197884_a(EnumFacing.Axis.Y, this.func_187116_l(), voxelshape, p_187110_3_);
@@ -271,12 +273,12 @@
}
this.func_187118_j();
- this.field_187132_l = p_187110_3_ != p_187110_3_ && d0 < 0.0D;
- if (p_187110_1_ != p_187110_1_) {
+ this.field_187132_l = d0 != p_187110_3_ && d0 < 0.0D;
+ if (origX != p_187110_1_) {
this.field_187129_i = 0.0D;
}
- if (p_187110_5_ != p_187110_5_) {
+ if (origZ != p_187110_5_) {
this.field_187131_k = 0.0D;
}
@@ -0,0 +1,30 @@
--- a/net/minecraft/client/particle/ParticleManager.java
+++ b/net/minecraft/client/particle/ParticleManager.java
@@ -145,6 +145,7 @@
}
public void func_78873_a(Particle p_78873_1_) {
+ if (p_78873_1_ == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs.
this.field_187241_h.add(p_78873_1_);
}
@@ -332,7 +333,7 @@
}
public void func_180533_a(BlockPos p_180533_1_, IBlockState p_180533_2_) {
- if (!p_180533_2_.func_196958_f()) {
+ if (!p_180533_2_.isAir(this.field_78878_a, p_180533_1_)) {
VoxelShape voxelshape = p_180533_2_.func_196954_c(this.field_78878_a, p_180533_1_);
double d0 = 0.25D;
voxelshape.func_197755_b((p_199284_3_, p_199284_5_, p_199284_7_, p_199284_9_, p_199284_11_, p_199284_13_) -> {
@@ -411,4 +412,10 @@
return String.valueOf(i);
}
+
+ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.math.RayTraceResult target) {
+ IBlockState state = field_78878_a.func_180495_p(pos);
+ if (!state.addHitEffects(field_78878_a, target, this))
+ func_180532_a(pos, target.field_178784_b);
+ }
}
@@ -0,0 +1,12 @@
--- a/net/minecraft/client/renderer/BlockRendererDispatcher.java
+++ b/net/minecraft/client/renderer/BlockRendererDispatcher.java
@@ -105,4 +105,9 @@
public void func_195410_a(IResourceManager p_195410_1_) {
this.field_175025_e.func_178268_a();
}
+
+ @Override
+ public net.minecraftforge.resource.IResourceType getResourceType() {
+ return net.minecraftforge.resource.VanillaResourceType.MODELS;
+ }
}
@@ -0,0 +1,12 @@
--- a/net/minecraft/client/renderer/EntityRenderer.java
+++ b/net/minecraft/client/renderer/EntityRenderer.java
@@ -1182,4 +1182,9 @@
public float func_205001_m() {
return this.field_78530_s;
}
+
+ @Override
+ public net.minecraftforge.resource.IResourceType getResourceType() {
+ return net.minecraftforge.resource.VanillaResourceType.SHADERS;
+ }
}
@@ -9,3 +9,13 @@
for(Item item : Item.field_150901_e) {
if (!field_195411_c.contains(item)) {
@@ -380,4 +380,9 @@
public void func_195410_a(IResourceManager p_195410_1_) {
this.field_175059_m.func_178085_b();
}
+
+ @Override
+ public net.minecraftforge.resource.IResourceType getResourceType() {
+ return net.minecraftforge.resource.VanillaResourceType.MODELS;
+ }
}
@@ -0,0 +1,14 @@
--- a/net/minecraft/client/renderer/RenderGlobal.java
+++ b/net/minecraft/client/renderer/RenderGlobal.java
@@ -2126,6 +2126,11 @@
}
}
+ @Override
+ public net.minecraftforge.resource.IResourceType getResourceType() {
+ return net.minecraftforge.resource.VanillaResourceType.MODELS;
+ }
+
@OnlyIn(Dist.CLIENT)
class ContainerLocalRenderInformation {
private final RenderChunk field_178036_a;
@@ -0,0 +1,12 @@
--- a/net/minecraft/client/renderer/block/model/ModelManager.java
+++ b/net/minecraft/client/renderer/block/model/ModelManager.java
@@ -39,4 +39,9 @@
public BlockModelShapes func_174954_c() {
return this.field_174957_c;
}
+
+ @Override
+ public net.minecraftforge.resource.IResourceType getResourceType() {
+ return net.minecraftforge.resource.VanillaResourceType.MODELS;
+ }
}
@@ -0,0 +1,12 @@
--- a/net/minecraft/client/renderer/texture/TextureManager.java
+++ b/net/minecraft/client/renderer/texture/TextureManager.java
@@ -127,4 +127,9 @@
}
}
+
+ @Override
+ public net.minecraftforge.resource.IResourceType getResourceType() {
+ return net.minecraftforge.resource.VanillaResourceType.TEXTURES;
+ }
}
@@ -0,0 +1,12 @@
--- a/net/minecraft/client/resources/FoliageColorReloadListener.java
+++ b/net/minecraft/client/resources/FoliageColorReloadListener.java
@@ -21,4 +21,9 @@
}
}
+
+ @Override
+ public net.minecraftforge.resource.IResourceType getResourceType() {
+ return net.minecraftforge.resource.VanillaResourceType.TEXTURES;
+ }
}
@@ -0,0 +1,12 @@
--- a/net/minecraft/client/resources/GrassColorReloadListener.java
+++ b/net/minecraft/client/resources/GrassColorReloadListener.java
@@ -21,4 +21,9 @@
}
}
+
+ @Override
+ public net.minecraftforge.resource.IResourceType getResourceType() {
+ return net.minecraftforge.resource.VanillaResourceType.TEXTURES;
+ }
}
@@ -1,6 +1,6 @@
--- a/net/minecraft/client/resources/Language.java
+++ b/net/minecraft/client/resources/Language.java
@@ -15,7 +15,13 @@
@@ -15,6 +15,12 @@
this.field_135037_b = p_i1303_2_;
this.field_135038_c = p_i1303_3_;
this.field_135036_d = p_i1303_4_;
@@ -9,16 +9,15 @@
+ this.javaLocale = new java.util.Locale(field_135039_a);
+ } else {
+ this.javaLocale = new java.util.Locale(splitLangCode[0], splitLangCode[1]);
+ }
}
+ }
public String func_135034_a() {
return this.field_135039_a;
@@ -44,4 +50,8 @@
public int compareTo(Language p_compareTo_1_) {
return this.field_135039_a.compareTo(p_compareTo_1_.field_135039_a);
}
+
+
+ // Forge: add access to Locale so modders can create correct string and number formatters
+ private final java.util.Locale javaLocale;
+ public java.util.Locale getJavaLocale() { return javaLocale; }
@@ -0,0 +1,12 @@
--- a/net/minecraft/client/resources/LanguageManager.java
+++ b/net/minecraft/client/resources/LanguageManager.java
@@ -79,4 +79,9 @@
public Language func_191960_a(String p_191960_1_) {
return this.field_135046_d.get(p_191960_1_);
}
+
+ @Override
+ public net.minecraftforge.resource.IResourceType getResourceType() {
+ return net.minecraftforge.resource.VanillaResourceType.LANGUAGES;
+ }
}
@@ -0,0 +1,57 @@
--- a/net/minecraft/client/shader/Framebuffer.java
+++ b/net/minecraft/client/shader/Framebuffer.java
@@ -22,6 +22,7 @@
public int field_147624_h;
public float[] field_147625_i;
public int field_147623_j;
+ private boolean stencilEnabled = false;
public Framebuffer(int p_i45078_1_, int p_i45078_2_, boolean p_i45078_3_) {
this.field_147619_e = p_i45078_3_;
@@ -95,8 +96,14 @@
OpenGlHelper.func_153188_a(OpenGlHelper.field_153198_e, OpenGlHelper.field_153200_g, 3553, this.field_147617_g, 0);
if (this.field_147619_e) {
OpenGlHelper.func_153176_h(OpenGlHelper.field_153199_f, this.field_147624_h);
+ if (!this.stencilEnabled) {
OpenGlHelper.func_153186_a(OpenGlHelper.field_153199_f, 33190, this.field_147622_a, this.field_147620_b);
OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, OpenGlHelper.field_153201_h, OpenGlHelper.field_153199_f, this.field_147624_h);
+ } else {
+ OpenGlHelper.func_153186_a(OpenGlHelper.field_153199_f, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, this.field_147622_a, this.field_147620_b);
+ OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.field_153199_f, this.field_147624_h);
+ OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.field_153199_f, this.field_147624_h);
+ }
}
this.func_147611_b();
@@ -229,4 +236,31 @@
GlStateManager.func_179086_m(i);
this.func_147609_e();
}
+
+ /**
+ * Attempts to enabled 8 bits of stencil buffer on this FrameBuffer.
+ * Modders must call this directly to set things up.
+ * This is to prevent the default cause where graphics cards do not support stencil bits.
+ * Modders should check the below 'isStencilEnabled' to check if another modder has already enabled them.
+ *
+ * Note:
+ * As of now the only thing that is checked is if FBOs are supported entirely, in the future
+ * we may expand to check for errors.
+ *
+ * @return True if the FBO was re-initialized with stencil bits.
+ */
+ public boolean enableStencil() {
+ if (!OpenGlHelper.func_148822_b()) return false;
+ stencilEnabled = true;
+ this.func_147613_a(field_147621_c, field_147618_d);
+ return true; //TODO: Find a way to detect if this failed?
+ }
+
+ /**
+ * Returns wither or not this FBO has been successfully initialized with stencil bits.
+ * If not, and a modder wishes it to be, they must call enableStencil.
+ */
+ public boolean isStencilEnabled() {
+ return this.stencilEnabled;
+ }
}
@@ -0,0 +1,12 @@
--- a/net/minecraft/client/shader/ShaderGroup.java
+++ b/net/minecraft/client/shader/ShaderGroup.java
@@ -143,7 +143,8 @@
String s3 = JsonUtils.func_151200_h(jsonobject1, "id");
Framebuffer framebuffer2 = this.func_148017_a(s3);
if (framebuffer2 == null) {
- ResourceLocation resourcelocation = new ResourceLocation("textures/effect/" + s3 + ".png");
+ ResourceLocation rl = ResourceLocation.func_208304_a(s3);
+ ResourceLocation resourcelocation = new ResourceLocation(rl.func_110624_b(), "textures/effect/" + rl.func_110623_a() + ".png");
IResource iresource = null;
try {
@@ -0,0 +1,12 @@
--- a/net/minecraft/client/shader/ShaderLoader.java
+++ b/net/minecraft/client/shader/ShaderLoader.java
@@ -51,7 +51,8 @@
public static ShaderLoader func_195655_a(IResourceManager p_195655_0_, ShaderLoader.ShaderType p_195655_1_, String p_195655_2_) throws IOException {
ShaderLoader shaderloader = (ShaderLoader)p_195655_1_.func_148064_d().get(p_195655_2_);
if (shaderloader == null) {
- ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_195655_2_ + p_195655_1_.func_148063_b());
+ ResourceLocation rl = ResourceLocation.func_208304_a(p_195655_2_);
+ ResourceLocation resourcelocation = new ResourceLocation(rl.func_110624_b(), "shaders/program/" + rl.func_110623_a() + p_195655_1_.func_148063_b());
IResource iresource = p_195655_0_.func_199002_a(resourcelocation);
ByteBuffer bytebuffer = null;
@@ -0,0 +1,12 @@
--- a/net/minecraft/client/shader/ShaderManager.java
+++ b/net/minecraft/client/shader/ShaderManager.java
@@ -51,7 +51,8 @@
public ShaderManager(IResourceManager p_i45087_1_, String p_i45087_2_) throws IOException {
JsonParser jsonparser = new JsonParser();
- ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_i45087_2_ + ".json");
+ ResourceLocation rl = ResourceLocation.func_208304_a(p_i45087_2_);
+ ResourceLocation resourcelocation = new ResourceLocation(rl.func_110624_b(), "shaders/program/" + rl.func_110623_a() + ".json");
this.field_148007_m = p_i45087_2_;
IResource iresource = null;
@@ -0,0 +1,14 @@
--- a/net/minecraft/client/util/SearchTreeManager.java
+++ b/net/minecraft/client/util/SearchTreeManager.java
@@ -30,6 +30,11 @@
return (ISearchTree<T>) this.field_194013_c.get(p_194010_1_);
}
+ @Override
+ public net.minecraftforge.resource.IResourceType getResourceType() {
+ return net.minecraftforge.resource.VanillaResourceType.LANGUAGES;
+ }
+
@OnlyIn(Dist.CLIENT)
public static class Key<T> {
}
@@ -9,7 +9,15 @@
private static final DataParameter<Float> field_184829_a = EntityDataManager.<Float>func_187226_a(EntityPlayer.class, DataSerializers.field_187193_c);
private static final DataParameter<Integer> field_184830_b = EntityDataManager.<Integer>func_187226_a(EntityPlayer.class, DataSerializers.field_187192_b);
protected static final DataParameter<Byte> field_184827_bp = EntityDataManager.<Byte>func_187226_a(EntityPlayer.class, DataSerializers.field_187191_a);
@@ -663,7 +665,12 @@
@@ -161,6 +163,7 @@
this.func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a((double)0.1F);
this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_188790_f);
this.func_110140_aT().func_111150_b(SharedMonsterAttributes.field_188792_h);
+ this.func_110140_aT().func_111150_b(REACH_DISTANCE);
}
protected void func_70088_a() {
@@ -663,7 +666,12 @@
return p_184816_1_.func_92059_d();
}
@@ -22,7 +30,7 @@
float f = this.field_71071_by.func_184438_a(p_184813_1_);
if (f > 1.0F) {
int i = EnchantmentHelper.func_185293_e(this);
@@ -705,6 +712,7 @@
@@ -705,6 +713,7 @@
f /= 5.0F;
}
@@ -59,7 +59,7 @@
return this.field_77994_a <= 0;
} else {
return true;
@@ -144,10 +152,11 @@
@@ -144,18 +152,27 @@
}
public Item func_77973_b() {
@@ -68,11 +68,32 @@
}
public EnumActionResult func_196084_a(ItemUseContext p_196084_1_) {
- EntityPlayer entityplayer = p_196084_1_.func_195999_j();
- BlockPos blockpos = p_196084_1_.func_195995_a();
- BlockWorldState blockworldstate = new BlockWorldState(p_196084_1_.func_195991_k(), blockpos, false);
- if (entityplayer != null && !entityplayer.field_71075_bZ.field_75099_e && !this.func_206847_b(p_196084_1_.func_195991_k().func_205772_D(), blockworldstate)) {
+ return onItemUse(p_196084_1_, (c) -> func_77973_b().func_195939_a(p_196084_1_));
+ }
+
+ public EnumActionResult onItemUseFirst(ItemUseContext context) {
+ return onItemUse(context, (c) -> func_77973_b().onItemUseFirst(this, context));
+ }
+
+ private EnumActionResult onItemUse(ItemUseContext context, java.util.function.Function<ItemUseContext, EnumActionResult> callback) {
+ //if (!context.world.isRemote) return net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(context);
EntityPlayer entityplayer = p_196084_1_.func_195999_j();
BlockPos blockpos = p_196084_1_.func_195995_a();
BlockWorldState blockworldstate = new BlockWorldState(p_196084_1_.func_195991_k(), blockpos, false);
@@ -183,12 +192,15 @@
+ EntityPlayer entityplayer = context.func_195999_j();
+ BlockPos blockpos = context.func_195995_a();
+ BlockWorldState blockworldstate = new BlockWorldState(context.func_195991_k(), blockpos, false);
+ if (entityplayer != null && !entityplayer.field_71075_bZ.field_75099_e && !this.func_206847_b(context.func_195991_k().func_205772_D(), blockworldstate)) {
return EnumActionResult.PASS;
} else {
Item item = this.func_77973_b();
- EnumActionResult enumactionresult = item.func_195939_a(p_196084_1_);
+ EnumActionResult enumactionresult = callback.apply(context);
if (entityplayer != null && enumactionresult == EnumActionResult.SUCCESS) {
entityplayer.func_71029_a(StatList.field_75929_E.func_199076_b(item));
}
@@ -183,12 +200,15 @@
if (this.field_77990_d != null) {
p_77955_1_.func_74782_a("tag", this.field_77990_d);
}
@@ -90,7 +111,7 @@
}
public boolean func_77985_e() {
@@ -196,7 +208,7 @@
@@ -196,7 +216,7 @@
}
public boolean func_77984_f() {
@@ -99,7 +120,7 @@
NBTTagCompound nbttagcompound = this.func_77978_p();
return nbttagcompound == null || !nbttagcompound.func_74767_n("Unbreakable");
} else {
@@ -205,7 +217,7 @@
@@ -205,7 +225,7 @@
}
public boolean func_77951_h() {
@@ -108,7 +129,7 @@
}
public int func_77952_i() {
@@ -217,7 +229,7 @@
@@ -217,7 +237,7 @@
}
public int func_77958_k() {
@@ -117,7 +138,7 @@
}
public boolean func_96631_a(int p_96631_1_, Random p_96631_2_, @Nullable EntityPlayerMP p_96631_3_) {
@@ -285,7 +297,7 @@
@@ -285,7 +305,7 @@
}
public boolean func_150998_b(IBlockState p_150998_1_) {
@@ -126,7 +147,7 @@
}
public boolean func_111282_a(EntityPlayer p_111282_1_, EntityLivingBase p_111282_2_, EnumHand p_111282_3_) {
@@ -293,7 +305,7 @@
@@ -293,7 +313,7 @@
}
public ItemStack func_77946_l() {
@@ -135,7 +156,7 @@
itemstack.func_190915_d(this.func_190921_D());
if (this.field_77990_d != null) {
itemstack.field_77990_d = this.field_77990_d.func_74737_b();
@@ -309,7 +321,7 @@
@@ -309,7 +329,7 @@
if (p_77970_0_.field_77990_d == null && p_77970_1_.field_77990_d != null) {
return false;
} else {
@@ -144,7 +165,7 @@
}
} else {
return false;
@@ -332,7 +344,7 @@
@@ -332,7 +352,7 @@
} else if (this.field_77990_d == null && p_77959_1_.field_77990_d != null) {
return false;
} else {
@@ -153,7 +174,7 @@
}
}
@@ -633,6 +645,7 @@
@@ -633,6 +653,7 @@
}
}
@@ -161,7 +182,7 @@
return list;
}
@@ -743,7 +756,7 @@
@@ -743,7 +764,7 @@
}
}
} else {
@@ -170,7 +191,7 @@
}
return multimap;
@@ -874,4 +887,89 @@
@@ -874,4 +895,89 @@
public void func_190918_g(int p_190918_1_) {
this.func_190917_f(-p_190918_1_);
}
@@ -0,0 +1,19 @@
--- a/net/minecraft/item/crafting/RecipeItemHelper.java
+++ b/net/minecraft/item/crafting/RecipeItemHelper.java
@@ -25,9 +25,13 @@
}
public void func_194112_a(ItemStack p_194112_1_) {
- if (!p_194112_1_.func_190926_b()) {
- int i = func_194113_b(p_194112_1_);
- int j = p_194112_1_.func_190916_E();
+ this.accountStack(p_194112_1_, -1);
+ }
+
+ public void accountStack(ItemStack stack, int forceCount) {
+ if (!stack.func_190926_b()) {
+ int i = func_194113_b(stack);
+ int j = forceCount == -1 ? stack.func_190916_E() : forceCount;
this.func_194117_b(i, j);
}
@@ -0,0 +1,18 @@
--- a/net/minecraft/resources/IResourceManagerReloadListener.java
+++ b/net/minecraft/resources/IResourceManagerReloadListener.java
@@ -1,5 +1,15 @@
package net.minecraft.resources;
+
+/**
+ * @deprecated Forge: {@link net.minecraftforge.resource.ISelectiveResourceReloadListener}, which selectively allows
+ * individual resource types being reloaded should rather be used where possible.
+ */
+@Deprecated
public interface IResourceManagerReloadListener {
void func_195410_a(IResourceManager p_195410_1_);
+ @javax.annotation.Nullable
+ default net.minecraftforge.resource.IResourceType getResourceType() {
+ return null;
+ }
}
@@ -8,3 +8,50 @@
public Set<String> func_199001_a() {
return this.field_199016_e;
}
@@ -86,35 +85,46 @@
}
public void func_199005_a(List<IResourcePack> p_199005_1_) {
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resources", p_199005_1_.size() + 1, true);
this.func_199008_b();
field_199012_a.info("Reloading ResourceManager: {}", p_199005_1_.stream().map(IResourcePack::func_195762_a).collect(Collectors.joining(", ")));
for(IResourcePack iresourcepack : p_199005_1_) {
+ resReload.step(iresourcepack.func_195762_a());
this.func_199009_a(iresourcepack);
}
+ resReload.step("Reloading listeners");
if (field_199012_a.isDebugEnabled()) {
this.func_199011_d();
} else {
this.func_199010_c();
}
+ net.minecraftforge.fml.common.ProgressManager.pop(resReload);
}
public void func_199006_a(IResourceManagerReloadListener p_199006_1_) {
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resource", 1);
+ resReload.step(p_199006_1_.getClass());
this.field_199015_d.add(p_199006_1_);
if (field_199012_a.isDebugEnabled()) {
field_199012_a.info(this.func_199007_b(p_199006_1_));
} else {
p_199006_1_.func_195410_a(this);
}
+ net.minecraftforge.fml.common.ProgressManager.pop(resReload);
}
private void func_199010_c() {
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Reloading", this.field_199015_d.size());
for(IResourceManagerReloadListener iresourcemanagerreloadlistener : this.field_199015_d) {
+ resReload.step(iresourcemanagerreloadlistener.getClass());
+ if (!net.minecraftforge.resource.SelectiveReloadStateHandler.INSTANCE.test(iresourcemanagerreloadlistener)) continue; // Forge: Selective reloading for vanilla listeners
iresourcemanagerreloadlistener.func_195410_a(this);
}
+ net.minecraftforge.fml.common.ProgressManager.pop(resReload);
}
@@ -13,11 +13,54 @@
private static final Logger field_145852_a = LogManager.getLogger();
private final TileEntityType<?> field_200663_e;
protected World field_145850_b;
@@ -26,6 +27,7 @@
@@ -23,9 +24,12 @@
protected boolean field_145846_f;
@Nullable
private IBlockState field_195045_e;
+ private NBTTagCompound customTileData;
+
public TileEntity(TileEntityType<?> p_i48289_1_) {
this.field_200663_e = p_i48289_1_;
+ this.gatherCapabilities();
}
@Nullable
@@ -43,6 +47,8 @@
public void func_145839_a(NBTTagCompound p_145839_1_) {
this.field_174879_c = new BlockPos(p_145839_1_.func_74762_e("x"), p_145839_1_.func_74762_e("y"), p_145839_1_.func_74762_e("z"));
+ if (p_145839_1_.func_74764_b("ForgeData")) this.customTileData = p_145839_1_.func_74775_l("ForgeData");
+ if (getCapabilities() != null && p_145839_1_.func_74764_b("ForgeCaps")) deserializeCaps(p_145839_1_.func_74775_l("ForgeCaps"));
}
public NBTTagCompound func_189515_b(NBTTagCompound p_189515_1_) {
@@ -58,6 +64,8 @@
p_189516_1_.func_74768_a("x", this.field_174879_c.func_177958_n());
p_189516_1_.func_74768_a("y", this.field_174879_c.func_177956_o());
p_189516_1_.func_74768_a("z", this.field_174879_c.func_177952_p());
+ if (this.customTileData != null) p_189516_1_.func_74782_a("ForgeData", this.customTileData);
+ if (getCapabilities() != null) p_189516_1_.func_74782_a("ForgeCaps", serializeCaps());
return p_189516_1_;
}
}
@@ -98,7 +106,6 @@
}
- @OnlyIn(Dist.CLIENT)
public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_) {
double d0 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_;
double d1 = (double)this.field_174879_c.func_177956_o() + 0.5D - p_145835_3_;
@@ -179,4 +186,11 @@
public TileEntityType<?> func_200662_C() {
return this.field_200663_e;
}
+
+ @Override
+ public NBTTagCompound getTileData() {
+ if (this.customTileData == null)
+ this.customTileData = new NBTTagCompound();
+ return this.customTileData;
+ }
}
@@ -0,0 +1,12 @@
--- a/net/minecraft/util/ActionResult.java
+++ b/net/minecraft/util/ActionResult.java
@@ -16,4 +16,9 @@
public T func_188398_b() {
return this.field_188400_b;
}
+
+ //Just a generic helper function to make typecasing easier...
+ public static <T> ActionResult<T> newResult(EnumActionResult result, T value) {
+ return new ActionResult<T>(result, value);
+ }
}
@@ -0,0 +1,12 @@
--- a/net/minecraft/util/ClassInheritanceMultiMap.java
+++ b/net/minecraft/util/ClassInheritanceMultiMap.java
@@ -12,7 +12,8 @@
import java.util.Set;
public class ClassInheritanceMultiMap<T> extends AbstractSet<T> {
- private static final Set<Class<?>> field_181158_a = Sets.<Class<?>>newHashSet();
+ // Forge: Use concurrent collection to allow creating chunks from multiple threads safely
+ private static final Set<Class<?>> field_181158_a = java.util.Collections.newSetFromMap(new java.util.concurrent.ConcurrentHashMap<Class<?>, Boolean>());
private final Map<Class<?>, List<T>> field_180218_a = Maps.<Class<?>, List<T>>newHashMap();
private final Set<Class<?>> field_180216_b = Sets.<Class<?>>newIdentityHashSet();
private final Class<T> field_180217_c;
@@ -0,0 +1,59 @@
--- a/net/minecraft/util/EnumFacing.java
+++ b/net/minecraft/util/EnumFacing.java
@@ -13,8 +13,6 @@
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3i;
-import net.minecraftforge.api.distmarker.Dist;
-import net.minecraftforge.api.distmarker.OnlyIn;
public enum EnumFacing implements IStringSerializable {
DOWN(0, 1, -1, "down", EnumFacing.AxisDirection.NEGATIVE, EnumFacing.Axis.Y, new Vec3i(0, -1, 0)),
@@ -109,7 +107,6 @@
return func_82600_a(this.field_176759_h);
}
- @OnlyIn(Dist.CLIENT)
public EnumFacing func_176732_a(EnumFacing.Axis p_176732_1_) {
switch(p_176732_1_) {
case X:
@@ -150,7 +147,6 @@
}
}
- @OnlyIn(Dist.CLIENT)
private EnumFacing func_176744_n() {
switch(this) {
case NORTH:
@@ -168,7 +164,6 @@
}
}
- @OnlyIn(Dist.CLIENT)
private EnumFacing func_176738_p() {
switch(this) {
case EAST:
@@ -221,7 +216,6 @@
}
@Nullable
- @OnlyIn(Dist.CLIENT)
public static EnumFacing func_176739_a(@Nullable String p_176739_0_) {
return p_176739_0_ == null ? null : (EnumFacing)field_176761_p.get(p_176739_0_.toLowerCase(Locale.ROOT));
}
@@ -295,7 +289,6 @@
throw new IllegalArgumentException("No such direction: " + p_181076_0_ + " " + p_181076_1_);
}
- @OnlyIn(Dist.CLIENT)
public Vec3i func_176730_m() {
return this.field_176756_m;
}
@@ -339,7 +332,6 @@
}
@Nullable
- @OnlyIn(Dist.CLIENT)
public static EnumFacing.Axis func_176717_a(String p_176717_0_) {
return field_176725_d.get(p_176717_0_.toLowerCase(Locale.ROOT));
}
@@ -0,0 +1,25 @@
--- a/net/minecraft/util/ScreenShotHelper.java
+++ b/net/minecraft/util/ScreenShotHelper.java
@@ -39,10 +39,21 @@
file2 = new File(file1, p_148259_1_);
}
+ file2 = file2.getCanonicalFile(); // FORGE: Fix errors on Windows with paths that include \.\
+ net.minecraftforge.client.event.ScreenshotEvent event = net.minecraftforge.client.ForgeHooksClient.onScreenshot(nativeimage, file2);
+ if (event.isCanceled()) {
+ return event.getCancelMessage();
+ } else {
+ file2 = event.getScreenshotFile();
+ }
nativeimage.func_209271_a(file2);
+ final File output = file2;
ITextComponent itextcomponent = (new TextComponentString(file2.getName())).func_211708_a(TextFormatting.UNDERLINE).func_211710_a((p_211564_1_) -> {
- p_211564_1_.func_150241_a(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath()));
+ p_211564_1_.func_150241_a(new ClickEvent(ClickEvent.Action.OPEN_FILE, output.getAbsolutePath()));
});
+ if (event.getResultMessage() != null) {
+ return event.getResultMessage();
+ }
TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("screenshot.success", new Object[]{itextcomponent});
return textcomponenttranslation;
} catch (Exception exception) {
@@ -0,0 +1,51 @@
--- a/net/minecraft/util/Session.java
+++ b/net/minecraft/util/Session.java
@@ -18,8 +18,22 @@
private final String field_148257_b;
private final String field_148258_c;
private final Session.Type field_152429_d;
+ /** Forge: Cache of the local session's GameProfile properties. */
+ private com.mojang.authlib.properties.PropertyMap properties;
public Session(String p_i1098_1_, String p_i1098_2_, String p_i1098_3_, String p_i1098_4_) {
+ if (p_i1098_1_ == null || p_i1098_1_.isEmpty()) {
+ p_i1098_1_ = "MissingName";
+ p_i1098_2_ = p_i1098_3_ = "NotValid";
+ org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger(getClass().getName());
+ logger.log(org.apache.logging.log4j.Level.WARN, "=========================================================");
+ logger.log(org.apache.logging.log4j.Level.WARN, "WARNING!! the username was not set for this session, typically");
+ logger.log(org.apache.logging.log4j.Level.WARN, "this means you installed Forge incorrectly. We have set your");
+ logger.log(org.apache.logging.log4j.Level.WARN, "name to \"MissingName\" and your session to nothing. Please");
+ logger.log(org.apache.logging.log4j.Level.WARN, "check your installation and post a console log from the launcher");
+ logger.log(org.apache.logging.log4j.Level.WARN, "when asking for help!");
+ logger.log(org.apache.logging.log4j.Level.WARN, "=========================================================");
+ }
this.field_74286_b = p_i1098_1_;
this.field_148257_b = p_i1098_2_;
this.field_148258_c = p_i1098_3_;
@@ -45,12 +59,24 @@
public GameProfile func_148256_e() {
try {
UUID uuid = UUIDTypeAdapter.fromString(this.func_148255_b());
- return new GameProfile(uuid, this.func_111285_a());
+ GameProfile ret = new GameProfile(uuid, this.func_111285_a()); //Forge: Adds cached GameProfile properties to returned GameProfile.
+ if (properties != null) ret.getProperties().putAll(properties); // Helps to cut down on calls to the session service,
+ return ret; // which helps to fix MC-52974.
} catch (IllegalArgumentException var2) {
return new GameProfile((UUID)null, this.func_111285_a());
}
}
+ //For internal use only. Modders should never need to use this.
+ public void setProperties(com.mojang.authlib.properties.PropertyMap properties) {
+ if (this.properties == null)
+ this.properties = properties;
+ }
+
+ public boolean hasCachedProperties() {
+ return properties != null;
+ }
+
@OnlyIn(Dist.CLIENT)
public static enum Type {
LEGACY("legacy"),
@@ -0,0 +1,10 @@
--- a/net/minecraft/util/SharedConstants.java
+++ b/net/minecraft/util/SharedConstants.java
@@ -29,6 +29,7 @@
}
static {
+ if (System.getProperty("io.netty.leakDetection.level") == null) // Forge: allow level to be manually specified
ResourceLeakDetector.setLevel(field_184877_a);
CommandSyntaxException.ENABLE_COMMAND_STACK_TRACES = false;
CommandSyntaxException.BUILT_IN_EXCEPTIONS = new TranslatableExceptionProvider();
@@ -1,11 +1,13 @@
--- a/net/minecraft/util/SoundEvent.java
+++ b/net/minecraft/util/SoundEvent.java
@@ -4,7 +4,7 @@
@@ -4,8 +4,8 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
-public class SoundEvent {
- public static final RegistryNamespaced<ResourceLocation, SoundEvent> field_187505_a = new RegistryNamespaced<ResourceLocation, SoundEvent>();
+public class SoundEvent extends net.minecraftforge.registries.ForgeRegistryEntry<SoundEvent> {
public static final RegistryNamespaced<ResourceLocation, SoundEvent> field_187505_a = new RegistryNamespaced<ResourceLocation, SoundEvent>();
+ public static final RegistryNamespaced<ResourceLocation, SoundEvent> field_187505_a = net.minecraftforge.registries.GameData.getWrapper(SoundEvent.class);
private final ResourceLocation field_187506_b;
public SoundEvent(ResourceLocation p_i46834_1_) {
@@ -0,0 +1,15 @@
--- a/net/minecraft/util/math/RayTraceResult.java
+++ b/net/minecraft/util/math/RayTraceResult.java
@@ -9,7 +9,12 @@
public EnumFacing field_178784_b;
public Vec3d field_72307_f;
public Entity field_72308_g;
+ /** Used to determine what sub-segment is hit */
+ public int subHit = -1;
+ /** Used to add extra hit info */
+ public Object hitInfo = null;
+
public RayTraceResult(Vec3d p_i47094_1_, EnumFacing p_i47094_2_, BlockPos p_i47094_3_) {
this(RayTraceResult.Type.BLOCK, p_i47094_1_, p_i47094_2_, p_i47094_3_);
}
@@ -0,0 +1,24 @@
--- a/net/minecraft/util/math/Vec3d.java
+++ b/net/minecraft/util/math/Vec3d.java
@@ -2,8 +2,6 @@
import java.util.EnumSet;
import net.minecraft.util.EnumFacing;
-import net.minecraftforge.api.distmarker.Dist;
-import net.minecraftforge.api.distmarker.OnlyIn;
public class Vec3d {
public static final Vec3d field_186680_a = new Vec3d(0.0D, 0.0D, 0.0D);
@@ -136,12 +134,10 @@
return new Vec3d(d0, d1, d2);
}
- @OnlyIn(Dist.CLIENT)
public static Vec3d func_189984_a(Vec2f p_189984_0_) {
return func_189986_a(p_189984_0_.field_189982_i, p_189984_0_.field_189983_j);
}
- @OnlyIn(Dist.CLIENT)
public static Vec3d func_189986_a(float p_189986_0_, float p_189986_1_) {
float f = MathHelper.func_76134_b(-p_189986_1_ * ((float)Math.PI / 180F) - (float)Math.PI);
float f1 = MathHelper.func_76126_a(-p_189986_1_ * ((float)Math.PI / 180F) - (float)Math.PI);
@@ -9,7 +9,7 @@
public static final float[] field_111203_a = new float[]{1.0F, 0.75F, 0.5F, 0.25F, 0.0F, 0.25F, 0.5F, 0.75F};
protected World field_76579_a;
protected boolean field_76575_d;
@@ -141,4 +141,91 @@
@@ -141,4 +141,107 @@
public abstract boolean func_76568_b(int p_76568_1_, int p_76568_2_);
public abstract DimensionType func_186058_p();
@@ -97,6 +97,22 @@
+ return (this.func_76567_e() && this.field_76579_a.func_180494_b(pos) != net.minecraft.init.Biomes.field_76778_j) ? SleepResult.ALLOW : SleepResult.BED_EXPLODES;
+ }
+
+ /**
+ * If this method returns true, then chunks received by the client will
+ * have {@link net.minecraft.world.chunk.Chunk#resetRelightChecks} called
+ * on them, queuing lighting checks for all air blocks in the chunk (and
+ * any adjacent light-emitting blocks).
+ *
+ * Returning true here is recommended if the chunk generator used also
+ * does this for newly generated chunks.
+ *
+ * @return true if lighting checks should be performed
+ */
+ public boolean shouldClientCheckLighting()
+ {
+ return !(this instanceof OverworldDimension);
+ }
+
+ public enum SleepResult {
+ ALLOW, DENY, BED_EXPLODES
+ }
@@ -1,606 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/Minecraft.java
+++ ../src-work/minecraft/net/minecraft/client/Minecraft.java
@@ -344,7 +344,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_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;
@@ -464,10 +463,10 @@
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_110451_am.func_110542_a(this.field_135017_as);
- this.func_110436_a();
+ net.minecraftforge.fml.client.FMLClientHandler.instance().beginMinecraftLoading(this, this.field_110449_ao, this.field_110451_am, this.field_110452_an);
this.field_71446_o = new TextureManager(this.field_110451_am);
this.field_110451_am.func_110542_a(this.field_71446_o);
- this.func_180510_a(this.field_71446_o);
+ net.minecraftforge.fml.client.SplashProgress.drawVanillaScreen(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.field_71469_aa = new AnvilSaveConverter(new File(this.field_71412_D, "saves"), this.field_184131_U);
this.field_147127_av = new SoundHandler(this.field_110451_am, this.field_71474_y);
@@ -487,6 +486,8 @@
this.field_110451_am.func_110542_a(new GrassColorReloadListener());
this.field_110451_am.func_110542_a(new FoliageColorReloadListener());
this.field_71417_B = new MouseHelper();
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar= net.minecraftforge.fml.common.ProgressManager.push("Rendering Setup", 5, true);
+ bar.step("GL Setup");
this.func_71361_d("Pre startup");
GlStateManager.func_179098_w();
GlStateManager.func_179103_j(7425);
@@ -500,19 +501,24 @@
GlStateManager.func_179096_D();
GlStateManager.func_179128_n(5888);
this.func_71361_d("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_110542_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 RenderItem(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 ItemRenderer(this);
this.field_110451_am.func_110542_a(this.field_175621_X);
+ bar.step("Loading Entity Renderer");
+ net.minecraftforge.fml.client.SplashProgress.pause();
this.field_71460_t = new EntityRenderer(this, this.field_110451_am);
this.field_110451_am.func_110542_a(this.field_71460_t);
this.field_175618_aM = new BlockRendererDispatcher(this.field_175617_aL.func_174954_c(), this.field_184127_aH);
@@ -523,23 +529,27 @@
this.field_110451_am.func_110542_a(this.field_193995_ae);
GlStateManager.func_179083_b(0, 0, this.field_71443_c, this.field_71440_d);
this.field_71452_i = new ParticleManager(this.field_71441_e, this.field_71446_o);
+ net.minecraftforge.fml.client.SplashProgress.resume();
+ 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)
{
- this.func_147108_a(new GuiConnecting(new GuiMainMenu(), this, this.field_71475_ae, this.field_71477_af));
+ net.minecraftforge.fml.client.FMLClientHandler.instance().connectToServerAtStartup(this.field_71475_ae, this.field_71477_af);
}
else
{
this.func_147108_a(new GuiMainMenu());
}
- this.field_71446_o.func_147645_c(this.field_152354_ay);
+ net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(field_71446_o, field_152354_ay);
this.field_152354_ay = null;
this.field_71461_s = new LoadingScreenRenderer(this);
this.field_184132_p = new DebugRenderer(this);
+ net.minecraftforge.fml.client.FMLClientHandler.instance().onInitializationComplete();
if (this.field_71474_y.field_74353_u && !this.field_71431_Q)
{
this.func_71352_k();
@@ -748,21 +758,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;
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().handleExit(retVal);
}
public boolean func_152349_b()
@@ -770,6 +782,7 @@
return this.field_135017_as.func_135042_a() || this.field_71474_y.field_151455_aw;
}
+ @Deprecated // Forge: Use selective refreshResources method in FMLClientHandler
public void func_110436_a()
{
List<IResourcePack> list = Lists.newArrayList(this.field_110449_ao);
@@ -955,11 +968,6 @@
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();
@@ -969,6 +977,17 @@
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;
@@ -1082,7 +1101,7 @@
long i1 = System.nanoTime() - l;
this.func_71361_d("Pre render");
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();
@@ -1094,11 +1113,13 @@
if (!this.field_71454_w)
{
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickStart(this.field_71428_T.field_194147_b);
this.field_71424_I.func_76318_c("gameRenderer");
this.field_71460_t.func_181560_a(this.field_71445_n ? this.field_193996_ah : this.field_71428_T.field_194147_b, i);
this.field_71424_I.func_76318_c("toasts");
this.field_193034_aS.func_191783_a(new ScaledResolution(this));
this.field_71424_I.func_76319_b();
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickEnd(this.field_71428_T.field_194147_b);
}
this.field_71424_I.func_76319_b();
@@ -1455,9 +1476,9 @@
{
BlockPos blockpos = this.field_71476_x.func_178782_a();
- if (this.field_71441_e.func_180495_p(blockpos).func_185904_a() != Material.field_151579_a && this.field_71442_b.func_180512_c(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.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_184609_a(EnumHand.MAIN_HAND);
}
}
@@ -1491,7 +1512,7 @@
case BLOCK:
BlockPos blockpos = this.field_71476_x.func_178782_a();
- if (this.field_71441_e.func_180495_p(blockpos).func_185904_a() != Material.field_151579_a)
+ 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;
@@ -1505,6 +1526,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);
@@ -1570,6 +1592,7 @@
}
}
+ 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);
@@ -1630,6 +1653,11 @@
}
Display.setFullscreen(this.field_71431_Q);
+ if (!this.field_71431_Q) //Forge: Fix MC-68754, Screen is not resizeable after exiting fullscreen due to LWJGL bug https://github.com/LWJGL/lwjgl/issues/142 which is fixed, but not in the version MC ships
+ {
+ Display.setResizable(false);
+ Display.setResizable(true);
+ }
Display.setVSyncEnabled(this.field_71474_y.field_74352_v);
this.func_175601_h();
}
@@ -1676,6 +1704,8 @@
--this.field_71467_ac;
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreClientTick();
+
this.field_71424_I.func_76320_a("gui");
if (!this.field_71445_n)
@@ -1877,6 +1907,7 @@
}
this.field_71424_I.func_76319_b();
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick();
this.field_71423_H = func_71386_F();
}
@@ -1982,6 +2013,7 @@
}
}
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput();
}
this.func_184117_aA();
@@ -2239,6 +2271,8 @@
{
while (Mouse.next())
{
+ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue;
+
int i = Mouse.getEventButton();
KeyBinding.func_74510_a(i - 100, Mouse.getEventButtonState());
@@ -2294,6 +2328,7 @@
this.field_71462_r.func_146274_d();
}
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireMouseInput();
}
}
@@ -2304,6 +2339,7 @@
public void func_71371_a(String p_71371_1_, String p_71371_2_, @Nullable WorldSettings p_71371_3_)
{
+ net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(p_71371_1_, p_71371_2_, p_71371_3_);
this.func_71403_a((WorldClient)null);
System.gc();
ISaveHandler isavehandler = this.field_71469_aa.func_75804_a(p_71371_1_, false);
@@ -2344,8 +2380,14 @@
this.field_71461_s.func_73720_a(I18n.func_135052_a("menu.loadingLevel"));
- while (!this.field_71437_Z.func_71200_ad())
+ while (!this.field_71437_Z.func_71200_ad() && !this.field_71437_Z.func_71241_aa())
{
+ if (!net.minecraftforge.fml.common.StartupQuery.check())
+ {
+ func_71403_a(null);
+ func_147108_a(null);
+ return;
+ }
String s = this.field_71437_Z.func_71195_b_();
if (s != null)
@@ -2371,8 +2413,14 @@
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(socketaddress.toString(), 0, EnumConnectionState.LOGIN));
- networkmanager.func_179290_a(new CPacketLoginStart(this.func_110432_I().func_148256_e()));
+ networkmanager.func_179290_a(new C00Handshake(socketaddress.toString(), 0, EnumConnectionState.LOGIN, true));
+ 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;
}
@@ -2383,6 +2431,8 @@
public void func_71353_a(@Nullable 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();
@@ -2395,6 +2445,18 @@
if (this.field_71437_Z != null && this.field_71437_Z.func_175578_N())
{
this.field_71437_Z.func_71263_m();
+ if (field_71461_s != null && this.field_71425_J)
+ {
+ 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;
@@ -2418,6 +2480,7 @@
this.field_71456_v.func_181029_i();
this.func_71351_a((ServerData)null);
this.field_71455_al = false;
+ net.minecraftforge.fml.client.FMLClientHandler.instance().handleClientWorldClosing(this.field_71441_e);
}
this.field_147127_av.func_147690_c();
@@ -2434,6 +2497,7 @@
}
TileEntityRendererDispatcher.field_147556_a.func_147543_a(p_71353_1_);
+ net.minecraftforge.client.MinecraftForgeClient.clearRenderCache();
if (p_71353_1_ != null)
{
@@ -2488,6 +2552,7 @@
EntityPlayerSP entityplayersp = this.field_71439_g;
this.field_71439_g = this.field_71442_b.func_192830_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 RecipeBook() : this.field_71439_g.func_192035_E());
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_71354_1_;
this.field_175622_Z = this.field_71439_g;
this.field_71439_g.func_70065_x();
@@ -2535,159 +2600,8 @@
{
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_185904_a() == Material.field_151579_a)
- {
- 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 item1;
-
- switch (entityminecart.func_184264_v())
- {
- case FURNACE:
- item1 = Items.field_151109_aJ;
- break;
- case CHEST:
- item1 = Items.field_151108_aI;
- break;
- case TNT:
- item1 = Items.field_151142_bV;
- break;
- case HOPPER:
- item1 = Items.field_151140_bW;
- break;
- case COMMAND_BLOCK:
- item1 = Items.field_151095_cc;
- break;
- default:
- item1 = Items.field_151143_au;
- }
-
- itemstack = new ItemStack(item1);
- }
- 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
- {
- ResourceLocation resourcelocation = EntityList.func_191301_a(this.field_71476_x.field_72308_g);
-
- if (resourcelocation == null || !EntityList.field_75627_a.containsKey(resourcelocation))
- {
- return;
- }
-
- itemstack = new ItemStack(Items.field_151063_bx);
- ItemMonsterPlacer.func_185078_a(itemstack, resourcelocation);
- }
- }
-
- if (itemstack.func_190926_b())
- {
- String s = "";
-
- if (this.field_71476_x.field_72313_a == RayTraceResult.Type.BLOCK)
- {
- s = ((ResourceLocation)Block.field_149771_c.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 = EntityList.func_191301_a(this.field_71476_x.field_72308_g).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
}
}
@@ -2834,6 +2748,7 @@
return field_71432_P;
}
+ @Deprecated // Forge: Use selective scheduleResourceRefresh method in FMLClientHandler
public ListenableFuture<Object> func_175603_A()
{
return this.func_152344_a(new Runnable()
@@ -3009,18 +2924,8 @@
public static int func_71369_N()
{
- for (int i = 16384; i > 0; i >>= 1)
- {
- GlStateManager.func_187419_a(32868, 0, 6408, i, i, 0, 6408, 5121, (IntBuffer)null);
- int j = GlStateManager.func_187411_c(32868, 0, 4096);
-
- if (j != 0)
- {
- return i;
- }
- }
-
- return -1;
+ //Forge we redirect this to our code which caches the value before any splash screen stuff is done.
+ return net.minecraftforge.fml.client.SplashProgress.getMaxTextureSize();
}
public boolean func_70002_Q()
@@ -3152,6 +3057,9 @@
}
else if (this.field_71439_g != null)
{
+ MusicTicker.MusicType type = this.field_71441_e.field_73011_w.getMusicType();
+ if (type != null) return type;
+
if (this.field_71439_g.field_70170_p.field_73011_w instanceof WorldProviderHell)
{
return MusicTicker.MusicType.NETHER;
@@ -3181,11 +3089,11 @@
{
if (Keyboard.getEventKeyState())
{
- if (i == this.field_71474_y.field_152395_am.func_151463_i())
+ if (this.field_71474_y.field_152395_am.isActiveAndMatches(i))
{
this.func_71352_k();
}
- else if (i == this.field_71474_y.field_151447_Z.func_151463_i())
+ else if (this.field_71474_y.field_151447_Z.isActiveAndMatches(i))
{
this.field_71456_v.func_146158_b().func_146227_a(ScreenShotHelper.func_148260_a(this.field_71412_D, this.field_71443_c, this.field_71440_d, this.field_147124_at));
}
@@ -3199,6 +3107,7 @@
}
}
}
+ else if (this.field_71462_r instanceof GuiControls) ((GuiControls)this.field_71462_r).field_146491_f = null;
}
}
}
@@ -3328,6 +3237,12 @@
return this.field_184127_aH;
}
+ // FORGE
+ public ItemColors getItemColors()
+ {
+ return this.field_184128_aI;
+ }
+
public boolean func_189648_am()
{
return this.field_71439_g != null && this.field_71439_g.func_175140_cp() || this.field_71474_y.field_178879_v;
@@ -3342,4 +3257,9 @@
{
return this.field_193035_aW;
}
+
+ public SearchTreeManager getSearchTreeManager()
+ {
+ return this.field_193995_ae;
+ }
}
@@ -1,10 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/model/ModelBase.java
+++ ../src-work/minecraft/net/minecraft/client/model/ModelBase.java
@@ -10,7 +10,6 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-@SideOnly(Side.CLIENT)
public abstract class ModelBase
{
public float field_78095_p;
@@ -1,18 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/model/ModelBox.java
+++ ../src-work/minecraft/net/minecraft/client/model/ModelBox.java
@@ -4,7 +4,6 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-@SideOnly(Side.CLIENT)
public class ModelBox
{
private final PositionTextureVertex[] field_78253_h;
@@ -81,6 +80,7 @@
}
}
+ @SideOnly(Side.CLIENT)
public void func_178780_a(BufferBuilder p_178780_1_, float p_178780_2_)
{
for (TexturedQuad texturedquad : this.field_78254_i)
@@ -1,42 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/model/ModelRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/model/ModelRenderer.java
@@ -9,7 +9,6 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-@SideOnly(Side.CLIENT)
public class ModelRenderer
{
public float field_78801_a;
@@ -108,6 +107,7 @@
this.field_78798_e = p_78793_3_;
}
+ @SideOnly(Side.CLIENT)
public void func_78785_a(float p_78785_1_)
{
if (!this.field_78807_k)
@@ -189,6 +189,7 @@
}
}
+ @SideOnly(Side.CLIENT)
public void func_78791_b(float p_78791_1_)
{
if (!this.field_78807_k)
@@ -224,6 +225,7 @@
}
}
+ @SideOnly(Side.CLIENT)
public void func_78794_c(float p_78794_1_)
{
if (!this.field_78807_k)
@@ -265,6 +267,7 @@
}
}
+ @SideOnly(Side.CLIENT)
private void func_78788_d(float p_78788_1_)
{
this.field_78811_r = GLAllocation.func_74526_a(1);
@@ -1,13 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/model/PositionTextureVertex.java
+++ ../src-work/minecraft/net/minecraft/client/model/PositionTextureVertex.java
@@ -1,10 +1,7 @@
package net.minecraft.client.model;
import net.minecraft.util.math.Vec3d;
-import net.minecraftforge.fml.relauncher.Side;
-import net.minecraftforge.fml.relauncher.SideOnly;
-@SideOnly(Side.CLIENT)
public class PositionTextureVertex
{
public Vec3d field_78243_a;
@@ -1,18 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/model/TexturedQuad.java
+++ ../src-work/minecraft/net/minecraft/client/model/TexturedQuad.java
@@ -7,7 +7,6 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-@SideOnly(Side.CLIENT)
public class TexturedQuad
{
public PositionTextureVertex[] field_78239_a;
@@ -43,6 +42,7 @@
this.field_78239_a = apositiontexturevertex;
}
+ @SideOnly(Side.CLIENT)
public void func_178765_a(BufferBuilder p_178765_1_, float p_178765_2_)
{
Vec3d vec3d = this.field_78239_a[1].field_78243_a.func_72444_a(this.field_78239_a[0].field_78243_a);
@@ -1,10 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/ChunkProviderClient.java
@@ -60,6 +60,7 @@
{
Chunk chunk = new Chunk(this.field_73235_d, p_73158_1_, p_73158_2_);
this.field_73236_b.put(ChunkPos.func_77272_a(p_73158_1_, p_73158_2_), chunk);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.ChunkEvent.Load(chunk));
chunk.func_177417_c(true);
return chunk;
}
@@ -1,11 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/GuiConnecting.java
@@ -67,7 +67,7 @@
inetaddress = InetAddress.getByName(p_146367_1_);
GuiConnecting.this.field_146371_g = NetworkManager.func_181124_a(inetaddress, p_146367_2_, GuiConnecting.this.field_146297_k.field_71474_y.func_181148_f());
GuiConnecting.this.field_146371_g.func_150719_a(new NetHandlerLoginClient(GuiConnecting.this.field_146371_g, GuiConnecting.this.field_146297_k, GuiConnecting.this.field_146374_i));
- GuiConnecting.this.field_146371_g.func_179290_a(new C00Handshake(p_146367_1_, p_146367_2_, EnumConnectionState.LOGIN));
+ GuiConnecting.this.field_146371_g.func_179290_a(new C00Handshake(p_146367_1_, p_146367_2_, EnumConnectionState.LOGIN, true));
GuiConnecting.this.field_146371_g.func_179290_a(new CPacketLoginStart(GuiConnecting.this.field_146297_k.func_110432_I().func_148256_e()));
}
catch (UnknownHostException unknownhostexception)
@@ -1,214 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/PlayerControllerMP.java
@@ -126,10 +126,16 @@
}
}
- if (this.field_78779_k.func_77145_d() && !this.field_78776_a.field_71439_g.func_184614_ca().func_190926_b() && this.field_78776_a.field_71439_g.func_184614_ca().func_77973_b() instanceof ItemSword)
+ ItemStack stack = field_78776_a.field_71439_g.func_184614_ca();
+ if (!stack.func_190926_b() && stack.func_77973_b().onBlockStartBreak(stack, p_187103_1_, field_78776_a.field_71439_g))
{
return false;
}
+
+ if (this.field_78779_k.func_77145_d() && !stack.func_190926_b() && !stack.func_77973_b().canDestroyBlockInCreative(field_78776_a.field_71441_e, p_187103_1_, stack, field_78776_a.field_71439_g))
+ {
+ return false;
+ }
else
{
World world = this.field_78776_a.field_71441_e;
@@ -147,19 +153,13 @@
else
{
world.func_175718_b(2001, p_187103_1_, Block.func_176210_f(iblockstate));
- block.func_176208_a(world, p_187103_1_, iblockstate, this.field_78776_a.field_71439_g);
- boolean flag = world.func_180501_a(p_187103_1_, Blocks.field_150350_a.func_176223_P(), 11);
- if (flag)
- {
- block.func_176206_d(world, p_187103_1_, iblockstate);
- }
-
this.field_178895_c = new BlockPos(this.field_178895_c.func_177958_n(), -1, this.field_178895_c.func_177952_p());
if (!this.field_78779_k.func_77145_d())
{
ItemStack itemstack1 = this.field_78776_a.field_71439_g.func_184614_ca();
+ ItemStack copyBeforeUse = itemstack1.func_77946_l();
if (!itemstack1.func_190926_b())
{
@@ -167,11 +167,18 @@
if (itemstack1.func_190926_b())
{
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.field_78776_a.field_71439_g, copyBeforeUse, EnumHand.MAIN_HAND);
this.field_78776_a.field_71439_g.func_184611_a(EnumHand.MAIN_HAND, ItemStack.field_190927_a);
}
}
}
+ boolean flag = block.removedByPlayer(iblockstate, world, p_187103_1_, field_78776_a.field_71439_g, false);
+
+ if (flag)
+ {
+ block.func_176206_d(world, p_187103_1_, iblockstate);
+ }
return flag;
}
}
@@ -212,6 +219,7 @@
{
this.field_78776_a.func_193032_ao().func_193294_a(this.field_78776_a.field_71441_e, p_180511_1_, this.field_78776_a.field_71441_e.func_180495_p(p_180511_1_), 1.0F);
this.field_78774_b.func_147297_a(new CPacketPlayerDigging(CPacketPlayerDigging.Action.START_DESTROY_BLOCK, p_180511_1_, p_180511_2_));
+ if (!net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180511_1_, p_180511_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(this.field_78776_a.field_71439_g, func_78757_d() + 1)).isCanceled())
func_178891_a(this.field_78776_a, this, p_180511_1_, p_180511_2_);
this.field_78781_i = 5;
}
@@ -221,6 +229,7 @@
{
this.field_78774_b.func_147297_a(new CPacketPlayerDigging(CPacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, this.field_178895_c, p_180511_2_));
}
+ net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock event = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(this.field_78776_a.field_71439_g, p_180511_1_, p_180511_2_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(this.field_78776_a.field_71439_g, func_78757_d() + 1));
IBlockState iblockstate = this.field_78776_a.field_71441_e.func_180495_p(p_180511_1_);
this.field_78776_a.func_193032_ao().func_193294_a(this.field_78776_a.field_71441_e, p_180511_1_, iblockstate, 0.0F);
@@ -229,9 +238,11 @@
if (flag && this.field_78770_f == 0.0F)
{
+ if (event.getUseBlock() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY)
iblockstate.func_177230_c().func_180649_a(this.field_78776_a.field_71441_e, p_180511_1_, this.field_78776_a.field_71439_g);
}
+ if (event.getUseItem() == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) return true;
if (flag && iblockstate.func_185903_a(this.field_78776_a.field_71439_g, this.field_78776_a.field_71439_g.field_70170_p, p_180511_1_) >= 1.0F)
{
this.func_187103_a(p_180511_1_);
@@ -297,7 +308,7 @@
if (this.field_78780_h % 4.0F == 0.0F)
{
- SoundType soundtype = block.func_185467_w();
+ SoundType soundtype = block.getSoundType(iblockstate, field_78776_a.field_71441_e, p_180512_1_, field_78776_a.field_71439_g);
this.field_78776_a.func_147118_V().func_147682_a(new PositionedSoundRecord(soundtype.func_185846_f(), SoundCategory.NEUTRAL, (soundtype.func_185843_a() + 1.0F) / 8.0F, soundtype.func_185847_b() * 0.5F, p_180512_1_));
}
@@ -326,7 +337,8 @@
public float func_78757_d()
{
- return this.field_78779_k.func_77145_d() ? 5.0F : 4.5F;
+ float attrib = (float) field_78776_a.field_71439_g.func_110148_a(EntityPlayer.REACH_DISTANCE).func_111126_e();
+ return this.field_78779_k.func_77145_d() ? attrib : attrib - 0.5F;
}
public void func_78765_e()
@@ -350,7 +362,7 @@
if (!this.field_85183_f.func_190926_b() && !itemstack.func_190926_b())
{
- flag = itemstack.func_77973_b() == this.field_85183_f.func_77973_b() && ItemStack.func_77970_a(itemstack, this.field_85183_f) && (itemstack.func_77984_f() || itemstack.func_77960_j() == this.field_85183_f.func_77960_j());
+ flag = !net.minecraftforge.client.ForgeHooksClient.shouldCauseBlockBreakReset(this.field_85183_f, itemstack);
}
return p_178893_1_.equals(this.field_178895_c) && flag;
@@ -382,13 +394,34 @@
}
else
{
+ net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = net.minecraftforge.common.ForgeHooks
+ .onRightClickBlock(p_187099_1_, p_187099_6_, p_187099_3_, p_187099_4_, net.minecraftforge.common.ForgeHooks.rayTraceEyeHitVec(p_187099_1_, func_78757_d() + 1));
+ if (event.isCanceled())
+ {
+ // Give the server a chance to fire event as well. That way server event is not dependant on client event.
+ this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2));
+ return event.getCancellationResult();
+ }
+ EnumActionResult result = EnumActionResult.PASS;
+
if (this.field_78779_k != GameType.SPECTATOR)
{
+ EnumActionResult ret = itemstack.onItemUseFirst(p_187099_1_, p_187099_2_, p_187099_3_, p_187099_6_, p_187099_4_, f, f1, f2);
+ if (ret != EnumActionResult.PASS)
+ {
+ // The server needs to process the item use as well. Otherwise onItemUseFirst won't ever be called on the server without causing weird bugs
+ this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2));
+ return ret;
+ }
+
IBlockState iblockstate = p_187099_2_.func_180495_p(p_187099_3_);
+ boolean bypass = p_187099_1_.func_184614_ca().doesSneakBypassUse(p_187099_2_, p_187099_3_, p_187099_1_) && p_187099_1_.func_184592_cb().doesSneakBypassUse(p_187099_2_, p_187099_3_, p_187099_1_);
- if ((!p_187099_1_.func_70093_af() || p_187099_1_.func_184614_ca().func_190926_b() && p_187099_1_.func_184592_cb().func_190926_b()) && iblockstate.func_177230_c().func_180639_a(p_187099_2_, p_187099_3_, iblockstate, p_187099_1_, p_187099_6_, p_187099_4_, f, f1, f2))
+ if ((!p_187099_1_.func_70093_af() || bypass || event.getUseBlock() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW))
{
- flag = true;
+ if (event.getUseBlock() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY)
+ flag = iblockstate.func_177230_c().func_180639_a(p_187099_2_, p_187099_3_, iblockstate, p_187099_1_, p_187099_6_, p_187099_4_, f, f1, f2);
+ if (flag) result = EnumActionResult.SUCCESS;
}
if (!flag && itemstack.func_77973_b() instanceof ItemBlock)
@@ -404,7 +437,7 @@
this.field_78774_b.func_147297_a(new CPacketPlayerTryUseItemOnBlock(p_187099_3_, p_187099_4_, p_187099_6_, f, f1, f2));
- if (!flag && this.field_78779_k != GameType.SPECTATOR)
+ if (!flag && this.field_78779_k != GameType.SPECTATOR || event.getUseItem() == net.minecraftforge.fml.common.eventhandler.Event.Result.ALLOW)
{
if (itemstack.func_190926_b())
{
@@ -430,14 +463,20 @@
{
int i = itemstack.func_77960_j();
int j = itemstack.func_190916_E();
+ if (event.getUseItem() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY) {
EnumActionResult enumactionresult = itemstack.func_179546_a(p_187099_1_, p_187099_2_, p_187099_3_, p_187099_6_, p_187099_4_, f, f1, f2);
itemstack.func_77964_b(i);
itemstack.func_190920_e(j);
return enumactionresult;
+ } else return result;
}
else
{
- return itemstack.func_179546_a(p_187099_1_, p_187099_2_, p_187099_3_, p_187099_6_, p_187099_4_, f, f1, f2);
+ ItemStack copyForUse = itemstack.func_77946_l();
+ if (event.getUseItem() != net.minecraftforge.fml.common.eventhandler.Event.Result.DENY)
+ result = itemstack.func_179546_a(p_187099_1_, p_187099_2_, p_187099_3_, p_187099_6_, p_187099_4_, f, f1, f2);
+ if (itemstack.func_190926_b()) net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187099_1_, copyForUse, p_187099_6_);
+ return result;
}
}
}
@@ -466,6 +505,8 @@
}
else
{
+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onItemRightClick(p_187101_1_, p_187101_3_);
+ if (cancelResult != null) return cancelResult;
int i = itemstack.func_190916_E();
ActionResult<ItemStack> actionresult = itemstack.func_77957_a(p_187101_2_, p_187101_1_, p_187101_3_);
ItemStack itemstack1 = actionresult.func_188398_b();
@@ -473,6 +514,10 @@
if (itemstack1 != itemstack || itemstack1.func_190916_E() != i)
{
p_187101_1_.func_184611_a(p_187101_3_, itemstack1);
+ if (itemstack1.func_190926_b())
+ {
+ net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(p_187101_1_, itemstack, p_187101_3_);
+ }
}
return actionresult.func_188397_a();
@@ -509,6 +554,9 @@
this.func_78750_j();
Vec3d vec3d = new Vec3d(p_187102_3_.field_72307_f.field_72450_a - p_187102_2_.field_70165_t, p_187102_3_.field_72307_f.field_72448_b - p_187102_2_.field_70163_u, p_187102_3_.field_72307_f.field_72449_c - p_187102_2_.field_70161_v);
this.field_78774_b.func_147297_a(new CPacketUseEntity(p_187102_2_, p_187102_4_, vec3d));
+ if (this.field_78779_k == GameType.SPECTATOR) return EnumActionResult.PASS; // don't fire for spectators to match non-specific EntityInteract
+ EnumActionResult cancelResult = net.minecraftforge.common.ForgeHooks.onInteractEntityAt(p_187102_1_, p_187102_2_, p_187102_3_, p_187102_4_);
+ if(cancelResult != null) return cancelResult;
return this.field_78779_k == GameType.SPECTATOR ? EnumActionResult.PASS : p_187102_2_.func_184199_a(p_187102_1_, vec3d, p_187102_4_);
}
@@ -1,24 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/multiplayer/WorldClient.java
+++ ../src-work/minecraft/net/minecraft/client/multiplayer/WorldClient.java
@@ -60,17 +60,19 @@
public WorldClient(NetHandlerPlayClient p_i45063_1_, WorldSettings p_i45063_2_, int p_i45063_3_, EnumDifficulty p_i45063_4_, Profiler p_i45063_5_)
{
- super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), DimensionType.func_186069_a(p_i45063_3_).func_186070_d(), p_i45063_5_, true);
+ super(new SaveHandlerMP(), new WorldInfo(p_i45063_2_, "MpServer"), net.minecraftforge.common.DimensionManager.createProviderFor(p_i45063_3_), p_i45063_5_, true);
this.field_184158_M = this.field_73012_v.nextInt(12000);
this.field_184157_a = Sets.<ChunkPos>newHashSet();
this.field_73035_a = p_i45063_1_;
this.func_72912_H().func_176144_a(p_i45063_4_);
- this.func_175652_B(new BlockPos(8, 64, 8));
this.field_73011_w.func_76558_a(this);
+ this.func_175652_B(new BlockPos(8, 64, 8)); //Forge: Moved below registerWorld to prevent NPE in our redirect.
this.field_73020_y = this.func_72970_h();
this.field_72988_C = new SaveDataMemoryStorage();
this.func_72966_v();
this.func_72947_a();
+ this.initCapabilities();
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(this));
}
public void func_72835_b()
@@ -1,10 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java
+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerHandshakeMemory.java
@@ -23,6 +23,7 @@
public void func_147383_a(C00Handshake p_147383_1_)
{
+ if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerHandshake(p_147383_1_, this.field_147384_b)) return;
this.field_147384_b.func_150723_a(p_147383_1_.func_149594_c());
this.field_147384_b.func_150719_a(new NetHandlerLoginServer(this.field_147385_a, this.field_147384_b));
}
@@ -1,14 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java
+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerLoginClient.java
@@ -108,7 +108,10 @@
{
this.field_175091_e = p_147390_1_.func_179730_a();
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));
+ 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);
+ net.minecraftforge.fml.client.FMLClientHandler.instance().setPlayClient(nhpc);
+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.fmlClientHandshake(this.field_147393_d);
}
public void func_147231_a(ITextComponent p_147231_1_)
@@ -1,101 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java
+++ ../src-work/minecraft/net/minecraft/client/network/NetHandlerPlayClient.java
@@ -295,7 +295,7 @@
{
PacketThreadUtil.func_180031_a(p_147282_1_, this, this.field_147299_f);
this.field_147299_f.field_71442_b = new PlayerControllerMP(this.field_147299_f, this);
- this.field_147300_g = new WorldClient(this, new WorldSettings(0L, p_147282_1_.func_149198_e(), false, p_147282_1_.func_149195_d(), p_147282_1_.func_149196_i()), p_147282_1_.func_149194_f(), p_147282_1_.func_149192_g(), this.field_147299_f.field_71424_I);
+ this.field_147300_g = new WorldClient(this, new WorldSettings(0L, p_147282_1_.func_149198_e(), false, p_147282_1_.func_149195_d(), p_147282_1_.func_149196_i()), net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.get(func_147298_b()).getOverrideDimension(p_147282_1_), p_147282_1_.func_149192_g(), this.field_147299_f.field_71424_I);
this.field_147299_f.field_71474_y.field_74318_M = p_147282_1_.func_149192_g();
this.field_147299_f.func_71403_a(this.field_147300_g);
this.field_147299_f.field_71439_g.field_71093_bK = p_147282_1_.func_149194_f();
@@ -745,7 +745,7 @@
chunk.func_186033_a(p_147263_1_.func_186946_a(), p_147263_1_.func_149276_g(), p_147263_1_.func_149274_i());
this.field_147300_g.func_147458_c(p_147263_1_.func_149273_e() << 4, 0, p_147263_1_.func_149271_f() << 4, (p_147263_1_.func_149273_e() << 4) + 15, 256, (p_147263_1_.func_149271_f() << 4) + 15);
- if (!p_147263_1_.func_149274_i() || !(this.field_147300_g.field_73011_w instanceof WorldProviderSurface))
+ if (!p_147263_1_.func_149274_i() || this.field_147300_g.field_73011_w.shouldClientCheckLighting())
{
chunk.func_76613_n();
}
@@ -757,7 +757,7 @@
if (tileentity != null)
{
- tileentity.func_145839_a(nbttagcompound);
+ tileentity.handleUpdateTag(nbttagcompound);
}
}
}
@@ -840,7 +840,9 @@
public void func_147251_a(SPacketChat p_147251_1_)
{
PacketThreadUtil.func_180031_a(p_147251_1_, this, this.field_147299_f);
- this.field_147299_f.field_71456_v.func_191742_a(p_147251_1_.func_192590_c(), p_147251_1_.func_148915_c());
+ net.minecraft.util.text.ITextComponent message = net.minecraftforge.event.ForgeEventFactory.onClientChat(p_147251_1_.func_192590_c(), p_147251_1_.func_148915_c());
+ if (message == null) return;
+ this.field_147299_f.field_71456_v.func_191742_a(p_147251_1_.func_192590_c(), message);
}
public void func_147279_a(SPacketAnimation p_147279_1_)
@@ -971,7 +973,7 @@
if (entity1 == this.field_147299_f.field_71439_g && !flag)
{
- this.field_147299_f.field_71456_v.func_110326_a(I18n.func_135052_a("mount.onboard", GameSettings.func_74298_c(this.field_147299_f.field_71474_y.field_74311_E.func_151463_i())), false);
+ this.field_147299_f.field_71456_v.func_110326_a(I18n.func_135052_a("mount.onboard", this.field_147299_f.field_71474_y.field_74311_E.getDisplayName()), false);
}
}
}
@@ -1219,6 +1221,15 @@
{
tileentity.func_145839_a(p_147273_1_.func_148857_g());
}
+ else
+ {
+ if(tileentity == null)
+ {
+ field_147301_d.error("Received invalid update packet for null tile entity at {} with data: {}", p_147273_1_.func_179823_a(), p_147273_1_.func_148857_g());
+ return;
+ }
+ tileentity.onDataPacket(field_147302_e, p_147273_1_);
+ }
if (flag && this.field_147299_f.field_71462_r instanceof GuiCommandBlock)
{
@@ -1319,15 +1330,15 @@
}
else if (f == 101.0F)
{
- this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(new TextComponentTranslation("demo.help.movement", new Object[] {GameSettings.func_74298_c(gamesettings.field_74351_w.func_151463_i()), GameSettings.func_74298_c(gamesettings.field_74370_x.func_151463_i()), GameSettings.func_74298_c(gamesettings.field_74368_y.func_151463_i()), GameSettings.func_74298_c(gamesettings.field_74366_z.func_151463_i())}));
+ this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(new TextComponentTranslation("demo.help.movement", new Object[] {gamesettings.field_74351_w.getDisplayName(), gamesettings.field_74370_x.getDisplayName(), gamesettings.field_74368_y.getDisplayName(), gamesettings.field_74366_z.getDisplayName()}));
}
else if (f == 102.0F)
{
- this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(new TextComponentTranslation("demo.help.jump", new Object[] {GameSettings.func_74298_c(gamesettings.field_74314_A.func_151463_i())}));
+ this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(new TextComponentTranslation("demo.help.jump", new Object[] {gamesettings.field_74314_A.getDisplayName()}));
}
else if (f == 103.0F)
{
- this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(new TextComponentTranslation("demo.help.inventory", new Object[] {GameSettings.func_74298_c(gamesettings.field_151445_Q.func_151463_i())}));
+ this.field_147299_f.field_71456_v.func_146158_b().func_146227_a(new TextComponentTranslation("demo.help.inventory", new Object[] {gamesettings.field_151445_Q.getDisplayName()}));
}
}
else if (i == 6)
@@ -1489,7 +1500,7 @@
if (entity instanceof EntityLivingBase)
{
- Potion potion = Potion.func_188412_a(p_147260_1_.func_149427_e());
+ Potion potion = Potion.func_188412_a(p_147260_1_.func_149427_e() & 0xFF);
if (potion != null)
{
@@ -1856,6 +1867,7 @@
}
finally
{
+ if (false) // Forge: let packet handle releasing buffer
packetbuffer.release();
}
}
@@ -1,19 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/network/ServerPinger.java
+++ ../src-work/minecraft/net/minecraft/client/network/ServerPinger.java
@@ -150,6 +150,7 @@
p_147224_1_.func_147407_a((String)null);
}
+ net.minecraftforge.fml.client.FMLClientHandler.instance().bindServerListData(p_147224_1_, serverstatusresponse);
this.field_175092_e = Minecraft.func_71386_F();
networkmanager.func_179290_a(new CPacketPing(this.field_175092_e));
this.field_147403_d = true;
@@ -176,7 +177,7 @@
try
{
- networkmanager.func_179290_a(new C00Handshake(serveraddress.func_78861_a(), serveraddress.func_78864_b(), EnumConnectionState.STATUS));
+ networkmanager.func_179290_a(new C00Handshake(serveraddress.func_78861_a(), serveraddress.func_78864_b(), EnumConnectionState.STATUS, true));
networkmanager.func_179290_a(new CPacketServerQuery());
}
catch (Throwable throwable)
@@ -1,40 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/particle/Particle.java
+++ ../src-work/minecraft/net/minecraft/client/particle/Particle.java
@@ -265,8 +265,8 @@
{
this.field_187134_n = p_187115_1_;
this.field_187135_o = p_187115_2_;
- AxisAlignedBB axisalignedbb = this.func_187116_l();
- this.func_187108_a(new AxisAlignedBB(axisalignedbb.field_72340_a, axisalignedbb.field_72338_b, axisalignedbb.field_72339_c, axisalignedbb.field_72340_a + (double)this.field_187134_n, axisalignedbb.field_72338_b + (double)this.field_187135_o, axisalignedbb.field_72339_c + (double)this.field_187134_n));
+ // FORGE: Fix MC-12269 - Glitchy movement when setSize is called without setPosition
+ func_187109_b(field_187126_f, field_187127_g, field_187128_h);
}
}
@@ -283,6 +283,8 @@
public void func_187110_a(double p_187110_1_, double p_187110_3_, double p_187110_5_)
{
double d0 = p_187110_3_;
+ double origX = p_187110_1_;
+ double origZ = p_187110_5_;
if (this.field_190017_n)
{
@@ -315,14 +317,14 @@
}
this.func_187118_j();
- this.field_187132_l = p_187110_3_ != p_187110_3_ && d0 < 0.0D;
+ this.field_187132_l = d0 != p_187110_3_ && d0 < 0.0D;
- if (p_187110_1_ != p_187110_1_)
+ if (origX != p_187110_1_)
{
this.field_187129_i = 0.0D;
}
- if (p_187110_5_ != p_187110_5_)
+ if (origZ != p_187110_5_)
{
this.field_187131_k = 0.0D;
}
@@ -1,33 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/particle/ParticleManager.java
+++ ../src-work/minecraft/net/minecraft/client/particle/ParticleManager.java
@@ -153,6 +153,7 @@
public void func_78873_a(Particle p_78873_1_)
{
+ if (p_78873_1_ == null) return; //Forge: Prevent modders from being bad and adding nulls causing untraceable NPEs.
this.field_187241_h.add(p_78873_1_);
}
@@ -409,7 +410,7 @@
public void func_180533_a(BlockPos p_180533_1_, IBlockState p_180533_2_)
{
- if (p_180533_2_.func_185904_a() != Material.field_151579_a)
+ if (!p_180533_2_.func_177230_c().isAir(p_180533_2_, this.field_78878_a, p_180533_1_) && !p_180533_2_.func_177230_c().addDestroyEffects(field_78878_a, p_180533_1_, this))
{
p_180533_2_ = p_180533_2_.func_185899_b(this.field_78878_a, p_180533_1_);
int i = 4;
@@ -493,4 +494,13 @@
return "" + i;
}
+
+ public void addBlockHitEffects(BlockPos pos, net.minecraft.util.math.RayTraceResult target)
+ {
+ IBlockState state = field_78878_a.func_180495_p(pos);
+ if (state != null && !state.func_177230_c().addHitEffects(state, field_78878_a, target, this))
+ {
+ func_180532_a(pos, target.field_178784_b);
+ }
+ }
}
@@ -1,10 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/resources/FallbackResourceManager.java
+++ ../src-work/minecraft/net/minecraft/client/resources/FallbackResourceManager.java
@@ -69,6 +69,7 @@
throw new FileNotFoundException(p_110536_1_.toString());
}
+ @SuppressWarnings("resource")
protected InputStream func_177245_a(ResourceLocation p_177245_1_, IResourcePack p_177245_2_) throws IOException
{
InputStream inputstream = p_177245_2_.func_110590_a(p_177245_1_);
@@ -1,14 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/resources/IResourceManagerReloadListener.java
+++ ../src-work/minecraft/net/minecraft/client/resources/IResourceManagerReloadListener.java
@@ -3,6 +3,11 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
+/**
+ * @deprecated Forge: {@link net.minecraftforge.client.resource.ISelectiveResourceReloadListener}, which selectively allows
+ * individual resource types being reloaded should rather be used where possible.
+ */
+@Deprecated
@SideOnly(Side.CLIENT)
public interface IResourceManagerReloadListener
{
@@ -1,24 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/resources/Language.java
+++ ../src-work/minecraft/net/minecraft/client/resources/Language.java
@@ -17,6 +17,12 @@
this.field_135037_b = p_i1303_2_;
this.field_135038_c = p_i1303_3_;
this.field_135036_d = p_i1303_4_;
+ String[] splitLangCode = field_135039_a.split("_", 2);
+ if (splitLangCode.length == 1) { // Vanilla has some languages without underscores
+ this.javaLocale = new java.util.Locale(field_135039_a);
+ } else {
+ this.javaLocale = new java.util.Locale(splitLangCode[0], splitLangCode[1]);
+ }
}
public String func_135034_a()
@@ -55,4 +61,8 @@
{
return this.field_135039_a.compareTo(p_compareTo_1_.field_135039_a);
}
+
+ // Forge: add access to Locale so modders can create correct string and number formatters
+ private final java.util.Locale javaLocale;
+ public java.util.Locale getJavaLocale() { return javaLocale; }
}
@@ -1,11 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/resources/Locale.java
+++ ../src-work/minecraft/net/minecraft/client/resources/Locale.java
@@ -95,6 +95,8 @@
private void func_135021_a(InputStream p_135021_1_) throws IOException
{
+ p_135021_1_ = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(field_135032_a, p_135021_1_);
+ if (p_135021_1_ == null) return;
for (String s : IOUtils.readLines(p_135021_1_, StandardCharsets.UTF_8))
{
if (!s.isEmpty() && s.charAt(0) != '#')
@@ -1,44 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java
+++ ../src-work/minecraft/net/minecraft/client/resources/SimpleReloadableResourceManager.java
@@ -92,6 +92,7 @@
public void func_110541_a(List<IResourcePack> p_110541_1_)
{
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resources", p_110541_1_.size()+1, true);
this.func_110543_a();
field_147967_a.info("Reloading ResourceManager: {}", (Object)field_130074_a.join(Iterables.transform(p_110541_1_, new Function<IResourcePack, String>()
{
@@ -103,23 +104,33 @@
for (IResourcePack iresourcepack : p_110541_1_)
{
+ resReload.step(iresourcepack.func_130077_b());
this.func_110545_a(iresourcepack);
}
+ resReload.step("Reloading listeners");
this.func_110544_b();
+ net.minecraftforge.fml.common.ProgressManager.pop(resReload);
}
public void func_110542_a(IResourceManagerReloadListener p_110542_1_)
{
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Loading Resource", 1);
+ resReload.step(p_110542_1_.getClass());
this.field_110546_b.add(p_110542_1_);
p_110542_1_.func_110549_a(this);
+ net.minecraftforge.fml.common.ProgressManager.pop(resReload);
}
private void func_110544_b()
{
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar resReload = net.minecraftforge.fml.common.ProgressManager.push("Reloading", this.field_110546_b.size());
for (IResourceManagerReloadListener iresourcemanagerreloadlistener : this.field_110546_b)
{
+ resReload.step(iresourcemanagerreloadlistener.getClass());
+ if (!net.minecraftforge.client.ForgeHooksClient.shouldUseVanillaReloadableListener(iresourcemanagerreloadlistener)) continue; // Forge: Selective reloading for vanilla listeners
iresourcemanagerreloadlistener.func_110549_a(this);
}
+ net.minecraftforge.fml.common.ProgressManager.pop(resReload);
}
}
@@ -1,57 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/shader/Framebuffer.java
+++ ../src-work/minecraft/net/minecraft/client/shader/Framebuffer.java
@@ -118,8 +118,17 @@
if (this.field_147619_e)
{
OpenGlHelper.func_153176_h(OpenGlHelper.field_153199_f, this.field_147624_h);
+ if (!this.stencilEnabled)
+ {
OpenGlHelper.func_153186_a(OpenGlHelper.field_153199_f, 33190, this.field_147622_a, this.field_147620_b);
OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, OpenGlHelper.field_153201_h, OpenGlHelper.field_153199_f, this.field_147624_h);
+ }
+ else
+ {
+ OpenGlHelper.func_153186_a(OpenGlHelper.field_153199_f, org.lwjgl.opengl.EXTPackedDepthStencil.GL_DEPTH24_STENCIL8_EXT, this.field_147622_a, this.field_147620_b);
+ OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, org.lwjgl.opengl.EXTFramebufferObject.GL_DEPTH_ATTACHMENT_EXT, OpenGlHelper.field_153199_f, this.field_147624_h);
+ OpenGlHelper.func_153190_b(OpenGlHelper.field_153198_e, org.lwjgl.opengl.EXTFramebufferObject.GL_STENCIL_ATTACHMENT_EXT, OpenGlHelper.field_153199_f, this.field_147624_h);
+ }
}
this.func_147614_f();
@@ -279,4 +288,36 @@
GlStateManager.func_179086_m(i);
this.func_147609_e();
}
+
+ /*================================ FORGE START ================================================*/
+ private boolean stencilEnabled = false;
+ /**
+ * Attempts to enabled 8 bits of stencil buffer on this FrameBuffer.
+ * Modders must call this directly to set things up.
+ * This is to prevent the default cause where graphics cards do not support stencil bits.
+ * Modders should check the below 'isStencilEnabled' to check if another modder has already enabled them.
+ *
+ * Note:
+ * As of now the only thing that is checked is if FBOs are supported entirely, in the future
+ * we may expand to check for errors.
+ *
+ * @return True if the FBO was re-initialized with stencil bits.
+ */
+ public boolean enableStencil()
+ {
+ if (!OpenGlHelper.func_148822_b()) return false;
+ stencilEnabled = true;
+ this.func_147613_a(field_147621_c, field_147618_d);
+ return true; //TODO: Find a way to detect if this failed?
+ }
+
+ /**
+ * Returns wither or not this FBO has been successfully initialized with stencil bits.
+ * If not, and a modder wishes it to be, they must call enableStencil.
+ */
+ public boolean isStencilEnabled()
+ {
+ return this.stencilEnabled;
+ }
+ /*================================ FORGE END ================================================*/
}
@@ -1,12 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/shader/ShaderGroup.java
+++ ../src-work/minecraft/net/minecraft/client/shader/ShaderGroup.java
@@ -179,7 +179,8 @@
if (framebuffer2 == null)
{
- ResourceLocation resourcelocation = new ResourceLocation("textures/effect/" + s3 + ".png");
+ String[] rl = ResourceLocation.func_177516_a(s3);
+ ResourceLocation resourcelocation = new ResourceLocation(rl[0], "textures/effect/" + rl[1] + ".png");
IResource iresource = null;
try
@@ -1,12 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/shader/ShaderLoader.java
+++ ../src-work/minecraft/net/minecraft/client/shader/ShaderLoader.java
@@ -60,7 +60,8 @@
if (shaderloader == null)
{
- ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_148057_2_ + p_148057_1_.func_148063_b());
+ String[] rl = ResourceLocation.func_177516_a(p_148057_2_);
+ ResourceLocation resourcelocation = new ResourceLocation(rl[0], "shaders/program/" + rl[1] + p_148057_1_.func_148063_b());
IResource iresource = p_148057_0_.func_110536_a(resourcelocation);
try
@@ -1,12 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/shader/ShaderManager.java
+++ ../src-work/minecraft/net/minecraft/client/shader/ShaderManager.java
@@ -54,7 +54,8 @@
public ShaderManager(IResourceManager p_i45087_1_, String p_i45087_2_) throws JsonException, IOException
{
JsonParser jsonparser = new JsonParser();
- ResourceLocation resourcelocation = new ResourceLocation("shaders/program/" + p_i45087_2_ + ".json");
+ String[] rl = ResourceLocation.func_177516_a(p_i45087_2_);
+ ResourceLocation resourcelocation = new ResourceLocation(rl[0], "shaders/program/" + rl[1] + ".json");
this.field_148007_m = p_i45087_2_;
IResource iresource = null;
@@ -1,17 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/util/RecipeBookClient.java
+++ ../src-work/minecraft/net/minecraft/client/util/RecipeBookClient.java
@@ -54,6 +54,14 @@
static
{
+ rebuildTable();
+ }
+
+ public static void rebuildTable()
+ {
+ field_194086_e.clear();
+ field_194087_f.clear();
+
Table<CreativeTabs, String, RecipeList> table = HashBasedTable.<CreativeTabs, String, RecipeList>create();
for (IRecipe irecipe : CraftingManager.field_193380_a)
@@ -1,19 +0,0 @@
--- ../src-base/minecraft/net/minecraft/client/util/RecipeItemHelper.java
+++ ../src-work/minecraft/net/minecraft/client/util/RecipeItemHelper.java
@@ -24,10 +24,15 @@
public void func_194112_a(ItemStack p_194112_1_)
{
+ this.accountStack(p_194112_1_, -1);
+ }
+
+ public void accountStack(ItemStack p_194112_1_, int forceCount)
+ {
if (!p_194112_1_.func_190926_b() && !p_194112_1_.func_77951_h() && !p_194112_1_.func_77948_v() && !p_194112_1_.func_82837_s())
{
int i = func_194113_b(p_194112_1_);
- int j = p_194112_1_.func_190916_E();
+ int j = forceCount == -1 ? p_194112_1_.func_190916_E() : forceCount;
this.func_194117_b(i, j);
}
}
@@ -1,45 +1,5 @@
--- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java
@@ -21,7 +21,7 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-public abstract class TileEntity
+public abstract class TileEntity implements net.minecraftforge.common.capabilities.ICapabilitySerializable<NBTTagCompound>
{
private static final Logger field_145852_a = LogManager.getLogger();
private static final RegistryNamespaced < ResourceLocation, Class <? extends TileEntity >> field_190562_f = new RegistryNamespaced < ResourceLocation, Class <? extends TileEntity >> ();
@@ -60,6 +60,8 @@
public void func_145839_a(NBTTagCompound p_145839_1_)
{
this.field_174879_c = new BlockPos(p_145839_1_.func_74762_e("x"), p_145839_1_.func_74762_e("y"), p_145839_1_.func_74762_e("z"));
+ if (p_145839_1_.func_74764_b("ForgeData")) this.customTileData = p_145839_1_.func_74775_l("ForgeData");
+ if (this.capabilities != null && p_145839_1_.func_74764_b("ForgeCaps")) this.capabilities.deserializeNBT(p_145839_1_.func_74775_l("ForgeCaps"));
}
public NBTTagCompound func_189515_b(NBTTagCompound p_189515_1_)
@@ -81,6 +83,8 @@
p_189516_1_.func_74768_a("x", this.field_174879_c.func_177958_n());
p_189516_1_.func_74768_a("y", this.field_174879_c.func_177956_o());
p_189516_1_.func_74768_a("z", this.field_174879_c.func_177952_p());
+ if (this.customTileData != null) p_189516_1_.func_74782_a("ForgeData", this.customTileData);
+ if (this.capabilities != null) p_189516_1_.func_74782_a("ForgeCaps", this.capabilities.serializeNBT());
return p_189516_1_;
}
}
@@ -90,10 +94,11 @@
{
TileEntity tileentity = null;
String s = p_190200_1_.func_74779_i("id");
+ Class <? extends TileEntity > oclass = null;
try
{
- Class <? extends TileEntity > oclass = (Class)field_190562_f.func_82594_a(new ResourceLocation(s));
+ oclass = (Class)field_190562_f.func_82594_a(new ResourceLocation(s));
if (oclass != null)
{
@@ -103,6 +108,8 @@
catch (Throwable throwable1)
{
@@ -58,52 +18,11 @@
tileentity = null;
}
}
@@ -156,7 +165,6 @@
}
}
- @SideOnly(Side.CLIENT)
public double func_145835_a(double p_145835_1_, double p_145835_3_, double p_145835_5_)
{
double d0 = (double)this.field_174879_c.func_177958_n() + 0.5D - p_145835_1_;
@@ -244,7 +252,7 @@
try
{
- return String.format("ID #%d (%s // %s)", i, Block.func_149729_e(i).func_149739_a(), Block.func_149729_e(i).getClass().getCanonicalName());
+ return String.format("ID #%d (%s // %s // %s)", i, Block.func_149729_e(i).func_149739_a(), Block.func_149729_e(i).getClass().getName(), Block.func_149729_e(i).getRegistryName());
}
catch (Throwable var3)
{
@@ -297,6 +305,204 @@
{
}
+ // -- BEGIN FORGE PATCHES --
+ /**
+ * Called when you receive a TileEntityData packet for the location this
+ * TileEntity is currently in. On the client, the NetworkManager will always
+ * be the remote server. On the server, it will be whomever is responsible for
+ * sending the packet.
+ *
+ * @param net The NetworkManager the packet originated from
+ * @param pkt The data packet
+ */
+ public void onDataPacket(net.minecraft.network.NetworkManager net, net.minecraft.network.play.server.SPacketUpdateTileEntity pkt)
+ {
+ }
+
+ /**
+ * Called when the chunk's TE update tag, gotten from {@link #getUpdateTag()}, is received on the client.
+ * <p>
+ * Used to handle this tag in a special way. By default this simply calls {@link #readFromNBT(NBTTagCompound)}.
+ *
+ * @param tag The {@link NBTTagCompound} sent from {@link #getUpdateTag()}
+ */
+ public void handleUpdateTag(NBTTagCompound tag)
+ {
+ this.func_145839_a(tag);
+ }
+
+ /**
+ * Called when the chunk this TileEntity is on is Unloaded.
@@ -197,24 +116,6 @@
+ block instanceof net.minecraft.block.BlockSign ||
+ block instanceof net.minecraft.block.BlockSkull);
+ }
+
+ private NBTTagCompound customTileData;
+
+ /**
+ * Gets a {@link NBTTagCompound} that can be used to store custom data for this tile entity.
+ * It will be written, and read from disc, so it persists over world saves.
+ *
+ * @return A compound tag for custom data
+ */
+ public NBTTagCompound getTileData()
+ {
+ if (this.customTileData == null)
+ {
+ this.customTileData = new NBTTagCompound();
+ }
+ return this.customTileData;
+ }
+
+ /**
+ * Determines if the player can overwrite the NBT data of this tile entity while they place it using a ItemStack.
+ * Added as a fix for MC-75630 - Exploit with signs and command blocks
@@ -245,37 +146,6 @@
+ {
+ return false;
+ }
+
+ private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities;
+ public TileEntity()
+ {
+ capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this);
+ }
+
+ @Override
+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability<?> capability, @Nullable net.minecraft.util.EnumFacing facing)
+ {
+ return capabilities == null ? false : capabilities.hasCapability(capability, facing);
+ }
+
+ @Override
+ @Nullable
+ public <T> T getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.util.EnumFacing facing)
+ {
+ return capabilities == null ? null : capabilities.getCapability(capability, facing);
+ }
+
+ public void deserializeNBT(NBTTagCompound nbt)
+ {
+ this.func_145839_a(nbt);
+ }
+
+ public NBTTagCompound serializeNBT()
+ {
+ NBTTagCompound ret = new NBTTagCompound();
+ this.func_189515_b(ret);
+ return ret;
+ }
+
static
{
@@ -1,13 +0,0 @@
--- ../src-base/minecraft/net/minecraft/util/ActionResult.java
+++ ../src-work/minecraft/net/minecraft/util/ActionResult.java
@@ -20,4 +20,10 @@
{
return this.field_188400_b;
}
+
+ //Just a generic helper function to make typecasing easier...
+ public static <T> ActionResult<T> newResult(EnumActionResult result, T value)
+ {
+ return new ActionResult<T>(result, value);
+ }
}
@@ -1,12 +0,0 @@
--- ../src-base/minecraft/net/minecraft/util/BlockRenderLayer.java
+++ ../src-work/minecraft/net/minecraft/util/BlockRenderLayer.java
@@ -1,9 +1,5 @@
package net.minecraft.util;
-import net.minecraftforge.fml.relauncher.Side;
-import net.minecraftforge.fml.relauncher.SideOnly;
-
-@SideOnly(Side.CLIENT)
public enum BlockRenderLayer
{
SOLID("Solid"),
@@ -1,10 +0,0 @@
--- ../src-base/minecraft/net/minecraft/util/ChatAllowedCharacters.java
+++ ../src-work/minecraft/net/minecraft/util/ChatAllowedCharacters.java
@@ -31,6 +31,7 @@
static
{
+ if (System.getProperty("io.netty.leakDetection.level") == null) // Forge: allow level to be manually specified
ResourceLeakDetector.setLevel(field_184877_a);
}
}
@@ -1,12 +0,0 @@
--- ../src-base/minecraft/net/minecraft/util/ClassInheritanceMultiMap.java
+++ ../src-work/minecraft/net/minecraft/util/ClassInheritanceMultiMap.java
@@ -13,7 +13,8 @@
public class ClassInheritanceMultiMap<T> extends AbstractSet<T>
{
- private static final Set < Class<? >> field_181158_a = Sets. < Class<? >> newHashSet();
+ // Forge: Use concurrent collection to allow creating chunks from multiple threads safely
+ private static final Set < Class<? >> field_181158_a = java.util.Collections.newSetFromMap(new java.util.concurrent.ConcurrentHashMap<Class<?>, Boolean>());
private final Map < Class<?>, List<T >> field_180218_a = Maps. < Class<?>, List<T >> newHashMap();
private final Set < Class<? >> field_180216_b = Sets. < Class<? >> newIdentityHashSet();
private final Class<T> field_180217_c;
@@ -1,67 +0,0 @@
--- ../src-base/minecraft/net/minecraft/util/EnumFacing.java
+++ ../src-work/minecraft/net/minecraft/util/EnumFacing.java
@@ -12,8 +12,6 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3i;
-import net.minecraftforge.fml.relauncher.Side;
-import net.minecraftforge.fml.relauncher.SideOnly;
public enum EnumFacing implements IStringSerializable
{
@@ -66,7 +64,6 @@
return func_82600_a(this.field_176759_h);
}
- @SideOnly(Side.CLIENT)
public EnumFacing func_176732_a(EnumFacing.Axis p_176732_1_)
{
switch (p_176732_1_)
@@ -117,7 +114,6 @@
}
}
- @SideOnly(Side.CLIENT)
private EnumFacing func_176744_n()
{
switch (this)
@@ -137,7 +133,6 @@
}
}
- @SideOnly(Side.CLIENT)
private EnumFacing func_176738_p()
{
switch (this)
@@ -199,7 +194,6 @@
}
@Nullable
- @SideOnly(Side.CLIENT)
public static EnumFacing func_176739_a(String p_176739_0_)
{
return p_176739_0_ == null ? null : (EnumFacing)field_176761_p.get(p_176739_0_.toLowerCase(Locale.ROOT));
@@ -230,7 +224,6 @@
return values()[p_176741_0_.nextInt(values().length)];
}
- @SideOnly(Side.CLIENT)
public static EnumFacing func_176737_a(float p_176737_0_, float p_176737_1_, float p_176737_2_)
{
EnumFacing enumfacing = NORTH;
@@ -293,7 +286,6 @@
return p_190914_1_.func_174811_aO().func_176734_d();
}
- @SideOnly(Side.CLIENT)
public Vec3i func_176730_m()
{
return this.field_176756_m;
@@ -330,7 +322,6 @@
}
@Nullable
- @SideOnly(Side.CLIENT)
public static EnumFacing.Axis func_176717_a(String p_176717_0_)
{
return p_176717_0_ == null ? null : (EnumFacing.Axis)field_176725_d.get(p_176717_0_.toLowerCase(Locale.ROOT));
@@ -1,10 +0,0 @@
--- ../src-base/minecraft/net/minecraft/util/IntIdentityHashBiMap.java
+++ ../src-work/minecraft/net/minecraft/util/IntIdentityHashBiMap.java
@@ -168,7 +168,6 @@
return Iterators.filter(Iterators.forArray(this.field_186820_d), Predicates.notNull());
}
- @SideOnly(Side.CLIENT)
public void func_186812_a()
{
Arrays.fill(this.field_186818_b, (Object)null);
@@ -1,10 +0,0 @@
--- ../src-base/minecraft/net/minecraft/util/MouseHelper.java
+++ ../src-work/minecraft/net/minecraft/util/MouseHelper.java
@@ -13,6 +13,7 @@
public void func_74372_a()
{
+ if (Boolean.parseBoolean(System.getProperty("fml.noGrab","false"))) return;
Mouse.setGrabbed(true);
this.field_74377_a = 0;
this.field_74375_b = 0;
@@ -1,17 +0,0 @@
--- ../src-base/minecraft/net/minecraft/util/ScreenShotHelper.java
+++ ../src-work/minecraft/net/minecraft/util/ScreenShotHelper.java
@@ -53,10 +53,14 @@
file2 = new File(file1, p_148259_1_);
}
+ file2 = file2.getCanonicalFile(); // FORGE: Fix errors on Windows with paths that include \.\
+ net.minecraftforge.client.event.ScreenshotEvent event = net.minecraftforge.client.ForgeHooksClient.onScreenshot(bufferedimage, file2);
+ if (event.isCanceled()) return event.getCancelMessage(); else file2 = event.getScreenshotFile();
ImageIO.write(bufferedimage, "png", file2);
ITextComponent itextcomponent = new TextComponentString(file2.getName());
itextcomponent.func_150256_b().func_150241_a(new ClickEvent(ClickEvent.Action.OPEN_FILE, file2.getAbsolutePath()));
itextcomponent.func_150256_b().func_150228_d(Boolean.valueOf(true));
+ if (event.getResultMessage() != null) return event.getResultMessage();
return new TextComponentTranslation("screenshot.success", new Object[] {itextcomponent});
}
catch (Exception exception)
@@ -1,30 +0,0 @@
--- ../src-base/minecraft/net/minecraft/util/ServerRecipeBookHelper.java
+++ ../src-work/minecraft/net/minecraft/util/ServerRecipeBookHelper.java
@@ -55,6 +55,11 @@
this.field_194335_f = ((ContainerPlayer)container).field_75179_f;
this.field_194336_g = ((ContainerPlayer)container).field_75181_e;
}
+ else if (container instanceof net.minecraftforge.common.crafting.IRecipeContainer)
+ {
+ this.field_194335_f = ((net.minecraftforge.common.crafting.IRecipeContainer)container).getCraftResult();
+ this.field_194336_g = ((net.minecraftforge.common.crafting.IRecipeContainer)container).getCraftMatrix();
+ }
if (this.field_194335_f != null && this.field_194336_g != null)
{
@@ -199,11 +204,11 @@
int i = this.field_194336_g.func_174922_i();
int j = this.field_194336_g.func_174923_h();
- if (this.field_194333_d instanceof ShapedRecipes)
+ if (this.field_194333_d instanceof net.minecraftforge.common.crafting.IShapedRecipe)
{
- ShapedRecipes shapedrecipes = (ShapedRecipes)this.field_194333_d;
- i = shapedrecipes.func_192403_f();
- j = shapedrecipes.func_192404_g();
+ net.minecraftforge.common.crafting.IShapedRecipe shapedrecipes = (net.minecraftforge.common.crafting.IShapedRecipe)this.field_194333_d;
+ i = shapedrecipes.getRecipeWidth();
+ j = shapedrecipes.getRecipeHeight();
}
int j1 = 1;
@@ -1,60 +0,0 @@
--- ../src-base/minecraft/net/minecraft/util/Session.java
+++ ../src-work/minecraft/net/minecraft/util/Session.java
@@ -17,9 +17,25 @@
private final String field_148257_b;
private final String field_148258_c;
private final Session.Type field_152429_d;
+ /** Forge: Cache of the local session's GameProfile properties. */
+ private com.mojang.authlib.properties.PropertyMap properties;
public Session(String p_i1098_1_, String p_i1098_2_, String p_i1098_3_, String p_i1098_4_)
{
+ if (p_i1098_1_ == null || p_i1098_1_.isEmpty())
+ {
+ p_i1098_1_ = "MissingName";
+ p_i1098_2_ = p_i1098_3_ = "NotValid";
+ org.apache.logging.log4j.Logger logger = net.minecraftforge.fml.common.FMLLog.log;
+ logger.log(org.apache.logging.log4j.Level.WARN, "=========================================================");
+ logger.log(org.apache.logging.log4j.Level.WARN, "WARNING!! the username was not set for this session, typically");
+ logger.log(org.apache.logging.log4j.Level.WARN, "this means you installed Forge incorrectly. We have set your");
+ logger.log(org.apache.logging.log4j.Level.WARN, "name to \"MissingName\" and your session to nothing. Please");
+ logger.log(org.apache.logging.log4j.Level.WARN, "check your installation and post a console log from the launcher");
+ logger.log(org.apache.logging.log4j.Level.WARN, "when asking for help!");
+ logger.log(org.apache.logging.log4j.Level.WARN, "=========================================================");
+ }
+
this.field_74286_b = p_i1098_1_;
this.field_148257_b = p_i1098_2_;
this.field_148258_c = p_i1098_3_;
@@ -51,14 +67,29 @@
try
{
UUID uuid = UUIDTypeAdapter.fromString(this.func_148255_b());
- return new GameProfile(uuid, this.func_111285_a());
+ GameProfile ret = new GameProfile(uuid, this.func_111285_a()); //Forge: Adds cached GameProfile properties to returned GameProfile.
+ if (properties != null) ret.getProperties().putAll(properties); // Helps to cut down on calls to the session service,
+ return ret; // which helps to fix MC-52974.
}
catch (IllegalArgumentException var2)
{
- return new GameProfile((UUID)null, this.func_111285_a());
+ return new GameProfile(net.minecraft.entity.player.EntityPlayer.func_146094_a(new GameProfile((UUID)null, this.func_111285_a())), this.func_111285_a());
}
}
+ /* ======================================== FORGE START ===================================== */
+ //For internal use only. Modders should never need to use this.
+ public void setProperties(com.mojang.authlib.properties.PropertyMap properties)
+ {
+ if(this.properties == null) this.properties = properties;
+ }
+
+ public boolean hasCachedProperties()
+ {
+ return properties != null;
+ }
+ /* ========================================= FORGE END ====================================== */
+
@SideOnly(Side.CLIENT)
public static enum Type
{
@@ -1,14 +0,0 @@
--- ../src-base/minecraft/net/minecraft/util/SoundEvent.java
+++ ../src-work/minecraft/net/minecraft/util/SoundEvent.java
@@ -4,9 +4,9 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
-public class SoundEvent
+public class SoundEvent extends net.minecraftforge.registries.IForgeRegistryEntry.Impl<SoundEvent>
{
- public static final RegistryNamespaced<ResourceLocation, SoundEvent> field_187505_a = new RegistryNamespaced<ResourceLocation, SoundEvent>();
+ public static final RegistryNamespaced<ResourceLocation, SoundEvent> field_187505_a = net.minecraftforge.registries.GameData.getWrapper(SoundEvent.class);
private final ResourceLocation field_187506_b;
private static int field_187507_c;
@@ -1,39 +0,0 @@
--- ../src-base/minecraft/net/minecraft/util/TabCompleter.java
+++ ../src-work/minecraft/net/minecraft/util/TabCompleter.java
@@ -55,13 +55,14 @@
this.field_186844_a.func_146175_b(i - this.field_186844_a.func_146198_h());
}
- this.field_186844_a.func_146191_b(this.field_186849_f.get(this.field_186848_e++));
+ this.field_186844_a.func_146191_b(net.minecraft.util.text.TextFormatting.func_110646_a(this.field_186849_f.get(this.field_186848_e++)));
}
private void func_186838_a(String p_186838_1_)
{
if (p_186838_1_.length() >= 1)
{
+ net.minecraftforge.client.ClientCommandHandler.instance.autoComplete(p_186838_1_);
Minecraft.func_71410_x().field_71439_g.field_71174_a.func_147297_a(new CPacketTabComplete(p_186838_1_, this.func_186839_b(), this.field_186845_b));
this.field_186847_d = true;
}
@@ -77,6 +78,12 @@
this.field_186846_c = false;
this.field_186849_f.clear();
+ String[] complete = net.minecraftforge.client.ClientCommandHandler.instance.latestAutoComplete;
+ if (complete != null)
+ {
+ p_186840_1_ = com.google.common.collect.ObjectArrays.concat(complete, p_186840_1_, String.class);
+ }
+
for (String s : p_186840_1_)
{
if (!s.isEmpty())
@@ -87,6 +94,7 @@
String s1 = this.field_186844_a.func_146179_b().substring(this.field_186844_a.func_146197_a(-1, this.field_186844_a.func_146198_h(), false));
String s2 = org.apache.commons.lang3.StringUtils.getCommonPrefix(p_186840_1_);
+ s2 = net.minecraft.util.text.TextFormatting.func_110646_a(s2);
if (!s2.isEmpty() && !s1.equalsIgnoreCase(s2))
{
@@ -1,15 +0,0 @@
--- ../src-base/minecraft/net/minecraft/util/math/RayTraceResult.java
+++ ../src-work/minecraft/net/minecraft/util/math/RayTraceResult.java
@@ -5,6 +5,12 @@
public class RayTraceResult
{
+ /** Used to determine what sub-segment is hit */
+ public int subHit = -1;
+
+ /** Used to add extra hit info */
+ public Object hitInfo = null;
+
private BlockPos field_178783_e;
public RayTraceResult.Type field_72313_a;
public EnumFacing field_178784_b;
@@ -1,42 +0,0 @@
--- ../src-base/minecraft/net/minecraft/util/math/Vec3d.java
+++ ../src-work/minecraft/net/minecraft/util/math/Vec3d.java
@@ -1,9 +1,6 @@
package net.minecraft.util.math;
import javax.annotation.Nullable;
-import net.minecraftforge.fml.relauncher.Side;
-import net.minecraftforge.fml.relauncher.SideOnly;
-
public class Vec3d
{
public static final Vec3d field_186680_a = new Vec3d(0.0D, 0.0D, 0.0D);
@@ -54,7 +51,6 @@
return this.field_72450_a * p_72430_1_.field_72450_a + this.field_72448_b * p_72430_1_.field_72448_b + this.field_72449_c * p_72430_1_.field_72449_c;
}
- @SideOnly(Side.CLIENT)
public Vec3d func_72431_c(Vec3d p_72431_1_)
{
return new Vec3d(this.field_72448_b * p_72431_1_.field_72449_c - this.field_72449_c * p_72431_1_.field_72448_b, this.field_72449_c * p_72431_1_.field_72450_a - this.field_72450_a * p_72431_1_.field_72449_c, this.field_72450_a * p_72431_1_.field_72448_b - this.field_72448_b * p_72431_1_.field_72450_a);
@@ -114,7 +110,6 @@
return (double)MathHelper.func_76133_a(this.field_72450_a * this.field_72450_a + this.field_72448_b * this.field_72448_b + this.field_72449_c * this.field_72449_c);
}
- @SideOnly(Side.CLIENT)
public double func_189985_c()
{
return this.field_72450_a * this.field_72450_a + this.field_72448_b * this.field_72448_b + this.field_72449_c * this.field_72449_c;
@@ -239,13 +234,11 @@
return new Vec3d(d0, d1, d2);
}
- @SideOnly(Side.CLIENT)
public static Vec3d func_189984_a(Vec2f p_189984_0_)
{
return func_189986_a(p_189984_0_.field_189982_i, p_189984_0_.field_189983_j);
}
- @SideOnly(Side.CLIENT)
public static Vec3d func_189986_a(float p_189986_0_, float p_189986_1_)
{
float f = MathHelper.func_76134_b(-p_189986_1_ * 0.017453292F - (float)Math.PI);
@@ -1,10 +0,0 @@
--- ../src-base/minecraft/net/minecraft/util/text/ITextComponent.java
+++ ../src-work/minecraft/net/minecraft/util/text/ITextComponent.java
@@ -34,7 +34,6 @@
String func_150260_c();
- @SideOnly(Side.CLIENT)
String func_150254_d();
List<ITextComponent> func_150253_a();
@@ -1,10 +0,0 @@
--- ../src-base/minecraft/net/minecraft/util/text/Style.java
+++ ../src-work/minecraft/net/minecraft/util/text/Style.java
@@ -238,7 +238,6 @@
return this;
}
- @SideOnly(Side.CLIENT)
public String func_150218_j()
{
if (this.func_150229_g())
@@ -1,10 +0,0 @@
--- ../src-base/minecraft/net/minecraft/util/text/TextComponentBase.java
+++ ../src-work/minecraft/net/minecraft/util/text/TextComponentBase.java
@@ -75,7 +75,6 @@
return stringbuilder.toString();
}
- @SideOnly(Side.CLIENT)
public final String func_150254_d()
{
StringBuilder stringbuilder = new StringBuilder();
@@ -1,54 +0,0 @@
--- ../src-base/minecraft/net/minecraft/util/text/translation/LanguageMap.java
+++ ../src-work/minecraft/net/minecraft/util/text/translation/LanguageMap.java
@@ -23,9 +23,29 @@
public LanguageMap()
{
+ InputStream inputstream = LanguageMap.class.getResourceAsStream("/assets/minecraft/lang/en_us.lang");
+ inject(this, inputstream);
+ }
+
+ public static void inject(InputStream inputstream)
+ {
+ inject(field_74817_a, inputstream);
+ }
+
+ private static void inject(LanguageMap inst, InputStream inputstream)
+ {
+ Map<String, String> map = parseLangFile(inputstream);
+ inst.field_74816_c.putAll(map);
+ inst.field_150511_e = System.currentTimeMillis();
+ }
+
+ public static Map<String, String> parseLangFile(InputStream inputstream)
+ {
+ Map<String, String> table = Maps.newHashMap();
try
{
- InputStream inputstream = LanguageMap.class.getResourceAsStream("/assets/minecraft/lang/en_us.lang");
+ inputstream = net.minecraftforge.fml.common.FMLCommonHandler.instance().loadLanguage(table, inputstream);
+ if (inputstream == null) return table;
for (String s : IOUtils.readLines(inputstream, StandardCharsets.UTF_8))
{
@@ -37,17 +57,18 @@
{
String s1 = astring[0];
String s2 = field_111053_a.matcher(astring[1]).replaceAll("%$1s");
- this.field_74816_c.put(s1, s2);
+ table.put(s1, s2);
}
}
}
- this.field_150511_e = System.currentTimeMillis();
}
catch (IOException var7)
{
;
}
+ catch (Exception ex) {}
+ return table;
}
static LanguageMap func_74808_a()
@@ -245,18 +245,6 @@
+ }
+
+ /**
+ * Called on the client to get the music type to play when in this world type.
+ * At the time of calling, the client player and world are guaranteed to be non-null
+ * @return null to use vanilla logic, otherwise a MusicType to play in this world
+ */
+ @Nullable
+ @SideOnly(Side.CLIENT)
+ public net.minecraft.client.audio.MusicTicker.MusicType getMusicType()
+ {
+ return null;
+ }
+
+ /**
+ * Determines if the player can sleep in this world (or if the bed should explode for example).
+ *
+ * @param player The player that is attempting to sleep
@@ -268,13 +256,6 @@
+ return (this.func_76567_e() && this.field_76579_a.func_180494_b(pos) != net.minecraft.init.Biomes.field_76778_j) ? WorldSleepResult.ALLOW : WorldSleepResult.BED_EXPLODES;
+ }
+
+ public static enum WorldSleepResult
+ {
+ ALLOW,
+ DENY,
+ BED_EXPLODES;
+ }
+
+ /*======================================= Start Moved From World =========================================*/
+
+ public Biome getBiomeForCoords(BlockPos pos)
+150
View File
@@ -0,0 +1,150 @@
--- ../src-base/minecraft/net/minecraft/client/Minecraft.java
+++ ../src-work/minecraft/net/minecraft/client/Minecraft.java
@@ -536,23 +544,27 @@
- this.field_71446_o.func_147645_c(this.field_152354_ay);
+ net.minecraftforge.fml.client.SplashProgress.clearVanillaResources(field_71446_o, field_152354_ay);
this.field_152354_ay = null;
this.field_71461_s = new LoadingScreenRenderer(this);
this.field_184132_p = new DebugRenderer(this);
@@ -1094,11 +1113,13 @@
if (!this.field_71454_w)
{
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickStart(this.field_71428_T.field_194147_b);
this.field_71424_I.func_76318_c("gameRenderer");
this.field_71460_t.func_181560_a(this.field_71445_n ? this.field_193996_ah : this.field_71428_T.field_194147_b, i);
this.field_71424_I.func_76318_c("toasts");
this.field_193034_aS.func_191783_a(new ScaledResolution(this));
this.field_71424_I.func_76319_b();
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onRenderTickEnd(this.field_71428_T.field_194147_b);
}
this.field_71424_I.func_76319_b();
@@ -1630,6 +1653,11 @@
}
Display.setFullscreen(this.field_71431_Q);
+ if (!this.field_71431_Q) //Forge: Fix MC-68754, Screen is not resizeable after exiting fullscreen due to LWJGL bug https://github.com/LWJGL/lwjgl/issues/142 which is fixed, but not in the version MC ships
+ {
+ Display.setResizable(false);
+ Display.setResizable(true);
+ }
Display.setVSyncEnabled(this.field_71474_y.field_74352_v);
this.func_175601_h();
}
@@ -1676,6 +1704,8 @@
--this.field_71467_ac;
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPreClientTick();
+
this.field_71424_I.func_76320_a("gui");
if (!this.field_71445_n)
@@ -1877,6 +1907,7 @@
}
this.field_71424_I.func_76319_b();
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPostClientTick();
this.field_71423_H = func_71386_F();
}
@@ -1982,6 +2013,7 @@
}
}
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireKeyInput();
}
this.func_184117_aA();
@@ -2239,6 +2271,8 @@
{
while (Mouse.next())
{
+ if (net.minecraftforge.client.ForgeHooksClient.postMouseEvent()) continue;
+
int i = Mouse.getEventButton();
KeyBinding.func_74510_a(i - 100, Mouse.getEventButtonState());
@@ -2294,6 +2328,7 @@
this.field_71462_r.func_146274_d();
}
}
+ net.minecraftforge.fml.common.FMLCommonHandler.instance().fireMouseInput();
}
}
@@ -2304,6 +2339,7 @@
public void func_71371_a(String p_71371_1_, String p_71371_2_, @Nullable WorldSettings p_71371_3_)
{
+ net.minecraftforge.fml.client.FMLClientHandler.instance().startIntegratedServer(p_71371_1_, p_71371_2_, p_71371_3_);
this.func_71403_a((WorldClient)null);
System.gc();
ISaveHandler isavehandler = this.field_71469_aa.func_75804_a(p_71371_1_, false);
@@ -2344,8 +2380,14 @@
this.field_71461_s.func_73720_a(I18n.func_135052_a("menu.loadingLevel"));
- while (!this.field_71437_Z.func_71200_ad())
+ while (!this.field_71437_Z.func_71200_ad() && !this.field_71437_Z.func_71241_aa())
{
+ if (!net.minecraftforge.fml.common.StartupQuery.check())
+ {
+ func_71403_a(null);
+ func_147108_a(null);
+ return;
+ }
String s = this.field_71437_Z.func_71195_b_();
if (s != null)
@@ -2395,6 +2445,18 @@
if (this.field_71437_Z != null && this.field_71437_Z.func_175578_N())
{
this.field_71437_Z.func_71263_m();
+ if (field_71461_s != null && this.field_71425_J)
+ {
+ 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;
@@ -2418,6 +2480,7 @@
this.field_71456_v.func_181029_i();
this.func_71351_a((ServerData)null);
this.field_71455_al = false;
+ net.minecraftforge.fml.client.FMLClientHandler.instance().handleClientWorldClosing(this.field_71441_e);
}
this.field_147127_av.func_147690_c();
@@ -3181,11 +3089,11 @@
{
if (Keyboard.getEventKeyState())
{
- if (i == this.field_71474_y.field_152395_am.func_151463_i())
+ if (this.field_71474_y.field_152395_am.isActiveAndMatches(i))
{
this.func_71352_k();
}
- else if (i == this.field_71474_y.field_151447_Z.func_151463_i())
+ else if (this.field_71474_y.field_151447_Z.isActiveAndMatches(i))
{
this.field_71456_v.func_146158_b().func_146227_a(ScreenShotHelper.func_148260_a(this.field_71412_D, this.field_71443_c, this.field_71440_d, this.field_147124_at));
}
@@ -3199,6 +3107,7 @@
}
}
}
+ else if (this.field_71462_r instanceof GuiControls) ((GuiControls)this.field_71462_r).field_146491_f = null;
}
}
}
@@ -23,8 +23,6 @@ import javax.annotation.Nonnull;
import java.nio.ByteBuffer;
import java.util.function.Predicate;
import net.minecraftforge.client.resource.IResourceType;
import net.minecraftforge.client.resource.VanillaResourceType;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
@@ -47,7 +45,9 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.common.ForgeModContainer;
import net.minecraftforge.client.resource.ISelectiveResourceReloadListener;
import net.minecraftforge.resource.IResourceType;
import net.minecraftforge.resource.ISelectiveResourceReloadListener;
import net.minecraftforge.resource.VanillaResourceType;
public class CloudRenderer implements ISelectiveResourceReloadListener
{
@@ -70,6 +70,7 @@ import net.minecraft.client.renderer.block.model.SimpleBakedModel;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.client.renderer.entity.model.ModelBiped;
import net.minecraft.client.renderer.texture.NativeImage;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap;
@@ -122,10 +123,6 @@ import net.minecraftforge.client.event.sound.PlaySoundEvent;
import net.minecraftforge.client.model.ModelDynBucket;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.client.model.animation.Animation;
import net.minecraftforge.client.resource.IResourceType;
import net.minecraftforge.client.resource.ReloadRequirements;
import net.minecraftforge.client.resource.SelectiveReloadStateHandler;
import net.minecraftforge.client.resource.VanillaResourceType;
import net.minecraftforge.common.ForgeMod;
import net.minecraftforge.versions.forge.ForgeVersion;
import net.minecraftforge.common.MinecraftForge;
@@ -134,6 +131,10 @@ import net.minecraftforge.common.model.ITransformation;
import net.minecraftforge.common.model.TRSRTransformation;
import net.minecraftforge.fml.VersionChecker;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.resource.IResourceType;
import net.minecraftforge.resource.ReloadRequirements;
import net.minecraftforge.resource.SelectiveReloadStateHandler;
import net.minecraftforge.resource.VanillaResourceType;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.logging.log4j.LogManager;
@@ -669,11 +670,6 @@ public class ForgeHooksClient
return from.getItem().shouldCauseReequipAnimation(from, to, changed);
}
public static boolean shouldCauseBlockBreakReset(@Nonnull ItemStack from, @Nonnull ItemStack to)
{
return from.getItem().shouldCauseBlockBreakReset(from, to);
}
public static BlockFaceUV applyUVLock(BlockFaceUV blockFaceUV, EnumFacing originalSide, ITransformation rotation)
{
TRSRTransformation global = new TRSRTransformation(rotation.getMatrixVec());
@@ -729,7 +725,7 @@ public class ForgeHooksClient
MinecraftForge.EVENT_BUS.post(new RenderGameOverlayEvent.Post(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res), BOSSINFO));
}
public static ScreenshotEvent onScreenshot(BufferedImage image, File screenshotFile)
public static ScreenshotEvent onScreenshot(NativeImage image, File screenshotFile)
{
ScreenshotEvent event = new ScreenshotEvent(image, screenshotFile);
MinecraftForge.EVENT_BUS.post(event);
@@ -757,28 +753,6 @@ public class ForgeHooksClient
return texture;
}
public static boolean shouldUseVanillaReloadableListener(IResourceManagerReloadListener listener)
{
Predicate<IResourceType> predicate = SelectiveReloadStateHandler.INSTANCE.get();
if (listener instanceof ModelManager || listener instanceof ItemRenderer)
return predicate.test(VanillaResourceType.MODELS);
else if (listener instanceof BlockRendererDispatcher || listener instanceof RenderGlobal)
return predicate.test(VanillaResourceType.MODELS);
else if (listener instanceof TextureManager || listener instanceof FontRenderer)
return predicate.test(VanillaResourceType.TEXTURES);
else if (listener instanceof FoliageColorReloadListener || listener instanceof GrassColorReloadListener)
return predicate.test(VanillaResourceType.TEXTURES);
else if (listener instanceof SoundHandler)
return predicate.test(VanillaResourceType.SOUNDS);
else if (listener instanceof EntityRenderer)
return predicate.test(VanillaResourceType.SHADERS);
else if (listener instanceof LanguageManager || listener instanceof SearchTreeManager)
return predicate.test(VanillaResourceType.LANGUAGES);
return true;
}
public static void refreshResources(Minecraft mc, VanillaResourceType... types) {
SelectiveReloadStateHandler.INSTANCE.beginReload(ReloadRequirements.include(types));
mc.refreshResources();
@@ -19,6 +19,7 @@
package net.minecraftforge.client.event;
import net.minecraft.client.renderer.texture.NativeImage;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.eventbus.api.Cancelable;
@@ -37,23 +38,23 @@ import java.io.File;
* {@link #resultMessage} contains the {@link ITextComponent} to be returned. If {@code null}, the default vanilla message will be used instead
*/
@Cancelable
public class ScreenshotEvent extends net.minecraftforge.eventbus.api.Event
public class ScreenshotEvent extends Event
{
public static final ITextComponent DEFAULT_CANCEL_REASON = new TextComponentString("Screenshot canceled");
private BufferedImage image;
private NativeImage image;
private File screenshotFile;
private ITextComponent resultMessage = null;
public ScreenshotEvent(BufferedImage image, File screenshotFile)
public ScreenshotEvent(NativeImage image, File screenshotFile)
{
this.image = image;
this.screenshotFile = screenshotFile;
}
public BufferedImage getImage()
public NativeImage getImage()
{
return image;
}
@@ -21,12 +21,12 @@ package net.minecraftforge.client.model;
import java.util.function.Predicate;
import net.minecraftforge.client.resource.IResourceType;
import net.minecraftforge.client.resource.ISelectiveResourceReloadListener;
import net.minecraftforge.client.resource.VanillaResourceType;
import net.minecraft.client.renderer.block.model.IUnbakedModel;
import net.minecraft.resources.IResourceManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.resource.IResourceType;
import net.minecraftforge.resource.ISelectiveResourceReloadListener;
import net.minecraftforge.resource.VanillaResourceType;
public interface ICustomModelLoader extends ISelectiveResourceReloadListener
{
@@ -52,4 +52,11 @@ public interface ICustomModelLoader extends ISelectiveResourceReloadListener
* loads (or reloads) specified model
*/
IUnbakedModel loadModel(ResourceLocation modelLocation) throws Exception;
@Override
default IResourceType getResourceType()
{
return VanillaResourceType.MODELS;
}
}
@@ -300,161 +300,6 @@ public class ForgeHooks
*/
public static boolean onPickBlock(RayTraceResult target, EntityPlayer player, World world)
{
/*
boolean flag = this.player.capabilities.isCreativeMode;
TileEntity tileentity = null;
ItemStack itemstack;
if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
{
BlockPos blockpos = this.objectMouseOver.getBlockPos();
IBlockState iblockstate = this.world.getBlockState(blockpos);
Block block = iblockstate.getBlock();
if (iblockstate.getMaterial() == Material.AIR)
{
return;
}
itemstack = block.getItem(this.world, blockpos, iblockstate);
if (itemstack.isEmpty())
{
return;
}
if (flag && GuiScreen.isCtrlKeyDown() && block.hasTileEntity())
{
tileentity = this.world.getTileEntity(blockpos);
}
}
else
{
if (this.objectMouseOver.typeOfHit != RayTraceResult.Type.ENTITY || this.objectMouseOver.entityHit == null || !flag)
{
return;
}
if (this.objectMouseOver.entityHit instanceof EntityPainting)
{
itemstack = new ItemStack(Items.PAINTING);
}
else if (this.objectMouseOver.entityHit instanceof EntityLeashKnot)
{
itemstack = new ItemStack(Items.LEAD);
}
else if (this.objectMouseOver.entityHit instanceof EntityItemFrame)
{
EntityItemFrame entityitemframe = (EntityItemFrame)this.objectMouseOver.entityHit;
ItemStack itemstack1 = entityitemframe.getDisplayedItem();
if (itemstack1.isEmpty())
{
itemstack = new ItemStack(Items.ITEM_FRAME);
}
else
{
itemstack = itemstack1.copy();
}
}
else if (this.objectMouseOver.entityHit instanceof EntityMinecart)
{
EntityMinecart entityminecart = (EntityMinecart)this.objectMouseOver.entityHit;
Item item;
switch (entityminecart.getType())
{
case FURNACE:
item = Items.FURNACE_MINECART;
break;
case CHEST:
item = Items.CHEST_MINECART;
break;
case TNT:
item = Items.TNT_MINECART;
break;
case HOPPER:
item = Items.HOPPER_MINECART;
break;
case COMMAND_BLOCK:
item = Items.COMMAND_BLOCK_MINECART;
break;
default:
item = Items.MINECART;
}
itemstack = new ItemStack(item);
}
else if (this.objectMouseOver.entityHit instanceof EntityBoat)
{
itemstack = new ItemStack(((EntityBoat)this.objectMouseOver.entityHit).getItemBoat());
}
else if (this.objectMouseOver.entityHit instanceof EntityArmorStand)
{
itemstack = new ItemStack(Items.ARMOR_STAND);
}
else if (this.objectMouseOver.entityHit instanceof EntityEnderCrystal)
{
itemstack = new ItemStack(Items.END_CRYSTAL);
}
else
{
ResourceLocation resourcelocation = EntityList.func_191301_a(this.objectMouseOver.entityHit);
if (resourcelocation == null || !EntityList.ENTITY_EGGS.containsKey(resourcelocation))
{
return;
}
itemstack = new ItemStack(Items.SPAWN_EGG);
ItemMonsterPlacer.applyEntityIdToItemStack(itemstack, resourcelocation);
}
}
if (itemstack.isEmpty())
{
String s = "";
if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.BLOCK)
{
s = ((ResourceLocation)Block.REGISTRY.getNameForObject(this.world.getBlockState(this.objectMouseOver.getBlockPos()).getBlock())).toString();
}
else if (this.objectMouseOver.typeOfHit == RayTraceResult.Type.ENTITY)
{
s = EntityList.func_191301_a(this.objectMouseOver.entityHit).toString();
}
LOGGER.warn("Picking on: [{}] {} gave null item", new Object[] {this.objectMouseOver.typeOfHit, s});
}
else
{
InventoryPlayer inventoryplayer = this.player.inventory;
if (tileentity != null)
{
this.storeTEInStack(itemstack, tileentity);
}
int i = inventoryplayer.getSlotFor(itemstack);
if (flag)
{
inventoryplayer.setPickedItemStack(itemstack);
this.playerController.sendSlotPacket(this.player.getHeldItem(EnumHand.MAIN_HAND), 36 + inventoryplayer.currentItem);
}
else if (i != -1)
{
if (InventoryPlayer.isHotbar(i))
{
inventoryplayer.currentItem = i;
}
else
{
this.playerController.pickItem(i);
}
}
}
*/
ItemStack result;
boolean isCreative = player.abilities.isCreativeMode;
TileEntity te = null;
@@ -463,12 +308,10 @@ public class ForgeHooks
{
IBlockState state = world.getBlockState(target.getBlockPos());
if (state.getBlock().isAir(state, world, target.getBlockPos()))
{
if (state.isAir(world, target.getBlockPos()))
return false;
}
if (isCreative && GuiScreen.isCtrlKeyDown() && state.getBlock().hasTileEntity(state))
if (isCreative && GuiScreen.isCtrlKeyDown() && state.hasTileEntity())
te = world.getTileEntity(target.getBlockPos());
result = state.getBlock().getPickBlock(state, target, world, target.getBlockPos(), player);
@@ -754,7 +597,7 @@ public class ForgeHooks
boolean preCancelEvent = false;
ItemStack itemstack = entityPlayer.getHeldItemMainhand();
if (gameType.isCreative() && !itemstack.isEmpty()
&& !itemstack.getItem().canDestroyBlockInCreative(world, pos, itemstack, entityPlayer))
&& !itemstack.getItem().canPlayerBreakBlockWhileHolding(world.getBlockState(pos), world, pos, entityPlayer))
preCancelEvent = true;
if (gameType.hasLimitedInteractions())
@@ -37,6 +37,7 @@ import net.minecraft.entity.boss.EntityDragon;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityWitherSkull;
import net.minecraft.fluid.IFluidState;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.init.MobEffects;
@@ -65,6 +66,7 @@ import net.minecraft.world.dimension.EndDimension;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.EnumPlantType;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.ToolType;
@@ -216,7 +218,7 @@ public interface IForgeBlock
*/
default public boolean canHarvestBlock(IBlockState state, IBlockReader world, BlockPos pos, EntityPlayer player)
{
return net.minecraftforge.common.ForgeHooks.canHarvestBlock(state, player, world, pos);
return ForgeHooks.canHarvestBlock(state, player, world, pos);
}
/**
@@ -236,12 +238,13 @@ public interface IForgeBlock
* @param pos Block position in world
* @param willHarvest True if Block.harvestBlock will be called after this, if the return in true.
* Can be useful to delay the destruction of tile entities till after harvestBlock
* @param fluid The current fluid state at current position
* @return True if the block is actually destroyed.
*/
default boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
default boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest, IFluidState fluid)
{
getBlock().onBlockHarvested(world, pos, state, player);
return world.setBlockState(pos, net.minecraft.init.Blocks.AIR.getDefaultState(), world.isRemote ? 11 : 3);
return world.setBlockState(pos, fluid.getBlockState(), world.isRemote ? 11 : 3);
}
/**
@@ -508,6 +511,24 @@ public interface IForgeBlock
return false;
}
/**
* Spawn a digging particle effect in the world, this is a wrapper
* around EffectRenderer.addBlockHitEffects to allow the block more
* control over the particles. Useful when you have entirely different
* texture sheets for different sides/locations in the world.
*
* @param state The current state
* @param world The current world
* @param target The target the player is looking at {x/y/z/side/sub}
* @param manager A reference to the current particle manager.
* @return True to prevent vanilla digging particles form spawning.
*/
@OnlyIn(Dist.CLIENT)
default boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, ParticleManager manager)
{
return false;
}
/**
* Spawn particles for when the block is destroyed. Due to the nature
* of how this is invoked, the x/y/z locations are not always guaranteed
@@ -30,6 +30,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EntitySpawnPlacementRegistry.SpawnPlacementType;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.fluid.IFluidState;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -199,11 +200,12 @@ public interface IForgeBlockState
* @param pos Block position in world
* @param willHarvest True if Block.harvestBlock will be called after this, if the return in true.
* Can be useful to delay the destruction of tile entities till after harvestBlock
* @param fluid The current fluid and block state for the position in the world.
* @return True if the block is actually destroyed.
*/
default boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest)
default boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest, IFluidState fluid)
{
return getBlockState().getBlock().removedByPlayer(getBlockState(), world, pos, player, willHarvest);
return getBlockState().getBlock().removedByPlayer(getBlockState(), world, pos, player, willHarvest, fluid);
}
/**
@@ -449,6 +451,23 @@ public interface IForgeBlockState
return getBlockState().getBlock().addRunningEffects(getBlockState(), world, pos, entity);
}
/**
* Spawn a digging particle effect in the world, this is a wrapper
* around EffectRenderer.addBlockHitEffects to allow the block more
* control over the particles. Useful when you have entirely different
* texture sheets for different sides/locations in the world.
*
* @param world The current world
* @param target The target the player is looking at {x/y/z/side/sub}
* @param manager A reference to the current particle manager.
* @return True to prevent vanilla digging particles form spawning.
*/
@OnlyIn(Dist.CLIENT)
default boolean addHitEffects(World world, RayTraceResult target, ParticleManager manager)
{
return getBlockState().getBlock().addHitEffects(getBlockState(), world, target, manager);
}
/**
* Spawn particles for when the block is destroyed. Due to the nature
* of how this is invoked, the x/y/z locations are not always guaranteed
@@ -21,6 +21,7 @@ package net.minecraftforge.common.extensions;
import javax.annotation.Nullable;
import net.minecraft.client.audio.MusicTicker;
import net.minecraft.world.World;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.dimension.NetherDimension;
@@ -44,7 +45,7 @@ public interface IForgeDimension
* and VillageCollection are initialized. On client, called when world is
* constructed, just before world load event is called. Note that this method is
* always called before the world load event.
*
*
* @return initial holder for capabilities on the world
*/
default net.minecraftforge.common.capabilities.ICapabilityProvider initCapabilities()
@@ -58,7 +59,7 @@ public interface IForgeDimension
* worldA.provider.getMovementFactor() / worldB.provider.getMovementFactor()
* Example: Overworld factor is 1, nether factor is 8. Traveling from overworld
* to nether multiplies coordinates by 1/8.
*
*
* @return The movement factor
*/
default double getMovementFactor()
@@ -103,7 +104,7 @@ public interface IForgeDimension
void setWeatherRenderer(IRenderHandler renderer);
void resetRainAndThunder();
default boolean canDoLightning(net.minecraft.world.chunk.Chunk chunk)
{
return true;
@@ -113,4 +114,16 @@ public interface IForgeDimension
{
return true;
}
/**
* Called on the client to get the music type to play when in this world type.
* At the time of calling, the client player and world are guaranteed to be non-null
* @return null to use vanilla logic, otherwise a MusicType to play in this world
*/
@Nullable
@OnlyIn(Dist.CLIENT)
default MusicTicker.MusicType getMusicType()
{
return null;
}
}
@@ -532,22 +532,6 @@ public interface IForgeItem
stack.getOrCreateTag().setInt("Damage", Math.max(0, damage));
}
/**
* Checked from
* {@link net.minecraft.client.multiplayer.PlayerControllerMP#onPlayerDestroyBlock(BlockPos pos)
* PlayerControllerMP.onPlayerDestroyBlock()} when a creative player left-clicks
* a block with this item. Also checked from
* {@link net.minecraftforge.common.ForgeHooks#onBlockBreakEvent(World, GameType, EntityPlayerMP, BlockPos)
* ForgeHooks.onBlockBreakEvent()} to prevent sending an event.
*
* @return true if the given player can destroy specified block in creative mode
* with this item
*/
default boolean canDestroyBlockInCreative(World world, BlockPos pos, ItemStack stack, EntityPlayer player)
{
return !(this instanceof ItemSword);
}
/**
* ItemStack sensitive version of {@link #canHarvestBlock(IBlockState)}
*
Loaded 100 of 109 files, more files were not shown because too many files have changed in this diff. Show more