Add my 'patches_old' directory, so that people can see my "progress".

Once the old folder is done, then patches are done.
Want to know whats still to do? Look in that folder.
Now stop asking.
This commit is contained in:
LexManos 2018-11-22 13:43:16 -08:00
parent 47a11b9a7e
commit b687180e12
356 changed files with 19939 additions and 4 deletions

4
.gitignore vendored
View File

@ -29,10 +29,6 @@
# FML changelog
changelog.txt
/patches_old/
/patches_old_bak/
/patches/minecraft.old/
/projects.old/
*.py
*.7z
/logs/

View File

@ -0,0 +1,606 @@
--- ../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;
+ }
}

View File

@ -0,0 +1,10 @@
--- ../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;

View File

@ -0,0 +1,18 @@
--- ../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)

View File

@ -0,0 +1,42 @@
--- ../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);

View File

@ -0,0 +1,13 @@
--- ../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;

View File

@ -0,0 +1,18 @@
--- ../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);

View File

@ -0,0 +1,10 @@
--- ../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;
}

View File

@ -0,0 +1,11 @@
--- ../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)

View File

@ -0,0 +1,214 @@
--- ../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_);
}

View File

@ -0,0 +1,24 @@
--- ../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()

View File

@ -0,0 +1,10 @@
--- ../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));
}

View File

@ -0,0 +1,14 @@
--- ../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_)

View File

@ -0,0 +1,101 @@
--- ../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();
}
}

View File

@ -0,0 +1,19 @@
--- ../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)

View File

@ -0,0 +1,40 @@
--- ../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;
}

View File

@ -0,0 +1,33 @@
--- ../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);
+ }
+ }
}

View File

@ -0,0 +1,38 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/ActiveRenderInfo.java
@@ -30,6 +30,11 @@
public static void func_74583_a(EntityPlayer p_74583_0_, boolean p_74583_1_)
{
+ updateRenderInfo((Entity) p_74583_0_, p_74583_1_);
+ }
+
+ public static void updateRenderInfo(Entity p_74583_0_, boolean p_74583_1_)
+ {
GlStateManager.func_179111_a(2982, field_178812_b);
GlStateManager.func_179111_a(2983, field_178813_c);
GlStateManager.func_187445_a(2978, field_178814_a);
@@ -81,7 +86,7 @@
}
}
- return iblockstate;
+ return iblockstate.func_177230_c().getStateAtViewpoint(iblockstate, p_186703_0_, blockpos, vec3d);
}
public static float func_178808_b()
@@ -108,4 +113,14 @@
{
return field_74596_h;
}
+
+ /* ======================================== FORGE START =====================================*/
+
+ /**
+ * Vector from render view entity position (corrected for partialTickTime) to the middle of screen
+ */
+ public static Vec3d getCameraPosition()
+ {
+ return field_178811_e;
+ }
}

View File

@ -0,0 +1,14 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/BlockFluidRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/BlockFluidRenderer.java
@@ -184,9 +184,9 @@
if (!flag)
{
- Block block = p_178270_1_.func_180495_p(blockpos).func_177230_c();
+ IBlockState state = p_178270_1_.func_180495_p(blockpos);
- if (block == Blocks.field_150359_w || block == Blocks.field_150399_cn)
+ if (state.func_193401_d(p_178270_1_, blockpos, EnumFacing.field_82609_l[i1+2].func_176734_d()) == net.minecraft.block.state.BlockFaceShape.SOLID)
{
textureatlassprite1 = this.field_187501_d;
}

View File

@ -0,0 +1,54 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelRenderer.java
@@ -40,7 +40,7 @@
public boolean func_187493_a(IBlockAccess p_187493_1_, IBakedModel p_187493_2_, IBlockState p_187493_3_, BlockPos p_187493_4_, BufferBuilder p_187493_5_, boolean p_187493_6_, long p_187493_7_)
{
- boolean flag = Minecraft.func_71379_u() && p_187493_3_.func_185906_d() == 0 && p_187493_2_.func_177555_b();
+ boolean flag = Minecraft.func_71379_u() && p_187493_3_.getLightValue(p_187493_1_, p_187493_4_) == 0 && p_187493_2_.isAmbientOcclusion(p_187493_3_);
try
{
@@ -128,7 +128,14 @@
p_187492_8_.func_187491_a(p_187492_1_, p_187492_2_, p_187492_3_, bakedquad.func_178210_d(), p_187492_6_, p_187492_7_);
p_187492_4_.func_178981_a(bakedquad.func_178209_a());
p_187492_4_.func_178962_a(p_187492_8_.field_178207_c[0], p_187492_8_.field_178207_c[1], p_187492_8_.field_178207_c[2], p_187492_8_.field_178207_c[3]);
-
+ if(bakedquad.shouldApplyDiffuseLighting())
+ {
+ float diffuse = net.minecraftforge.client.model.pipeline.LightUtil.diffuseLight(bakedquad.func_178210_d());
+ p_187492_8_.field_178206_b[0] *= diffuse;
+ p_187492_8_.field_178206_b[1] *= diffuse;
+ p_187492_8_.field_178206_b[2] *= diffuse;
+ p_187492_8_.field_178206_b[3] *= diffuse;
+ }
if (bakedquad.func_178212_b())
{
int k = this.field_187499_a.func_186724_a(p_187492_2_, p_187492_1_, p_187492_3_, bakedquad.func_178211_c());
@@ -262,11 +269,26 @@
float f = (float)(k >> 16 & 255) / 255.0F;
float f1 = (float)(k >> 8 & 255) / 255.0F;
float f2 = (float)(k & 255) / 255.0F;
+ if(bakedquad.shouldApplyDiffuseLighting())
+ {
+ float diffuse = net.minecraftforge.client.model.pipeline.LightUtil.diffuseLight(bakedquad.func_178210_d());
+ f *= diffuse;
+ f1 *= diffuse;
+ f2 *= diffuse;
+ }
p_187496_6_.func_178978_a(f, f1, f2, 4);
p_187496_6_.func_178978_a(f, f1, f2, 3);
p_187496_6_.func_178978_a(f, f1, f2, 2);
p_187496_6_.func_178978_a(f, f1, f2, 1);
}
+ else if(bakedquad.shouldApplyDiffuseLighting())
+ {
+ float diffuse = net.minecraftforge.client.model.pipeline.LightUtil.diffuseLight(bakedquad.func_178210_d());
+ p_187496_6_.func_178978_a(diffuse, diffuse, diffuse, 4);
+ p_187496_6_.func_178978_a(diffuse, diffuse, diffuse, 3);
+ p_187496_6_.func_178978_a(diffuse, diffuse, diffuse, 2);
+ p_187496_6_.func_178978_a(diffuse, diffuse, diffuse, 1);
+ }
p_187496_6_.func_178987_a(d0, d1, d2);
}

View File

@ -0,0 +1,9 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/BlockModelShapes.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/BlockModelShapes.java
@@ -391,5 +391,6 @@
return new ModelResourceLocation(s + "_double_slab", s1);
}
});
+ net.minecraftforge.client.model.ModelLoader.onRegisterAllBlocks(this);
}
}

View File

@ -0,0 +1,31 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/BlockRendererDispatcher.java
@@ -28,7 +28,7 @@
public BlockRendererDispatcher(BlockModelShapes p_i46577_1_, BlockColors p_i46577_2_)
{
this.field_175028_a = p_i46577_1_;
- this.field_175027_c = new BlockModelRenderer(p_i46577_2_);
+ this.field_175027_c = new net.minecraftforge.client.model.pipeline.ForgeBlockModelRenderer(p_i46577_2_);
this.field_175025_e = new BlockFluidRenderer(p_i46577_2_);
}
@@ -43,7 +43,7 @@
{
p_175020_1_ = p_175020_1_.func_185899_b(p_175020_4_, p_175020_2_);
IBakedModel ibakedmodel = this.field_175028_a.func_178125_b(p_175020_1_);
- IBakedModel ibakedmodel1 = (new SimpleBakedModel.Builder(p_175020_1_, ibakedmodel, p_175020_3_, p_175020_2_)).func_177645_b();
+ IBakedModel ibakedmodel1 = net.minecraftforge.client.ForgeHooksClient.getDamageModel(ibakedmodel, p_175020_3_, p_175020_1_, p_175020_4_, p_175020_2_);
this.field_175027_c.func_178267_a(p_175020_4_, ibakedmodel1, p_175020_1_, p_175020_2_, Tessellator.func_178181_a().func_178180_c(), true);
}
}
@@ -75,7 +75,9 @@
switch (enumblockrendertype)
{
case MODEL:
- return this.field_175027_c.func_178267_a(p_175018_3_, this.func_184389_a(p_175018_1_), p_175018_1_, p_175018_2_, p_175018_4_, true);
+ IBakedModel model = this.func_184389_a(p_175018_1_);
+ p_175018_1_ = p_175018_1_.func_177230_c().getExtendedState(p_175018_1_, p_175018_3_, p_175018_2_);
+ return this.field_175027_c.func_178267_a(p_175018_3_, model, p_175018_1_, p_175018_2_, p_175018_4_, true);
case ENTITYBLOCK_ANIMATED:
return false;
case LIQUID:

View File

@ -0,0 +1,70 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/BufferBuilder.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/BufferBuilder.java
@@ -123,6 +123,8 @@
bitset.set(i1);
}
+ this.field_178999_b.limit(this.field_178999_b.capacity());
+ this.field_178999_b.position(this.func_181664_j());
}
public BufferBuilder.State func_181672_a()
@@ -415,7 +417,7 @@
public void func_178981_a(int[] p_178981_1_)
{
- this.func_181670_b(p_178981_1_.length * 4);
+ this.func_181670_b(p_178981_1_.length * 4 + this.field_179011_q.func_177338_f());//Forge, fix MC-122110
this.field_178999_b.position(this.func_181664_j());
this.field_178999_b.put(p_178981_1_);
this.field_178997_d += p_178981_1_.length / this.field_179011_q.func_181719_f();
@@ -506,15 +508,15 @@
break;
case USHORT:
case SHORT:
- this.field_179001_a.putShort(i, (short)((int)p_181663_1_ * 32767 & 65535));
- this.field_179001_a.putShort(i + 2, (short)((int)p_181663_2_ * 32767 & 65535));
- this.field_179001_a.putShort(i + 4, (short)((int)p_181663_3_ * 32767 & 65535));
+ this.field_179001_a.putShort(i, (short)((int)(p_181663_1_ * 32767) & 65535));
+ this.field_179001_a.putShort(i + 2, (short)((int)(p_181663_2_ * 32767) & 65535));
+ this.field_179001_a.putShort(i + 4, (short)((int)(p_181663_3_ * 32767) & 65535));
break;
case UBYTE:
case BYTE:
- this.field_179001_a.put(i, (byte)((int)p_181663_1_ * 127 & 255));
- this.field_179001_a.put(i + 1, (byte)((int)p_181663_2_ * 127 & 255));
- this.field_179001_a.put(i + 2, (byte)((int)p_181663_3_ * 127 & 255));
+ this.field_179001_a.put(i, (byte)((int)(p_181663_1_ * 127) & 255));
+ this.field_179001_a.put(i + 1, (byte)((int)(p_181663_2_ * 127) & 255));
+ this.field_179001_a.put(i + 2, (byte)((int)(p_181663_3_ * 127) & 255));
}
this.func_181667_k();
@@ -605,4 +607,27 @@
return this.field_179018_e;
}
}
+
+
+ //For some unknown reason Mojang changed the vanilla function to hardcode alpha as 255.... So lets re-add the parameter -.-
+ public void putColorRGBA(int index, int red, int green, int blue, int alpha)
+ {
+ if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN)
+ this.field_178999_b.put(index, alpha << 24 | blue << 16 | green << 8 | red);
+ else
+ this.field_178999_b.put(index, red << 24 | green << 16 | blue << 8 | alpha);
+ }
+
+ public boolean isColorDisabled()
+ {
+ return this.field_78939_q;
+ }
+
+ public void putBulkData(ByteBuffer buffer)
+ {
+ func_181670_b(buffer.limit() + this.field_179011_q.func_177338_f());
+ this.field_179001_a.position(this.field_178997_d * this.field_179011_q.func_177338_f());
+ this.field_179001_a.put(buffer);
+ this.field_178997_d += buffer.limit() / this.field_179011_q.func_177338_f();
+ }
}

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/ChestRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/ChestRenderer.java
@@ -13,6 +13,7 @@
{
GlStateManager.func_179131_c(p_178175_2_, p_178175_2_, p_178175_2_, 1.0F);
GlStateManager.func_179114_b(90.0F, 0.0F, 1.0F, 0.0F);
- TileEntityItemStackRenderer.field_147719_a.func_179022_a(new ItemStack(p_178175_1_));
+ ItemStack stack = new ItemStack(p_178175_1_);
+ stack.func_77973_b().getTileEntityItemStackRenderer().func_179022_a(stack);
}
}

View File

@ -0,0 +1,296 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/EntityRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/EntityRenderer.java
@@ -211,6 +211,7 @@
{
this.func_175069_a(new ResourceLocation("shaders/post/invert.json"));
}
+ else net.minecraftforge.client.ForgeHooksClient.loadEntityShader(p_175066_1_, this);
}
}
@@ -290,7 +291,7 @@
this.field_78531_r.func_175607_a(this.field_78531_r.field_71439_g);
}
- float f3 = this.field_78531_r.field_71441_e.func_175724_o(new BlockPos(this.field_78531_r.func_175606_aa()));
+ float f3 = this.field_78531_r.field_71441_e.func_175724_o(new BlockPos(this.field_78531_r.func_175606_aa().func_174824_e(1F))); // Forge: fix MC-51150
float f4 = (float)this.field_78531_r.field_71474_y.field_151451_c / 32.0F;
float f2 = f3 * (1.0F - f4) + f4;
this.field_78539_ae += (f2 - this.field_78539_ae) * 0.1F;
@@ -412,7 +413,7 @@
if (d3 < d2 || d2 == 0.0D)
{
- if (entity1.func_184208_bv() == entity.func_184208_bv())
+ if (entity1.func_184208_bv() == entity.func_184208_bv() && !entity1.canRiderInteract())
{
if (d2 == 0.0D)
{
@@ -505,7 +506,7 @@
f = f * 60.0F / 70.0F;
}
- return f;
+ return net.minecraftforge.client.ForgeHooksClient.getFOVModifier(this, entity, iblockstate, p_78481_1_, f);
}
}
@@ -569,14 +570,8 @@
{
BlockPos blockpos = new BlockPos(entity);
IBlockState iblockstate = this.field_78531_r.field_71441_e.func_180495_p(blockpos);
- Block block = iblockstate.func_177230_c();
+ net.minecraftforge.client.ForgeHooksClient.orientBedCamera(this.field_78531_r.field_71441_e, blockpos, iblockstate, entity);
- if (block == Blocks.field_150324_C)
- {
- int j = ((EnumFacing)iblockstate.func_177229_b(BlockBed.field_185512_D)).func_176736_b();
- GlStateManager.func_179114_b((float)(j * 90), 0.0F, 1.0F, 0.0F);
- }
-
GlStateManager.func_179114_b(entity.field_70126_B + (entity.field_70177_z - entity.field_70126_B) * p_78467_1_ + 180.0F, 0.0F, -1.0F, 0.0F);
GlStateManager.func_179114_b(entity.field_70127_C + (entity.field_70125_A - entity.field_70127_C) * p_78467_1_, -1.0F, 0.0F, 0.0F);
}
@@ -643,17 +638,20 @@
if (!this.field_78531_r.field_71474_y.field_74325_U)
{
- GlStateManager.func_179114_b(entity.field_70127_C + (entity.field_70125_A - entity.field_70127_C) * p_78467_1_, 1.0F, 0.0F, 0.0F);
-
+ float yaw = entity.field_70126_B + (entity.field_70177_z - entity.field_70126_B) * p_78467_1_ + 180.0F;
+ float pitch = entity.field_70127_C + (entity.field_70125_A - entity.field_70127_C) * p_78467_1_;
+ float roll = 0.0F;
if (entity instanceof EntityAnimal)
{
EntityAnimal entityanimal = (EntityAnimal)entity;
- GlStateManager.func_179114_b(entityanimal.field_70758_at + (entityanimal.field_70759_as - entityanimal.field_70758_at) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F);
+ yaw = entityanimal.field_70758_at + (entityanimal.field_70759_as - entityanimal.field_70758_at) * p_78467_1_ + 180.0F;
}
- else
- {
- GlStateManager.func_179114_b(entity.field_70126_B + (entity.field_70177_z - entity.field_70126_B) * p_78467_1_ + 180.0F, 0.0F, 1.0F, 0.0F);
- }
+ IBlockState state = ActiveRenderInfo.func_186703_a(this.field_78531_r.field_71441_e, entity, p_78467_1_);
+ net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup event = new net.minecraftforge.client.event.EntityViewRenderEvent.CameraSetup(this, entity, state, p_78467_1_, yaw, pitch, roll);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
+ GlStateManager.func_179114_b(event.getRoll(), 0.0F, 0.0F, 1.0F);
+ GlStateManager.func_179114_b(event.getPitch(), 1.0F, 0.0F, 0.0F);
+ GlStateManager.func_179114_b(event.getYaw(), 0.0F, 1.0F, 0.0F);
}
GlStateManager.func_179109_b(0.0F, -f, 0.0F);
@@ -771,6 +769,7 @@
boolean flag = this.field_78531_r.func_175606_aa() instanceof EntityLivingBase && ((EntityLivingBase)this.field_78531_r.func_175606_aa()).func_70608_bn();
+ if (!net.minecraftforge.client.ForgeHooksClient.renderFirstPersonHand(field_78531_r.field_71438_f, p_78476_1_, p_78476_2_))
if (this.field_78531_r.field_71474_y.field_74320_O == 0 && !flag && !this.field_78531_r.field_71474_y.field_74319_N && !this.field_78531_r.field_71442_b.func_78747_a())
{
this.func_180436_i();
@@ -875,6 +874,15 @@
f10 = 0.25F + f7 * 0.75F;
}
+ float[] colors = {f8, f9, f10};
+ world.field_73011_w.getLightmapColors(p_78472_1_, f, f2, f3, colors);
+ f8 = colors[0]; f9 = colors[1]; f10 = colors[2];
+
+ // Forge: fix MC-58177
+ f8 = MathHelper.func_76131_a(f8, 0f, 1f);
+ f9 = MathHelper.func_76131_a(f9, 0f, 1f);
+ f10 = MathHelper.func_76131_a(f10, 0f, 1f);
+
if (this.field_78531_r.field_71439_g.func_70644_a(MobEffects.field_76439_r))
{
float f15 = this.func_180438_a(this.field_78531_r.field_71439_g, p_78472_1_);
@@ -1101,6 +1109,10 @@
GlStateManager.func_179096_D();
this.func_78478_c();
this.field_78510_Z = System.nanoTime();
+ // Forge: Fix MC-112292
+ net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.field_147556_a.field_147553_e = this.field_78531_r.func_110434_K();
+ // Forge: also fix rendering text before entering world (not part of MC-112292, but the same reason)
+ net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.field_147556_a.field_147557_n = this.field_78531_r.field_71466_p;
}
if (this.field_78531_r.field_71462_r != null)
@@ -1109,7 +1121,7 @@
try
{
- this.field_78531_r.field_71462_r.func_73863_a(k1, l1, this.field_78531_r.func_193989_ak());
+ net.minecraftforge.client.ForgeHooksClient.drawScreen(this.field_78531_r.field_71462_r, k1, l1, this.field_78531_r.func_193989_ak());
}
catch (Throwable throwable)
{
@@ -1204,7 +1216,7 @@
if (this.field_78531_r.field_71442_b.func_178889_l() == GameType.SPECTATOR)
{
- flag = block.func_149716_u() && this.field_78531_r.field_71441_e.func_175625_s(blockpos) instanceof IInventory;
+ flag = block.hasTileEntity(this.field_78531_r.field_71441_e.func_180495_p(blockpos)) && this.field_78531_r.field_71441_e.func_175625_s(blockpos) instanceof IInventory;
}
else
{
@@ -1262,7 +1274,7 @@
GlStateManager.func_179086_m(16640);
this.field_78531_r.field_71424_I.func_76318_c("camera");
this.func_78479_a(p_175068_2_, p_175068_1_);
- ActiveRenderInfo.func_74583_a(this.field_78531_r.field_71439_g, this.field_78531_r.field_71474_y.field_74320_O == 2);
+ ActiveRenderInfo.updateRenderInfo(this.field_78531_r.func_175606_aa(), this.field_78531_r.field_71474_y.field_74320_O == 2); //Forge: MC-46445 Spectator mode particles and sounds computed from where you have been before
this.field_78531_r.field_71424_I.func_76318_c("frustum");
ClippingHelperImpl.func_78558_a();
this.field_78531_r.field_71424_I.func_76318_c("culling");
@@ -1315,7 +1327,9 @@
GlStateManager.func_179118_c();
renderglobal.func_174977_a(BlockRenderLayer.SOLID, (double)p_175068_2_, p_175068_1_, entity);
GlStateManager.func_179141_d();
+ this.field_78531_r.func_110434_K().func_110581_b(TextureMap.field_110575_b).func_174936_b(false, this.field_78531_r.field_71474_y.field_151442_I > 0); // FORGE: fix flickering leaves when mods mess up the blurMipmap settings
renderglobal.func_174977_a(BlockRenderLayer.CUTOUT_MIPPED, (double)p_175068_2_, p_175068_1_, entity);
+ this.field_78531_r.func_110434_K().func_110581_b(TextureMap.field_110575_b).func_174935_a();
this.field_78531_r.func_110434_K().func_110581_b(TextureMap.field_110575_b).func_174936_b(false, false);
renderglobal.func_174977_a(BlockRenderLayer.CUTOUT, (double)p_175068_2_, p_175068_1_, entity);
this.field_78531_r.func_110434_K().func_110581_b(TextureMap.field_110575_b).func_174935_a();
@@ -1329,7 +1343,9 @@
GlStateManager.func_179094_E();
RenderHelper.func_74519_b();
this.field_78531_r.field_71424_I.func_76318_c("entities");
+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0);
renderglobal.func_180446_a(entity, icamera, p_175068_2_);
+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(0);
RenderHelper.func_74518_a();
this.func_175072_h();
}
@@ -1342,6 +1358,7 @@
EntityPlayer entityplayer = (EntityPlayer)entity;
GlStateManager.func_179118_c();
this.field_78531_r.field_71424_I.func_76318_c("outline");
+ if (!net.minecraftforge.client.ForgeHooksClient.onDrawBlockHighlight(renderglobal, entityplayer, field_78531_r.field_71476_x, 0, p_175068_2_))
renderglobal.func_72731_b(entityplayer, this.field_78531_r.field_71476_x, 0, p_175068_2_);
GlStateManager.func_179141_d();
}
@@ -1388,6 +1405,17 @@
GlStateManager.func_179103_j(7425);
this.field_78531_r.field_71424_I.func_76318_c("translucent");
renderglobal.func_174977_a(BlockRenderLayer.TRANSLUCENT, (double)p_175068_2_, p_175068_1_, entity);
+ if (!this.field_175078_W) //Only render if render pass 0 happens as well.
+ {
+ RenderHelper.func_74519_b();
+ this.field_78531_r.field_71424_I.func_76318_c("entities");
+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(1);
+ renderglobal.func_180446_a(entity, icamera, p_175068_2_);
+ // restore blending function changed by RenderGlobal.preRenderDamagedBlocks
+ GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
+ net.minecraftforge.client.ForgeHooksClient.setRenderPass(-1);
+ RenderHelper.func_74518_a();
+ }
GlStateManager.func_179103_j(7424);
GlStateManager.func_179132_a(true);
GlStateManager.func_179089_o();
@@ -1400,6 +1428,9 @@
this.func_180437_a(renderglobal, p_175068_2_, p_175068_1_, d0, d1, d2);
}
+ this.field_78531_r.field_71424_I.func_76318_c("forge_render_last");
+ net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(renderglobal, p_175068_2_);
+
this.field_78531_r.field_71424_I.func_76318_c("hand");
if (this.field_175074_C)
@@ -1515,6 +1546,13 @@
protected void func_78474_d(float p_78474_1_)
{
+ net.minecraftforge.client.IRenderHandler renderer = this.field_78531_r.field_71441_e.field_73011_w.getWeatherRenderer();
+ if (renderer != null)
+ {
+ renderer.render(p_78474_1_, this.field_78531_r.field_71441_e, field_78531_r);
+ return;
+ }
+
float f = this.field_78531_r.field_71441_e.func_72867_j(p_78474_1_);
if (f > 0.0F)
@@ -1749,30 +1787,17 @@
this.field_175082_R = (float)vec3d3.field_72448_b;
this.field_175081_S = (float)vec3d3.field_72449_c;
}
- else if (iblockstate.func_185904_a() == Material.field_151586_h)
+ else
{
- float f12 = 0.0F;
-
- if (entity instanceof EntityLivingBase)
- {
- f12 = (float)EnchantmentHelper.func_185292_c((EntityLivingBase)entity) * 0.2F;
-
- if (((EntityLivingBase)entity).func_70644_a(MobEffects.field_76427_o))
- {
- f12 = f12 * 0.3F + 0.6F;
- }
- }
-
- this.field_175080_Q = 0.02F + f12;
- this.field_175082_R = 0.02F + f12;
- this.field_175081_S = 0.2F + f12;
+ //Forge Moved to Block.
+ Vec3d viewport = ActiveRenderInfo.func_178806_a(entity, p_78466_1_);
+ BlockPos viewportPos = new BlockPos(viewport);
+ IBlockState viewportState = this.field_78531_r.field_71441_e.func_180495_p(viewportPos);
+ Vec3d inMaterialColor = viewportState.func_177230_c().getFogColor(this.field_78531_r.field_71441_e, viewportPos, viewportState, entity, new Vec3d(field_175080_Q, field_175082_R, field_175081_S), p_78466_1_);
+ this.field_175080_Q = (float)inMaterialColor.field_72450_a;
+ this.field_175082_R = (float)inMaterialColor.field_72448_b;
+ this.field_175081_S = (float)inMaterialColor.field_72449_c;
}
- else if (iblockstate.func_185904_a() == Material.field_151587_i)
- {
- this.field_175080_Q = 0.6F;
- this.field_175082_R = 0.1F;
- this.field_175081_S = 0.0F;
- }
float f13 = this.field_78535_ad + (this.field_78539_ae - this.field_78535_ad) * p_78466_1_;
this.field_175080_Q *= f13;
@@ -1830,6 +1855,9 @@
f6 = 1.0F / this.field_175081_S;
}
+ // Forge: fix MC-4647 and MC-10480
+ if (Float.isInfinite(f6)) f6 = Math.nextAfter(f6, 0.0);
+
this.field_175080_Q = this.field_175080_Q * (1.0F - f15) + this.field_175080_Q * f6 * f15;
this.field_175082_R = this.field_175082_R * (1.0F - f15) + this.field_175082_R * f6 * f15;
this.field_175081_S = this.field_175081_S * (1.0F - f15) + this.field_175081_S * f6 * f15;
@@ -1845,6 +1873,13 @@
this.field_175081_S = f7;
}
+ net.minecraftforge.client.event.EntityViewRenderEvent.FogColors event = new net.minecraftforge.client.event.EntityViewRenderEvent.FogColors(this, entity, iblockstate, p_78466_1_, this.field_175080_Q, this.field_175082_R, this.field_175081_S);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
+
+ this.field_175080_Q = event.getRed();
+ this.field_175082_R = event.getGreen();
+ this.field_175081_S = event.getBlue();
+
GlStateManager.func_179082_a(this.field_175080_Q, this.field_175082_R, this.field_175081_S, 0.0F);
}
@@ -1855,7 +1890,9 @@
GlStateManager.func_187432_a(0.0F, -1.0F, 0.0F);
GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
IBlockState iblockstate = ActiveRenderInfo.func_186703_a(this.field_78531_r.field_71441_e, entity, p_78468_2_);
-
+ float hook = net.minecraftforge.client.ForgeHooksClient.getFogDensity(this, entity, iblockstate, p_78468_2_, 0.1F);
+ if (hook >= 0) GlStateManager.func_179095_a(hook);
+ else
if (entity instanceof EntityLivingBase && ((EntityLivingBase)entity).func_70644_a(MobEffects.field_76440_q))
{
float f1 = 5.0F;
@@ -1940,6 +1977,7 @@
GlStateManager.func_179102_b(f * 0.05F);
GlStateManager.func_179153_c(Math.min(f, 192.0F) * 0.5F);
}
+ net.minecraftforge.client.ForgeHooksClient.onFogRender(this, entity, iblockstate, p_78468_2_, p_78468_1_, f);
}
GlStateManager.func_179142_g();

