diff --git a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch index 87a5da6d5..21344305e 100644 --- a/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/EntityRenderer.java.patch @@ -50,7 +50,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_195457_1_)) 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_178889_l() != GameType.SPECTATOR) { this.func_180436_i(); @@ -124,16 +124,16 @@ renderglobal.func_72731_b(entityplayer, this.field_78531_r.field_71476_x, 0, p_181560_1_); GlStateManager.func_179141_d(); } -@@ -851,6 +871,9 @@ - this.field_78531_r.field_71424_I.func_76318_c("aboveClouds"); +@@ -852,6 +872,9 @@ this.func_195456_a(renderglobal, p_181560_1_, d0, d1, d2); } -+ + + this.field_78531_r.field_71424_I.func_76318_c("forge_render_last"); + net.minecraftforge.client.ForgeHooksClient.dispatchRenderLast(renderglobal, p_181560_1_); - ++ this.field_78531_r.field_71424_I.func_76318_c("hand"); if (this.field_175074_C) { + GlStateManager.func_179086_m(256); @@ -955,6 +978,11 @@ } diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index 5cefbc1c4..dd6881908 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -57,6 +57,33 @@ float f = this.field_70130_N / 2.0F; float f1 = this.field_70131_O; this.func_174826_a(new AxisAlignedBB(p_70107_1_ - (double)f, p_70107_3_, p_70107_5_ - (double)f, p_70107_1_ + (double)f, p_70107_3_ + (double)f1, p_70107_5_ + (double)f)); +@@ -697,7 +703,7 @@ + int k1 = MathHelper.func_76128_c(this.field_70161_v); + BlockPos blockpos = new BlockPos(j1, k, k1); + IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); +- if (iblockstate.func_196958_f()) { ++ if (iblockstate.isAir(this.field_70170_p, blockpos)) { + BlockPos blockpos1 = blockpos.func_177977_b(); + IBlockState iblockstate1 = this.field_70170_p.func_180495_p(blockpos1); + Block block1 = iblockstate1.func_177230_c(); +@@ -735,7 +741,7 @@ + + this.field_70140_Q = (float)((double)this.field_70140_Q + (double)MathHelper.func_76133_a(d21 * d21 + d23 * d23) * 0.6D); + this.field_82151_R = (float)((double)this.field_82151_R + (double)MathHelper.func_76133_a(d21 * d21 + d22 * d22 + d23 * d23) * 0.6D); +- if (this.field_82151_R > this.field_70150_b && !iblockstate.func_196958_f()) { ++ if (this.field_82151_R > this.field_70150_b && !iblockstate.isAir(this.field_70170_p, blockpos)) { + this.field_70150_b = this.func_203009_ad(); + if (this.func_70090_H()) { + Entity entity = this.func_184207_aI() && this.func_184179_bs() != null ? this.func_184179_bs() : this; +@@ -749,7 +755,7 @@ + } else { + this.func_180429_a(blockpos, iblockstate); + } +- } else if (this.field_82151_R > this.field_191959_ay && this.func_191957_ae() && iblockstate.func_196958_f()) { ++ } else if (this.field_82151_R > this.field_191959_ay && this.func_191957_ae() && iblockstate.isAir(this.field_70170_p, blockpos)) { + this.field_191959_ay = this.func_191954_d(this.field_82151_R); + } + } @@ -794,6 +800,7 @@ this.field_70165_t = (axisalignedbb.field_72340_a + axisalignedbb.field_72336_d) / 2.0D; this.field_70163_u = axisalignedbb.field_72338_b; @@ -250,12 +277,12 @@ BlockPos blockpos1 = worldserver1.func_205770_a(Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.func_175694_M()); entity.func_174828_a(blockpos1, entity.field_70177_z, entity.field_70125_A); } else { -@@ -2591,4 +2624,49 @@ +@@ -2591,4 +2624,56 @@ public double func_212107_bY() { return this.field_211517_W; } + -+ private boolean canUpdate = false; ++ private boolean canUpdate = true; + @Override + public void canUpdate(boolean value) { + this.canUpdate = value; @@ -275,6 +302,13 @@ + this.captureDrops = value; + return ret; + } ++ private NBTTagCompound entityData; ++ @Override ++ public NBTTagCompound getEntityData() { ++ if (entityData == null) ++ entityData = new NBTTagCompound(); ++ return entityData; ++ } + @Override + public boolean canTrample(IBlockState state, BlockPos pos, float fallDistance) { + return field_70170_p.field_73012_v.nextFloat() < fallDistance - 0.5F diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch index eb5c04b49..34b967eb0 100644 --- a/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch @@ -56,7 +56,16 @@ } protected boolean func_204229_de() { -@@ -433,10 +445,10 @@ +@@ -420,6 +432,8 @@ + } + + public void func_70098_U() { ++ if (!this.field_70170_p.field_72995_K) ++ System.out.println(this.func_70093_af() + " " + this.func_184218_aH()); + if (!this.field_70170_p.field_72995_K && this.func_70093_af() && this.func_184218_aH()) { + this.func_184210_p(); + this.func_70095_a(false); +@@ -433,10 +447,10 @@ this.field_71107_bF = this.field_71109_bG; this.field_71109_bG = 0.0F; this.func_71015_k(this.field_70165_t - d0, this.field_70163_u - d1, this.field_70161_v - d2); @@ -69,7 +78,7 @@ } } -@@ -555,10 +567,12 @@ +@@ -555,10 +569,12 @@ } public void func_70645_a(DamageSource p_70645_1_) { @@ -82,7 +91,7 @@ if ("Notch".equals(this.func_200200_C_().getString())) { this.func_146097_a(new ItemStack(Items.field_151034_e), true, false); } -@@ -568,6 +582,8 @@ +@@ -568,6 +584,8 @@ this.field_71071_by.func_70436_m(); } @@ -91,7 +100,7 @@ if (p_70645_1_ != null) { this.field_70159_w = (double)(-MathHelper.func_76134_b((this.field_70739_aP + this.field_70177_z) * ((float)Math.PI / 180F)) * 0.1F); this.field_70179_y = (double)(-MathHelper.func_76126_a((this.field_70739_aP + this.field_70177_z) * ((float)Math.PI / 180F)) * 0.1F); -@@ -607,12 +623,14 @@ +@@ -607,12 +625,14 @@ @Nullable public EntityItem func_71040_bB(boolean p_71040_1_) { @@ -108,7 +117,7 @@ } @Nullable -@@ -659,11 +677,18 @@ +@@ -659,11 +679,18 @@ } public ItemStack func_184816_a(EntityItem p_184816_1_) { @@ -127,7 +136,7 @@ float f = this.field_71071_by.func_184438_a(p_184813_1_); if (f > 1.0F) { int i = EnchantmentHelper.func_185293_e(this); -@@ -705,11 +730,12 @@ +@@ -705,11 +732,12 @@ f /= 5.0F; } @@ -141,7 +150,7 @@ } public void func_70037_a(NBTTagCompound p_70037_1_) { -@@ -739,6 +765,14 @@ +@@ -739,6 +767,14 @@ this.field_82248_d = p_70037_1_.func_74767_n("SpawnForced"); } @@ -156,7 +165,7 @@ this.field_71100_bB.func_75112_a(p_70037_1_); this.field_71075_bZ.func_75095_b(p_70037_1_); if (p_70037_1_.func_150297_b("EnderItems", 9)) { -@@ -785,9 +819,26 @@ +@@ -785,9 +821,26 @@ p_70014_1_.func_74782_a("ShoulderEntityRight", this.func_192025_dl()); } @@ -183,7 +192,7 @@ if (this.func_180431_b(p_70097_1_)) { return false; } else if (this.field_71075_bZ.field_75102_a && !p_70097_1_.func_76357_e()) { -@@ -823,7 +874,7 @@ +@@ -823,7 +876,7 @@ protected void func_190629_c(EntityLivingBase p_190629_1_) { super.func_190629_c(p_190629_1_); @@ -192,7 +201,7 @@ this.func_190777_m(true); } -@@ -844,11 +895,13 @@ +@@ -844,11 +897,13 @@ } protected void func_184590_k(float p_184590_1_) { @@ -207,7 +216,7 @@ if (enumhand == EnumHand.MAIN_HAND) { this.func_184201_a(EntityEquipmentSlot.MAINHAND, ItemStack.field_190927_a); } else { -@@ -876,11 +929,14 @@ +@@ -876,11 +931,14 @@ protected void func_70665_d(DamageSource p_70665_1_, float p_70665_2_) { if (!this.func_180431_b(p_70665_1_)) { @@ -222,7 +231,7 @@ if (p_70665_2_ != 0.0F) { this.func_71020_j(p_70665_1_.func_76345_d()); float f1 = this.func_110143_aJ(); -@@ -929,6 +985,8 @@ +@@ -929,6 +987,8 @@ return EnumActionResult.PASS; } else { @@ -231,7 +240,7 @@ ItemStack itemstack = this.func_184586_b(p_190775_2_); ItemStack itemstack1 = itemstack.func_190926_b() ? ItemStack.field_190927_a : itemstack.func_77946_l(); if (p_190775_1_.func_184230_a(this, p_190775_2_)) { -@@ -936,6 +994,10 @@ +@@ -936,6 +996,10 @@ itemstack.func_190920_e(itemstack1.func_190916_E()); } @@ -242,7 +251,7 @@ return EnumActionResult.SUCCESS; } else { if (!itemstack.func_190926_b() && p_190775_1_ instanceof EntityLivingBase) { -@@ -945,6 +1007,7 @@ +@@ -945,6 +1009,7 @@ if (itemstack.func_111282_a(this, (EntityLivingBase)p_190775_1_, p_190775_2_)) { if (itemstack.func_190926_b() && !this.field_71075_bZ.field_75098_d) { @@ -250,7 +259,7 @@ this.func_184611_a(p_190775_2_, ItemStack.field_190927_a); } -@@ -967,6 +1030,7 @@ +@@ -967,6 +1032,7 @@ } public void func_71059_n(Entity p_71059_1_) { @@ -258,7 +267,7 @@ if (p_71059_1_.func_70075_an()) { if (!p_71059_1_.func_85031_j(this)) { float f = (float)this.func_110148_a(SharedMonsterAttributes.field_111264_e).func_111126_e(); -@@ -994,8 +1058,11 @@ +@@ -994,8 +1060,11 @@ boolean flag2 = flag && this.field_70143_R > 0.0F && !this.field_70122_E && !this.func_70617_f_() && !this.func_70090_H() && !this.func_70644_a(MobEffects.field_76440_q) && !this.func_184218_aH() && p_71059_1_ instanceof EntityLivingBase; flag2 = flag2 && !this.func_70051_ag(); @@ -271,7 +280,7 @@ } f = f + f1; -@@ -1091,8 +1158,10 @@ +@@ -1091,8 +1160,10 @@ } if (!itemstack1.func_190926_b() && entity instanceof EntityLivingBase) { @@ -282,7 +291,7 @@ this.func_184611_a(EnumHand.MAIN_HAND, ItemStack.field_190927_a); } } -@@ -1134,7 +1203,7 @@ +@@ -1134,7 +1205,7 @@ } if (this.field_70146_Z.nextFloat() < f) { @@ -291,7 +300,7 @@ this.func_184602_cy(); this.field_70170_p.func_72960_a(this, (byte)30); } -@@ -1182,7 +1251,12 @@ +@@ -1182,7 +1253,12 @@ } public EntityPlayer.SleepResult func_180469_a(BlockPos p_180469_1_) { @@ -305,7 +314,7 @@ if (!this.field_70170_p.field_72995_K) { if (this.func_70608_bn() || !this.func_70089_S()) { return EntityPlayer.SleepResult.OTHER_PROBLEM; -@@ -1192,7 +1266,7 @@ +@@ -1192,7 +1268,7 @@ return EntityPlayer.SleepResult.NOT_POSSIBLE_HERE; } @@ -314,7 +323,7 @@ return EntityPlayer.SleepResult.NOT_POSSIBLE_NOW; } -@@ -1217,7 +1291,7 @@ +@@ -1217,7 +1293,7 @@ this.func_192030_dh(); this.func_175145_a(StatList.field_199092_j.func_199076_b(StatList.field_203284_n)); this.func_70105_a(0.2F, 0.2F); @@ -323,7 +332,7 @@ float f1 = 0.5F + (float)enumfacing.func_82601_c() * 0.4F; float f = 0.5F + (float)enumfacing.func_82599_e() * 0.4F; this.func_175139_a(enumfacing); -@@ -1242,6 +1316,8 @@ +@@ -1242,6 +1318,8 @@ private boolean func_190774_a(BlockPos p_190774_1_, EnumFacing p_190774_2_) { if (Math.abs(this.field_70165_t - (double)p_190774_1_.func_177958_n()) <= 3.0D && Math.abs(this.field_70163_u - (double)p_190774_1_.func_177956_o()) <= 2.0D && Math.abs(this.field_70161_v - (double)p_190774_1_.func_177952_p()) <= 3.0D) { return true; @@ -332,7 +341,7 @@ } else { BlockPos blockpos = p_190774_1_.func_177972_a(p_190774_2_.func_176734_d()); return Math.abs(this.field_70165_t - (double)blockpos.func_177958_n()) <= 3.0D && Math.abs(this.field_70163_u - (double)blockpos.func_177956_o()) <= 2.0D && Math.abs(this.field_70161_v - (double)blockpos.func_177952_p()) <= 3.0D; -@@ -1254,16 +1330,19 @@ +@@ -1254,16 +1332,19 @@ } public void func_70999_a(boolean p_70999_1_, boolean p_70999_2_, boolean p_70999_3_) { @@ -356,7 +365,7 @@ } this.field_71083_bS = false; -@@ -1279,29 +1358,30 @@ +@@ -1279,29 +1360,30 @@ } private boolean func_175143_p() { @@ -393,7 +402,7 @@ switch(enumfacing) { case SOUTH: return 90.0F; -@@ -1333,23 +1413,67 @@ +@@ -1333,23 +1415,67 @@ public void func_146105_b(ITextComponent p_146105_1_, boolean p_146105_2_) { } @@ -470,7 +479,7 @@ } public void func_195066_a(ResourceLocation p_195066_1_) { -@@ -1519,6 +1643,8 @@ +@@ -1519,6 +1645,8 @@ } super.func_180430_e(p_180430_1_, p_180430_2_); @@ -479,7 +488,7 @@ } } -@@ -1780,7 +1906,10 @@ +@@ -1780,7 +1908,10 @@ } public ITextComponent func_145748_c_() { @@ -491,7 +500,7 @@ return this.func_208016_c(itextcomponent); } -@@ -1800,7 +1929,7 @@ +@@ -1800,7 +1931,7 @@ } public float func_70047_e() { @@ -500,7 +509,7 @@ if (this.func_70608_bn()) { f = 0.2F; } else if (!this.func_203007_ba() && !this.func_184613_cA() && this.field_70131_O != 0.6F) { -@@ -1967,6 +2096,30 @@ +@@ -1967,6 +2098,30 @@ return this.field_71075_bZ.field_75098_d && this.func_184840_I() >= 2; } diff --git a/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch new file mode 100644 index 000000000..9a42413bd --- /dev/null +++ b/patches/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch @@ -0,0 +1,120 @@ +--- a/net/minecraft/entity/player/EntityPlayerMP.java ++++ b/net/minecraft/entity/player/EntityPlayerMP.java +@@ -418,6 +418,7 @@ + } + + public void func_70645_a(DamageSource p_70645_1_) { ++ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; + boolean flag = this.field_70170_p.func_82736_K().func_82766_b("showDeathMessages"); + this.field_71135_a.func_147359_a(new SPacketCombatEvent(this.func_110142_aN(), SPacketCombatEvent.Event.ENTITY_DIED, flag)); + if (flag) { +@@ -435,8 +436,10 @@ + + this.func_192030_dh(); + if (!this.field_70170_p.func_82736_K().func_82766_b("keepInventory") && !this.func_175149_v()) { ++ this.captureDrops(new java.util.ArrayList<>()); + this.func_190776_cN(); + this.field_71071_by.func_70436_m(); ++ if (!field_70170_p.field_72995_K) net.minecraftforge.event.ForgeEventFactory.onPlayerDrops(this, p_70645_1_, captureDrops(null), field_70718_bc > 0); + } + + this.func_96123_co().func_197893_a(IScoreCriteria.field_96642_c, this.func_195047_I_(), Score::func_96648_a); +@@ -521,7 +524,9 @@ + } + + @Nullable +- public Entity func_184204_a(int p_184204_1_) { ++ @Override ++ public Entity changeDimension(int p_184204_1_, net.minecraftforge.common.util.ITeleporter teleporter) { ++ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_184204_1_)) return null; + this.field_184851_cj = true; + if (this.field_71093_bK == 0 && p_184204_1_ == -1) { + this.field_193110_cw = new Vec3d(this.field_70165_t, this.field_70163_u, this.field_70161_v); +@@ -529,7 +534,7 @@ + this.field_193110_cw = null; + } + +- if (this.field_71093_bK == 1 && p_184204_1_ == 1) { ++ if (this.field_71093_bK == 1 && p_184204_1_ == 1 && teleporter.isVanilla()) { + this.field_70170_p.func_72900_e(this); + if (!this.field_71136_j) { + this.field_71136_j = true; +@@ -543,7 +548,7 @@ + p_184204_1_ = 1; + } + +- this.field_71133_b.func_184103_al().func_187242_a(this, p_184204_1_); ++ this.field_71133_b.func_184103_al().changePlayerDimension(this, p_184204_1_, teleporter); + this.field_71135_a.func_147359_a(new SPacketEffect(1032, BlockPos.field_177992_a, 0, false)); + this.field_71144_ck = -1; + this.field_71149_ch = -1.0F; +@@ -645,7 +650,7 @@ + int k = MathHelper.func_76128_c(this.field_70161_v); + BlockPos blockpos = new BlockPos(i, j, k); + IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); +- if (iblockstate.func_196958_f()) { ++ if (iblockstate.isAir(field_70170_p, blockpos)) { + BlockPos blockpos1 = blockpos.func_177977_b(); + IBlockState iblockstate1 = this.field_70170_p.func_180495_p(blockpos1); + Block block = iblockstate1.func_177230_c(); +@@ -676,6 +681,7 @@ + this.field_71070_bA = p_180468_1_.func_174876_a(this.field_71071_by, this); + this.field_71070_bA.field_75152_c = this.field_71139_cq; + this.field_71070_bA.func_75132_a(this); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.field_71070_bA)); + } + } + +@@ -707,6 +713,7 @@ + + this.field_71070_bA.field_75152_c = this.field_71139_cq; + this.field_71070_bA.func_75132_a(this); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.field_71070_bA)); + } + } + +@@ -715,6 +722,7 @@ + this.field_71070_bA = new ContainerMerchant(this.field_71071_by, p_180472_1_, this.field_70170_p); + this.field_71070_bA.field_75152_c = this.field_71139_cq; + this.field_71070_bA.func_75132_a(this); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.field_71070_bA)); + IInventory iinventory = ((ContainerMerchant)this.field_71070_bA).func_75174_d(); + ITextComponent itextcomponent = p_180472_1_.func_145748_c_(); + this.field_71135_a.func_147359_a(new SPacketOpenWindow(this.field_71139_cq, "minecraft:villager", itextcomponent, iinventory.func_70302_i_())); +@@ -738,6 +746,7 @@ + this.field_71070_bA = new ContainerHorseInventory(this.field_71071_by, p_184826_2_, p_184826_1_, this); + this.field_71070_bA.field_75152_c = this.field_71139_cq; + this.field_71070_bA.func_75132_a(this); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.field_71070_bA)); + } + + public void func_184814_a(ItemStack p_184814_1_, EnumHand p_184814_2_) { +@@ -800,6 +809,7 @@ + + public void func_71128_l() { + this.field_71070_bA.func_75134_a(this); ++ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Close(this, this.field_71070_bA)); + this.field_71070_bA = this.field_71069_bz; + } + +@@ -929,6 +939,20 @@ + this.field_193110_cw = p_193104_1_.field_193110_cw; + this.func_192029_h(p_193104_1_.func_192023_dk()); + this.func_192031_i(p_193104_1_.func_192025_dl()); ++ ++ this.spawnPosMap = p_193104_1_.spawnPosMap; ++ this.spawnForcedMap = p_193104_1_.spawnForcedMap; ++ if(p_193104_1_.field_71093_bK != 0) { ++ this.field_71077_c = p_193104_1_.field_71077_c; ++ this.field_82248_d = p_193104_1_.field_82248_d; ++ } ++ ++ //Copy over a section of the Entity Data from the old player. ++ //Allows mods to specify data that persists after players respawn. ++ NBTTagCompound old = p_193104_1_.getEntityData(); ++ if (old.func_74764_b(PERSISTED_NBT_TAG)) ++ getEntityData().func_74782_a(PERSISTED_NBT_TAG, old.func_74781_a(PERSISTED_NBT_TAG)); ++ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, p_193104_1_, !p_193104_2_); + } + + protected void func_70670_a(PotionEffect p_70670_1_) { diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index e1d8f62d3..e2bbb290a 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -393,14 +393,14 @@ } public void func_72939_s() { -@@ -953,6 +1017,7 @@ - Entity entity = this.field_73007_j.get(i); +@@ -954,6 +1018,7 @@ try { -+ if (entity.canUpdate()) continue; ++entity.field_70173_aa; ++ if (entity.canUpdate()) entity.func_70071_h_(); } catch (Throwable throwable2) { + CrashReport crashreport = CrashReport.func_85055_a(throwable2, "Ticking entity"); @@ -964,6 +1029,10 @@ entity.func_85029_a(crashreportcategory); } diff --git a/patches_old/minecraft/net/minecraft/entity/Entity.java.patch b/patches_old/minecraft/net/minecraft/entity/Entity.java.patch deleted file mode 100644 index ab6086bf6..000000000 --- a/patches_old/minecraft/net/minecraft/entity/Entity.java.patch +++ /dev/null @@ -1,463 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/Entity.java -+++ ../src-work/minecraft/net/minecraft/entity/Entity.java -@@ -85,7 +85,7 @@ - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - --public abstract class Entity implements ICommandSender -+public abstract class Entity implements ICommandSender, net.minecraftforge.common.capabilities.ICapabilitySerializable - { - private static final Logger field_184243_a = LogManager.getLogger(); - private static final List field_190535_b = Collections.emptyList(); -@@ -200,7 +204,7 @@ - - if (p_i1582_1_ != null) - { -- this.field_71093_bK = p_i1582_1_.field_73011_w.func_186058_p().func_186068_a(); -+ this.field_71093_bK = p_i1582_1_.field_73011_w.getDimension(); - } - - this.field_70180_af = new EntityDataManager(this); -@@ -211,8 +215,16 @@ - this.field_70180_af.func_187214_a(field_184234_aB, Boolean.valueOf(false)); - this.field_70180_af.func_187214_a(field_189655_aD, Boolean.valueOf(false)); - this.func_70088_a(); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(this)); -+ capabilities = net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(this); - } - -+ /** Forge: Used to store custom data for each entity. */ -+ private NBTTagCompound customEntityData; -+ public boolean captureDrops = false; -+ public java.util.ArrayList capturedDrops = new java.util.ArrayList(); -+ private net.minecraftforge.common.capabilities.CapabilityDispatcher capabilities; -+ - public int func_145782_y() - { - return this.field_145783_c; -@@ -344,6 +356,7 @@ - this.field_70165_t = p_70107_1_; - this.field_70163_u = p_70107_3_; - this.field_70161_v = p_70107_5_; -+ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K) this.field_70170_p.func_72866_a(this, false); // Forge - Process chunk registration after moving. - float f = this.field_70130_N / 2.0F; - float f1 = this.field_70131_O; - this.func_174826_a(new AxisAlignedBB(p_70107_1_ - (double)f, p_70107_3_, p_70107_5_ - (double)f, p_70107_1_ + (double)f, p_70107_3_ + (double)f1, p_70107_5_ + (double)f)); -@@ -995,6 +1008,7 @@ - this.field_70165_t = (axisalignedbb.field_72340_a + axisalignedbb.field_72336_d) / 2.0D; - this.field_70163_u = axisalignedbb.field_72338_b; - this.field_70161_v = (axisalignedbb.field_72339_c + axisalignedbb.field_72334_f) / 2.0D; -+ if (this.isAddedToWorld() && !this.field_70170_p.field_72995_K) this.field_70170_p.func_72866_a(this, false); // Forge - Process chunk registration after moving. - } - - protected SoundEvent func_184184_Z() -@@ -1053,7 +1067,7 @@ - - protected void func_180429_a(BlockPos p_180429_1_, Block p_180429_2_) - { -- SoundType soundtype = p_180429_2_.func_185467_w(); -+ SoundType soundtype = p_180429_2_.getSoundType(field_70170_p.func_180495_p(p_180429_1_), field_70170_p, p_180429_1_, this); - - if (this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a()).func_177230_c() == Blocks.field_150431_aC) - { -@@ -1259,6 +1273,7 @@ - BlockPos blockpos = new BlockPos(i, j, k); - IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); - -+ if(!iblockstate.func_177230_c().addRunningEffects(iblockstate, field_70170_p, blockpos, this)) - if (iblockstate.func_185901_i() != EnumBlockRenderType.INVISIBLE) - { - this.field_70170_p.func_175688_a(EnumParticleTypes.BLOCK_CRACK, this.field_70165_t + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_70130_N, this.func_174813_aQ().field_72338_b + 0.1D, this.field_70161_v + ((double)this.field_70146_Z.nextFloat() - 0.5D) * (double)this.field_70130_N, -this.field_70159_w * 4.0D, 1.5D, -this.field_70179_y * 4.0D, Block.func_176210_f(iblockstate)); -@@ -1277,12 +1292,12 @@ - BlockPos blockpos = new BlockPos(this.field_70165_t, d0, this.field_70161_v); - IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); - -+ Boolean result = iblockstate.func_177230_c().isEntityInsideMaterial(this.field_70170_p, blockpos, iblockstate, this, d0, p_70055_1_, true); -+ if (result != null) return result; -+ - if (iblockstate.func_185904_a() == p_70055_1_) - { -- float f = BlockLiquid.func_149801_b(iblockstate.func_177230_c().func_176201_c(iblockstate)) - 0.11111111F; -- float f1 = (float)(blockpos.func_177956_o() + 1) - f; -- boolean flag = d0 < (double)f1; -- return !flag && this instanceof EntityPlayer ? false : flag; -+ return net.minecraftforge.common.ForgeHooks.isInsideOfMaterial(p_70055_1_, this, blockpos); - } - else - { -@@ -1382,6 +1397,7 @@ - this.field_70126_B -= 360.0F; - } - -+ if (!this.field_70170_p.field_72995_K) this.field_70170_p.func_72964_e((int) Math.floor(this.field_70165_t) >> 4, (int) Math.floor(this.field_70161_v) >> 4); // Forge - ensure target chunk is loaded. - this.func_70107_b(this.field_70165_t, this.field_70163_u, this.field_70161_v); - this.func_70101_b(p_70080_7_, p_70080_8_); - } -@@ -1707,6 +1723,7 @@ - { - p_189511_1_.func_74757_a("Glowing", this.field_184238_ar); - } -+ p_189511_1_.func_74757_a("UpdateBlocked", updateBlocked); - - if (!this.field_184236_aF.isEmpty()) - { -@@ -1720,6 +1737,9 @@ - p_189511_1_.func_74782_a("Tags", nbttaglist); - } - -+ if (customEntityData != null) p_189511_1_.func_74782_a("ForgeData", customEntityData); -+ if (this.capabilities != null) p_189511_1_.func_74782_a("ForgeCaps", this.capabilities.serializeNBT()); -+ - this.func_70014_b(p_189511_1_); - - if (this.func_184207_aI()) -@@ -1826,7 +1846,11 @@ - this.func_174810_b(p_70020_1_.func_74767_n("Silent")); - this.func_189654_d(p_70020_1_.func_74767_n("NoGravity")); - this.func_184195_f(p_70020_1_.func_74767_n("Glowing")); -+ updateBlocked = p_70020_1_.func_74767_n("UpdateBlocked"); - -+ if (p_70020_1_.func_74764_b("ForgeData")) customEntityData = p_70020_1_.func_74775_l("ForgeData"); -+ if (this.capabilities != null && p_70020_1_.func_74764_b("ForgeCaps")) this.capabilities.deserializeNBT(p_70020_1_.func_74775_l("ForgeCaps")); -+ - if (p_70020_1_.func_150297_b("Tags", 9)) - { - this.field_184236_aF.clear(); -@@ -1918,7 +1942,10 @@ - { - EntityItem entityitem = new EntityItem(this.field_70170_p, this.field_70165_t, this.field_70163_u + (double)p_70099_2_, this.field_70161_v, p_70099_1_); - entityitem.func_174869_p(); -- this.field_70170_p.func_72838_d(entityitem); -+ if (captureDrops) -+ this.capturedDrops.add(entityitem); -+ else -+ this.field_70170_p.func_72838_d(entityitem); - return entityitem; - } - } -@@ -1985,6 +2012,7 @@ - this.field_70159_w = 0.0D; - this.field_70181_x = 0.0D; - this.field_70179_y = 0.0D; -+ if(!updateBlocked) - this.func_70071_h_(); - - if (this.func_184218_aH()) -@@ -2032,6 +2060,7 @@ - } - } - -+ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, p_184205_1_, true)) return false; - if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) - { - if (this.func_184218_aH()) -@@ -2067,6 +2096,7 @@ - if (this.field_184239_as != null) - { - Entity entity = this.field_184239_as; -+ if (!net.minecraftforge.event.ForgeEventFactory.canMountEntity(this, entity, false)) return; - this.field_184239_as = null; - entity.func_184225_p(this); - } -@@ -2509,8 +2539,16 @@ - @Nullable - public Entity func_184204_a(int p_184204_1_) - { -+ if (this.field_70170_p.field_72995_K || this.field_70128_L) return null; -+ return changeDimension(p_184204_1_, this.func_184102_h().func_71218_a(p_184204_1_).func_85176_s()); -+ } -+ -+ @Nullable // Forge: Entities that require custom handling should override this method, not the other -+ public Entity changeDimension(int p_184204_1_, net.minecraftforge.common.util.ITeleporter teleporter) -+ { - if (!this.field_70170_p.field_72995_K && !this.field_70128_L) - { -+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_184204_1_)) return null; - this.field_70170_p.field_72984_F.func_76320_a("changeDimension"); - MinecraftServer minecraftserver = this.func_184102_h(); - int i = this.field_71093_bK; -@@ -2518,7 +2556,7 @@ - WorldServer worldserver1 = minecraftserver.func_71218_a(p_184204_1_); - this.field_71093_bK = p_184204_1_; - -- if (i == 1 && p_184204_1_ == 1) -+ if (i == 1 && p_184204_1_ == 1 && teleporter.isVanilla()) - { - worldserver1 = minecraftserver.func_71218_a(0); - this.field_71093_bK = 0; -@@ -2529,22 +2567,23 @@ - this.field_70170_p.field_72984_F.func_76320_a("reposition"); - BlockPos blockpos; - -- if (p_184204_1_ == 1) -+ if (p_184204_1_ == 1 && teleporter.isVanilla()) - { - blockpos = worldserver1.func_180504_m(); - } - else - { -- double d0 = this.field_70165_t; -- double d1 = this.field_70161_v; -+ double moveFactor = worldserver.field_73011_w.getMovementFactor() / worldserver1.field_73011_w.getMovementFactor(); -+ double d0 = MathHelper.func_151237_a(this.field_70165_t * moveFactor, worldserver1.func_175723_af().func_177726_b() + 16.0D, worldserver1.func_175723_af().func_177728_d() - 16.0D); -+ double d1 = MathHelper.func_151237_a(this.field_70161_v * moveFactor, worldserver1.func_175723_af().func_177736_c() + 16.0D, worldserver1.func_175723_af().func_177733_e() - 16.0D); - double d2 = 8.0D; - -- if (p_184204_1_ == -1) -+ if (false && p_184204_1_ == -1) - { - d0 = MathHelper.func_151237_a(d0 / 8.0D, worldserver1.func_175723_af().func_177726_b() + 16.0D, worldserver1.func_175723_af().func_177728_d() - 16.0D); - d1 = MathHelper.func_151237_a(d1 / 8.0D, worldserver1.func_175723_af().func_177736_c() + 16.0D, worldserver1.func_175723_af().func_177733_e() - 16.0D); - } -- else if (p_184204_1_ == 0) -+ else if (false && p_184204_1_ == 0) - { - d0 = MathHelper.func_151237_a(d0 * 8.0D, worldserver1.func_175723_af().func_177726_b() + 16.0D, worldserver1.func_175723_af().func_177728_d() - 16.0D); - d1 = MathHelper.func_151237_a(d1 * 8.0D, worldserver1.func_175723_af().func_177736_c() + 16.0D, worldserver1.func_175723_af().func_177733_e() - 16.0D); -@@ -2554,8 +2593,7 @@ - d1 = (double)MathHelper.func_76125_a((int)d1, -29999872, 29999872); - float f = this.field_70177_z; - this.func_70012_b(d0, this.field_70163_u, d1, 90.0F, 0.0F); -- Teleporter teleporter = worldserver1.func_85176_s(); -- teleporter.func_180620_b(this, f); -+ teleporter.placeEntity(worldserver1, this, f); - blockpos = new BlockPos(this); - } - -@@ -2567,7 +2605,7 @@ - { - entity.func_180432_n(this); - -- if (i == 1 && p_184204_1_ == 1) -+ if (i == 1 && p_184204_1_ == 1 && teleporter.isVanilla()) - { - BlockPos blockpos1 = worldserver1.func_175672_r(worldserver1.func_175694_M()); - entity.func_174828_a(blockpos1, entity.field_70177_z, entity.field_70125_A); -@@ -2604,7 +2642,7 @@ - - public float func_180428_a(Explosion p_180428_1_, World p_180428_2_, BlockPos p_180428_3_, IBlockState p_180428_4_) - { -- return p_180428_4_.func_177230_c().func_149638_a(this); -+ return p_180428_4_.func_177230_c().getExplosionResistance(p_180428_2_, p_180428_3_, this, p_180428_1_); - } - - public boolean func_174816_a(Explosion p_174816_1_, World p_174816_2_, BlockPos p_174816_3_, IBlockState p_174816_4_, float p_174816_5_) -@@ -2901,6 +2939,218 @@ - EnchantmentHelper.func_151385_b(p_174815_1_, p_174815_2_); - } - -+ /* ================================== Forge Start =====================================*/ -+ /** -+ * Internal use for keeping track of entities that are tracked by a world, to -+ * allow guarantees that entity position changes will force a chunk load, avoiding -+ * potential issues with entity desyncing and bad chunk data. -+ */ -+ private boolean isAddedToWorld; -+ -+ /** -+ * Gets whether this entity has been added to a world (for tracking). Specifically -+ * between the times when an entity is added to a world and the entity being removed -+ * from the world's tracked lists. See {@link World#onEntityAdded(Entity)} and -+ * {@link World#onEntityRemoved(Entity)}. -+ * -+ * @return True if this entity is being tracked by a world -+ */ -+ public final boolean isAddedToWorld() { return this.isAddedToWorld; } -+ -+ /** -+ * Called after the entity has been added to the world's -+ * ticking list. Can be overriden, but needs to call super -+ * to prevent MC-136995. -+ */ -+ public void onAddedToWorld() { -+ this.isAddedToWorld = true; -+ } -+ -+ /** -+ * Called after the entity has been removed to the world's -+ * ticking list. Can be overriden, but needs to call super -+ * to prevent MC-136995. -+ */ -+ public void onRemovedFromWorld() { -+ this.isAddedToWorld = false; -+ } -+ -+ /** -+ * Returns a NBTTagCompound that can be used to store custom data for this entity. -+ * It will be written, and read from disc, so it persists over world saves. -+ * @return A NBTTagCompound -+ */ -+ public NBTTagCompound getEntityData() -+ { -+ if (customEntityData == null) -+ { -+ customEntityData = new NBTTagCompound(); -+ } -+ return customEntityData; -+ } -+ -+ /** -+ * Used in model rendering to determine if the entity riding this entity should be in the 'sitting' position. -+ * @return false to prevent an entity that is mounted to this entity from displaying the 'sitting' animation. -+ */ -+ public boolean shouldRiderSit() -+ { -+ return true; -+ } -+ -+ /** -+ * Called when a user uses the creative pick block button on this entity. -+ * -+ * @param target The full target the player is looking at -+ * @return A ItemStack to add to the player's inventory, empty ItemStack if nothing should be added. -+ */ -+ public ItemStack getPickedResult(RayTraceResult target) -+ { -+ if (this instanceof net.minecraft.entity.item.EntityPainting) -+ { -+ return new ItemStack(net.minecraft.init.Items.field_151159_an); -+ } -+ else if (this instanceof EntityLeashKnot) -+ { -+ return new ItemStack(net.minecraft.init.Items.field_151058_ca); -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityItemFrame) -+ { -+ ItemStack held = ((net.minecraft.entity.item.EntityItemFrame)this).func_82335_i(); -+ if (held.func_190926_b()) -+ { -+ return new ItemStack(net.minecraft.init.Items.field_151160_bD); -+ } -+ else -+ { -+ return held.func_77946_l(); -+ } -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityMinecart) -+ { -+ return ((net.minecraft.entity.item.EntityMinecart)this).getCartItem(); -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityBoat) -+ { -+ return new ItemStack(((EntityBoat)this).func_184455_j()); -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityArmorStand) -+ { -+ return new ItemStack(net.minecraft.init.Items.field_179565_cj); -+ } -+ else if (this instanceof net.minecraft.entity.item.EntityEnderCrystal) -+ { -+ return new ItemStack(net.minecraft.init.Items.field_185158_cP); -+ } -+ else -+ { -+ ResourceLocation name = EntityList.func_191301_a(this); -+ if (name != null && EntityList.field_75627_a.containsKey(name)) -+ { -+ ItemStack stack = new ItemStack(net.minecraft.init.Items.field_151063_bx); -+ net.minecraft.item.ItemMonsterPlacer.func_185078_a(stack, name); -+ return stack; -+ } -+ } -+ return ItemStack.field_190927_a; -+ } -+ -+ public UUID getPersistentID() -+ { -+ return field_96093_i; -+ } -+ -+ /** -+ * Reset the entity ID to a new value. Not to be used from Mod code -+ */ -+ @Deprecated // TODO: remove (1.13?) -+ public final void resetEntityId() -+ { -+ this.field_145783_c = field_70152_a++; -+ } -+ -+ public boolean shouldRenderInPass(int pass) -+ { -+ return pass == 0; -+ } -+ -+ /** -+ * Returns true if the entity is of the @link{EnumCreatureType} provided -+ * @param type The EnumCreatureType type this entity is evaluating -+ * @param forSpawnCount If this is being invoked to check spawn count caps. -+ * @return If the creature is of the type provided -+ */ -+ public boolean isCreatureType(EnumCreatureType type, boolean forSpawnCount) -+ { -+ if (forSpawnCount && (this instanceof EntityLiving) && ((EntityLiving)this).func_104002_bU()) return false; -+ return type.func_75598_a().isAssignableFrom(this.getClass()); -+ } -+ -+ /** -+ * If a rider of this entity can interact with this entity. Should return true on the -+ * ridden entity if so. -+ * -+ * @return if the entity can be interacted with from a rider -+ */ -+ public boolean canRiderInteract() -+ { -+ return false; -+ } -+ -+ /** -+ * If the rider should be dismounted from the entity when the entity goes under water -+ * -+ * @param rider The entity that is riding -+ * @return if the entity should be dismounted when under water -+ */ -+ public boolean shouldDismountInWater(Entity rider) -+ { -+ return this instanceof EntityLivingBase; -+ } -+ -+ @Override -+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable net.minecraft.util.EnumFacing facing) -+ { -+ return capabilities != null && capabilities.hasCapability(capability, facing); -+ } -+ -+ @Override -+ @Nullable -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable net.minecraft.util.EnumFacing facing) -+ { -+ return capabilities == null ? null : capabilities.getCapability(capability, facing); -+ } -+ -+ public void deserializeNBT(NBTTagCompound nbt) -+ { -+ this.func_70020_e(nbt); -+ } -+ -+ public NBTTagCompound serializeNBT() -+ { -+ NBTTagCompound ret = new NBTTagCompound(); -+ ret.func_74778_a("id", this.func_70022_Q()); -+ return this.func_189511_e(ret); -+ } -+ -+ /** -+ * Checks if this {@link Entity} can trample a {@link Block}. -+ * -+ * @param world The world in which the block will be trampled -+ * @param block The block being tested -+ * @param pos The block pos -+ * @param fallDistance The fall distance -+ * @return {@code true} if this entity can trample, {@code false} otherwise -+ */ -+ public boolean canTrample(World world, Block block, BlockPos pos, float fallDistance) -+ { -+ return world.field_73012_v.nextFloat() < fallDistance - 0.5F -+ && this instanceof EntityLivingBase -+ && (this instanceof EntityPlayer || net.minecraftforge.event.ForgeEventFactory.getMobGriefingEvent(world, this)) -+ && this.field_70130_N * this.field_70130_N * this.field_70131_O > 0.512F; -+ } -+ /* ================================== Forge End =====================================*/ -+ - public void func_184178_b(EntityPlayerMP p_184178_1_) - { - } diff --git a/patches_old/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch b/patches_old/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch deleted file mode 100644 index 5d7421471..000000000 --- a/patches_old/minecraft/net/minecraft/entity/player/EntityPlayer.java.patch +++ /dev/null @@ -1,99 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayer.java -+++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayer.java -@@ -180,6 +187,7 @@ - - public void func_70071_h_() - { -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPreTick(this); - this.field_70145_X = this.func_175149_v(); - - if (this.func_175149_v()) -@@ -367,6 +375,7 @@ - this.func_70105_a(f, f1); - } - } -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().onPlayerPostTick(this); - } - - public int func_82145_z() -@@ -896,6 +943,7 @@ - p_70014_1_.func_74768_a("XpTotal", this.field_71067_cb); - p_70014_1_.func_74768_a("XpSeed", this.field_175152_f); - p_70014_1_.func_74768_a("Score", this.func_71037_bA()); -+ net.minecraftforge.fml.common.FMLCommonHandler.instance().getDataFixer().writeVersionData(p_70014_1_); //Moved down so it doesn't keep missing every MC update. - - if (this.field_71077_c != null) - { -@@ -2421,6 +2534,168 @@ - return this.field_71075_bZ.field_75098_d && this.func_70003_b(2, ""); - } - -+ /** -+ * Opens a GUI with this player, uses FML's IGuiHandler system. -+ * Allows for extension by modders. -+ * -+ * @param mod The mod trying to open a GUI -+ * @param modGuiId GUI ID -+ * @param world Current World -+ * @param x Passed directly to IGuiHandler, data meaningless Typically world X position -+ * @param y Passed directly to IGuiHandler, data meaningless Typically world Y position -+ * @param z Passed directly to IGuiHandler, data meaningless Typically world Z position -+ */ -+ public void openGui(Object mod, int modGuiId, World world, int x, int y, int z) -+ { -+ net.minecraftforge.fml.common.network.internal.FMLNetworkHandler.openGui(this, mod, modGuiId, world, x, y, z); -+ } -+ private String displayname; -+ -+ /** -+ * Get the currently computed display name, cached for efficiency. -+ * @return the current display name -+ */ -+ public String getDisplayNameString() -+ { -+ if(this.displayname == null) -+ { -+ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.func_70005_c_()); -+ } -+ return this.displayname; -+ } -+ -+ /** -+ * Force the displayed name to refresh -+ */ -+ public void refreshDisplayName() -+ { -+ this.displayname = net.minecraftforge.event.ForgeEventFactory.getPlayerDisplayName(this, this.func_70005_c_()); -+ } -+ -+ private final net.minecraftforge.items.IItemHandler playerMainHandler = new net.minecraftforge.items.wrapper.PlayerMainInvWrapper(field_71071_by); -+ private final net.minecraftforge.items.IItemHandler playerEquipmentHandler = new net.minecraftforge.items.wrapper.CombinedInvWrapper( -+ new net.minecraftforge.items.wrapper.PlayerArmorInvWrapper(field_71071_by), -+ new net.minecraftforge.items.wrapper.PlayerOffhandInvWrapper(field_71071_by)); -+ private final net.minecraftforge.items.IItemHandler playerJoinedHandler = new net.minecraftforge.items.wrapper.PlayerInvWrapper(field_71071_by); -+ -+ @SuppressWarnings("unchecked") -+ @Override -+ @Nullable -+ public T getCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable net.minecraft.util.EnumFacing facing) -+ { -+ if (capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) -+ { -+ if (facing == null) return (T) playerJoinedHandler; -+ else if (facing.func_176740_k().func_176720_b()) return (T) playerMainHandler; -+ else if (facing.func_176740_k().func_176722_c()) return (T) playerEquipmentHandler; -+ } -+ return super.getCapability(capability, facing); -+ } -+ -+ @Override -+ public boolean hasCapability(net.minecraftforge.common.capabilities.Capability capability, @Nullable net.minecraft.util.EnumFacing facing) -+ { -+ return capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing); -+ } -+ -+ /* ======================================== FORGE END =====================================*/ -+ - public static enum EnumChatVisibility - { - FULL(0, "options.chat.visibility.full"), diff --git a/patches_old/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch b/patches_old/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch deleted file mode 100644 index 51170d5b8..000000000 --- a/patches_old/minecraft/net/minecraft/entity/player/EntityPlayerMP.java.patch +++ /dev/null @@ -1,146 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -+++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java -@@ -158,9 +158,9 @@ - super(p_i45285_2_, p_i45285_3_); - p_i45285_4_.field_73090_b = this; - this.field_71134_c = p_i45285_4_; -- BlockPos blockpos = p_i45285_2_.func_175694_M(); -+ BlockPos blockpos = p_i45285_2_.field_73011_w.getRandomizedSpawnPoint(); - -- if (p_i45285_2_.field_73011_w.func_191066_m() && p_i45285_2_.func_72912_H().func_76077_q() != GameType.ADVENTURE) -+ if (false && p_i45285_2_.field_73011_w.func_191066_m() && p_i45285_2_.func_72912_H().func_76077_q() != GameType.ADVENTURE) - { - int i = Math.max(0, p_i45285_1_.func_184108_a(p_i45285_2_)); - int j = MathHelper.func_76128_c(p_i45285_2_.func_175723_af().func_177729_b((double)blockpos.func_177958_n(), (double)blockpos.func_177952_p())); -@@ -323,7 +323,7 @@ - - this.field_71070_bA.func_75142_b(); - -- if (!this.field_70170_p.field_72995_K && !this.field_71070_bA.func_75145_c(this)) -+ if (!this.field_70170_p.field_72995_K && this.field_71070_bA != null && !this.field_71070_bA.func_75145_c(this)) - { - this.func_71053_j(); - this.field_71070_bA = this.field_71069_bz; -@@ -471,6 +471,7 @@ - - public void func_70645_a(DamageSource p_70645_1_) - { -+ if (net.minecraftforge.common.ForgeHooks.onLivingDeath(this, p_70645_1_)) return; - boolean flag = this.field_70170_p.func_82736_K().func_82766_b("showDeathMessages"); - this.field_71135_a.func_147359_a(new SPacketCombatEvent(this.func_110142_aN(), SPacketCombatEvent.Event.ENTITY_DIED, flag)); - -@@ -499,8 +500,20 @@ - - if (!this.field_70170_p.func_82736_K().func_82766_b("keepInventory") && !this.func_175149_v()) - { -+ captureDrops = true; -+ capturedDrops.clear(); - this.func_190776_cN(); - this.field_71071_by.func_70436_m(); -+ -+ captureDrops = false; -+ net.minecraftforge.event.entity.player.PlayerDropsEvent event = new net.minecraftforge.event.entity.player.PlayerDropsEvent(this, p_70645_1_, capturedDrops, field_70718_bc > 0); -+ if (!net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event)) -+ { -+ for (net.minecraft.entity.item.EntityItem item : capturedDrops) -+ { -+ this.field_70170_p.func_72838_d(item); -+ } -+ } - } - - for (ScoreObjective scoreobjective : this.field_70170_p.func_96441_U().func_96520_a(IScoreCriteria.field_96642_c)) -@@ -645,8 +658,9 @@ - } - - @Nullable -- public Entity func_184204_a(int p_184204_1_) -+ public Entity changeDimension(int p_184204_1_, net.minecraftforge.common.util.ITeleporter teleporter) - { -+ if (!net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_184204_1_)) return this; - this.field_184851_cj = true; - - if (this.field_71093_bK == 0 && p_184204_1_ == -1) -@@ -658,7 +672,7 @@ - this.field_193110_cw = null; - } - -- if (this.field_71093_bK == 1 && p_184204_1_ == 1) -+ if (this.field_71093_bK == 1 && p_184204_1_ == 1 && teleporter.isVanilla()) - { - this.field_70170_p.func_72900_e(this); - -@@ -678,7 +692,7 @@ - p_184204_1_ = 1; - } - -- this.field_71133_b.func_184103_al().func_187242_a(this, p_184204_1_); -+ this.field_71133_b.func_184103_al().transferPlayerToDimension(this, p_184204_1_, teleporter); - this.field_71135_a.func_147359_a(new SPacketEffect(1032, BlockPos.field_177992_a, 0, false)); - this.field_71144_ck = -1; - this.field_71149_ch = -1.0F; -@@ -808,7 +822,7 @@ - BlockPos blockpos = new BlockPos(i, j, k); - IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); - -- if (iblockstate.func_185904_a() == Material.field_151579_a) -+ if (iblockstate.func_177230_c().isAir(iblockstate, this.field_70170_p, blockpos)) - { - BlockPos blockpos1 = blockpos.func_177977_b(); - IBlockState iblockstate1 = this.field_70170_p.func_180495_p(blockpos1); -@@ -848,6 +862,7 @@ - this.field_71070_bA = p_180468_1_.func_174876_a(this.field_71071_by, this); - this.field_71070_bA.field_75152_c = this.field_71139_cq; - this.field_71070_bA.func_75132_a(this); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.field_71070_bA)); - } - } - -@@ -891,6 +906,7 @@ - - this.field_71070_bA.field_75152_c = this.field_71139_cq; - this.field_71070_bA.func_75132_a(this); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.field_71070_bA)); - } - } - -@@ -900,6 +916,7 @@ - this.field_71070_bA = new ContainerMerchant(this.field_71071_by, p_180472_1_, this.field_70170_p); - this.field_71070_bA.field_75152_c = this.field_71139_cq; - this.field_71070_bA.func_75132_a(this); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Open(this, this.field_71070_bA)); - IInventory iinventory = ((ContainerMerchant)this.field_71070_bA).func_75174_d(); - ITextComponent itextcomponent = p_180472_1_.func_145748_c_(); - this.field_71135_a.func_147359_a(new SPacketOpenWindow(this.field_71139_cq, "minecraft:villager", itextcomponent, iinventory.func_70302_i_())); -@@ -1003,6 +1020,7 @@ - public void func_71128_l() - { - this.field_71070_bA.func_75134_a(this); -+ net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerContainerEvent.Close(this, this.field_71070_bA)); - this.field_71070_bA = this.field_71069_bz; - } - -@@ -1144,6 +1162,23 @@ - this.field_193110_cw = p_193104_1_.field_193110_cw; - this.func_192029_h(p_193104_1_.func_192023_dk()); - this.func_192031_i(p_193104_1_.func_192025_dl()); -+ -+ this.spawnChunkMap = p_193104_1_.spawnChunkMap; -+ this.spawnForcedMap = p_193104_1_.spawnForcedMap; -+ if(p_193104_1_.field_71093_bK != 0) -+ { -+ this.field_71077_c = p_193104_1_.field_71077_c; -+ this.field_82248_d = p_193104_1_.field_82248_d; -+ } -+ -+ //Copy over a section of the Entity Data from the old player. -+ //Allows mods to specify data that persists after players respawn. -+ NBTTagCompound old = p_193104_1_.getEntityData(); -+ if (old.func_74764_b(PERSISTED_NBT_TAG)) -+ { -+ getEntityData().func_74782_a(PERSISTED_NBT_TAG, old.func_74775_l(PERSISTED_NBT_TAG)); -+ } -+ net.minecraftforge.event.ForgeEventFactory.onPlayerClone(this, p_193104_1_, !p_193104_2_); - } - - protected void func_70670_a(PotionEffect p_70670_1_) diff --git a/patches_old/minecraft/net/minecraft/tileentity/TileEntity.java.patch b/patches_old/minecraft/net/minecraft/tileentity/TileEntity.java.patch deleted file mode 100644 index 70d0e1ad1..000000000 --- a/patches_old/minecraft/net/minecraft/tileentity/TileEntity.java.patch +++ /dev/null @@ -1,87 +0,0 @@ ---- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java -+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java -@@ -297,6 +305,204 @@ - { - } -+ -+ public boolean shouldRenderInPass(int pass) -+ { -+ return pass == 0; -+ } -+ -+ /** -+ * Sometimes default render bounding box: infinite in scope. Used to control rendering on {@link TileEntitySpecialRenderer}. -+ */ -+ public static final net.minecraft.util.math.AxisAlignedBB INFINITE_EXTENT_AABB = new net.minecraft.util.math.AxisAlignedBB(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); -+ /** -+ * Return an {@link AxisAlignedBB} that controls the visible scope of a {@link TileEntitySpecialRenderer} associated with this {@link TileEntity} -+ * Defaults to the collision bounding box {@link Block#getCollisionBoundingBoxFromPool(World, int, int, int)} associated with the block -+ * at this location. -+ * -+ * @return an appropriately size {@link AxisAlignedBB} for the {@link TileEntity} -+ */ -+ @SideOnly(Side.CLIENT) -+ public net.minecraft.util.math.AxisAlignedBB getRenderBoundingBox() -+ { -+ net.minecraft.util.math.AxisAlignedBB bb = INFINITE_EXTENT_AABB; -+ Block type = func_145838_q(); -+ BlockPos pos = func_174877_v(); -+ if (type == Blocks.field_150381_bn) -+ { -+ bb = new net.minecraft.util.math.AxisAlignedBB(pos, pos.func_177982_a(1, 1, 1)); -+ } -+ else if (type == Blocks.field_150486_ae || type == Blocks.field_150447_bR) -+ { -+ bb = new net.minecraft.util.math.AxisAlignedBB(pos.func_177982_a(-1, 0, -1), pos.func_177982_a(2, 2, 2)); -+ } -+ else if (type == Blocks.field_185779_df) -+ { -+ bb = INFINITE_EXTENT_AABB; -+ } -+ else if (type != null && type != Blocks.field_150461_bJ) -+ { -+ net.minecraft.util.math.AxisAlignedBB cbb = null; -+ try -+ { -+ cbb = field_145850_b.func_180495_p(func_174877_v()).func_185890_d(field_145850_b, pos).func_186670_a(pos); -+ } -+ catch (Exception e) -+ { -+ // We have to capture any exceptions that may occur here because BUKKIT servers like to send -+ // the tile entity data BEFORE the chunk data, you know, the OPPOSITE of what vanilla does! -+ // So we can not GARENTEE that the world state is the real state for the block... -+ // So, once again in the long line of US having to accommodate BUKKIT breaking things, -+ // here it is, assume that the TE is only 1 cubic block. Problem with this is that it may -+ // cause the TileEntity renderer to error further down the line! But alas, nothing we can do. -+ cbb = new net.minecraft.util.math.AxisAlignedBB(func_174877_v().func_177982_a(-1, 0, -1), func_174877_v().func_177982_a(1, 1, 1)); -+ } -+ if (cbb != null) bb = cbb; -+ } -+ return bb; -+ } -+ -+ /** -+ * Checks if this tile entity knows how to render its 'breaking' overlay effect. -+ * If this returns true, The TileEntitySpecialRenderer will be called again with break progress set. -+ * @return True to re-render tile with breaking effect. -+ */ -+ public boolean canRenderBreaking() -+ { -+ Block block = this.func_145838_q(); -+ return (block instanceof net.minecraft.block.BlockChest || -+ block instanceof net.minecraft.block.BlockEnderChest || -+ block instanceof net.minecraft.block.BlockSign || -+ block instanceof net.minecraft.block.BlockSkull); -+ } -+ /** -+ * If the TileEntitySpecialRenderer associated with this TileEntity can be batched in with another renderers, and won't access the GL state. -+ * If TileEntity returns true, then TESR should have the same functionality as (and probably extend) the FastTESR class. -+ */ -+ public boolean hasFastRenderer() -+ { -+ return false; -+ } -+ - static - { - func_190560_a("furnace", TileEntityFurnace.class); diff --git a/patches_old_unknown/EntityPlayerMP.java.patch b/patches_old_unknown/EntityPlayerMP.java.patch new file mode 100644 index 000000000..262b902ea --- /dev/null +++ b/patches_old_unknown/EntityPlayerMP.java.patch @@ -0,0 +1,15 @@ +--- ../src-base/minecraft/net/minecraft/entity/player/EntityPlayerMP.java ++++ ../src-work/minecraft/net/minecraft/entity/player/EntityPlayerMP.java +@@ -158,9 +158,9 @@ + super(p_i45285_2_, p_i45285_3_); + p_i45285_4_.field_73090_b = this; + this.field_71134_c = p_i45285_4_; +- BlockPos blockpos = p_i45285_2_.func_175694_M(); ++ BlockPos blockpos = p_i45285_2_.field_73011_w.getRandomizedSpawnPoint(); + +- if (p_i45285_2_.field_73011_w.func_191066_m() && p_i45285_2_.func_72912_H().func_76077_q() != GameType.ADVENTURE) ++ if (false && p_i45285_2_.field_73011_w.func_191066_m() && p_i45285_2_.func_72912_H().func_76077_q() != GameType.ADVENTURE) + { + int i = Math.max(0, p_i45285_1_.func_184108_a(p_i45285_2_)); + int j = MathHelper.func_76128_c(p_i45285_2_.func_175723_af().func_177729_b((double)blockpos.func_177958_n(), (double)blockpos.func_177952_p())); + \ No newline at end of file diff --git a/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java b/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java index 64cbc6ece..5c06cf252 100644 --- a/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java +++ b/src/main/java/net/minecraftforge/common/extensions/IForgeEntity.java @@ -75,6 +75,14 @@ public interface IForgeEntity extends ICapabilitySerializable Collection captureDrops(); Collection captureDrops(@Nullable Collection captureDrops); + + /** + * Returns a NBTTagCompound that can be used to store custom data for this entity. + * It will be written, and read from disc, so it persists over world saves. + * @return A NBTTagCompound + */ + NBTTagCompound getEntityData(); + /** * Used in model rendering to determine if the entity riding this entity should be in the 'sitting' position. * @return false to prevent an entity that is mounted to this entity from displaying the 'sitting' animation. @@ -84,7 +92,6 @@ public interface IForgeEntity extends ICapabilitySerializable return true; } - /** * Called when a user uses the creative pick block button on this entity. * diff --git a/src/main/resources/forge.exc b/src/main/resources/forge.exc index 5c7c21a08..8ce1f6c05 100644 --- a/src/main/resources/forge.exc +++ b/src/main/resources/forge.exc @@ -8,7 +8,7 @@ net/minecraft/entity/Entity.changeDimension(ILnet/minecraftforge/common/util/ITe #net/minecraft/entity/item/EntityEnderPearl.changeDimension(ILnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;=|p_184204_1_,teleporter #net/minecraft/entity/item/EntityItem.changeDimension(ILnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;=|p_184204_1_,teleporter #net/minecraft/entity/item/EntityMinecartContainer.changeDimension(ILnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;=|p_184204_1_,teleporter -#net/minecraft/entity/player/EntityPlayerMP.changeDimension(ILnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;=|p_184204_1_,teleporter +net/minecraft/entity/player/EntityPlayerMP.changeDimension(ILnet/minecraftforge/common/util/ITeleporter;)Lnet/minecraft/entity/Entity;=|p_184204_1_,teleporter net/minecraft/entity/player/EntityPlayer.getDigSpeed(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/math/BlockPos;)F=|p_184813_1_,pos net/minecraft/server/management/PlayerList.changePlayerDimension(Lnet/minecraft/entity/player/EntityPlayerMP;ILnet/minecraftforge/common/util/ITeleporter;)V=|p_187242_1_,p_187242_2_,teleporter net/minecraft/server/management/PlayerList.transferEntityToWorld(Lnet/minecraft/entity/Entity;ILnet/minecraft/world/WorldServer;Lnet/minecraft/world/WorldServer;Lnet/minecraftforge/common/util/ITeleporter;)V=|p_82448_1_,p_82448_2_,p_82448_3_,p_82448_4_,teleporter