diff --git a/patches/minecraft/net/minecraft/entity/Entity.java.patch b/patches/minecraft/net/minecraft/entity/Entity.java.patch index 7796ef11e..0487ad426 100644 --- a/patches/minecraft/net/minecraft/entity/Entity.java.patch +++ b/patches/minecraft/net/minecraft/entity/Entity.java.patch @@ -9,7 +9,18 @@ { private static final Logger field_184243_a = LogManager.getLogger(); private static final List field_190535_b = Collections.emptyList(); -@@ -197,7 +197,7 @@ +@@ -175,6 +175,10 @@ + private boolean field_184237_aG; + private double[] field_191505_aI; + private long field_191506_aJ; ++ /** ++ * Setting this to true will prevent the world from calling {@link #onUpdate()} for this entity. ++ */ ++ public boolean updateBlocked; + + public Entity(World p_i1582_1_) + { +@@ -197,7 +201,7 @@ if (p_i1582_1_ != null) { @@ -18,7 +29,7 @@ } this.field_70180_af = new EntityDataManager(this); -@@ -208,8 +208,16 @@ +@@ -208,8 +212,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(); @@ -35,7 +46,7 @@ public int func_145782_y() { return this.field_145783_c; -@@ -1034,7 +1042,7 @@ +@@ -1034,7 +1046,7 @@ protected void func_180429_a(BlockPos p_180429_1_, Block p_180429_2_) { @@ -44,7 +55,7 @@ if (this.field_70170_p.func_180495_p(p_180429_1_.func_177984_a()).func_177230_c() == Blocks.field_150431_aC) { -@@ -1243,12 +1251,12 @@ +@@ -1243,12 +1255,12 @@ BlockPos blockpos = new BlockPos(this.field_70165_t, d0, this.field_70161_v); IBlockState iblockstate = this.field_70170_p.func_180495_p(blockpos); @@ -61,7 +72,15 @@ } else { -@@ -1680,6 +1688,9 @@ +@@ -1667,6 +1679,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.size() > 0) + { +@@ -1680,6 +1693,9 @@ p_189511_1_.func_74782_a("Tags", nbttaglist); } @@ -71,9 +90,11 @@ this.func_70014_b(p_189511_1_); if (this.func_184207_aI()) -@@ -1787,6 +1798,9 @@ +@@ -1786,7 +1802,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")); @@ -81,7 +102,7 @@ if (p_70020_1_.func_150297_b("Tags", 9)) { this.field_184236_aF.clear(); -@@ -1878,7 +1892,10 @@ +@@ -1878,7 +1898,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(); @@ -93,7 +114,15 @@ return entityitem; } } -@@ -1992,6 +2009,7 @@ +@@ -1945,6 +1968,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()) +@@ -1992,6 +2016,7 @@ } } @@ -101,7 +130,7 @@ if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) { if (this.func_184218_aH()) -@@ -2027,6 +2045,7 @@ +@@ -2027,6 +2052,7 @@ if (this.field_184239_as != null) { Entity entity = this.field_184239_as; @@ -109,7 +138,7 @@ this.field_184239_as = null; entity.func_184225_p(this); } -@@ -2472,6 +2491,7 @@ +@@ -2472,6 +2498,7 @@ { if (!this.field_70170_p.field_72995_K && !this.field_70128_L) { @@ -117,7 +146,7 @@ this.field_70170_p.field_72984_F.func_76320_a("changeDimension"); MinecraftServer minecraftserver = this.func_184102_h(); int i = this.field_71093_bK; -@@ -2565,7 +2585,7 @@ +@@ -2565,7 +2592,7 @@ public float func_180428_a(Explosion p_180428_1_, World p_180428_2_, BlockPos p_180428_3_, IBlockState p_180428_4_) { @@ -126,7 +155,7 @@ } 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_) -@@ -2862,6 +2882,184 @@ +@@ -2862,6 +2889,184 @@ EnchantmentHelper.func_151385_b(p_174815_1_, p_174815_2_); } diff --git a/patches/minecraft/net/minecraft/world/World.java.patch b/patches/minecraft/net/minecraft/world/World.java.patch index 4bf0f3226..475071a4e 100644 --- a/patches/minecraft/net/minecraft/world/World.java.patch +++ b/patches/minecraft/net/minecraft/world/World.java.patch @@ -371,7 +371,15 @@ float f = this.func_72826_c(p_72880_1_); float f1 = 1.0F - (MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.25F); f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F); -@@ -1581,6 +1684,12 @@ +@@ -1564,6 +1667,7 @@ + + try + { ++ if(entity.updateBlocked) continue; + ++entity.field_70173_aa; + entity.func_70071_h_(); + } +@@ -1581,6 +1685,12 @@ entity.func_85029_a(crashreportcategory); } @@ -384,7 +392,7 @@ throw new ReportedException(crashreport); } -@@ -1642,6 +1751,12 @@ +@@ -1642,6 +1752,12 @@ CrashReport crashreport1 = CrashReport.func_85055_a(throwable1, "Ticking entity"); CrashReportCategory crashreportcategory1 = crashreport1.func_85058_a("Entity being ticked"); entity2.func_85029_a(crashreportcategory1); @@ -397,7 +405,7 @@ throw new ReportedException(crashreport1); } } -@@ -1678,7 +1793,7 @@ +@@ -1678,7 +1794,7 @@ { BlockPos blockpos = tileentity.func_174877_v(); @@ -406,7 +414,7 @@ { try { -@@ -1691,6 +1806,13 @@ +@@ -1691,6 +1807,13 @@ CrashReport crashreport2 = CrashReport.func_85055_a(throwable, "Ticking block entity"); CrashReportCategory crashreportcategory2 = crashreport2.func_85058_a("Block entity being ticked"); tileentity.func_145828_a(crashreportcategory2); @@ -420,7 +428,7 @@ throw new ReportedException(crashreport2); } } -@@ -1703,20 +1825,28 @@ +@@ -1703,20 +1826,28 @@ if (this.func_175667_e(tileentity.func_174877_v())) { @@ -452,7 +460,7 @@ this.field_72984_F.func_76318_c("pendingBlockEntities"); if (!this.field_147484_a.isEmpty()) -@@ -1755,8 +1885,12 @@ +@@ -1755,8 +1886,12 @@ public boolean func_175700_a(TileEntity p_175700_1_) { @@ -466,7 +474,7 @@ if (flag && p_175700_1_ instanceof ITickable) { this.field_175730_i.add(p_175700_1_); -@@ -1776,6 +1910,11 @@ +@@ -1776,6 +1911,11 @@ { if (this.field_147481_N) { @@ -478,7 +486,7 @@ this.field_147484_a.addAll(p_147448_1_); } else -@@ -1796,9 +1935,12 @@ +@@ -1796,9 +1936,12 @@ { int i = MathHelper.func_76128_c(p_72866_1_.field_70165_t); int j = MathHelper.func_76128_c(p_72866_1_.field_70161_v); @@ -493,7 +501,15 @@ { p_72866_1_.field_70142_S = p_72866_1_.field_70165_t; p_72866_1_.field_70137_T = p_72866_1_.field_70163_u; -@@ -1997,6 +2139,11 @@ +@@ -1816,6 +1959,7 @@ + } + else + { ++ if(!p_72866_1_.updateBlocked) + p_72866_1_.func_70071_h_(); + } + } +@@ -1997,6 +2141,11 @@ blockpos$pooledmutableblockpos.func_185344_t(); return true; } @@ -505,7 +521,7 @@ } } } -@@ -2036,6 +2183,16 @@ +@@ -2036,6 +2185,16 @@ IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos); Block block = iblockstate.func_177230_c(); @@ -522,7 +538,7 @@ if (iblockstate.func_185904_a() == p_72918_2_) { double d0 = (double)((float)(l1 + 1) - BlockLiquid.func_149801_b(((Integer)iblockstate.func_177229_b(BlockLiquid.field_176367_b)).intValue())); -@@ -2102,6 +2259,7 @@ +@@ -2102,6 +2261,7 @@ public Explosion func_72885_a(@Nullable Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) { Explosion explosion = new Explosion(this, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, p_72885_9_, p_72885_10_); @@ -530,7 +546,7 @@ explosion.func_77278_a(); explosion.func_77279_a(true); return explosion; -@@ -2224,6 +2382,7 @@ +@@ -2224,6 +2384,7 @@ public void func_175690_a(BlockPos p_175690_1_, @Nullable TileEntity p_175690_2_) { @@ -538,7 +554,7 @@ if (!this.func_189509_E(p_175690_1_)) { if (p_175690_2_ != null && !p_175690_2_.func_145837_r()) -@@ -2231,6 +2390,8 @@ +@@ -2231,6 +2392,8 @@ if (this.field_147481_N) { p_175690_2_.func_174878_a(p_175690_1_); @@ -547,7 +563,7 @@ Iterator iterator = this.field_147484_a.iterator(); while (iterator.hasNext()) -@@ -2248,7 +2409,8 @@ +@@ -2248,7 +2411,8 @@ } else { @@ -557,7 +573,7 @@ this.func_175700_a(p_175690_2_); } } -@@ -2263,6 +2425,8 @@ +@@ -2263,6 +2427,8 @@ { tileentity.func_145843_s(); this.field_147484_a.remove(tileentity); @@ -566,7 +582,7 @@ } else { -@@ -2275,6 +2439,7 @@ +@@ -2275,6 +2441,7 @@ this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_); } @@ -574,7 +590,7 @@ } public void func_147457_a(TileEntity p_147457_1_) -@@ -2301,7 +2466,7 @@ +@@ -2301,7 +2468,7 @@ if (chunk != null && !chunk.func_76621_g()) { IBlockState iblockstate = this.func_180495_p(p_175677_1_); @@ -583,7 +599,7 @@ } else { -@@ -2324,6 +2489,7 @@ +@@ -2324,6 +2491,7 @@ { this.field_72985_G = p_72891_1_; this.field_72992_H = p_72891_2_; @@ -591,7 +607,7 @@ } public void func_72835_b() -@@ -2333,6 +2499,11 @@ +@@ -2333,6 +2501,11 @@ protected void func_72947_a() { @@ -603,7 +619,7 @@ if (this.field_72986_A.func_76059_o()) { this.field_73004_o = 1.0F; -@@ -2346,6 +2517,11 @@ +@@ -2346,6 +2519,11 @@ protected void func_72979_l() { @@ -615,7 +631,7 @@ if (this.field_73011_w.func_191066_m()) { if (!this.field_72995_K) -@@ -2470,6 +2646,11 @@ +@@ -2470,6 +2648,11 @@ public boolean func_175670_e(BlockPos p_175670_1_, boolean p_175670_2_) { @@ -627,7 +643,7 @@ Biome biome = this.func_180494_b(p_175670_1_); float f = biome.func_180626_a(p_175670_1_); -@@ -2511,6 +2692,11 @@ +@@ -2511,6 +2694,11 @@ public boolean func_175708_f(BlockPos p_175708_1_, boolean p_175708_2_) { @@ -639,7 +655,7 @@ Biome biome = this.func_180494_b(p_175708_1_); float f = biome.func_180626_a(p_175708_1_); -@@ -2528,7 +2714,7 @@ +@@ -2528,7 +2716,7 @@ { IBlockState iblockstate = this.func_180495_p(p_175708_1_); @@ -648,7 +664,7 @@ { return true; } -@@ -2560,10 +2746,11 @@ +@@ -2560,10 +2748,11 @@ else { IBlockState iblockstate = this.func_180495_p(p_175638_1_); @@ -663,7 +679,7 @@ { j = 1; } -@@ -2662,7 +2849,7 @@ +@@ -2662,7 +2851,7 @@ int j4 = j2 + enumfacing.func_96559_d(); int k4 = k2 + enumfacing.func_82599_e(); blockpos$pooledmutableblockpos.func_181079_c(i4, j4, k4); @@ -672,7 +688,7 @@ i3 = this.func_175642_b(p_180500_1_, blockpos$pooledmutableblockpos); if (i3 == l2 - l4 && j < this.field_72994_J.length) -@@ -2770,10 +2957,10 @@ +@@ -2770,10 +2959,10 @@ public List func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate p_175674_3_) { List list = Lists.newArrayList(); @@ -687,7 +703,7 @@ for (int i1 = i; i1 <= j; ++i1) { -@@ -2826,10 +3013,10 @@ +@@ -2826,10 +3015,10 @@ public List func_175647_a(Class p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate p_175647_3_) { @@ -702,7 +718,7 @@ List list = Lists.newArrayList(); for (int i1 = i; i1 < j; ++i1) -@@ -2909,11 +3096,13 @@ +@@ -2909,11 +3098,13 @@ public void func_175650_b(Collection p_175650_1_) { @@ -719,7 +735,7 @@ } } -@@ -2926,7 +3115,7 @@ +@@ -2926,7 +3117,7 @@ { IBlockState iblockstate = this.func_180495_p(p_190527_2_); AxisAlignedBB axisalignedbb = p_190527_3_ ? null : p_190527_1_.func_176223_P().func_185890_d(this, p_190527_2_); @@ -728,7 +744,7 @@ } public int func_181545_F() -@@ -3009,7 +3198,7 @@ +@@ -3009,7 +3200,7 @@ public int func_175651_c(BlockPos p_175651_1_, EnumFacing p_175651_2_) { IBlockState iblockstate = this.func_180495_p(p_175651_1_); @@ -737,7 +753,7 @@ } public boolean func_175640_z(BlockPos p_175640_1_) -@@ -3152,6 +3341,8 @@ +@@ -3152,6 +3343,8 @@ d2 *= ((Double)Objects.firstNonNull(p_184150_11_.apply(entityplayer1), Double.valueOf(1.0D))).doubleValue(); } @@ -746,7 +762,7 @@ if ((p_184150_9_ < 0.0D || Math.abs(entityplayer1.field_70163_u - p_184150_3_) < p_184150_9_ * p_184150_9_) && (p_184150_7_ < 0.0D || d1 < d2 * d2) && (d0 == -1.0D || d1 < d0)) { d0 = d1; -@@ -3213,7 +3404,7 @@ +@@ -3213,7 +3406,7 @@ public long func_72905_C() { @@ -755,7 +771,7 @@ } public long func_82737_E() -@@ -3223,17 +3414,17 @@ +@@ -3223,17 +3416,17 @@ public long func_72820_D() { @@ -776,7 +792,7 @@ if (!this.func_175723_af().func_177746_a(blockpos)) { -@@ -3245,7 +3436,7 @@ +@@ -3245,7 +3438,7 @@ public void func_175652_B(BlockPos p_175652_1_) { @@ -785,7 +801,7 @@ } @SideOnly(Side.CLIENT) -@@ -3265,12 +3456,18 @@ +@@ -3265,12 +3458,18 @@ if (!this.field_72996_f.contains(p_72897_1_)) { @@ -804,7 +820,7 @@ return true; } -@@ -3364,8 +3561,7 @@ +@@ -3364,8 +3563,7 @@ public boolean func_180502_D(BlockPos p_180502_1_) { @@ -814,7 +830,7 @@ } @Nullable -@@ -3426,12 +3622,12 @@ +@@ -3426,12 +3624,12 @@ public int func_72800_K() { @@ -829,7 +845,7 @@ } public Random func_72843_D(int p_72843_1_, int p_72843_2_, int p_72843_3_) -@@ -3475,7 +3671,7 @@ +@@ -3475,7 +3673,7 @@ @SideOnly(Side.CLIENT) public double func_72919_O() { @@ -838,7 +854,7 @@ } public void func_175715_c(int p_175715_1_, BlockPos p_175715_2_, int p_175715_3_) -@@ -3509,7 +3705,7 @@ +@@ -3509,7 +3707,7 @@ public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) { @@ -847,7 +863,7 @@ { BlockPos blockpos = p_175666_1_.func_177972_a(enumfacing); -@@ -3517,18 +3713,14 @@ +@@ -3517,18 +3715,14 @@ { IBlockState iblockstate = this.func_180495_p(blockpos); @@ -870,7 +886,7 @@ } } } -@@ -3594,6 +3786,115 @@ +@@ -3594,6 +3788,115 @@ return i >= -128 && i <= 128 && j >= -128 && j <= 128; } diff --git a/src/test/java/net/minecraftforge/test/EntityUpdateBlockedTest.java b/src/test/java/net/minecraftforge/test/EntityUpdateBlockedTest.java new file mode 100644 index 000000000..0a8bb28ff --- /dev/null +++ b/src/test/java/net/minecraftforge/test/EntityUpdateBlockedTest.java @@ -0,0 +1,49 @@ +package net.minecraftforge.test; + +import net.minecraft.command.CommandBase; +import net.minecraft.command.CommandException; +import net.minecraft.command.ICommandSender; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.server.MinecraftServer; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.event.FMLServerStartingEvent; + +@Mod(modid = "entityupdateblockedtest", name = "Entity Update Blocked Test", version = "1.0.0") +public class EntityUpdateBlockedTest +{ + @Mod.EventHandler + public void init(FMLServerStartingEvent event) + { + event.registerServerCommand(new BlockEntityUpdateCommand()); + } + + private class BlockEntityUpdateCommand extends CommandBase + { + + @Override + public String getName() + { + return "blockEntityUpdate"; + } + + @Override + public String getUsage(ICommandSender sender) + { + return "blockEntityUpdate "; + } + + @Override + public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException + { + if (args.length != 1) + return; + boolean value = Boolean.parseBoolean(args[0]); + for (Entity ent : sender.getEntityWorld().loadedEntityList) + { + if (!(ent instanceof EntityPlayer)) + ent.updateBlocked = value; + } + } + } +}