View File

@ -0,0 +1,40 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/InventoryEffectRenderer.java
@@ -28,13 +28,19 @@
protected void func_175378_g()
{
- if (this.field_146297_k.field_71439_g.func_70651_bq().isEmpty())
+ boolean hasVisibleEffect = false;
+ for(PotionEffect potioneffect : this.field_146297_k.field_71439_g.func_70651_bq()) {
+ Potion potion = potioneffect.func_188419_a();
+ if(potion.shouldRender(potioneffect)) { hasVisibleEffect = true; break; }
+ }
+ if (this.field_146297_k.field_71439_g.func_70651_bq().isEmpty() || !hasVisibleEffect)
{
this.field_147003_i = (this.field_146294_l - this.field_146999_f) / 2;
this.field_147045_u = false;
}
else
{
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.PotionShiftEvent(this))) this.field_147003_i = (this.field_146294_l - this.field_146999_f) / 2; else
this.field_147003_i = 160 + (this.field_146294_l - this.field_146999_f - 200) / 2;
this.field_147045_u = true;
}
@@ -71,6 +77,7 @@
for (PotionEffect potioneffect : Ordering.natural().sortedCopy(collection))
{
Potion potion = potioneffect.func_188419_a();
+ if(!potion.shouldRender(potioneffect)) continue;
GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146297_k.func_110434_K().func_110577_a(field_147001_a);
this.func_73729_b(i, j, 0, 166, 140, 32);
@@ -81,6 +88,8 @@
this.func_73729_b(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18);
}
+ potion.renderInventoryEffect(i, j, potioneffect, field_146297_k);
+ if (!potion.shouldRenderInvText(potioneffect)) { j += l; continue; }
String s1 = I18n.func_135052_a(potion.func_76393_a());
if (potioneffect.func_76458_c() == 1)

View File

@ -0,0 +1,13 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/ItemModelMesher.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/ItemModelMesher.java
@@ -33,7 +33,9 @@
public TextureAtlasSprite func_178087_a(Item p_178087_1_, int p_178087_2_)
{
- return this.func_178089_a(new ItemStack(p_178087_1_, 1, p_178087_2_)).func_177554_e();
+ ItemStack stack = new ItemStack(p_178087_1_, 1, p_178087_2_);
+ IBakedModel model = this.func_178089_a(stack);
+ return model.func_188617_f().handleItemState(model, stack, null, null).func_177554_e();
}
public IBakedModel func_178089_a(ItemStack p_178089_1_)

View File

@ -0,0 +1,101 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/ItemRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/ItemRenderer.java
@@ -216,7 +216,7 @@
bufferbuilder.func_181662_b(135.0D, -7.0D, 0.0D).func_187315_a(1.0D, 0.0D).func_181675_d();
bufferbuilder.func_181662_b(-7.0D, -7.0D, 0.0D).func_187315_a(0.0D, 0.0D).func_181675_d();
tessellator.func_78381_a();
- MapData mapdata = Items.field_151098_aY.func_77873_a(p_187461_1_, this.field_78455_a.field_71441_e);
+ MapData mapdata = ((net.minecraft.item.ItemMap) p_187461_1_.func_77973_b()).func_77873_a(p_187461_1_, this.field_78455_a.field_71441_e);
if (mapdata != null)
{
@@ -312,7 +312,7 @@
{
ItemStack itemstack = abstractclientplayer.func_184607_cu();
- if (itemstack.func_77973_b() == Items.field_151031_f)
+ if (!itemstack.func_190926_b() && itemstack.func_77973_b() == Items.field_151031_f) //Forge: Data watcher can desync and cause this to NPE...
{
EnumHand enumhand1 = abstractclientplayer.func_184600_cs();
flag = enumhand1 == EnumHand.MAIN_HAND;
@@ -329,6 +329,7 @@
{
float f3 = enumhand == EnumHand.MAIN_HAND ? f : 0.0F;
float f5 = 1.0F - (this.field_187470_g + (this.field_187469_f - this.field_187470_g) * p_78440_1_);
+ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(EnumHand.MAIN_HAND, p_78440_1_, f1, f3, f5, this.field_187467_d))
this.func_187457_a(abstractclientplayer, p_78440_1_, f1, EnumHand.MAIN_HAND, f3, this.field_187467_d, f5);
}
@@ -336,6 +337,7 @@
{
float f4 = enumhand == EnumHand.OFF_HAND ? f : 0.0F;
float f6 = 1.0F - (this.field_187472_i + (this.field_187471_h - this.field_187472_i) * p_78440_1_);
+ if(!net.minecraftforge.client.ForgeHooksClient.renderSpecificFirstPersonHand(EnumHand.OFF_HAND, p_78440_1_, f1, f4, f6, this.field_187468_e))
this.func_187457_a(abstractclientplayer, p_78440_1_, f1, EnumHand.OFF_HAND, f4, this.field_187468_e, f6);
}
@@ -356,7 +358,7 @@
this.func_187456_a(p_187457_7_, p_187457_5_, enumhandside);
}
}
- else if (p_187457_6_.func_77973_b() == Items.field_151098_aY)
+ else if (p_187457_6_.func_77973_b() instanceof net.minecraft.item.ItemMap)
{
if (flag && this.field_187468_e.func_190926_b())
{
@@ -440,6 +442,7 @@
if (this.field_78455_a.field_71439_g.func_70094_T())
{
IBlockState iblockstate = this.field_78455_a.field_71441_e.func_180495_p(new BlockPos(this.field_78455_a.field_71439_g));
+ BlockPos overlayPos = new BlockPos(this.field_78455_a.field_71439_g);
EntityPlayer entityplayer = this.field_78455_a.field_71439_g;
for (int i = 0; i < 8; ++i)
@@ -453,11 +456,13 @@
if (iblockstate1.func_191058_s())
{
iblockstate = iblockstate1;
+ overlayPos = blockpos;
}
}
if (iblockstate.func_185901_i() != EnumBlockRenderType.INVISIBLE)
{
+ if (!net.minecraftforge.event.ForgeEventFactory.renderBlockOverlay(field_78455_a.field_71439_g, p_78447_1_, net.minecraftforge.client.event.RenderBlockOverlayEvent.OverlayType.BLOCK, iblockstate, overlayPos))
this.func_178108_a(this.field_78455_a.func_175602_ab().func_175023_a().func_178122_a(iblockstate));
}
}
@@ -466,11 +471,13 @@
{
if (this.field_78455_a.field_71439_g.func_70055_a(Material.field_151586_h))
{
+ if (!net.minecraftforge.event.ForgeEventFactory.renderWaterOverlay(field_78455_a.field_71439_g, p_78447_1_))
this.func_78448_c(p_78447_1_);
}
if (this.field_78455_a.field_71439_g.func_70027_ad())
{
+ if (!net.minecraftforge.event.ForgeEventFactory.renderFireOverlay(field_78455_a.field_71439_g, p_78447_1_))
this.func_78442_d();
}
}
@@ -592,8 +599,17 @@
else
{
float f = entityplayersp.func_184825_o(1.0F);
- this.field_187469_f += MathHelper.func_76131_a((Objects.equals(this.field_187467_d, itemstack) ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F);
- this.field_187471_h += MathHelper.func_76131_a((float)(Objects.equals(this.field_187468_e, itemstack1) ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F);
+
+ boolean requipM = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187467_d, itemstack, entityplayersp.field_71071_by.field_70461_c);
+ boolean requipO = net.minecraftforge.client.ForgeHooksClient.shouldCauseReequipAnimation(this.field_187468_e, itemstack1, -1);
+
+ if (!requipM && !Objects.equals(this.field_187467_d, itemstack))
+ this.field_187467_d = itemstack;
+ if (!requipM && !Objects.equals(this.field_187468_e, itemstack1))
+ this.field_187468_e = itemstack1;
+
+ this.field_187469_f += MathHelper.func_76131_a((!requipM ? f * f * f : 0.0F) - this.field_187469_f, -0.4F, 0.4F);
+ this.field_187471_h += MathHelper.func_76131_a((float)(!requipO ? 1 : 0) - this.field_187471_h, -0.4F, 0.4F);
}
if (this.field_187469_f < 0.1F)

View File

@ -0,0 +1,26 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/OpenGlHelper.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/OpenGlHelper.java
@@ -93,6 +93,10 @@
public static int field_176089_P;
public static int field_148826_e;
+ /* Stores the last values sent into setLightmapTextureCoords */
+ public static float lastBrightnessX = 0.0f;
+ public static float lastBrightnessY = 0.0f;
+
public static void func_77474_a()
{
ContextCapabilities contextcapabilities = GLContext.getCapabilities();
@@ -853,6 +857,12 @@
{
GL13.glMultiTexCoord2f(p_77475_0_, p_77475_1_, p_77475_2_);
}
+
+ if (p_77475_0_ == field_77476_b)
+ {
+ lastBrightnessX = p_77475_1_;
+ lastBrightnessY = p_77475_2_;
+ }
}
public static void func_148821_a(int p_148821_0_, int p_148821_1_, int p_148821_2_, int p_148821_3_)

View File

@ -0,0 +1,158 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/RenderGlobal.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/RenderGlobal.java
@@ -553,8 +553,10 @@
public void func_180446_a(Entity p_180446_1_, ICamera p_180446_2_, float p_180446_3_)
{
+ int pass = net.minecraftforge.client.MinecraftForgeClient.getRenderPass();
if (this.field_72740_G > 0)
{
+ if (pass > 0) return;
--this.field_72740_G;
}
else
@@ -565,9 +567,12 @@
this.field_72769_h.field_72984_F.func_76320_a("prepare");
TileEntityRendererDispatcher.field_147556_a.func_190056_a(this.field_72769_h, this.field_72777_q.func_110434_K(), this.field_72777_q.field_71466_p, this.field_72777_q.func_175606_aa(), this.field_72777_q.field_71476_x, p_180446_3_);
this.field_175010_j.func_180597_a(this.field_72769_h, this.field_72777_q.field_71466_p, this.field_72777_q.func_175606_aa(), this.field_72777_q.field_147125_j, this.field_72777_q.field_71474_y, p_180446_3_);
+ if(pass == 0)
+ {
this.field_72748_H = 0;
this.field_72749_I = 0;
this.field_72750_J = 0;
+ }
Entity entity = this.field_72777_q.func_175606_aa();
double d3 = entity.field_70142_S + (entity.field_70165_t - entity.field_70142_S) * (double)p_180446_3_;
double d4 = entity.field_70137_T + (entity.field_70163_u - entity.field_70137_T) * (double)p_180446_3_;
@@ -579,11 +584,15 @@
this.field_72777_q.field_71460_t.func_180436_i();
this.field_72769_h.field_72984_F.func_76318_c("global");
List<Entity> list = this.field_72769_h.func_72910_y();
+ if (pass == 0)
+ {
this.field_72748_H = list.size();
+ }
for (int i = 0; i < this.field_72769_h.field_73007_j.size(); ++i)
{
Entity entity1 = this.field_72769_h.field_73007_j.get(i);
+ if (!entity1.shouldRenderInPass(pass)) continue;
++this.field_72749_I;
if (entity1.func_145770_h(d0, d1, d2))
@@ -606,6 +615,7 @@
{
for (Entity entity2 : classinheritancemultimap)
{
+ if(!entity2.shouldRenderInPass(pass)) continue;
boolean flag = this.field_175010_j.func_178635_a(entity2, p_180446_2_, d0, d1, d2) || entity2.func_184215_y(this.field_72777_q.field_71439_g);
if (flag)
@@ -642,6 +652,7 @@
}
}
+ if(pass == 0)
if (this.func_174985_d() && (!list1.isEmpty() || this.field_184386_ad))
{
this.field_72769_h.field_72984_F.func_76318_c("entityOutlines");
@@ -681,6 +692,7 @@
this.field_72769_h.field_72984_F.func_76318_c("blockentities");
RenderHelper.func_74519_b();
+ TileEntityRendererDispatcher.field_147556_a.preDrawBatch();
for (RenderGlobal.ContainerLocalRenderInformation renderglobal$containerlocalrenderinformation1 : this.field_72755_R)
{
List<TileEntity> list3 = renderglobal$containerlocalrenderinformation1.field_178036_a.func_178571_g().func_178485_b();
@@ -689,6 +701,7 @@
{
for (TileEntity tileentity2 : list3)
{
+ if (!tileentity2.shouldRenderInPass(pass) || !p_180446_2_.func_78546_a(tileentity2.getRenderBoundingBox())) continue;
TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity2, p_180446_3_, -1);
}
}
@@ -698,9 +711,11 @@
{
for (TileEntity tileentity : this.field_181024_n)
{
+ if (!tileentity.shouldRenderInPass(pass) || !p_180446_2_.func_78546_a(tileentity.getRenderBoundingBox())) continue;
TileEntityRendererDispatcher.field_147556_a.func_180546_a(tileentity, p_180446_3_, -1);
}
}
+ TileEntityRendererDispatcher.field_147556_a.drawBatch(pass);
this.func_180443_s();
@@ -895,7 +910,7 @@
{
RenderChunk renderchunk1 = this.field_175008_n.func_178161_a(new BlockPos((j << 4) + 8, i, (k << 4) + 8));
- if (renderchunk1 != null && p_174970_4_.func_78546_a(renderchunk1.field_178591_c))
+ if (renderchunk1 != null && p_174970_4_.func_78546_a(renderchunk1.field_178591_c.func_72321_a(0.0, blockpos1.func_177956_o() > 0 ? Double.POSITIVE_INFINITY : Double.NEGATIVE_INFINITY, 0.0))) // Forge: fix MC-73139
{
renderchunk1.func_178577_a(p_174970_5_);
queue.add(new RenderGlobal.ContainerLocalRenderInformation(renderchunk1, (EnumFacing)null, 0));
@@ -951,7 +966,7 @@
BlockPos blockpos2 = renderchunk4.func_178568_j().func_177982_a(8, 8, 8);
boolean flag3 = blockpos2.func_177951_i(blockpos1) < 768.0D;
- if (!renderchunk4.func_188281_o() && !flag3)
+ if (net.minecraftforge.common.ForgeModContainer.alwaysSetupTerrainOffThread || (!renderchunk4.func_188281_o() && !flag3))
{
this.field_175009_l.add(renderchunk4);
}
@@ -1253,6 +1268,13 @@
public void func_174976_a(float p_174976_1_, int p_174976_2_)
{
+ net.minecraftforge.client.IRenderHandler renderer = this.field_72769_h.field_73011_w.getSkyRenderer();
+ if (renderer != null)
+ {
+ renderer.render(p_174976_1_, field_72769_h, field_72777_q);
+ return;
+ }
+
if (this.field_72777_q.field_71441_e.field_73011_w.func_186058_p().func_186068_a() == 1)
{
this.func_180448_r();
@@ -1470,6 +1492,7 @@
public void func_180447_b(float p_180447_1_, int p_180447_2_, double p_180447_3_, double p_180447_5_, double p_180447_7_)
{
+ if (net.minecraftforge.fml.client.FMLClientHandler.instance().renderClouds(this.field_72773_u, p_180447_1_)) return;
if (this.field_72777_q.field_71441_e.field_73011_w.func_76569_d())
{
if (this.field_72777_q.field_71474_y.func_181147_e() == 2)
@@ -1852,7 +1875,8 @@
GlStateManager.func_187428_a(GlStateManager.SourceFactor.DST_COLOR, GlStateManager.DestFactor.SRC_COLOR, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.func_179147_l();
GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 0.5F);
- GlStateManager.func_179136_a(-3.0F, -3.0F);
+ // FORGE: Fix MC-234
+ GlStateManager.func_179136_a(-1.0F, -10.0F);
GlStateManager.func_179088_q();
GlStateManager.func_179092_a(516, 0.1F);
GlStateManager.func_179141_d();
@@ -1892,8 +1916,11 @@
double d7 = (double)blockpos.func_177956_o() - d4;
double d8 = (double)blockpos.func_177952_p() - d5;
Block block = this.field_72769_h.func_180495_p(blockpos).func_177230_c();
+ TileEntity te = this.field_72769_h.func_175625_s(blockpos);
+ boolean hasBreak = block instanceof BlockChest || block instanceof BlockEnderChest || block instanceof BlockSign || block instanceof BlockSkull;
+ if (!hasBreak) hasBreak = te != null && te.canRenderBreaking();
- if (!(block instanceof BlockChest) && !(block instanceof BlockEnderChest) && !(block instanceof BlockSign) && !(block instanceof BlockSkull))
+ if (!hasBreak)
{
if (d6 * d6 + d7 * d7 + d8 * d8 > 1024.0D)
{
@@ -2388,7 +2415,7 @@
if (block.func_176223_P().func_185904_a() != Material.field_151579_a)
{
- SoundType soundtype = block.func_185467_w();
+ SoundType soundtype = block.getSoundType(Block.func_176220_d(p_180439_4_), field_72769_h, p_180439_3_, null);
this.field_72769_h.func_184156_a(p_180439_3_, soundtype.func_185845_c(), SoundCategory.BLOCKS, (soundtype.func_185843_a() + 1.0F) / 2.0F, soundtype.func_185847_b() * 0.8F, false);
}

View File

@ -0,0 +1,120 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/RenderItem.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/RenderItem.java
@@ -71,7 +71,7 @@
public RenderItem(TextureManager p_i46552_1_, ModelManager p_i46552_2_, ItemColors p_i46552_3_)
{
this.field_175057_n = p_i46552_1_;
- this.field_175059_m = new ItemModelMesher(p_i46552_2_);
+ this.field_175059_m = new net.minecraftforge.client.ItemModelMesherForge(p_i46552_2_);
this.func_175041_b();
this.field_184395_f = p_i46552_3_;
}
@@ -137,7 +137,7 @@
{
GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.func_179091_B();
- TileEntityItemStackRenderer.field_147719_a.func_179022_a(p_180454_1_);
+ p_180454_1_.func_77973_b().getTileEntityItemStackRenderer().func_179022_a(p_180454_1_);
}
else
{
@@ -218,7 +218,7 @@
k = k | -16777216;
}
- this.func_191969_a(p_191970_1_, bakedquad, k);
+ net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(p_191970_1_, bakedquad, k);
}
}
@@ -240,17 +240,7 @@
public IBakedModel func_184393_a(ItemStack p_184393_1_, @Nullable World p_184393_2_, @Nullable EntityLivingBase p_184393_3_)
{
IBakedModel ibakedmodel = this.field_175059_m.func_178089_a(p_184393_1_);
- Item item = p_184393_1_.func_77973_b();
-
- if (item != null && item.func_185040_i())
- {
- ResourceLocation resourcelocation = ibakedmodel.func_188617_f().func_188021_a(p_184393_1_, p_184393_2_, p_184393_3_);
- return resourcelocation == null ? ibakedmodel : this.field_175059_m.func_178083_a().func_174953_a(new ModelResourceLocation(resourcelocation, "inventory"));
- }
- else
- {
- return ibakedmodel;
- }
+ return ibakedmodel.func_188617_f().handleItemState(ibakedmodel, p_184393_1_, p_184393_2_, p_184393_3_);
}
public void func_184392_a(ItemStack p_184392_1_, EntityLivingBase p_184392_2_, ItemCameraTransforms.TransformType p_184392_3_, boolean p_184392_4_)
@@ -274,14 +264,9 @@
GlStateManager.func_179147_l();
GlStateManager.func_187428_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
GlStateManager.func_179094_E();
- ItemCameraTransforms itemcameratransforms = p_184394_2_.func_177552_f();
- ItemCameraTransforms.func_188034_a(itemcameratransforms.func_181688_b(p_184394_3_), p_184394_4_);
+ // TODO: check if negative scale is a thing
+ p_184394_2_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_184394_2_, p_184394_3_, p_184394_4_);
- if (this.func_183005_a(itemcameratransforms.func_181688_b(p_184394_3_)))
- {
- GlStateManager.func_187407_a(GlStateManager.CullFace.FRONT);
- }
-
this.func_180454_a(p_184394_1_, p_184394_2_);
GlStateManager.func_187407_a(GlStateManager.CullFace.BACK);
GlStateManager.func_179121_F();
@@ -314,7 +299,7 @@
GlStateManager.func_187401_a(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
this.func_180452_a(p_191962_2_, p_191962_3_, p_191962_4_.func_177556_c());
- p_191962_4_.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GUI);
+ p_191962_4_ = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_191962_4_, ItemCameraTransforms.TransformType.GUI, false);
this.func_180454_a(p_191962_1_, p_191962_4_);
GlStateManager.func_179118_c();
GlStateManager.func_179101_C();
@@ -367,6 +352,7 @@
return String.valueOf((Object)p_184391_2_.func_77973_b());
}
});
+ crashreportcategory.func_189529_a("Registry Name", () -> String.valueOf(p_184391_2_.func_77973_b().getRegistryName()));
crashreportcategory.func_189529_a("Item Aux", new ICrashReportDetail<String>()
{
public String call() throws Exception
@@ -413,9 +399,12 @@
p_180453_1_.func_175063_a(s, (float)(p_180453_3_ + 19 - 2 - p_180453_1_.func_78256_a(s)), (float)(p_180453_4_ + 6 + 3), 16777215);
GlStateManager.func_179145_e();
GlStateManager.func_179126_j();
+ // Fixes opaque cooldown overlay a bit lower
+ // TODO: check if enabled blending still screws things up down the line.
+ GlStateManager.func_179147_l();
}
- if (p_180453_2_.func_77951_h())
+ if (p_180453_2_.func_77973_b().showDurabilityBar(p_180453_2_))
{
GlStateManager.func_179140_f();
GlStateManager.func_179097_i();
@@ -424,11 +413,10 @@
GlStateManager.func_179084_k();
Tessellator tessellator = Tessellator.func_178181_a();
BufferBuilder bufferbuilder = tessellator.func_178180_c();
- float f = (float)p_180453_2_.func_77952_i();
- float f1 = (float)p_180453_2_.func_77958_k();
- float f2 = Math.max(0.0F, (f1 - f) / f1);
- int i = Math.round(13.0F - f * 13.0F / f1);
- int j = MathHelper.func_181758_c(f2 / 3.0F, 1.0F, 1.0F);
+ double health = p_180453_2_.func_77973_b().getDurabilityForDisplay(p_180453_2_);
+ int rgbfordisplay = p_180453_2_.func_77973_b().getRGBDurabilityForDisplay(p_180453_2_);
+ int i = Math.round(13.0F - (float)health * 13.0F);
+ int j = rgbfordisplay;
this.func_181565_a(bufferbuilder, p_180453_3_ + 2, p_180453_4_ + 13, 13, 2, 0, 0, 0, 255);
this.func_181565_a(bufferbuilder, p_180453_3_ + 2, p_180453_4_ + 13, i, 1, j >> 16 & 255, j >> 8 & 255, j & 255, 255);
GlStateManager.func_179147_l();
@@ -1099,6 +1087,7 @@
this.func_175029_a(Blocks.field_185779_df, TileEntityStructure.Mode.LOAD.func_185110_a(), "structure_block");
this.func_175029_a(Blocks.field_185779_df, TileEntityStructure.Mode.CORNER.func_185110_a(), "structure_block");
this.func_175029_a(Blocks.field_185779_df, TileEntityStructure.Mode.DATA.func_185110_a(), "structure_block");
+ net.minecraftforge.client.model.ModelLoader.onRegisterItems(this.field_175059_m);
}
public void func_110549_a(IResourceManager p_110549_1_)

View File

@ -0,0 +1,57 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/WorldVertexBufferUploader.java
@@ -27,26 +27,8 @@
int l = vertexformatelement.func_177369_e();
bytebuffer.position(vertexformat.func_181720_d(j));
- switch (vertexformatelement$enumusage)
- {
- case POSITION:
- GlStateManager.func_187427_b(vertexformatelement.func_177370_d(), k, i, bytebuffer);
- GlStateManager.func_187410_q(32884);
- break;
- case UV:
- OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a + l);
- GlStateManager.func_187404_a(vertexformatelement.func_177370_d(), k, i, bytebuffer);
- GlStateManager.func_187410_q(32888);
- OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a);
- break;
- case COLOR:
- GlStateManager.func_187400_c(vertexformatelement.func_177370_d(), k, i, bytebuffer);
- GlStateManager.func_187410_q(32886);
- break;
- case NORMAL:
- GlStateManager.func_187446_a(k, i, bytebuffer);
- GlStateManager.func_187410_q(32885);
- }
+ // moved to VertexFormatElement.preDraw
+ vertexformatelement.func_177375_c().preDraw(vertexformat, j, i, bytebuffer);
}
GlStateManager.func_187439_f(p_181679_1_.func_178979_i(), 0, p_181679_1_.func_178989_h());
@@ -58,23 +40,8 @@
VertexFormatElement.EnumUsage vertexformatelement$enumusage1 = vertexformatelement1.func_177375_c();
int k1 = vertexformatelement1.func_177369_e();
- switch (vertexformatelement$enumusage1)
- {
- case POSITION:
- GlStateManager.func_187429_p(32884);
- break;
- case UV:
- OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a + k1);
- GlStateManager.func_187429_p(32888);
- OpenGlHelper.func_77472_b(OpenGlHelper.field_77478_a);
- break;
- case COLOR:
- GlStateManager.func_187429_p(32886);
- GlStateManager.func_179117_G();
- break;
- case NORMAL:
- GlStateManager.func_187429_p(32885);
- }
+ // moved to VertexFormatElement.postDraw
+ vertexformatelement1.func_177375_c().postDraw(vertexformat, i1, i, bytebuffer);
}
}

View File

@ -0,0 +1,54 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/BakedQuad.java
@@ -6,15 +6,26 @@
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
-public class BakedQuad
+public class BakedQuad implements net.minecraftforge.client.model.pipeline.IVertexProducer
{
protected final int[] field_178215_a;
protected final int field_178213_b;
protected final EnumFacing field_178214_c;
protected final TextureAtlasSprite field_187509_d;
+ /**
+ * @deprecated Use constructor with the format argument.
+ */
+ @Deprecated
public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_)
{
+ this(p_i46574_1_, p_i46574_2_, p_i46574_3_, p_i46574_4_, true, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b);
+ }
+
+ public BakedQuad(int[] p_i46574_1_, int p_i46574_2_, EnumFacing p_i46574_3_, TextureAtlasSprite p_i46574_4_, boolean applyDiffuseLighting, net.minecraft.client.renderer.vertex.VertexFormat format)
+ {
+ this.format = format;
+ this.applyDiffuseLighting = applyDiffuseLighting;
this.field_178215_a = p_i46574_1_;
this.field_178213_b = p_i46574_2_;
this.field_178214_c = p_i46574_3_;
@@ -45,4 +56,23 @@
{
return this.field_178214_c;
}
+
+ protected final net.minecraft.client.renderer.vertex.VertexFormat format;
+ protected final boolean applyDiffuseLighting;
+
+ @Override
+ public void pipe(net.minecraftforge.client.model.pipeline.IVertexConsumer consumer)
+ {
+ net.minecraftforge.client.model.pipeline.LightUtil.putBakedQuad(consumer, this);
+ }
+
+ public net.minecraft.client.renderer.vertex.VertexFormat getFormat()
+ {
+ return format;
+ }
+
+ public boolean shouldApplyDiffuseLighting()
+ {
+ return applyDiffuseLighting;
+ }
}

View File

@ -0,0 +1,31 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/BakedQuadRetextured.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/BakedQuadRetextured.java
@@ -12,7 +12,7 @@
public BakedQuadRetextured(BakedQuad p_i46217_1_, TextureAtlasSprite p_i46217_2_)
{
- super(Arrays.copyOf(p_i46217_1_.func_178209_a(), p_i46217_1_.func_178209_a().length), p_i46217_1_.field_178213_b, FaceBakery.func_178410_a(p_i46217_1_.func_178209_a()), p_i46217_1_.func_187508_a());
+ super(Arrays.copyOf(p_i46217_1_.func_178209_a(), p_i46217_1_.func_178209_a().length), p_i46217_1_.field_178213_b, FaceBakery.func_178410_a(p_i46217_1_.func_178209_a()), p_i46217_1_.func_187508_a(), p_i46217_1_.applyDiffuseLighting, p_i46217_1_.format);
this.field_178218_d = p_i46217_2_;
this.func_178217_e();
}
@@ -21,9 +21,16 @@
{
for (int i = 0; i < 4; ++i)
{
- int j = 7 * i;
- this.field_178215_a[j + 4] = Float.floatToRawIntBits(this.field_178218_d.func_94214_a((double)this.field_187509_d.func_188537_a(Float.intBitsToFloat(this.field_178215_a[j + 4]))));
- this.field_178215_a[j + 4 + 1] = Float.floatToRawIntBits(this.field_178218_d.func_94207_b((double)this.field_187509_d.func_188536_b(Float.intBitsToFloat(this.field_178215_a[j + 4 + 1]))));
+ int j = format.func_181719_f() * i;
+ int uvIndex = format.func_177344_b(0) / 4;
+ this.field_178215_a[j + uvIndex] = Float.floatToRawIntBits(this.field_178218_d.func_94214_a((double)this.field_187509_d.func_188537_a(Float.intBitsToFloat(this.field_178215_a[j + uvIndex]))));
+ this.field_178215_a[j + uvIndex + 1] = Float.floatToRawIntBits(this.field_178218_d.func_94207_b((double)this.field_187509_d.func_188536_b(Float.intBitsToFloat(this.field_178215_a[j + uvIndex + 1]))));
}
}
+
+ @Override
+ public TextureAtlasSprite func_187508_a()
+ {
+ return field_178218_d;
+ }
}

View File

@ -0,0 +1,105 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/FaceBakery.java
@@ -49,14 +49,19 @@
public BakedQuad func_178414_a(Vector3f p_178414_1_, Vector3f p_178414_2_, BlockPartFace p_178414_3_, TextureAtlasSprite p_178414_4_, EnumFacing p_178414_5_, ModelRotation p_178414_6_, @Nullable BlockPartRotation p_178414_7_, boolean p_178414_8_, boolean p_178414_9_)
{
+ return makeBakedQuad(p_178414_1_, p_178414_2_, p_178414_3_, p_178414_4_, p_178414_5_, (net.minecraftforge.common.model.ITransformation)p_178414_6_, p_178414_7_, p_178414_8_, p_178414_9_);
+ }
+
+ public BakedQuad makeBakedQuad(Vector3f p_178414_1_, Vector3f p_178414_2_, BlockPartFace p_178414_3_, TextureAtlasSprite p_178414_4_, EnumFacing p_178414_5_, net.minecraftforge.common.model.ITransformation p_178414_6_, BlockPartRotation p_178414_7_, boolean p_178414_8_, boolean p_178414_9_)
+ {
BlockFaceUV blockfaceuv = p_178414_3_.field_178243_e;
if (p_178414_8_)
{
- blockfaceuv = this.func_188010_a(p_178414_3_.field_178243_e, p_178414_5_, p_178414_6_);
+ blockfaceuv = net.minecraftforge.client.ForgeHooksClient.applyUVLock(p_178414_3_.field_178243_e, p_178414_5_, p_178414_6_);
}
- int[] aint = this.func_188012_a(blockfaceuv, p_178414_4_, p_178414_5_, this.func_178403_a(p_178414_1_, p_178414_2_), p_178414_6_, p_178414_7_, p_178414_9_);
+ int[] aint = this.makeQuadVertexData(blockfaceuv, p_178414_4_, p_178414_5_, this.func_178403_a(p_178414_1_, p_178414_2_), p_178414_6_, p_178414_7_, false);
EnumFacing enumfacing = func_178410_a(aint);
if (p_178414_7_ == null)
@@ -64,7 +69,8 @@
this.func_178408_a(aint, enumfacing);
}
- return new BakedQuad(aint, p_178414_3_.field_178245_c, enumfacing, p_178414_4_);
+ net.minecraftforge.client.ForgeHooksClient.fillNormal(aint, enumfacing);
+ return new BakedQuad(aint, p_178414_3_.field_178245_c, enumfacing, p_178414_4_, p_178414_9_, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176599_b);
}
private BlockFaceUV func_188010_a(BlockFaceUV p_188010_1_, EnumFacing p_188010_2_, ModelRotation p_188010_3_)
@@ -74,11 +80,16 @@
private int[] func_188012_a(BlockFaceUV p_188012_1_, TextureAtlasSprite p_188012_2_, EnumFacing p_188012_3_, float[] p_188012_4_, ModelRotation p_188012_5_, @Nullable BlockPartRotation p_188012_6_, boolean p_188012_7_)
{
+ return makeQuadVertexData(p_188012_1_, p_188012_2_, p_188012_3_, p_188012_4_, (net.minecraftforge.common.model.ITransformation)p_188012_5_, p_188012_6_, p_188012_7_);
+ }
+
+ private int[] makeQuadVertexData(BlockFaceUV uvs, TextureAtlasSprite sprite, EnumFacing orientation, float[] p_188012_4_, net.minecraftforge.common.model.ITransformation rotationIn, BlockPartRotation partRotation, boolean shade)
+ {
int[] aint = new int[28];
for (int i = 0; i < 4; ++i)
{
- this.func_188015_a(aint, i, p_188012_3_, p_188012_1_, p_188012_4_, p_188012_2_, p_188012_5_, p_188012_6_, p_188012_7_);
+ this.fillVertexData(aint, i, orientation, uvs, p_188012_4_, sprite, rotationIn, partRotation, shade);
}
return aint;
@@ -124,12 +135,17 @@
private void func_188015_a(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, ModelRotation p_188015_7_, @Nullable BlockPartRotation p_188015_8_, boolean p_188015_9_)
{
- EnumFacing enumfacing = p_188015_7_.func_177523_a(p_188015_3_);
+ fillVertexData(p_188015_1_, p_188015_2_, p_188015_3_, p_188015_4_, p_188015_5_, p_188015_6_, (net.minecraftforge.common.model.ITransformation)p_188015_7_, p_188015_8_, p_188015_9_);
+ }
+
+ private void fillVertexData(int[] p_188015_1_, int p_188015_2_, EnumFacing p_188015_3_, BlockFaceUV p_188015_4_, float[] p_188015_5_, TextureAtlasSprite p_188015_6_, net.minecraftforge.common.model.ITransformation p_188015_7_, BlockPartRotation p_188015_8_, boolean p_188015_9_)
+ {
+ EnumFacing enumfacing = p_188015_7_.rotate(p_188015_3_);
int i = p_188015_9_ ? this.func_178413_a(enumfacing) : -1;
EnumFaceDirection.VertexInformation enumfacedirection$vertexinformation = EnumFaceDirection.func_179027_a(p_188015_3_).func_179025_a(p_188015_2_);
Vector3f vector3f = new Vector3f(p_188015_5_[enumfacedirection$vertexinformation.field_179184_a], p_188015_5_[enumfacedirection$vertexinformation.field_179182_b], p_188015_5_[enumfacedirection$vertexinformation.field_179183_c]);
this.func_178407_a(vector3f, p_188015_8_);
- int j = this.func_188011_a(vector3f, p_188015_3_, p_188015_2_, p_188015_7_);
+ int j = this.rotateVertex(vector3f, p_188015_3_, p_188015_2_, p_188015_7_);
this.func_178404_a(p_188015_1_, j, p_188015_2_, vector3f, i, p_188015_6_, p_188015_4_);
}
@@ -140,8 +156,8 @@
p_178404_1_[i + 1] = Float.floatToRawIntBits(p_178404_4_.y);
p_178404_1_[i + 2] = Float.floatToRawIntBits(p_178404_4_.z);
p_178404_1_[i + 3] = p_178404_5_;
- p_178404_1_[i + 4] = Float.floatToRawIntBits(p_178404_6_.func_94214_a((double)p_178404_7_.func_178348_a(p_178404_3_)));
- p_178404_1_[i + 4 + 1] = Float.floatToRawIntBits(p_178404_6_.func_94207_b((double)p_178404_7_.func_178346_b(p_178404_3_)));
+ p_178404_1_[i + 4] = Float.floatToRawIntBits(p_178404_6_.func_94214_a((double)p_178404_7_.func_178348_a(p_178404_3_) * .999 + p_178404_7_.func_178348_a((p_178404_3_ + 2) % 4) * .001));
+ p_178404_1_[i + 4 + 1] = Float.floatToRawIntBits(p_178404_6_.func_94207_b((double)p_178404_7_.func_178346_b(p_178404_3_) * .999 + p_178404_7_.func_178346_b((p_178404_3_ + 2) % 4) * .001));
}
private void func_178407_a(Vector3f p_178407_1_, @Nullable BlockPartRotation p_178407_2_)
@@ -190,14 +206,19 @@
public int func_188011_a(Vector3f p_188011_1_, EnumFacing p_188011_2_, int p_188011_3_, ModelRotation p_188011_4_)
{
+ return rotateVertex(p_188011_1_, p_188011_2_, p_188011_3_, (net.minecraftforge.common.model.ITransformation)p_188011_4_);
+ }
+
+ public int rotateVertex(Vector3f p_188011_1_, EnumFacing p_188011_2_, int p_188011_3_, net.minecraftforge.common.model.ITransformation p_188011_4_)
+ {
if (p_188011_4_ == ModelRotation.X0_Y0)
{
return p_188011_3_;
}
else
{
- this.func_178406_a(p_188011_1_, new Vector3f(0.5F, 0.5F, 0.5F), p_188011_4_.func_177525_a(), new Vector3f(1.0F, 1.0F, 1.0F));
- return p_188011_4_.func_177520_a(p_188011_2_, p_188011_3_);
+ net.minecraftforge.client.ForgeHooksClient.transform(p_188011_1_, p_188011_4_.getMatrix());
+ return p_188011_4_.rotate(p_188011_2_, p_188011_3_);
}
}

View File

@ -0,0 +1,22 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/IBakedModel.java
@@ -21,7 +21,18 @@
TextureAtlasSprite func_177554_e();
- ItemCameraTransforms func_177552_f();
+ @Deprecated
+ default ItemCameraTransforms func_177552_f() { return ItemCameraTransforms.field_178357_a; }
ItemOverrideList func_188617_f();
+
+ default boolean isAmbientOcclusion(IBlockState state) { return func_177555_b(); }
+
+ /*
+ * Returns the pair of the model for the given perspective, and the matrix
+ * that should be applied to the GL state before rendering it (matrix may be null).
+ */
+ default org.apache.commons.lang3.tuple.Pair<? extends IBakedModel, javax.vecmath.Matrix4f> handlePerspective(ItemCameraTransforms.TransformType cameraTransformType) {
+ return net.minecraftforge.client.ForgeHooksClient.handlePerspective(this, cameraTransformType);
+ }
}

View File

@ -0,0 +1,45 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemCameraTransforms.java
@@ -12,6 +12,9 @@
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.util.vector.Quaternion;
+/*
+ * @deprecated use {@link net.minecraftforge.client.model.IPerspectiveAwareModel} instead
+ */
@SideOnly(Side.CLIENT)
public class ItemCameraTransforms
{
@@ -39,6 +42,7 @@
this(ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a, ItemTransformVec3f.field_178366_a);
}
+ @Deprecated
public ItemCameraTransforms(ItemCameraTransforms p_i46443_1_)
{
this.field_188036_k = p_i46443_1_.field_188036_k;
@@ -51,6 +55,7 @@
this.field_181700_p = p_i46443_1_.field_181700_p;
}
+ @Deprecated
public ItemCameraTransforms(ItemTransformVec3f p_i46569_1_, ItemTransformVec3f p_i46569_2_, ItemTransformVec3f p_i46569_3_, ItemTransformVec3f p_i46569_4_, ItemTransformVec3f p_i46569_5_, ItemTransformVec3f p_i46569_6_, ItemTransformVec3f p_i46569_7_, ItemTransformVec3f p_i46569_8_)
{
this.field_188036_k = p_i46569_1_;
@@ -103,6 +108,7 @@
return new Quaternion(f3 * f6 * f8 + f4 * f5 * f7, f4 * f5 * f8 - f3 * f6 * f7, f3 * f5 * f8 + f4 * f6 * f7, f4 * f6 * f8 - f3 * f5 * f7);
}
+ @Deprecated
public ItemTransformVec3f func_181688_b(ItemCameraTransforms.TransformType p_181688_1_)
{
switch (p_181688_1_)
@@ -169,7 +175,7 @@
}
@SideOnly(Side.CLIENT)
- public static enum TransformType
+ public static enum TransformType implements net.minecraftforge.common.model.IModelPart
{
NONE,
THIRD_PERSON_LEFT_HAND,

View File

@ -0,0 +1,33 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemOverrideList.java
@@ -29,6 +29,7 @@
}
@Nullable
+ @Deprecated
public ResourceLocation func_188021_a(ItemStack p_188021_1_, @Nullable World p_188021_2_, @Nullable EntityLivingBase p_188021_3_)
{
if (!this.field_188023_b.isEmpty())
@@ -44,4 +45,22 @@
return null;
}
+
+ public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, @Nullable World world, @Nullable EntityLivingBase entity)
+ {
+ if (!stack.func_190926_b() && stack.func_77973_b().func_185040_i())
+ {
+ ResourceLocation location = func_188021_a(stack, world, entity);
+ if (location != null)
+ {
+ return net.minecraft.client.Minecraft.func_71410_x().func_175599_af().func_175037_a().func_178083_a().func_174953_a(net.minecraftforge.client.model.ModelLoader.getInventoryVariant(location.toString()));
+ }
+ }
+ return originalModel;
+ }
+
+ public com.google.common.collect.ImmutableList<ItemOverride> getOverrides()
+ {
+ return com.google.common.collect.ImmutableList.copyOf(field_188023_b);
+ }
}

View File

@ -0,0 +1,18 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ItemTransformVec3f.java
@@ -13,9 +13,14 @@
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.util.vector.Vector3f;
+/*
+ * @deprecated use {@link net.minecraftforge.client.model.IModelState} and {@link net.minecraftforge.client.model.TRSRTransformation}
+ */
@SideOnly(Side.CLIENT)
-public class ItemTransformVec3f
+@Deprecated
+public class ItemTransformVec3f implements net.minecraftforge.common.model.IModelState
{
+ public java.util.Optional<net.minecraftforge.common.model.TRSRTransformation> apply(java.util.Optional<? extends net.minecraftforge.common.model.IModelPart> part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(this, part); }
public static final ItemTransformVec3f field_178366_a = new ItemTransformVec3f(new Vector3f(), new Vector3f(), new Vector3f(1.0F, 1.0F, 1.0F));
public final Vector3f field_178364_b;
public final Vector3f field_178365_c;

View File

@ -0,0 +1,180 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBakery.java
@@ -103,6 +103,21 @@
{
try
{
+ loadBlock(blockstatemapper, block, resourcelocation);
+ }
+ catch (Exception exception)
+ {
+ field_177603_c.warn((String)("Unable to load definition " + resourcelocation), (Throwable)exception);
+ }
+ }
+ }
+ }
+
+ protected void loadBlock(BlockStateMapper blockstatemapper, Block block, final ResourceLocation resourcelocation)
+ {
+ {
+ {
+ {
ModelBlockDefinition modelblockdefinition = this.func_177586_a(resourcelocation);
Map<IBlockState, ModelResourceLocation> map = blockstatemapper.func_188181_b(block);
@@ -115,7 +130,6 @@
if (collection1 == null)
{
collection1 = Lists.<ModelResourceLocation>newArrayList();
- this.field_188642_k.put(modelblockdefinition, collection1);
}
collection1.addAll(Lists.newArrayList(Iterables.filter(collection, new Predicate<ModelResourceLocation>()
@@ -125,6 +139,7 @@
return resourcelocation.equals(p_apply_1_);
}
})));
+ registerMultipartVariant(modelblockdefinition, collection1);
}
for (Entry<IBlockState, ModelResourceLocation> entry : map.entrySet())
@@ -135,22 +150,18 @@
{
try
{
- this.field_177612_i.put(modelresourcelocation, modelblockdefinition.func_188004_c(modelresourcelocation.func_177518_c()));
+ func_177569_a(modelblockdefinition, modelresourcelocation);
}
catch (RuntimeException var12)
{
if (!modelblockdefinition.func_188002_b())
{
- field_177603_c.warn("Unable to load variant: {} from {}", modelresourcelocation.func_177518_c(), modelresourcelocation);
+ field_177603_c.warn("Unable to load variant: " + modelresourcelocation.func_177518_c() + " from " + modelresourcelocation, var12);
}
}
}
}
}
- catch (Exception exception)
- {
- field_177603_c.warn("Unable to load definition {}", resourcelocation, exception);
- }
}
}
}
@@ -228,7 +239,7 @@
try
{
inputstream = p_188636_2_.func_110527_b();
- lvt_4_1_ = ModelBlockDefinition.func_178331_a(new InputStreamReader(inputstream, StandardCharsets.UTF_8));
+ lvt_4_1_ = ModelBlockDefinition.parseFromReader(new InputStreamReader(inputstream, StandardCharsets.UTF_8), p_188636_1_);
}
catch (Exception exception)
{
@@ -394,6 +405,7 @@
protected void func_177592_e()
{
+ this.field_177613_u.clear(); // FML clear this to prevent double ups.
this.field_177613_u.put(Item.func_150898_a(Blocks.field_150348_b), Lists.newArrayList("stone", "granite", "granite_smooth", "diorite", "diorite_smooth", "andesite", "andesite_smooth"));
this.field_177613_u.put(Item.func_150898_a(Blocks.field_150346_d), Lists.newArrayList("dirt", "coarse_dirt", "podzol"));
this.field_177613_u.put(Item.func_150898_a(Blocks.field_150344_f), Lists.newArrayList("oak_planks", "spruce_planks", "birch_planks", "jungle_planks", "acacia_planks", "dark_oak_planks"));
@@ -441,6 +453,10 @@
this.field_177613_u.put(Items.field_179570_aq, Lists.newArrayList("oak_door"));
this.field_177613_u.put(Items.field_151124_az, Lists.newArrayList("oak_boat"));
this.field_177613_u.put(Items.field_190929_cY, Lists.newArrayList("totem"));
+ for (Entry<net.minecraftforge.registries.IRegistryDelegate<Item>, Set<String>> e : customVariantNames.entrySet())
+ {
+ this.field_177613_u.put(e.getKey().get(), Lists.newArrayList(e.getValue().iterator()));
+ }
}
protected List<String> func_177596_a(Item p_177596_1_)
@@ -457,7 +473,7 @@
protected ResourceLocation func_177583_a(String p_177583_1_)
{
- ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_);
+ ResourceLocation resourcelocation = new ResourceLocation(p_177583_1_.replaceAll("#.*", ""));
return new ResourceLocation(resourcelocation.func_110624_b(), "item/" + resourcelocation.func_110623_a());
}
@@ -565,7 +581,7 @@
for (Entry<String, ResourceLocation> entry : this.field_177615_s.entrySet())
{
ResourceLocation resourcelocation = entry.getValue();
- ModelResourceLocation modelresourcelocation = new ModelResourceLocation(entry.getKey(), "inventory");
+ ModelResourceLocation modelresourcelocation = net.minecraftforge.client.model.ModelLoader.getInventoryVariant(entry.getKey());
ModelBlock modelblock = this.field_177611_h.get(resourcelocation);
if (modelblock != null && modelblock.func_178303_d())
@@ -653,6 +669,11 @@
@Nullable
private IBakedModel func_177578_a(ModelBlock p_177578_1_, ModelRotation p_177578_2_, boolean p_177578_3_)
{
+ return bakeModel(p_177578_1_, (net.minecraftforge.common.model.ITransformation)p_177578_2_, p_177578_3_);
+ }
+
+ protected IBakedModel bakeModel(ModelBlock p_177578_1_, net.minecraftforge.common.model.ITransformation p_177578_2_, boolean p_177578_3_)
+ {
TextureAtlasSprite textureatlassprite = this.field_177599_g.get(new ResourceLocation(p_177578_1_.func_178308_c("particle")));
SimpleBakedModel.Builder simplebakedmodel$builder = (new SimpleBakedModel.Builder(p_177578_1_, p_177578_1_.func_187967_g())).func_177646_a(textureatlassprite);
@@ -669,13 +690,13 @@
BlockPartFace blockpartface = blockpart.field_178240_c.get(enumfacing);
TextureAtlasSprite textureatlassprite1 = this.field_177599_g.get(new ResourceLocation(p_177578_1_.func_178308_c(blockpartface.field_178242_d)));
- if (blockpartface.field_178244_b == null)
+ if (blockpartface.field_178244_b == null || !net.minecraftforge.common.model.TRSRTransformation.isInteger(p_177578_2_.getMatrix()))
{
- simplebakedmodel$builder.func_177648_a(this.func_177589_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_));
+ simplebakedmodel$builder.func_177648_a(this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_));
}
else
{
- simplebakedmodel$builder.func_177650_a(p_177578_2_.func_177523_a(blockpartface.field_178244_b), this.func_177589_a(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_));
+ simplebakedmodel$builder.func_177650_a(p_177578_2_.rotate(blockpartface.field_178244_b), this.makeBakedQuad(blockpart, blockpartface, textureatlassprite1, enumfacing, p_177578_2_, p_177578_3_));
}
}
}
@@ -686,9 +707,14 @@
private BakedQuad func_177589_a(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, ModelRotation p_177589_5_, boolean p_177589_6_)
{
- return this.field_177607_l.func_178414_a(p_177589_1_.field_178241_a, p_177589_1_.field_178239_b, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.field_178237_d, p_177589_6_, p_177589_1_.field_178238_e);
+ return makeBakedQuad(p_177589_1_, p_177589_2_, p_177589_3_, p_177589_4_, (net.minecraftforge.common.model.ITransformation)p_177589_5_, p_177589_6_);
}
+ protected BakedQuad makeBakedQuad(BlockPart p_177589_1_, BlockPartFace p_177589_2_, TextureAtlasSprite p_177589_3_, EnumFacing p_177589_4_, net.minecraftforge.common.model.ITransformation p_177589_5_, boolean p_177589_6_)
+ {
+ return this.field_177607_l.makeBakedQuad(p_177589_1_.field_178241_a, p_177589_1_.field_178239_b, p_177589_2_, p_177589_3_, p_177589_4_, p_177589_5_, p_177589_1_.field_178237_d, p_177589_6_, p_177589_1_.field_178238_e);
+ }
+
private void func_177597_h()
{
this.func_177574_i();
@@ -916,4 +942,23 @@
field_177606_o.field_178317_b = "generation marker";
field_177616_r.field_178317_b = "block entity marker";
}
+
+ protected void registerMultipartVariant(ModelBlockDefinition definition, Collection<ModelResourceLocation> locations)
+ {
+ this.field_188642_k.put(definition, locations);
+ }
+
+ private static Map<net.minecraftforge.registries.IRegistryDelegate<Item>, Set<String>> customVariantNames = Maps.newHashMap();
+
+ public static void registerItemVariants(Item item, ResourceLocation... names)
+ {
+ if (!customVariantNames.containsKey(item.delegate))
+ {
+ customVariantNames.put(item.delegate, Sets.<String>newHashSet());
+ }
+ for(ResourceLocation name : names)
+ {
+ customVariantNames.get(item.delegate).add(name.toString());
+ }
+ }
}

View File

@ -0,0 +1,20 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelBlockDefinition.java
@@ -32,11 +32,16 @@
private final Map<String, VariantList> field_178332_b = Maps.<String, VariantList>newHashMap();
private Multipart field_188005_c;
+ @Deprecated
public static ModelBlockDefinition func_178331_a(Reader p_178331_0_)
{
- return (ModelBlockDefinition)JsonUtils.func_193839_a(field_178333_a, p_178331_0_, ModelBlockDefinition.class);
+ return parseFromReader(p_178331_0_, null);
}
+ public static ModelBlockDefinition parseFromReader(Reader reader, net.minecraft.util.ResourceLocation location) {
+ return net.minecraftforge.client.model.BlockStateLoader.load(reader, location, field_178333_a);
+ }
+
public ModelBlockDefinition(Map<String, VariantList> p_i46572_1_, Multipart p_i46572_2_)
{
this.field_188005_c = p_i46572_2_;

View File

@ -0,0 +1,14 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelManager.java
@@ -24,9 +24,10 @@
public void func_110549_a(IResourceManager p_110549_1_)
{
- ModelBakery modelbakery = new ModelBakery(p_110549_1_, this.field_174956_b, this.field_174957_c);
+ net.minecraftforge.client.model.ModelLoader modelbakery = new net.minecraftforge.client.model.ModelLoader(p_110549_1_, this.field_174956_b, this.field_174957_c);
this.field_174958_a = modelbakery.func_177570_a();
this.field_174955_d = this.field_174958_a.func_82594_a(ModelBakery.field_177604_a);
+ net.minecraftforge.client.ForgeHooksClient.onModelBake(this, this.field_174958_a, modelbakery);
this.field_174957_c.func_178124_c();
}

View File

@ -0,0 +1,14 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelResourceLocation.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelResourceLocation.java
@@ -2,11 +2,8 @@
import java.util.Locale;
import net.minecraft.util.ResourceLocation;
-import net.minecraftforge.fml.relauncher.Side;
-import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.StringUtils;
-@SideOnly(Side.CLIENT)
public class ModelResourceLocation extends ResourceLocation
{
private final String field_177519_c;

View File

@ -0,0 +1,21 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/ModelRotation.java
@@ -10,7 +10,7 @@
import org.lwjgl.util.vector.Vector3f;
@SideOnly(Side.CLIENT)
-public enum ModelRotation
+public enum ModelRotation implements net.minecraftforge.common.model.IModelState, net.minecraftforge.common.model.ITransformation
{
X0_Y0(0, 0),
X0_Y90(0, 90),
@@ -116,4 +116,9 @@
field_177546_q.put(Integer.valueOf(modelrotation.field_177545_r), modelrotation);
}
}
+
+ public java.util.Optional<net.minecraftforge.common.model.TRSRTransformation> apply(java.util.Optional<? extends net.minecraftforge.common.model.IModelPart> part) { return net.minecraftforge.client.ForgeHooksClient.applyTransform(this, part); }
+ public javax.vecmath.Matrix4f getMatrix() { return net.minecraftforge.common.model.TRSRTransformation.from(this).getMatrix(); }
+ public EnumFacing rotate(EnumFacing facing) { return func_177523_a(facing); }
+ public int rotate(EnumFacing facing, int vertexIndex) { return func_177520_a(facing, vertexIndex); }
}

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/SimpleBakedModel.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/SimpleBakedModel.java
@@ -88,7 +88,7 @@
public Builder(IBlockState p_i46989_1_, IBakedModel p_i46989_2_, TextureAtlasSprite p_i46989_3_, BlockPos p_i46989_4_)
{
- this(p_i46989_2_.func_177555_b(), p_i46989_2_.func_177556_c(), p_i46989_2_.func_177552_f(), p_i46989_2_.func_188617_f());
+ this(p_i46989_2_.isAmbientOcclusion(p_i46989_1_), p_i46989_2_.func_177556_c(), p_i46989_2_.func_177552_f(), p_i46989_2_.func_188617_f());
this.field_177652_d = p_i46989_2_.func_177554_e();
long i = MathHelper.func_180186_a(p_i46989_4_);

View File

@ -0,0 +1,39 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/Variant.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/Variant.java
@@ -12,7 +12,7 @@
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
-public class Variant
+public class Variant implements net.minecraftforge.client.model.ISmartVariant
{
private final ResourceLocation field_188050_a;
private final ModelRotation field_188051_b;
@@ -32,11 +32,17 @@
return this.field_188050_a;
}
+ @Deprecated
public ModelRotation func_188048_b()
{
return this.field_188051_b;
}
+ public net.minecraftforge.common.model.IModelState getState()
+ {
+ return this.field_188051_b;
+ }
+
public boolean func_188049_c()
{
return this.field_188052_c;
@@ -138,4 +144,9 @@
}
}
}
+
+ public net.minecraftforge.client.model.IModel process(net.minecraftforge.client.model.IModel base)
+ {
+ return base.uvlock(func_188049_c());
+ }
}

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/model/WeightedBakedModel.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/model/WeightedBakedModel.java
@@ -41,6 +41,8 @@
return this.field_177566_c.func_177555_b();
}
+ public boolean isAmbientOcclusion(IBlockState state) { return this.field_177566_c.isAmbientOcclusion(state); }
+
public boolean func_177556_c()
{
return this.field_177566_c.func_177556_c();

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/block/statemap/StateMap.java
@@ -39,7 +39,7 @@
}
else
{
- s = this.func_187490_a(this.field_178142_a, map);
+ s = String.format("%s:%s", Block.field_149771_c.func_177774_c(p_178132_1_.func_177230_c()).func_110624_b(), this.func_187490_a(this.field_178142_a, map));
}
if (this.field_178141_c != null)

View File

@ -0,0 +1,19 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/ChunkRenderDispatcher.java
@@ -44,9 +44,15 @@
public ChunkRenderDispatcher()
{
+ this(-1);
+ }
+
+ public ChunkRenderDispatcher(int countRenderBuilders)
+ {
int i = Math.max(1, (int)((double)Runtime.getRuntime().maxMemory() * 0.3D) / 10485760);
int j = Math.max(1, MathHelper.func_76125_a(Runtime.getRuntime().availableProcessors(), 1, i / 5));
- this.field_188249_c = MathHelper.func_76125_a(j * 10, 1, i);
+ if(countRenderBuilders < 0) countRenderBuilders = MathHelper.func_76125_a(j * 10, 1, i);
+ this.field_188249_c = countRenderBuilders;
if (j > 1)
{

View File

@ -0,0 +1,80 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/chunk/RenderChunk.java
@@ -162,7 +162,7 @@
lvt_9_1_.func_178606_a(blockpos$mutableblockpos);
}
- if (block.func_149716_u())
+ if (block.hasTileEntity(iblockstate))
{
TileEntity tileentity = this.field_189564_r.func_190300_a(blockpos$mutableblockpos, Chunk.EnumCreateEntityType.CHECK);
@@ -172,17 +172,19 @@
if (tileentityspecialrenderer != null)
{
- compiledchunk.func_178490_a(tileentity);
if (tileentityspecialrenderer.func_188185_a(tileentity))
{
lvt_10_1_.add(tileentity);
}
+ else compiledchunk.func_178490_a(tileentity); // FORGE: Fix MC-112730
}
}
}
- BlockRenderLayer blockrenderlayer1 = block.func_180664_k();
+ for(BlockRenderLayer blockrenderlayer1 : BlockRenderLayer.values()) {
+ if(!block.canRenderInLayer(iblockstate, blockrenderlayer1)) continue;
+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(blockrenderlayer1);
int j = blockrenderlayer1.ordinal();
if (block.func_176223_P().func_185901_i() != EnumBlockRenderType.INVISIBLE)
@@ -197,6 +199,8 @@
aboolean[j] |= blockrendererdispatcher.func_175018_a(iblockstate, blockpos$mutableblockpos, this.field_189564_r, bufferbuilder);
}
+ }
+ net.minecraftforge.client.ForgeHooksClient.setRenderLayer(null);
}
for (BlockRenderLayer blockrenderlayer : BlockRenderLayer.values())
@@ -278,7 +282,9 @@
private void func_189563_q()
{
int i = 1;
- this.field_189564_r = new ChunkCache(this.field_178588_d, this.field_178586_f.func_177982_a(-1, -1, -1), this.field_178586_f.func_177982_a(16, 16, 16), 1);
+ ChunkCache cache = createRegionRenderCache(this.field_178588_d, this.field_178586_f.func_177982_a(-1, -1, -1), this.field_178586_f.func_177982_a(16, 16, 16), 1);
+ net.minecraftforge.client.MinecraftForgeClient.onRebuildChunk(this.field_178588_d, this.field_178586_f, cache);
+ this.field_189564_r = cache;
}
@Nullable
@@ -427,6 +433,26 @@
return this.field_178593_n && this.field_188284_q;
}
+ /* ======================================== FORGE START =====================================*/
+ /**
+ * Creates a new RegionRenderCache instance.<br>
+ * Extending classes can change the behavior of the cache, allowing to visually change
+ * blocks (schematics etc).
+ *
+ * @see RegionRenderCache
+ * @param world The world to cache.
+ * @param from The starting position of the chunk minus one on each axis.
+ * @param to The ending position of the chunk plus one on each axis.
+ * @param subtract Padding used internally by the RegionRenderCache constructor to make
+ * the cache a 20x20x20 cube, for a total of 8000 states in the cache.
+ * @return new RegionRenderCache instance
+ */
+ protected ChunkCache createRegionRenderCache(World world, BlockPos from, BlockPos to, int subtract)
+ {
+ return new ChunkCache(world, from, to, subtract);
+ }
+ /* ========================================= FORGE END ======================================*/
+
public BlockPos func_181701_a(EnumFacing p_181701_1_)
{
return this.field_181702_p[p_181701_1_.ordinal()];

View File

@ -0,0 +1,47 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/color/BlockColors.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/color/BlockColors.java
@@ -27,7 +27,8 @@
@SideOnly(Side.CLIENT)
public class BlockColors
{
- private final ObjectIntIdentityMap<IBlockColor> field_186725_a = new ObjectIntIdentityMap<IBlockColor>(32);
+ // FORGE: Use RegistryDelegates as non-Vanilla block ids are not constant
+ private final java.util.Map<net.minecraftforge.registries.IRegistryDelegate<Block>, IBlockColor> blockColorMap = com.google.common.collect.Maps.newHashMap();
public static BlockColors func_186723_a()
{
@@ -159,12 +160,13 @@
return p_186720_2_ != null && p_186720_3_ != null ? 2129968 : 7455580;
}
}, Blocks.field_150392_bi);
+ net.minecraftforge.client.ForgeHooksClient.onBlockColorsInit(blockcolors);
return blockcolors;
}
public int func_189991_a(IBlockState p_189991_1_, World p_189991_2_, BlockPos p_189991_3_)
{
- IBlockColor iblockcolor = this.field_186725_a.func_148745_a(Block.func_149682_b(p_189991_1_.func_177230_c()));
+ IBlockColor iblockcolor = this.blockColorMap.get(p_189991_1_.func_177230_c().delegate);
if (iblockcolor != null)
{
@@ -179,7 +181,7 @@
public int func_186724_a(IBlockState p_186724_1_, @Nullable IBlockAccess p_186724_2_, @Nullable BlockPos p_186724_3_, int p_186724_4_)
{
- IBlockColor iblockcolor = this.field_186725_a.func_148745_a(Block.func_149682_b(p_186724_1_.func_177230_c()));
+ IBlockColor iblockcolor = this.blockColorMap.get(p_186724_1_.func_177230_c().delegate);
return iblockcolor == null ? -1 : iblockcolor.func_186720_a(p_186724_1_, p_186724_2_, p_186724_3_, p_186724_4_);
}
@@ -187,7 +189,9 @@
{
for (Block block : p_186722_2_)
{
- this.field_186725_a.func_148746_a(p_186722_1_, Block.func_149682_b(block));
+ if (block == null) throw new IllegalArgumentException("Block registered to block color handler cannot be null!");
+ if (block.getRegistryName() == null) throw new IllegalArgumentException("Block must be registered before assigning color handler.");
+ this.blockColorMap.put(block.delegate, p_186722_1_);
}
}
}

View File

@ -0,0 +1,49 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/color/ItemColors.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/color/ItemColors.java
@@ -26,7 +26,8 @@
@SideOnly(Side.CLIENT)
public class ItemColors
{
- private final ObjectIntIdentityMap<IItemColor> field_186732_a = new ObjectIntIdentityMap<IItemColor>(32);
+ // FORGE: Use RegistryDelegates as non-Vanilla item ids are not constant
+ private final java.util.Map<net.minecraftforge.registries.IRegistryDelegate<Item>, IItemColor> itemColorMap = com.google.common.collect.Maps.newHashMap();
public static ItemColors func_186729_a(final BlockColors p_186729_0_)
{
@@ -137,12 +138,13 @@
return p_186726_2_ == 0 ? -1 : ItemMap.func_190907_h(p_186726_1_);
}
}, Items.field_151098_aY);
+ net.minecraftforge.client.ForgeHooksClient.onItemColorsInit(itemcolors, p_186729_0_);
return itemcolors;
}
public int func_186728_a(ItemStack p_186728_1_, int p_186728_2_)
{
- IItemColor iitemcolor = this.field_186732_a.func_148745_a(Item.field_150901_e.func_148757_b(p_186728_1_.func_77973_b()));
+ IItemColor iitemcolor = this.itemColorMap.get(p_186728_1_.func_77973_b().delegate);
return iitemcolor == null ? -1 : iitemcolor.func_186726_a(p_186728_1_, p_186728_2_);
}
@@ -150,7 +152,9 @@
{
for (Block block : p_186731_2_)
{
- this.field_186732_a.func_148746_a(p_186731_1_, Item.func_150891_b(Item.func_150898_a(block)));
+ if (block == null) throw new IllegalArgumentException("Block registered to item color handler cannot be null!");
+ if (block.getRegistryName() == null) throw new IllegalArgumentException("Block must be registered before assigning color handler.");
+ this.itemColorMap.put(Item.func_150898_a(block).delegate, p_186731_1_);
}
}
@@ -158,7 +162,9 @@
{
for (Item item : p_186730_2_)
{
- this.field_186732_a.func_148746_a(p_186730_1_, Item.func_150891_b(item));
+ if (item == null) throw new IllegalArgumentException("Item registered to item color handler cannot be null!");
+ if (item.getRegistryName() == null) throw new IllegalArgumentException("Item must be registered before assigning color handler.");
+ this.itemColorMap.put(item.delegate, p_186730_1_);
}
}
}

View File

@ -0,0 +1,86 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderEntityItem.java
@@ -44,7 +44,7 @@
boolean flag = p_177077_9_.func_177556_c();
int i = this.func_177078_a(itemstack);
float f = 0.25F;
- float f1 = MathHelper.func_76126_a(((float)p_177077_1_.func_174872_o() + p_177077_8_) / 10.0F + p_177077_1_.field_70290_d) * 0.1F + 0.1F;
+ float f1 = shouldBob() ? MathHelper.func_76126_a(((float)p_177077_1_.func_174872_o() + p_177077_8_) / 10.0F + p_177077_1_.field_70290_d) * 0.1F + 0.1F : 0;
float f2 = p_177077_9_.func_177552_f().func_181688_b(ItemCameraTransforms.TransformType.GROUND).field_178363_d.y;
GlStateManager.func_179109_b((float)p_177077_2_, (float)p_177077_4_ + f1 + 0.25F * f2, (float)p_177077_6_);
@@ -104,16 +104,13 @@
GlStateManager.func_179094_E();
IBakedModel ibakedmodel = this.field_177080_a.func_184393_a(itemstack, p_76986_1_.field_70170_p, (EntityLivingBase)null);
int j = this.func_177077_a(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_9_, ibakedmodel);
- float f = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.x;
- float f1 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.y;
- float f2 = ibakedmodel.func_177552_f().field_181699_o.field_178363_d.z;
boolean flag1 = ibakedmodel.func_177556_c();
if (!flag1)
{
- float f3 = -0.0F * (float)(j - 1) * 0.5F * f;
- float f4 = -0.0F * (float)(j - 1) * 0.5F * f1;
- float f5 = -0.09375F * (float)(j - 1) * 0.5F * f2;
+ float f3 = -0.0F * (float)(j - 1) * 0.5F;
+ float f4 = -0.0F * (float)(j - 1) * 0.5F;
+ float f5 = -0.09375F * (float)(j - 1) * 0.5F;
GlStateManager.func_179109_b(f3, f4, f5);
}
@@ -134,11 +131,11 @@
float f7 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F;
float f9 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F;
float f6 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F;
- GlStateManager.func_179109_b(f7, f9, f6);
+ GlStateManager.func_179109_b(shouldSpreadItems() ? f7 : 0, shouldSpreadItems() ? f9 : 0, f6);
}
- ibakedmodel.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GROUND);
- this.field_177080_a.func_180454_a(itemstack, ibakedmodel);
+ IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false);
+ this.field_177080_a.func_180454_a(itemstack, transformedModel);
GlStateManager.func_179121_F();
}
else
@@ -152,10 +149,10 @@
GlStateManager.func_179109_b(f8, f10, 0.0F);
}
- ibakedmodel.func_177552_f().func_181689_a(ItemCameraTransforms.TransformType.GROUND);
- this.field_177080_a.func_180454_a(itemstack, ibakedmodel);
+ IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false);
+ this.field_177080_a.func_180454_a(itemstack, transformedModel);
GlStateManager.func_179121_F();
- GlStateManager.func_179109_b(0.0F * f, 0.0F * f1, 0.09375F * f2);
+ GlStateManager.func_179109_b(0.0F, 0.0F, 0.09375F);
}
}
@@ -182,4 +179,25 @@
{
return TextureMap.field_110575_b;
}
+
+ /*==================================== FORGE START ===========================================*/
+
+ /**
+ * Items should spread out when rendered in 3d?
+ * @return
+ */
+ public boolean shouldSpreadItems()
+ {
+ return true;
+ }
+
+ /**
+ * Items should have a bob effect
+ * @return
+ */
+ public boolean shouldBob()
+ {
+ return true;
+ }
+ /*==================================== FORGE END =============================================*/
}

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderFish.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderFish.java
@@ -75,7 +75,7 @@
int k = entityplayer.func_184591_cq() == EnumHandSide.RIGHT ? 1 : -1;
ItemStack itemstack = entityplayer.func_184614_ca();
- if (itemstack.func_77973_b() != Items.field_151112_aM)
+ if (!(itemstack.func_77973_b() instanceof net.minecraft.item.ItemFishingRod))
{
k = -k;
}

View File

@ -0,0 +1,43 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderItemFrame.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderItemFrame.java
@@ -49,7 +49,7 @@
ModelManager modelmanager = blockrendererdispatcher.func_175023_a().func_178126_b();
IBakedModel ibakedmodel;
- if (p_76986_1_.func_82335_i().func_77973_b() == Items.field_151098_aY)
+ if (p_76986_1_.func_82335_i().func_77973_b() instanceof net.minecraft.item.ItemMap)
{
ibakedmodel = modelmanager.func_174953_a(this.field_177073_g);
}
@@ -96,10 +96,13 @@
{
GlStateManager.func_179094_E();
GlStateManager.func_179140_f();
- boolean flag = itemstack.func_77973_b() == Items.field_151098_aY;
+ boolean flag = itemstack.func_77973_b() instanceof net.minecraft.item.ItemMap;
int i = flag ? p_82402_1_.func_82333_j() % 4 * 2 : p_82402_1_.func_82333_j();
GlStateManager.func_179114_b((float)i * 360.0F / 8.0F, 0.0F, 0.0F, 1.0F);
+ net.minecraftforge.client.event.RenderItemInFrameEvent event = new net.minecraftforge.client.event.RenderItemInFrameEvent(p_82402_1_, this);
+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event))
+ {
if (flag)
{
this.field_76990_c.field_78724_e.func_110577_a(field_110789_a);
@@ -107,7 +110,7 @@
float f = 0.0078125F;
GlStateManager.func_179152_a(0.0078125F, 0.0078125F, 0.0078125F);
GlStateManager.func_179109_b(-64.0F, -64.0F, 0.0F);
- MapData mapdata = Items.field_151098_aY.func_77873_a(itemstack, p_82402_1_.field_70170_p);
+ MapData mapdata = ((net.minecraft.item.ItemMap) itemstack.func_77973_b()).func_77873_a(itemstack, p_82402_1_.field_70170_p);
GlStateManager.func_179109_b(0.0F, 0.0F, -1.0F);
if (mapdata != null)
@@ -124,6 +127,7 @@
RenderHelper.func_74518_a();
GlStateManager.func_179099_b();
}
+ }
GlStateManager.func_179145_e();
GlStateManager.func_179121_F();

View File

@ -0,0 +1,72 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderLivingBase.java
@@ -32,6 +32,9 @@
protected List<LayerRenderer<T>> field_177097_h = Lists.<LayerRenderer<T>>newArrayList();
protected boolean field_188323_j;
+ public static float NAME_TAG_RANGE = 64.0f;
+ public static float NAME_TAG_RANGE_SNEAK = 32.0f;
+
public RenderLivingBase(RenderManager p_i46156_1_, ModelBase p_i46156_2_, float p_i46156_3_)
{
super(p_i46156_1_);
@@ -72,10 +75,12 @@
public void func_76986_a(T p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Pre<T>(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_))) return;
GlStateManager.func_179094_E();
GlStateManager.func_179129_p();
this.field_77045_g.field_78095_p = this.func_77040_d(p_76986_1_, p_76986_9_);
- this.field_77045_g.field_78093_q = p_76986_1_.func_184218_aH();
+ boolean shouldSit = p_76986_1_.func_184218_aH() && (p_76986_1_.func_184187_bx() != null && p_76986_1_.func_184187_bx().shouldRiderSit());
+ this.field_77045_g.field_78093_q = shouldSit;
this.field_77045_g.field_78091_s = p_76986_1_.func_70631_g_();
try
@@ -84,7 +89,7 @@
float f1 = this.func_77034_a(p_76986_1_.field_70758_at, p_76986_1_.field_70759_as, p_76986_9_);
float f2 = f1 - f;
- if (p_76986_1_.func_184218_aH() && p_76986_1_.func_184187_bx() instanceof EntityLivingBase)
+ if (shouldSit && p_76986_1_.func_184187_bx() instanceof EntityLivingBase)
{
EntityLivingBase entitylivingbase = (EntityLivingBase)p_76986_1_.func_184187_bx();
f = this.func_77034_a(entitylivingbase.field_70760_ar, entitylivingbase.field_70761_aq, p_76986_9_);
@@ -133,6 +138,7 @@
{
f5 = 1.0F;
}
+ f2 = f1 - f; // Forge: Fix MC-1207
}
GlStateManager.func_179141_d();
@@ -194,6 +200,7 @@
GlStateManager.func_179089_o();
GlStateManager.func_179121_F();
super.func_76986_a(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Post<T>(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_));
}
public float func_188322_c(T p_188322_1_, float p_188322_2_)
@@ -454,10 +461,11 @@
public void func_177067_a(T p_177067_1_, double p_177067_2_, double p_177067_4_, double p_177067_6_)
{
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Pre<T>(p_177067_1_, this, p_177067_2_, p_177067_4_, p_177067_6_))) return;
if (this.func_177070_b(p_177067_1_))
{
double d0 = p_177067_1_.func_70068_e(this.field_76990_c.field_78734_h);
- float f = p_177067_1_.func_70093_af() ? 32.0F : 64.0F;
+ float f = p_177067_1_.func_70093_af() ? NAME_TAG_RANGE_SNEAK : NAME_TAG_RANGE;
if (d0 < (double)(f * f))
{
@@ -466,6 +474,7 @@
this.func_188296_a(p_177067_1_, p_177067_2_, p_177067_4_, p_177067_6_, s, d0);
}
}
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderLivingEvent.Specials.Post<T>(p_177067_1_, this, p_177067_2_, p_177067_4_, p_177067_6_));
}
protected boolean func_177070_b(T p_177070_1_)

View File

@ -0,0 +1,28 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderManager.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderManager.java
@@ -227,8 +227,13 @@
this.field_178637_m = new RenderPlayer(this);
this.field_178636_l.put("default", this.field_178637_m);
this.field_178636_l.put("slim", new RenderPlayer(this, true));
+ net.minecraftforge.fml.client.registry.RenderingRegistry.loadEntityRenderers(this, this.field_78729_o);
}
+ public Map<String, RenderPlayer> getSkinMap() {
+ return (Map<String, RenderPlayer>) java.util.Collections.unmodifiableMap(field_178636_l);
+ }
+
public void func_178628_a(double p_178628_1_, double p_178628_3_, double p_178628_5_)
{
this.field_78725_b = p_178628_1_;
@@ -277,9 +282,9 @@
IBlockState iblockstate = p_180597_1_.func_180495_p(new BlockPos(p_180597_3_));
Block block = iblockstate.func_177230_c();
- if (block == Blocks.field_150324_C)
+ if (block.isBed(iblockstate, p_180597_1_, new BlockPos(p_180597_3_), (EntityLivingBase)p_180597_3_))
{
- int i = ((EnumFacing)iblockstate.func_177229_b(BlockBed.field_185512_D)).func_176736_b();
+ int i = block.getBedDirection(iblockstate, p_180597_1_, new BlockPos(p_180597_3_)).func_176736_b();
this.field_78735_i = (float)(i * 90 + 180);
this.field_78732_j = 0.0F;
}

View File

@ -0,0 +1,30 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderPlayer.java
@@ -56,6 +56,7 @@
public void func_76986_a(AbstractClientPlayer p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_))) return;
if (!p_76986_1_.func_175144_cb() || this.field_76990_c.field_78734_h == p_76986_1_)
{
double d0 = p_76986_4_;
@@ -70,6 +71,7 @@
super.func_76986_a(p_76986_1_, p_76986_2_, d0, p_76986_6_, p_76986_8_, p_76986_9_);
GlStateManager.func_187440_b(GlStateManager.Profile.PLAYER_SKIN);
}
+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Post(p_76986_1_, this, p_76986_9_, p_76986_2_, p_76986_4_, p_76986_6_));
}
private void func_177137_d(AbstractClientPlayer p_177137_1_)
@@ -128,6 +130,11 @@
{
modelbiped$armpose1 = ModelBiped.ArmPose.BLOCK;
}
+ // FORGE: fix MC-88356 allow offhand to use bow and arrow animation
+ else if (enumaction1 == EnumAction.BOW)
+ {
+ modelbiped$armpose1 = ModelBiped.ArmPose.BOW_AND_ARROW;
+ }
}
}

View File

@ -0,0 +1,26 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderVillager.java
@@ -31,22 +31,7 @@
protected ResourceLocation func_110775_a(EntityVillager p_110775_1_)
{
- switch (p_110775_1_.func_70946_n())
- {
- case 0:
- return field_110904_g;
- case 1:
- return field_110908_h;
- case 2:
- return field_110907_k;
- case 3:
- return field_110905_l;
- case 4:
- return field_110906_m;
- case 5:
- default:
- return field_110903_f;
- }
+ return p_110775_1_.getProfessionForge().getSkin();
}
protected void func_77041_b(EntityVillager p_77041_1_, float p_77041_2_)

View File

@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/RenderZombieVillager.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/RenderZombieVillager.java
@@ -25,6 +25,7 @@
protected ResourceLocation func_110775_a(EntityZombieVillager p_110775_1_)
{
+ if (true) return p_110775_1_.getForgeProfession().getZombieSkin();
switch (p_110775_1_.func_190736_dl())
{
case 0:

View File

@ -0,0 +1,107 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerArmorBase.java
@@ -58,31 +58,29 @@
if (itemarmor.func_185083_B_() == p_188361_9_)
{
T t = this.func_188360_a(p_188361_9_);
+ t = getArmorModelHook(p_188361_1_, itemstack, p_188361_9_, t);
t.func_178686_a(this.field_177190_a.func_177087_b());
t.func_78086_a(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_4_);
this.func_188359_a(t, p_188361_9_);
boolean flag = this.func_188363_b(p_188361_9_);
- this.field_177190_a.func_110776_a(this.func_177181_a(itemarmor, flag));
+ this.field_177190_a.func_110776_a(this.getArmorResource(p_188361_1_, itemstack, p_188361_9_, null));
- switch (itemarmor.func_82812_d())
{
- case LEATHER:
+ if (itemarmor.hasOverlay(itemstack)) // Allow this for anything, not only cloth
+ {
int i = itemarmor.func_82814_b(itemstack);
float f = (float)(i >> 16 & 255) / 255.0F;
float f1 = (float)(i >> 8 & 255) / 255.0F;
float f2 = (float)(i & 255) / 255.0F;
GlStateManager.func_179131_c(this.field_177184_f * f, this.field_177185_g * f1, this.field_177192_h * f2, this.field_177187_e);
t.func_78088_a(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_);
- this.field_177190_a.func_110776_a(this.func_177178_a(itemarmor, flag, "overlay"));
- case CHAIN:
- case IRON:
- case GOLD:
- case DIAMOND:
+ this.field_177190_a.func_110776_a(this.getArmorResource(p_188361_1_, itemstack, p_188361_9_, "overlay"));
+ }
+ { // Non-colored
GlStateManager.func_179131_c(this.field_177184_f, this.field_177185_g, this.field_177192_h, this.field_177187_e);
t.func_78088_a(p_188361_1_, p_188361_2_, p_188361_3_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_);
- default:
-
- if (!this.field_177193_i && itemstack.func_77948_v())
+ } // Default
+ if (!this.field_177193_i && itemstack.func_77962_s())
{
func_188364_a(this.field_177190_a, p_188361_1_, t, p_188361_2_, p_188361_3_, p_188361_4_, p_188361_5_, p_188361_6_, p_188361_7_, p_188361_8_);
}
@@ -139,11 +137,13 @@
Minecraft.func_71410_x().field_71460_t.func_191514_d(false);
}
+ @Deprecated //Use the more sensitive version getArmorResource below
private ResourceLocation func_177181_a(ItemArmor p_177181_1_, boolean p_177181_2_)
{
return this.func_177178_a(p_177181_1_, p_177181_2_, (String)null);
}
+ @Deprecated //Use the more sensitive version getArmorResource below
private ResourceLocation func_177178_a(ItemArmor p_177178_1_, boolean p_177178_2_, String p_177178_3_)
{
String s = String.format("textures/models/armor/%s_layer_%d%s.png", p_177178_1_.func_82812_d().func_179242_c(), p_177178_2_ ? 2 : 1, p_177178_3_ == null ? "" : String.format("_%s", p_177178_3_));
@@ -161,4 +161,49 @@
protected abstract void func_177177_a();
protected abstract void func_188359_a(T p_188359_1_, EntityEquipmentSlot p_188359_2_);
+
+ /*=================================== FORGE START =========================================*/
+
+ /**
+ * Hook to allow item-sensitive armor model. for LayerBipedArmor.
+ */
+ protected T getArmorModelHook(EntityLivingBase entity, ItemStack itemStack, EntityEquipmentSlot slot, T model)
+ {
+ return model;
+ }
+
+ /**
+ * More generic ForgeHook version of the above function, it allows for Items to have more control over what texture they provide.
+ *
+ * @param entity Entity wearing the armor
+ * @param stack ItemStack for the armor
+ * @param slot Slot ID that the item is in
+ * @param type Subtype, can be null or "overlay"
+ * @return ResourceLocation pointing at the armor's texture
+ */
+ public ResourceLocation getArmorResource(net.minecraft.entity.Entity entity, ItemStack stack, EntityEquipmentSlot slot, String type)
+ {
+ ItemArmor item = (ItemArmor)stack.func_77973_b();
+ String texture = item.func_82812_d().func_179242_c();
+ String domain = "minecraft";
+ int idx = texture.indexOf(':');
+ if (idx != -1)
+ {
+ domain = texture.substring(0, idx);
+ texture = texture.substring(idx + 1);
+ }
+ String s1 = String.format("%s:textures/models/armor/%s_layer_%d%s.png", domain, texture, (func_188363_b(slot) ? 2 : 1), type == null ? "" : String.format("_%s", type));
+
+ s1 = net.minecraftforge.client.ForgeHooksClient.getArmorTexture(entity, stack, s1, slot, type);
+ ResourceLocation resourcelocation = (ResourceLocation)field_177191_j.get(s1);
+
+ if (resourcelocation == null)
+ {
+ resourcelocation = new ResourceLocation(s1);
+ field_177191_j.put(s1, resourcelocation);
+ }
+
+ return resourcelocation;
+ }
+ /*=================================== FORGE END ===========================================*/
}

View File

@ -0,0 +1,13 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerBipedArmor.java
@@ -51,4 +51,10 @@
{
p_177194_1_.func_178719_a(false);
}
+
+ @Override
+ protected ModelBiped getArmorModelHook(net.minecraft.entity.EntityLivingBase entity, net.minecraft.item.ItemStack itemStack, EntityEquipmentSlot slot, ModelBiped model)
+ {
+ return net.minecraftforge.client.ForgeHooksClient.getArmorModel(entity, itemStack, slot, model);
+ }
}

View File

@ -0,0 +1,18 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/entity/layers/LayerHeldItem.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/entity/layers/LayerHeldItem.java
@@ -49,13 +49,13 @@
if (!p_188358_2_.func_190926_b())
{
GlStateManager.func_179094_E();
- this.func_191361_a(p_188358_4_);
if (p_188358_1_.func_70093_af())
{
GlStateManager.func_179109_b(0.0F, 0.2F, 0.0F);
}
-
+ // Forge: moved this call down, fixes incorrect offset while sneaking.
+ this.func_191361_a(p_188358_4_);
GlStateManager.func_179114_b(-90.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.func_179114_b(180.0F, 0.0F, 1.0F, 0.0F);
boolean flag = p_188358_4_ == EnumHandSide.LEFT;

View File

@ -0,0 +1,45 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/texture/Stitcher.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/Stitcher.java
@@ -56,18 +56,24 @@
{
Stitcher.Holder[] astitcher$holder = (Stitcher.Holder[])this.field_94319_a.toArray(new Stitcher.Holder[this.field_94319_a.size()]);
Arrays.sort((Object[])astitcher$holder);
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", astitcher$holder.length);
for (Stitcher.Holder stitcher$holder : astitcher$holder)
{
+ bar.step(stitcher$holder.func_98150_a().func_94215_i());
if (!this.func_94310_b(stitcher$holder))
{
String s = String.format("Unable to fit: %s - size: %dx%d - Maybe try a lowerresolution resourcepack?", stitcher$holder.func_98150_a().func_94215_i(), stitcher$holder.func_98150_a().func_94211_a(), stitcher$holder.func_98150_a().func_94216_b());
+ net.minecraftforge.fml.common.FMLLog.log.info(s);
+ for (Stitcher.Holder h : astitcher$holder)
+ net.minecraftforge.fml.common.FMLLog.log.info(" {}", h);
throw new StitcherException(stitcher$holder, s);
}
}
this.field_94318_c = MathHelper.func_151236_b(this.field_94318_c);
this.field_94315_d = MathHelper.func_151236_b(this.field_94315_d);
+ net.minecraftforge.fml.common.ProgressManager.pop(bar);
}
public List<TextureAtlasSprite> func_94309_g()
@@ -148,7 +154,7 @@
if (flag3 ^ flag4)
{
- flag = flag3;
+ flag = !flag3 && flag1; //Forge: Fix stitcher not expanding entire height before growing width, and {potentially} growing larger then the max size.
}
else
{
@@ -240,7 +246,7 @@
public String toString()
{
- return "Holder{width=" + this.field_94204_c + ", height=" + this.field_94201_d + '}';
+ return "Holder{width=" + this.field_94204_c + ", height=" + this.field_94201_d + ", name=" + this.field_98151_a.func_94215_i() + '}';
}
public int compareTo(Stitcher.Holder p_compareTo_1_)

View File

@ -0,0 +1,59 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureAtlasSprite.java
@@ -50,12 +50,10 @@
this.field_110975_c = p_110971_3_;
this.field_110974_d = p_110971_4_;
this.field_130222_e = p_110971_5_;
- float f = (float)(0.009999999776482582D / (double)p_110971_1_);
- float f1 = (float)(0.009999999776482582D / (double)p_110971_2_);
- this.field_110979_l = (float)p_110971_3_ / (float)((double)p_110971_1_) + f;
- this.field_110980_m = (float)(p_110971_3_ + this.field_130223_c) / (float)((double)p_110971_1_) - f;
- this.field_110977_n = (float)p_110971_4_ / (float)p_110971_2_ + f1;
- this.field_110978_o = (float)(p_110971_4_ + this.field_130224_d) / (float)p_110971_2_ - f1;
+ this.field_110979_l = (float)p_110971_3_ / (float)p_110971_1_;
+ this.field_110980_m = (float)(p_110971_3_ + this.field_130223_c) / (float)p_110971_1_;
+ this.field_110977_n = (float)p_110971_4_ / (float)p_110971_2_;
+ this.field_110978_o = (float)(p_110971_4_ + this.field_130224_d) / (float)p_110971_2_;
}
public void func_94217_a(TextureAtlasSprite p_94217_1_)
@@ -398,4 +396,39 @@
{
return "TextureAtlasSprite{name='" + this.field_110984_i + '\'' + ", frameCount=" + this.field_110976_a.size() + ", rotated=" + this.field_130222_e + ", x=" + this.field_110975_c + ", y=" + this.field_110974_d + ", height=" + this.field_130224_d + ", width=" + this.field_130223_c + ", u0=" + this.field_110979_l + ", u1=" + this.field_110980_m + ", v0=" + this.field_110977_n + ", v1=" + this.field_110978_o + '}';
}
+
+ /*===================================== FORGE START =====================================*/
+ /**
+ * The result of this function determines is the below 'load' function is called, and the
+ * default vanilla loading code is bypassed completely.
+ * @param manager Main resource manager
+ * @param location File resource location
+ * @return True to use your own custom load code and bypass vanilla loading.
+ */
+ public boolean hasCustomLoader(net.minecraft.client.resources.IResourceManager manager, net.minecraft.util.ResourceLocation location)
+ {
+ return false;
+ }
+
+ /**
+ * Load the specified resource as this sprite's data.
+ * Returning false from this function will prevent this icon from being stitched onto the master texture.
+ * @param manager Main resource manager
+ * @param location File resource location
+ * @param textureGetter accessor for dependencies. All of them will be loaded before this one
+ * @return False to prevent this Icon from being stitched
+ */
+ public boolean load(net.minecraft.client.resources.IResourceManager manager, net.minecraft.util.ResourceLocation location, java.util.function.Function<ResourceLocation, TextureAtlasSprite> textureGetter)
+ {
+ return true;
+ }
+
+ /**
+ * @return all textures that should be loaded before this texture.
+ */
+ public java.util.Collection<ResourceLocation> getDependencies() {
+ return com.google.common.collect.ImmutableList.of();
+ }
+
+ /*===================================== FORGE END ======================================*/
}

View File

@ -0,0 +1,30 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureManager.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureManager.java
@@ -137,17 +137,20 @@
if (itextureobject != null)
{
+ this.field_110585_a.remove(p_147645_1_); // Forge: fix MC-98707
TextureUtil.func_147942_a(itextureobject.func_110552_b());
}
}
public void func_110549_a(IResourceManager p_110549_1_)
{
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Reloading Texture Manager", this.field_110585_a.keySet().size(), true);
Iterator<Entry<ResourceLocation, ITextureObject>> iterator = this.field_110585_a.entrySet().iterator();
while (iterator.hasNext())
{
Entry<ResourceLocation, ITextureObject> entry = (Entry)iterator.next();
+ bar.step(entry.getKey().toString());
ITextureObject itextureobject = entry.getValue();
if (itextureobject == TextureUtil.field_111001_a)
@@ -159,5 +162,6 @@
this.func_110579_a(entry.getKey(), itextureobject);
}
}
+ net.minecraftforge.fml.common.ProgressManager.pop(bar);
}
}

View File

@ -0,0 +1,246 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java
@@ -45,6 +45,16 @@
public TextureMap(String p_i46100_1_, @Nullable ITextureMapPopulator p_i46100_2_)
{
+ this(p_i46100_1_, p_i46100_2_, false);
+ }
+
+ public TextureMap(String basePathIn, boolean skipFirst)
+ {
+ this(basePathIn, null, skipFirst);
+ }
+
+ public TextureMap(String p_i46100_1_, @Nullable ITextureMapPopulator p_i46100_2_, boolean skipFirst)
+ {
this.field_94258_i = Lists.<TextureAtlasSprite>newArrayList();
this.field_110574_e = Maps.<String, TextureAtlasSprite>newHashMap();
this.field_94252_e = Maps.<String, TextureAtlasSprite>newHashMap();
@@ -74,6 +84,7 @@
public void func_174943_a(IResourceManager p_174943_1_, ITextureMapPopulator p_174943_2_)
{
this.field_110574_e.clear();
+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPre(this);
p_174943_2_.func_177059_a(this);
this.func_110569_e();
this.func_147631_c();
@@ -88,13 +99,55 @@
this.field_94258_i.clear();
int j = Integer.MAX_VALUE;
int k = 1 << this.field_147636_j;
+ net.minecraftforge.fml.common.FMLLog.log.info("Max texture size: {}", i);
+ net.minecraftforge.fml.common.ProgressManager.ProgressBar bar = net.minecraftforge.fml.common.ProgressManager.push("Texture stitching", this.field_110574_e.size());
+ loadedSprites.clear();
- for (Entry<String, TextureAtlasSprite> entry : this.field_110574_e.entrySet())
+ for (Entry<String, TextureAtlasSprite> entry : Maps.newHashMap(this.field_110574_e).entrySet())
{
- TextureAtlasSprite textureatlassprite = entry.getValue();
- ResourceLocation resourcelocation = this.func_184396_a(textureatlassprite);
- IResource iresource = null;
+ final ResourceLocation location = new ResourceLocation(entry.getKey());
+ bar.step(location.toString());
+ j = loadTexture(stitcher, p_110571_1_, location, entry.getValue(), bar, j, k);
+ }
+ finishLoading(stitcher, bar, j, k);
+ }
+ private int loadTexture(Stitcher stitcher, IResourceManager p_110571_1_, ResourceLocation location, TextureAtlasSprite textureatlassprite, net.minecraftforge.fml.common.ProgressManager.ProgressBar bar, int j, int k)
+ {
+ if (loadedSprites.contains(location)) {
+ return j;
+ }
+ ResourceLocation resourcelocation = this.func_184396_a(textureatlassprite);
+ IResource iresource = null;
+
+ for(ResourceLocation loading : loadingSprites)
+ {
+ if(location.equals(loading))
+ {
+ final String error = "circular model dependencies, stack: [" + com.google.common.base.Joiner.on(", ").join(loadingSprites) + "]";
+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation, error);
+ }
+ }
+ loadingSprites.addLast(location);
+ try
+ {
+ for (ResourceLocation dependency : textureatlassprite.getDependencies())
+ {
+ if (!field_110574_e.containsKey(dependency.toString()))
+ {
+ func_174942_a(dependency);
+ }
+ TextureAtlasSprite depSprite = field_110574_e.get(dependency.toString());
+ j = loadTexture(stitcher, p_110571_1_, dependency, depSprite, bar, j, k);
+ }
+ if (textureatlassprite.hasCustomLoader(p_110571_1_, resourcelocation))
+ {
+ if (textureatlassprite.load(p_110571_1_, resourcelocation, l -> field_110574_e.get(l.toString())))
+ {
+ return j;
+ }
+ }
+ else
try
{
PngSizeInfo pngsizeinfo = PngSizeInfo.func_188532_a(p_110571_1_.func_110536_a(resourcelocation));
@@ -104,13 +157,13 @@
}
catch (RuntimeException runtimeexception)
{
- field_147635_d.error("Unable to parse metadata from {}", resourcelocation, runtimeexception);
- continue;
+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackBrokenTexture(resourcelocation, runtimeexception.getMessage());
+ return j;
}
catch (IOException ioexception)
{
- field_147635_d.error("Using missing texture, unable to load {}", resourcelocation, ioexception);
- continue;
+ net.minecraftforge.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation);
+ return j;
}
finally
{
@@ -122,16 +175,28 @@
if (j1 < k)
{
- field_147635_d.warn("Texture {} with size {}x{} limits mip level from {} to {}", resourcelocation, Integer.valueOf(textureatlassprite.func_94211_a()), Integer.valueOf(textureatlassprite.func_94216_b()), Integer.valueOf(MathHelper.func_151239_c(k)), Integer.valueOf(MathHelper.func_151239_c(j1)));
- k = j1;
+ // FORGE: do not lower the mipmap level, just log the problematic textures
+ field_147635_d.warn("Texture {} with size {}x{} will have visual artifacts at mip level {}, it can only support level {}. Please report to the mod author that the texture should be some multiple of 16x16.", resourcelocation, Integer.valueOf(textureatlassprite.func_94211_a()), Integer.valueOf(textureatlassprite.func_94216_b()), Integer.valueOf(MathHelper.func_151239_c(k)), Integer.valueOf(MathHelper.func_151239_c(j1)));
}
+ if (func_184397_a(p_110571_1_, textureatlassprite))
stitcher.func_110934_a(textureatlassprite);
+ return j;
}
+ finally
+ {
+ loadingSprites.removeLast();
+ loadedSprites.add(location);
+ }
+ }
+ private void finishLoading(Stitcher stitcher, net.minecraftforge.fml.common.ProgressManager.ProgressBar bar, int j, int k)
+ {
+ net.minecraftforge.fml.common.ProgressManager.pop(bar);
int l = Math.min(j, k);
int i1 = MathHelper.func_151239_c(l);
+ if (false) // FORGE: do not lower the mipmap level
if (i1 < this.field_147636_j)
{
field_147635_d.warn("{}: dropping miplevel from {} to {}, because of minimum power of two: {}", this.field_94254_c, Integer.valueOf(this.field_147636_j), Integer.valueOf(i1), Integer.valueOf(l));
@@ -140,9 +205,11 @@
this.field_94249_f.func_147963_d(this.field_147636_j);
stitcher.func_110934_a(this.field_94249_f);
+ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture creation", 2);
try
{
+ bar.step("Stitching");
stitcher.func_94305_f();
}
catch (StitcherException stitcherexception)
@@ -151,12 +218,16 @@
}
field_147635_d.info("Created: {}x{} {}-atlas", Integer.valueOf(stitcher.func_110935_a()), Integer.valueOf(stitcher.func_110936_b()), this.field_94254_c);
+ bar.step("Allocating GL texture");
TextureUtil.func_180600_a(this.func_110552_b(), this.field_147636_j, stitcher.func_110935_a(), stitcher.func_110936_b());
Map<String, TextureAtlasSprite> map = Maps.<String, TextureAtlasSprite>newHashMap(this.field_110574_e);
+ net.minecraftforge.fml.common.ProgressManager.pop(bar);
+ bar = net.minecraftforge.fml.common.ProgressManager.push("Texture mipmap and upload", stitcher.func_94309_g().size());
+
for (TextureAtlasSprite textureatlassprite1 : stitcher.func_94309_g())
{
- if (textureatlassprite1 == this.field_94249_f || this.func_184397_a(p_110571_1_, textureatlassprite1))
+ bar.step(textureatlassprite1.func_94215_i());
{
String s = textureatlassprite1.func_94215_i();
map.remove(s);
@@ -186,6 +257,8 @@
{
textureatlassprite2.func_94217_a(this.field_94249_f);
}
+ net.minecraftforge.client.ForgeHooksClient.onTextureStitchedPost(this);
+ net.minecraftforge.fml.common.ProgressManager.pop(bar);
}
private boolean func_184397_a(IResourceManager p_184397_1_, final TextureAtlasSprite p_184397_2_)
@@ -195,7 +268,7 @@
label62:
{
boolean flag;
-
+ if (p_184397_2_.hasCustomLoader(p_184397_1_, resourcelocation)) break label62;
try
{
iresource = p_184397_1_.func_110536_a(resourcelocation);
@@ -292,7 +365,7 @@
}
else
{
- TextureAtlasSprite textureatlassprite = this.field_110574_e.get(p_174942_1_);
+ TextureAtlasSprite textureatlassprite = this.field_110574_e.get(p_174942_1_.toString());
if (textureatlassprite == null)
{
@@ -318,4 +391,52 @@
{
return this.field_94249_f;
}
+
+ //===================================================================================================
+ // Forge Start
+ //===================================================================================================
+
+ private final java.util.Deque<ResourceLocation> loadingSprites = new java.util.ArrayDeque<>();
+ private final java.util.Set<ResourceLocation> loadedSprites = new java.util.HashSet<>();
+
+ /**
+ * Grabs the registered entry for the specified name, returning null if there was not a entry.
+ * Opposed to registerIcon, this will not instantiate the entry, useful to test if a mapping exists.
+ *
+ * @param name The name of the entry to find
+ * @return The registered entry, null if nothing was registered.
+ */
+ @Nullable
+ public TextureAtlasSprite getTextureExtry(String name)
+ {
+ return field_110574_e.get(name);
+ }
+
+ /**
+ * Adds a texture registry entry to this map for the specified name if one does not already exist.
+ * Returns false if the map already contains a entry for the specified name.
+ *
+ * @param entry Entry instance
+ * @return True if the entry was added to the map, false otherwise.
+ */
+ public boolean setTextureEntry(TextureAtlasSprite entry)
+ {
+ String name = entry.func_94215_i();
+ if (!field_110574_e.containsKey(name))
+ {
+ field_110574_e.put(name, entry);
+ return true;
+ }
+ return false;
+ }
+
+ public String getBasePath()
+ {
+ return field_94254_c;
+ }
+
+ public int getMipmapLevels()
+ {
+ return field_147636_j;
+ }
}

View File

@ -0,0 +1,39 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureUtil.java
@@ -83,6 +83,7 @@
int[] aint1 = aint[l1 - 1];
int[] aint2 = new int[aint1.length >> 2];
int j = p_147949_1_ >> l1;
+ if (j > 0) { // FORGE: forcing higher mipmap levels on odd textures needs this check
int k = aint2.length / j;
int l = j << 1;
@@ -94,6 +95,7 @@
aint2[i1 + j1 * j] = func_147943_a(aint1[k1 + 0], aint1[k1 + 1], aint1[k1 + 0 + l], aint1[k1 + 1 + l], flag);
}
}
+ } // end if (j > 0)
aint[l1] = aint2;
}
@@ -168,6 +170,7 @@
for (int i = 0; i < p_147955_0_.length; ++i)
{
int[] aint = p_147955_0_[i];
+ if ((p_147955_1_ >> i <= 0) || (p_147955_2_ >> i <= 0)) break;
func_147947_a(i, aint, p_147955_1_ >> i, p_147955_2_ >> i, p_147955_3_ >> i, p_147955_4_ >> i, p_147955_5_, p_147955_6_, p_147955_0_.length > 1);
}
}
@@ -202,9 +205,11 @@
public static void func_180600_a(int p_180600_0_, int p_180600_1_, int p_180600_2_, int p_180600_3_)
{
+ synchronized (net.minecraftforge.fml.client.SplashProgress.class)
+ {
func_147942_a(p_180600_0_);
func_94277_a(p_180600_0_);
-
+ }
if (p_180600_1_ >= 0)
{
GlStateManager.func_187421_b(3553, 33085, p_180600_1_);

View File

@ -0,0 +1,10 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityItemStackRenderer.java
@@ -118,6 +118,7 @@
{
TileEntityRendererDispatcher.field_147556_a.func_192855_a(field_191274_b[BlockShulkerBox.func_190955_b(item).func_176765_a()], 0.0D, 0.0D, 0.0D, 0.0F, p_192838_2_);
}
+ else if (Block.func_149634_a(item) != Blocks.field_150486_ae) net.minecraftforge.client.ForgeHooksClient.renderTileItem(p_192838_1_.func_77973_b(), p_192838_1_.func_77960_j());
else
{
TileEntityRendererDispatcher.field_147556_a.func_192855_a(this.field_147717_b, 0.0D, 0.0D, 0.0D, 0.0F, p_192838_2_);

View File

@ -0,0 +1,15 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityPistonRenderer.java
@@ -23,10 +23,11 @@
@SideOnly(Side.CLIENT)
public class TileEntityPistonRenderer extends TileEntitySpecialRenderer<TileEntityPiston>
{
- private final BlockRendererDispatcher field_178462_c = Minecraft.func_71410_x().func_175602_ab();
+ private BlockRendererDispatcher field_178462_c;
public void func_192841_a(TileEntityPiston p_192841_1_, double p_192841_2_, double p_192841_4_, double p_192841_6_, float p_192841_8_, int p_192841_9_, float p_192841_10_)
{
+ if (field_178462_c == null) field_178462_c = Minecraft.func_71410_x().func_175602_ab(); //Forge: Delay this from constructor to allow us to change it later
BlockPos blockpos = p_192841_1_.func_174877_v();
IBlockState iblockstate = p_192841_1_.func_174927_b();
Block block = iblockstate.func_177230_c();

View File

@ -0,0 +1,91 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntityRendererDispatcher.java
@@ -92,7 +92,7 @@
@Nullable
public <T extends TileEntity> TileEntitySpecialRenderer<T> func_147547_b(@Nullable TileEntity p_147547_1_)
{
- return p_147547_1_ == null ? null : this.func_147546_a(p_147547_1_.getClass());
+ return p_147547_1_ == null || p_147547_1_.func_145837_r() ? null : this.func_147546_a(p_147547_1_.getClass()); // Forge: fix MC-123363
}
public void func_190056_a(World p_190056_1_, TextureManager p_190056_2_, FontRenderer p_190056_3_, Entity p_190056_4_, RayTraceResult p_190056_5_, float p_190056_6_)
@@ -117,12 +117,15 @@
{
if (p_180546_1_.func_145835_a(this.field_147560_j, this.field_147561_k, this.field_147558_l) < p_180546_1_.func_145833_n())
{
+ if(!drawingBatch || !p_180546_1_.hasFastRenderer())
+ {
RenderHelper.func_74519_b();
int i = this.field_147550_f.func_175626_b(p_180546_1_.func_174877_v(), 0);
int j = i % 65536;
int k = i / 65536;
OpenGlHelper.func_77475_a(OpenGlHelper.field_77476_b, (float)j, (float)k);
GlStateManager.func_179131_c(1.0F, 1.0F, 1.0F, 1.0F);
+ }
BlockPos blockpos = p_180546_1_.func_174877_v();
this.func_192854_a(p_180546_1_, (double)blockpos.func_177958_n() - field_147554_b, (double)blockpos.func_177956_o() - field_147555_c, (double)blockpos.func_177952_p() - field_147552_d, p_180546_2_, p_180546_3_, 1.0F);
}
@@ -146,6 +149,9 @@
{
try
{
+ if(drawingBatch && p_192854_1_.hasFastRenderer())
+ tileentityspecialrenderer.renderTileEntityFast(p_192854_1_, p_192854_2_, p_192854_4_, p_192854_6_, p_192854_8_, p_192854_9_, p_192854_10_, batchBuffer.func_178180_c());
+ else
tileentityspecialrenderer.func_192841_a(p_192854_1_, p_192854_2_, p_192854_4_, p_192854_6_, p_192854_8_, p_192854_9_, p_192854_10_);
}
catch (Throwable throwable)
@@ -172,4 +178,53 @@
{
return this.field_147557_n;
}
+
+ /* ======================================== FORGE START =====================================*/
+ /**
+ * Buffer used for batched TESRs
+ */
+ private net.minecraft.client.renderer.Tessellator batchBuffer = new net.minecraft.client.renderer.Tessellator(0x200000);
+ private boolean drawingBatch = false;
+
+ /**
+ * Prepare for a batched TESR rendering.
+ * You probably shouldn't call this manually.
+ */
+ public void preDrawBatch()
+ {
+ batchBuffer.func_178180_c().func_181668_a(org.lwjgl.opengl.GL11.GL_QUADS, net.minecraft.client.renderer.vertex.DefaultVertexFormats.field_176600_a);
+ drawingBatch = true;
+ }
+
+ /**
+ * Render all TESRs batched so far.
+ * You probably shouldn't call this manually.
+ */
+ public void drawBatch(int pass)
+ {
+ field_147553_e.func_110577_a(net.minecraft.client.renderer.texture.TextureMap.field_110575_b);
+ net.minecraft.client.renderer.RenderHelper.func_74518_a();
+ GlStateManager.func_179112_b(org.lwjgl.opengl.GL11.GL_SRC_ALPHA, org.lwjgl.opengl.GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GlStateManager.func_179147_l();
+ GlStateManager.func_179129_p();
+
+ if (net.minecraft.client.Minecraft.func_71379_u())
+ {
+ GlStateManager.func_179103_j(org.lwjgl.opengl.GL11.GL_SMOOTH);
+ }
+ else
+ {
+ GlStateManager.func_179103_j(org.lwjgl.opengl.GL11.GL_FLAT);
+ }
+
+ if(pass > 0)
+ {
+ net.minecraft.util.math.Vec3d cameraPos = net.minecraft.client.renderer.ActiveRenderInfo.getCameraPosition();
+ batchBuffer.func_178180_c().func_181674_a((float)cameraPos.field_72450_a, (float)cameraPos.field_72448_b, (float)cameraPos.field_72449_c);
+ }
+ batchBuffer.func_78381_a();
+
+ net.minecraft.client.renderer.RenderHelper.func_74519_b();
+ drawingBatch = false;
+ }
}

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer.java
@@ -77,6 +77,8 @@
return false;
}
+ public void renderTileEntityFast(T te, double x, double y, double z, float partialTicks, int destroyStage, float partial, net.minecraft.client.renderer.BufferBuilder buffer) {}
+
protected void func_190052_a(T p_190052_1_, String p_190052_2_, double p_190052_3_, double p_190052_5_, double p_190052_7_, int p_190052_9_)
{
Entity entity = this.field_147501_a.field_147551_g;

View File

@ -0,0 +1,38 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/vertex/VertexFormat.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/vertex/VertexFormat.java
@@ -17,6 +17,7 @@
private int field_177354_e;
private final List<Integer> field_177351_f;
private int field_177352_g;
+ private int hashCode;
public VertexFormat(VertexFormat p_i46097_1_)
{
@@ -47,6 +48,7 @@
this.field_177351_f.clear();
this.field_177352_g = -1;
this.field_177353_d = 0;
+ this.hashCode = 0;
}
@SuppressWarnings("incomplete-switch")
@@ -75,6 +77,7 @@
}
this.field_177353_d += p_181721_1_.func_177368_f();
+ this.hashCode = 0;
return this;
}
}
@@ -204,9 +207,11 @@
public int hashCode()
{
+ if (this.hashCode != 0) return this.hashCode;
int i = this.field_177355_b.hashCode();
i = 31 * i + this.field_177356_c.hashCode();
i = 31 * i + this.field_177353_d;
+ this.hashCode = i;
return i;
}
}

View File

@ -0,0 +1,21 @@
--- ../src-base/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java
+++ ../src-work/minecraft/net/minecraft/client/renderer/vertex/VertexFormatElement.java
@@ -158,10 +158,17 @@
NORMAL("Normal"),
COLOR("Vertex Color"),
UV("UV"),
+ // As of 1.8.8 - unused in vanilla; use GENERIC for now
+ @Deprecated
MATRIX("Bone Matrix"),
+ @Deprecated
BLEND_WEIGHT("Blend Weight"),
- PADDING("Padding");
+ PADDING("Padding"),
+ GENERIC("Generic");
+ public void preDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.preDraw(this, format, element, stride, buffer); }
+ public void postDraw(VertexFormat format, int element, int stride, java.nio.ByteBuffer buffer) { net.minecraftforge.client.ForgeHooksClient.postDraw(this, format, element, stride, buffer); }
+
private final String field_177392_h;
private EnumUsage(String p_i46094_3_)

View File

@ -0,0 +1,10 @@
--- ../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_);

View File

@ -0,0 +1,14 @@
--- ../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
{

View File

@ -0,0 +1,24 @@
--- ../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; }
}

View File

@ -0,0 +1,11 @@
--- ../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) != '#')

View File

@ -0,0 +1,44 @@
--- ../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);
}
}

View File

@ -0,0 +1,57 @@
--- ../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 ================================================*/
}

View File

@ -0,0 +1,12 @@
--- ../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

View File

@ -0,0 +1,12 @@
--- ../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

View File

@ -0,0 +1,12 @@
--- ../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;

View File

@ -0,0 +1,17 @@
--- ../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)

View File

@ -0,0 +1,19 @@
--- ../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);
}
}

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/command/CommandBase.java
+++ ../src-work/minecraft/net/minecraft/command/CommandBase.java
@@ -393,7 +393,7 @@
itextcomponent.func_150258_a(" ");
}
- ITextComponent itextcomponent1 = new TextComponentString(p_147176_1_[i]);
+ ITextComponent itextcomponent1 = net.minecraftforge.common.ForgeHooks.newChatWithLinks(p_147176_1_[i]); // Forge: links for messages
if (p_147176_3_)
{

View File

@ -0,0 +1,20 @@
--- ../src-base/minecraft/net/minecraft/command/CommandFill.java
+++ ../src-work/minecraft/net/minecraft/command/CommandFill.java
@@ -82,7 +82,7 @@
NBTTagCompound nbttagcompound = new NBTTagCompound();
boolean flag = false;
- if (p_184881_3_.length >= 10 && block.func_149716_u())
+ if (p_184881_3_.length >= 10 && block.hasTileEntity(iblockstate))
{
String s = func_180529_a(p_184881_3_, 9);
@@ -123,7 +123,7 @@
continue;
}
}
- else if ("replace".equals(p_184881_3_[8]) && !block.func_149716_u() && p_184881_3_.length > 9)
+ else if ("replace".equals(p_184881_3_[8]) && !block.hasTileEntity(iblockstate) && p_184881_3_.length > 9)
{
Block block1 = CommandBase.func_147180_g(p_184881_2_, p_184881_3_[9]);

View File

@ -0,0 +1,20 @@
--- ../src-base/minecraft/net/minecraft/command/CommandHandler.java
+++ ../src-work/minecraft/net/minecraft/command/CommandHandler.java
@@ -50,6 +50,17 @@
}
else if (icommand.func_184882_a(this.func_184879_a(), p_71556_1_))
{
+ net.minecraftforge.event.CommandEvent event = new net.minecraftforge.event.CommandEvent(icommand, p_71556_1_, astring);
+ if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event))
+ {
+ if (event.getException() != null)
+ {
+ com.google.common.base.Throwables.throwIfUnchecked(event.getException());
+ }
+ return 1;
+ }
+ if (event.getParameters() != null) astring = event.getParameters();
+
if (j > -1)
{
List<Entity> list = EntitySelector.<Entity>func_179656_b(p_71556_1_, astring[j], Entity.class);

View File

@ -0,0 +1,46 @@
--- ../src-base/minecraft/net/minecraft/command/EntitySelector.java
+++ ../src-work/minecraft/net/minecraft/command/EntitySelector.java
@@ -121,6 +121,11 @@
public static <T extends Entity> List<T> func_179656_b(ICommandSender p_179656_0_, String p_179656_1_, Class <? extends T > p_179656_2_) throws CommandException
{
+ return net.minecraftforge.common.command.SelectorHandlerManager.matchEntities(p_179656_0_, p_179656_1_, p_179656_2_);
+ }
+
+ public static <T extends Entity> List<T> matchEntitiesDefault(ICommandSender p_179656_0_, String p_179656_1_, Class <? extends T > p_179656_2_) throws CommandException
+ {
Matcher matcher = field_82389_a.matcher(p_179656_1_);
if (matcher.matches() && p_179656_0_.func_70003_b(1, "@"))
@@ -153,6 +158,7 @@
list2.addAll(func_184951_f(map));
list2.addAll(func_180698_a(map, vec3d));
list2.addAll(func_179662_g(map));
+ list2.addAll(net.minecraftforge.fml.common.registry.GameRegistry.createEntitySelectors(map, s, p_179656_0_, vec3d));
if ("s".equalsIgnoreCase(s))
{
@@ -786,6 +792,11 @@
public static boolean func_82377_a(String p_82377_0_) throws CommandException
{
+ return net.minecraftforge.common.command.SelectorHandlerManager.matchesMultiplePlayers(p_82377_0_);
+ }
+
+ public static boolean matchesMultiplePlayersDefault(String p_82377_0_) throws CommandException
+ {
Matcher matcher = field_82389_a.matcher(p_82377_0_);
if (!matcher.matches())
@@ -803,6 +814,11 @@
public static boolean func_82378_b(String p_82378_0_)
{
+ return net.minecraftforge.common.command.SelectorHandlerManager.isSelector(p_82378_0_);
+ }
+
+ public static boolean isSelectorDefault(String p_82378_0_)
+ {
return field_82389_a.matcher(p_82378_0_).matches();
}

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/command/server/CommandSetBlock.java
+++ ../src-work/minecraft/net/minecraft/command/server/CommandSetBlock.java
@@ -70,7 +70,7 @@
NBTTagCompound nbttagcompound = new NBTTagCompound();
boolean flag = false;
- if (p_184881_3_.length >= 7 && block.func_149716_u())
+ if (p_184881_3_.length >= 7 && block.hasTileEntity(iblockstate))
{
String s = func_180529_a(p_184881_3_, 6);

View File

@ -0,0 +1,50 @@
--- ../src-base/minecraft/net/minecraft/enchantment/Enchantment.java
+++ ../src-work/minecraft/net/minecraft/enchantment/Enchantment.java
@@ -14,9 +14,9 @@
import net.minecraft.util.text.TextFormatting;
import net.minecraft.util.text.translation.I18n;
-public abstract class Enchantment
+public abstract class Enchantment extends net.minecraftforge.registries.IForgeRegistryEntry.Impl<Enchantment>
{
- public static final RegistryNamespaced<ResourceLocation, Enchantment> field_185264_b = new RegistryNamespaced<ResourceLocation, Enchantment>();
+ public static final RegistryNamespaced<ResourceLocation, Enchantment> field_185264_b = net.minecraftforge.registries.GameData.getWrapper(Enchantment.class);
private final EntityEquipmentSlot[] field_185263_a;
private final Enchantment.Rarity field_77333_a;
@Nullable
@@ -134,7 +134,7 @@
public boolean func_92089_a(ItemStack p_92089_1_)
{
- return this.field_77351_y.func_77557_a(p_92089_1_.func_77973_b());
+ return canApplyAtEnchantingTable(p_92089_1_);
}
public void func_151368_a(EntityLivingBase p_151368_1_, Entity p_151368_2_, int p_151368_3_)
@@ -155,6 +155,26 @@
return false;
}
+ /**
+ * This applies specifically to applying at the enchanting table. The other method {@link #canApply(ItemStack)}
+ * applies for <i>all possible</i> enchantments.
+ * @param stack
+ * @return
+ */
+ public boolean canApplyAtEnchantingTable(ItemStack stack)
+ {
+ return stack.func_77973_b().canApplyAtEnchantingTable(stack, this);
+ }
+
+ /**
+ * Is this enchantment allowed to be enchanted on books via Enchantment Table
+ * @return false to disable the vanilla feature
+ */
+ public boolean isAllowedOnBooks()
+ {
+ return true;
+ }
+
public static void func_185257_f()
{
EntityEquipmentSlot[] aentityequipmentslot = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET};

View File

@ -0,0 +1,11 @@
--- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentFrostWalker.java
+++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentFrostWalker.java
@@ -59,7 +59,7 @@
{
IBlockState iblockstate1 = p_185266_1_.func_180495_p(blockpos$mutableblockpos1);
- if (iblockstate1.func_185904_a() == Material.field_151586_h && ((Integer)iblockstate1.func_177229_b(BlockLiquid.field_176367_b)).intValue() == 0 && p_185266_1_.func_190527_a(Blocks.field_185778_de, blockpos$mutableblockpos1, false, EnumFacing.DOWN, (Entity)null))
+ if (iblockstate1.func_185904_a() == Material.field_151586_h && (iblockstate1.func_177230_c() == net.minecraft.init.Blocks.field_150355_j || iblockstate1.func_177230_c() == net.minecraft.init.Blocks.field_150358_i) && ((Integer)iblockstate1.func_177229_b(BlockLiquid.field_176367_b)).intValue() == 0 && p_185266_1_.func_190527_a(Blocks.field_185778_de, blockpos$mutableblockpos1, false, EnumFacing.DOWN, (Entity)null))
{
p_185266_1_.func_175656_a(blockpos$mutableblockpos1, Blocks.field_185778_de.func_176223_P());
p_185266_1_.func_175684_a(blockpos$mutableblockpos1.func_185334_h(), Blocks.field_185778_de, MathHelper.func_76136_a(p_185266_0_.func_70681_au(), 60, 120));

View File

@ -0,0 +1,57 @@
--- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentHelper.java
+++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentHelper.java
@@ -140,6 +140,7 @@
field_77520_b.field_77497_a = 0;
field_77520_b.field_77496_b = p_77508_1_;
func_77516_a(field_77520_b, p_77508_0_);
+ field_77520_b.field_77496_b = null; //Forge Fix memory leaks: https://bugs.mojang.com/browse/MC-128547
return field_77520_b.field_77497_a;
}
@@ -171,6 +172,9 @@
{
func_77518_a(field_151388_d, p_151384_0_.func_184614_ca());
}
+
+ field_151388_d.field_151363_b = null; //Forge Fix memory leaks: https://bugs.mojang.com/browse/MC-128547
+ field_151388_d.field_151364_a = null;
}
public static void func_151385_b(EntityLivingBase p_151385_0_, Entity p_151385_1_)
@@ -187,6 +191,9 @@
{
func_77518_a(field_151389_e, p_151385_0_.func_184614_ca());
}
+
+ field_151389_e.field_151366_a = null; //Forge Fix memory leaks: https://bugs.mojang.com/browse/MC-128547
+ field_151389_e.field_151365_b = null;
}
public static int func_185284_a(Enchantment p_185284_0_, EntityLivingBase p_185284_1_)
@@ -302,7 +309,7 @@
public static int func_77514_a(Random p_77514_0_, int p_77514_1_, int p_77514_2_, ItemStack p_77514_3_)
{
Item item = p_77514_3_.func_77973_b();
- int i = item.func_77619_b();
+ int i = item.getItemEnchantability(p_77514_3_);
if (i <= 0)
{
@@ -357,7 +364,7 @@
{
List<EnchantmentData> list = Lists.<EnchantmentData>newArrayList();
Item item = p_77513_1_.func_77973_b();
- int i = item.func_77619_b();
+ int i = item.getItemEnchantability(p_77513_1_);
if (i <= 0)
{
@@ -413,7 +420,7 @@
for (Enchantment enchantment : Enchantment.field_185264_b)
{
- if ((!enchantment.func_185261_e() || p_185291_2_) && (enchantment.field_77351_y.func_77557_a(item) || flag))
+ if ((!enchantment.func_185261_e() || p_185291_2_) && (enchantment.canApplyAtEnchantingTable(p_185291_1_) || (flag && enchantment.isAllowedOnBooks())))
{
for (int i = enchantment.func_77325_b(); i > enchantment.func_77319_d() - 1; --i)
{

View File

@ -0,0 +1,43 @@
--- ../src-base/minecraft/net/minecraft/enchantment/EnchantmentThorns.java
+++ ../src-work/minecraft/net/minecraft/enchantment/EnchantmentThorns.java
@@ -51,12 +51,12 @@
if (!itemstack.func_190926_b())
{
- itemstack.func_77972_a(3, p_151367_1_);
+ damageArmor(itemstack, 3, p_151367_1_);
}
}
else if (!itemstack.func_190926_b())
{
- itemstack.func_77972_a(1, p_151367_1_);
+ damageArmor(itemstack, 1, p_151367_1_);
}
}
@@ -76,4 +76,25 @@
{
return p_92095_0_ > 10 ? p_92095_0_ - 10 : 1 + p_92095_1_.nextInt(4);
}
+
+ private void damageArmor(ItemStack stack, int amount, EntityLivingBase entity)
+ {
+ int slot = -1;
+ int x = 0;
+ for (ItemStack i : entity.func_184193_aE())
+ {
+ if (i == stack){
+ slot = x;
+ break;
+ }
+ x++;
+ }
+ if (slot == -1 || !(stack.func_77973_b() instanceof net.minecraftforge.common.ISpecialArmor))
+ {
+ stack.func_77972_a(1, entity);
+ return;
+ }
+ net.minecraftforge.common.ISpecialArmor armor = (net.minecraftforge.common.ISpecialArmor)stack.func_77973_b();
+ armor.damageArmor(entity, stack, DamageSource.func_92087_a(entity), amount, slot);
+ }
}

View File

@ -0,0 +1,17 @@
--- ../src-base/minecraft/net/minecraft/enchantment/EnumEnchantmentType.java
+++ ../src-work/minecraft/net/minecraft/enchantment/EnumEnchantmentType.java
@@ -100,5 +100,13 @@
{
}
- public abstract boolean func_77557_a(Item p_77557_1_);
+ private com.google.common.base.Predicate<Item> delegate = null;
+ private EnumEnchantmentType(com.google.common.base.Predicate<Item> delegate)
+ {
+ this.delegate = delegate;
+ }
+ public boolean func_77557_a(Item p_77557_1_)
+ {
+ return this.delegate == null ? false : this.delegate.apply(p_77557_1_);
+ }
}

View File

@ -0,0 +1,20 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityAgeable.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityAgeable.java
@@ -38,7 +38,7 @@
{
if (!this.field_70170_p.field_72995_K)
{
- Class <? extends Entity > oclass = (Class)EntityList.field_191308_b.func_82594_a(ItemMonsterPlacer.func_190908_h(itemstack));
+ Class <? extends Entity > oclass = EntityList.getClass(ItemMonsterPlacer.func_190908_h(itemstack));
if (oclass != null && this.getClass() == oclass)
{
@@ -79,7 +79,7 @@
}
else
{
- Class <? extends Entity > oclass = (Class)EntityList.field_191308_b.func_82594_a(ItemMonsterPlacer.func_190908_h(p_190669_1_));
+ Class <? extends Entity > oclass = EntityList.getClass(ItemMonsterPlacer.func_190908_h(p_190669_1_));
return oclass != null && p_190669_2_ == oclass;
}
}

View File

@ -0,0 +1,24 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityFlying.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityFlying.java
@@ -44,7 +44,9 @@
if (this.field_70122_E)
{
- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().field_149765_K * 0.91F;
+ BlockPos underPos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v));
+ IBlockState underState = this.field_70170_p.func_180495_p(underPos);
+ f = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, underPos, this) * 0.91F;
}
float f1 = 0.16277136F / (f * f * f);
@@ -53,7 +55,9 @@
if (this.field_70122_E)
{
- f = this.field_70170_p.func_180495_p(new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v))).func_177230_c().field_149765_K * 0.91F;
+ BlockPos underPos = new BlockPos(MathHelper.func_76128_c(this.field_70165_t), MathHelper.func_76128_c(this.func_174813_aQ().field_72338_b) - 1, MathHelper.func_76128_c(this.field_70161_v));
+ IBlockState underState = this.field_70170_p.func_180495_p(underPos);
+ f = underState.func_177230_c().getSlipperiness(underState, this.field_70170_p, underPos, this) * 0.91F;
}
this.func_70091_d(MoverType.SELF, this.field_70159_w, this.field_70181_x, this.field_70179_y);

View File

@ -0,0 +1,12 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityHanging.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityHanging.java
@@ -144,6 +144,9 @@
blockpos$mutableblockpos.func_189533_g(blockpos).func_189534_c(enumfacing, k + i1).func_189534_c(EnumFacing.UP, l + j1);
IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos$mutableblockpos);
+ if (iblockstate.isSideSolid(this.field_70170_p, blockpos$mutableblockpos, this.field_174860_b))
+ continue;
+
if (!iblockstate.func_185904_a().func_76220_a() && !BlockRedstoneDiode.func_185546_B(iblockstate))
{
return false;

View File

@ -0,0 +1,183 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityList.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityList.java
@@ -107,10 +107,8 @@
public static final ResourceLocation field_191307_a = new ResourceLocation("lightning_bolt");
private static final ResourceLocation field_191310_e = new ResourceLocation("player");
private static final Logger field_151516_b = LogManager.getLogger();
- public static final RegistryNamespaced < ResourceLocation, Class <? extends Entity >> field_191308_b = new RegistryNamespaced < ResourceLocation, Class <? extends Entity >> ();
public static final Map<ResourceLocation, EntityList.EntityEggInfo> field_75627_a = Maps.<ResourceLocation, EntityList.EntityEggInfo>newLinkedHashMap();
- public static final Set<ResourceLocation> field_191309_d = Sets.<ResourceLocation>newHashSet();
- private static final List<String> field_191311_g = Lists.<String>newArrayList();
+ private static final Set<ResourceLocation> EXTRA_NAMES = Sets.newHashSet();
@Nullable
public static ResourceLocation func_191301_a(Entity p_191301_0_)
@@ -121,38 +119,54 @@
@Nullable
public static ResourceLocation func_191306_a(Class <? extends Entity > p_191306_0_)
{
- return field_191308_b.func_177774_c(p_191306_0_);
+ net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.fml.common.registry.EntityRegistry.getEntry(p_191306_0_);
+ return entry == null ? null : entry.getRegistryName();
}
@Nullable
public static String func_75621_b(Entity p_75621_0_)
{
- int i = field_191308_b.func_148757_b(p_75621_0_.getClass());
- return i == -1 ? null : (String)field_191311_g.get(i);
+ net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.fml.common.registry.EntityRegistry.getEntry(p_75621_0_.getClass());
+ return entry == null ? null : entry.getName();
}
@Nullable
public static String func_191302_a(@Nullable ResourceLocation p_191302_0_)
{
- int i = field_191308_b.func_148757_b(field_191308_b.func_82594_a(p_191302_0_));
- return i == -1 ? null : (String)field_191311_g.get(i);
+ net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.fml.common.registry.ForgeRegistries.ENTITIES.getValue(p_191302_0_);
+ return entry == null ? null : entry.getName();
}
@Nullable
@SideOnly(Side.CLIENT)
public static Class <? extends Entity > func_90035_a(int p_90035_0_)
{
- return (Class)field_191308_b.func_148754_a(p_90035_0_);
+ net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.registries.GameData.getEntityRegistry().getValue(p_90035_0_);
+ return entry == null ? null : entry.getEntityClass();
}
@Nullable
@SideOnly(Side.CLIENT)
public static Class <? extends Entity > func_192839_a(String p_192839_0_)
{
- return (Class)field_191308_b.func_82594_a(new ResourceLocation(p_192839_0_));
+ net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.fml.common.registry.ForgeRegistries.ENTITIES.getValue(new ResourceLocation(p_192839_0_));
+ return entry == null ? null : entry.getEntityClass();
}
+ public static int getID(Class<? extends Entity> cls)
+ {
+ net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.fml.common.registry.EntityRegistry.getEntry(cls);
+ return entry == null ? -1 : net.minecraftforge.registries.GameData.getEntityRegistry().getID(entry);
+ }
+
@Nullable
+ public static Class<? extends Entity> getClass(ResourceLocation key)
+ {
+ net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.fml.common.registry.ForgeRegistries.ENTITIES.getValue(key);
+ return entry == null ? null : entry.getEntityClass();
+ }
+
+ @Nullable
public static Entity func_191304_a(@Nullable Class <? extends Entity > p_191304_0_, World p_191304_1_)
{
if (p_191304_0_ == null)
@@ -163,6 +177,8 @@
{
try
{
+ net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.fml.common.registry.EntityRegistry.getEntry(p_191304_0_);
+ if (entry != null) return entry.newInstance(p_191304_1_);
return p_191304_0_.getConstructor(World.class).newInstance(p_191304_1_);
}
catch (Exception exception)
@@ -177,13 +193,15 @@
@SideOnly(Side.CLIENT)
public static Entity func_75616_a(int p_75616_0_, World p_75616_1_)
{
- return func_191304_a(func_90035_a(p_75616_0_), p_75616_1_);
+ net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.registries.GameData.getEntityRegistry().getValue(p_75616_0_);
+ return entry == null ? null : entry.newInstance(p_75616_1_);
}
@Nullable
public static Entity func_188429_b(ResourceLocation p_188429_0_, World p_188429_1_)
{
- return func_191304_a(field_191308_b.func_82594_a(p_188429_0_), p_188429_1_);
+ net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.fml.common.registry.ForgeRegistries.ENTITIES.getValue(p_188429_0_);
+ return entry == null ? null : entry.newInstance(p_188429_1_);
}
@Nullable
@@ -198,7 +216,16 @@
}
else
{
+ try
+ {
entity.func_70020_e(p_75615_0_);
+ }
+ catch (Exception e)
+ {
+ net.minecraftforge.fml.common.FMLLog.log.error("An Entity {}({}) has thrown an exception during loading, its state cannot be restored. Report this to the mod author",
+ p_75615_0_.func_74779_i("id"), entity.func_70005_c_(), e);
+ entity = null;
+ }
}
return entity;
@@ -206,7 +233,7 @@
public static Set<ResourceLocation> func_180124_b()
{
- return field_191309_d;
+ return Sets.union(net.minecraftforge.fml.common.registry.ForgeRegistries.ENTITIES.getKeys(), EXTRA_NAMES);
}
public static boolean func_180123_a(Entity p_180123_0_, ResourceLocation p_180123_1_)
@@ -373,7 +400,7 @@
func_191305_a("zombie_horse", 3232308, 9945732);
func_191305_a("zombie_pigman", 15373203, 5009705);
func_191305_a("zombie_villager", 5651507, 7969893);
- field_191309_d.add(field_191307_a);
+ EXTRA_NAMES.add(field_191307_a);
}
private static void func_191303_a(int p_191303_0_, String p_191303_1_, Class <? extends Entity > p_191303_2_, String p_191303_3_)
@@ -394,22 +421,17 @@
else
{
ResourceLocation resourcelocation = new ResourceLocation(p_191303_1_);
- field_191308_b.func_177775_a(p_191303_0_, resourcelocation, p_191303_2_);
- field_191309_d.add(resourcelocation);
-
- while (field_191311_g.size() <= p_191303_0_)
- {
- field_191311_g.add(null);
- }
-
- field_191311_g.set(p_191303_0_, p_191303_3_);
+ net.minecraftforge.registries.GameData.registerEntity(p_191303_0_, resourcelocation, p_191303_2_, p_191303_3_);
}
}
protected static EntityList.EntityEggInfo func_191305_a(String p_191305_0_, int p_191305_1_, int p_191305_2_)
{
ResourceLocation resourcelocation = new ResourceLocation(p_191305_0_);
- return field_75627_a.put(resourcelocation, new EntityList.EntityEggInfo(resourcelocation, p_191305_1_, p_191305_2_));
+ EntityList.EntityEggInfo egg = new EntityList.EntityEggInfo(resourcelocation, p_191305_1_, p_191305_2_);
+ net.minecraftforge.fml.common.registry.EntityEntry entry = net.minecraftforge.fml.common.registry.ForgeRegistries.ENTITIES.getValue(resourcelocation);
+ if (entry != null) entry.setEgg(egg);
+ return (EntityList.EntityEggInfo)field_75627_a.put(resourcelocation, egg);
}
public static class EntityEggInfo
@@ -428,5 +450,16 @@
this.field_151512_d = StatList.func_151182_a(this);
this.field_151513_e = StatList.func_151176_b(this);
}
+
+ // Forge start
+ public EntityEggInfo(ResourceLocation id, int primaryColor, int secondaryColor, StatBase killEntityStatistic, StatBase entityKilledByStatistic)
+ {
+ this.field_75613_a = id;
+ this.field_75611_b = primaryColor;
+ this.field_75612_c = secondaryColor;
+ this.field_151512_d = killEntityStatistic;
+ this.field_151513_e = entityKilledByStatistic;
+ }
+ // Forge end
}
}

View File

@ -0,0 +1,88 @@
--- ../src-base/minecraft/net/minecraft/entity/EntityLiving.java
+++ ../src-work/minecraft/net/minecraft/entity/EntityLiving.java
@@ -170,6 +170,7 @@
public void func_70624_b(@Nullable EntityLivingBase p_70624_1_)
{
this.field_70696_bz = p_70624_1_;
+ net.minecraftforge.common.ForgeHooks.onLivingSetAttackTarget(this, p_70624_1_);
}
public boolean func_70686_a(Class <? extends EntityLivingBase > p_70686_1_)
@@ -576,7 +577,7 @@
super.func_70636_d();
this.field_70170_p.field_72984_F.func_76320_a("looting");
- if (!this.field_70170_p.field_72995_K && this.func_98052_bS() && !this.field_70729_aU && this.field_70170_p.func_82736_K().func_82766_b("mobGriefing"))
+ if (!this.field_70170_p.field_72995_K && this.func_98052_bS() && !this.field_70729_aU && net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(this.field_70170_p, this))
{
for (EntityItem entityitem : this.field_70170_p.func_72872_a(EntityItem.class, this.func_174813_aQ().func_72314_b(1.0D, 0.0D, 1.0D)))
{
@@ -702,10 +703,22 @@
protected void func_70623_bb()
{
+ net.minecraftforge.fml.common.eventhandler.Event.Result result = null;
if (this.field_82179_bU)
{
this.field_70708_bq = 0;
}
+ else if ((this.field_70708_bq & 0x1F) == 0x1F && (result = net.minecraftforge.event.ForgeEventFactory.canEntityDespawn(this)) != net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT)
+ {
+ if (result == net.minecraftforge.fml.common.eventhandler.Event.Result.DENY)
+ {
+ this.field_70708_bq = 0;
+ }
+ else
+ {
+ this.func_70106_y();
+ }
+ }
else
{
Entity entity = this.field_70170_p.func_72890_a(this, -1.0D);
@@ -839,7 +852,6 @@
return !this.field_70170_p.func_72953_d(this.func_174813_aQ()) && this.field_70170_p.func_184144_a(this, this.func_174813_aQ()).isEmpty() && this.field_70170_p.func_72917_a(this.func_174813_aQ(), this);
}
- @SideOnly(Side.CLIENT)
public float func_70603_bj()
{
return 1.0F;
@@ -991,6 +1003,8 @@
public static EntityEquipmentSlot func_184640_d(ItemStack p_184640_0_)
{
+ final EntityEquipmentSlot slot = p_184640_0_.func_77973_b().getEquipmentSlot(p_184640_0_);
+ if (slot != null) return slot; // FORGE: Allow modders to set a non-default equipment slot for a stack; e.g. a non-armor chestplate-slot item
if (p_184640_0_.func_77973_b() != Item.func_150898_a(Blocks.field_150423_aK) && p_184640_0_.func_77973_b() != Items.field_151144_bL)
{
if (p_184640_0_.func_77973_b() instanceof ItemArmor)
@@ -1003,7 +1017,7 @@
}
else
{
- return p_184640_0_.func_77973_b() == Items.field_185159_cQ ? EntityEquipmentSlot.OFFHAND : EntityEquipmentSlot.MAINHAND;
+ return p_184640_0_.func_77973_b().isShield(p_184640_0_, null) ? EntityEquipmentSlot.OFFHAND : EntityEquipmentSlot.MAINHAND;
}
}
else
@@ -1434,5 +1448,19 @@
ON_GROUND,
IN_AIR,
IN_WATER;
+
+ private final java.util.function.BiPredicate<net.minecraft.world.IBlockAccess, BlockPos> spawnPredicate;
+
+ SpawnPlacementType() { this.spawnPredicate = null; }
+
+ SpawnPlacementType(java.util.function.BiPredicate<net.minecraft.world.IBlockAccess, BlockPos> spawnPredicate)
+ {
+ this.spawnPredicate = spawnPredicate;
+ }
+
+ public boolean canSpawnAt(World world, BlockPos pos)
+ {
+ return this.spawnPredicate != null ? this.spawnPredicate.test(world, pos) : net.minecraft.world.WorldEntitySpawner.canCreatureTypeSpawnBody(this, world, pos);
+ }
}
}

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