Do not invalidate caps when entity is being moved across worlds. Should fix #5500

This commit is contained in:
LexManos 2019-03-19 14:10:29 -07:00
parent 8045e48952
commit f5375783c6
12 changed files with 236 additions and 97 deletions

View file

@ -15,3 +15,15 @@
}
public void func_72835_b(BooleanSupplier p_72835_1_) {
@@ -179,6 +181,11 @@
public void func_72900_e(Entity p_72900_1_) {
super.func_72900_e(p_72900_1_);
+ }
+
+ @Override
+ public void removeEntity(Entity p_72900_1_, boolean keepData) {
+ super.removeEntity(p_72900_1_, keepData);
this.field_73032_d.remove(p_72900_1_);
}

View file

@ -0,0 +1,23 @@
--- a/net/minecraft/command/impl/TeleportCommand.java
+++ b/net/minecraft/command/impl/TeleportCommand.java
@@ -135,9 +135,9 @@
p_201127_1_.func_70034_d(f);
} else {
WorldServer worldserver = (WorldServer)p_201127_1_.field_70170_p;
- worldserver.func_72900_e(p_201127_1_);
+ worldserver.removeEntity(p_201127_1_, true); //Forge: Delay invalidating caps until we copy.
p_201127_1_.field_71093_bK = p_201127_2_.field_73011_w.func_186058_p();
- p_201127_1_.field_70128_L = false;
+ p_201127_1_.revive();
Entity entity = p_201127_1_;
p_201127_1_ = p_201127_1_.func_200600_R().func_200721_a(p_201127_2_);
if (p_201127_1_ == null) {
@@ -152,7 +152,7 @@
p_201127_2_.func_72838_d(p_201127_1_);
p_201127_1_.field_98038_p = flag;
p_201127_2_.func_72866_a(p_201127_1_, false);
- entity.field_70128_L = true;
+ entity.remove(false); //Forge: now invalidate everything.
}
}

View file

@ -15,7 +15,15 @@
private final EntityType<?> field_200606_g;
private int field_145783_c;
public boolean field_70156_m;
@@ -192,6 +193,7 @@
@@ -132,6 +133,7 @@
public boolean field_70133_I;
protected boolean field_70134_J;
private boolean field_174835_g;
+ @Deprecated //Forge: Use isAlive, remove(boolean) and revive() instead of directly accessing this field. To allow the entity to react to and better control this information.
public boolean field_70128_L;
public float field_70130_N;
public float field_70131_O;
@@ -192,6 +194,7 @@
private long field_191506_aJ;
public Entity(EntityType<?> p_i48580_1_, World p_i48580_2_) {
@ -23,7 +31,7 @@
this.field_145783_c = field_70152_a++;
this.field_184244_h = Lists.newArrayList();
this.field_70121_D = field_174836_a;
@@ -221,6 +223,8 @@
@@ -221,6 +224,8 @@
this.field_70180_af.func_187214_a(field_184234_aB, false);
this.field_70180_af.func_187214_a(field_189655_aD, false);
this.func_70088_a();
@ -32,15 +40,21 @@
}
public EntityType<?> func_200600_R() {
@@ -290,6 +294,7 @@
@@ -289,7 +294,13 @@
}
public void func_70106_y() {
+ this.remove(false);
+ }
+
+ public void remove(boolean keepData) {
this.field_70128_L = true;
+ this.invalidateCaps();
+ if (!keepData)
+ this.invalidateCaps();
}
public void func_184174_b(boolean p_184174_1_) {
@@ -324,6 +329,7 @@
@@ -324,6 +335,7 @@
this.field_70165_t = p_70107_1_;
this.field_70163_u = p_70107_3_;
this.field_70161_v = p_70107_5_;
@ -48,7 +62,7 @@
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 @@
@@ -697,7 +709,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);
@ -57,7 +71,7 @@
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 @@
@@ -735,7 +747,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);
@ -66,7 +80,7 @@
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 @@
@@ -749,7 +761,7 @@
} else {
this.func_180429_a(blockpos, iblockstate);
}
@ -75,7 +89,7 @@
this.field_191959_ay = this.func_191954_d(this.field_82151_R);
}
}
@@ -795,6 +801,7 @@
@@ -795,6 +807,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;
@ -83,7 +97,7 @@
}
protected SoundEvent func_184184_Z() {
@@ -846,7 +853,7 @@
@@ -846,7 +859,7 @@
protected void func_180429_a(BlockPos p_180429_1_, IBlockState p_180429_2_) {
if (!p_180429_2_.func_185904_a().func_76224_d()) {
@ -92,7 +106,7 @@
this.func_184185_a(soundtype.func_185844_d(), soundtype.func_185843_a() * 0.15F, soundtype.func_185847_b());
}
}
@@ -1041,6 +1048,7 @@
@@ -1041,6 +1054,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);
@ -100,7 +114,7 @@
if (iblockstate.func_185901_i() != EnumBlockRenderType.INVISIBLE) {
this.field_70170_p.func_195594_a(new BlockParticleData(Particles.field_197611_d, iblockstate), 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);
}
@@ -1054,7 +1062,7 @@
@@ -1054,7 +1068,7 @@
double d0 = this.field_70163_u + (double)this.func_70047_e();
BlockPos blockpos = new BlockPos(this.field_70165_t, d0, this.field_70161_v);
IFluidState ifluidstate = this.field_70170_p.func_204610_c(blockpos);
@ -109,7 +123,7 @@
}
}
@@ -1123,6 +1131,7 @@
@@ -1123,6 +1137,7 @@
this.field_70126_B -= 360.0F;
}
@ -117,7 +131,7 @@
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_);
}
@@ -1371,6 +1380,7 @@
@@ -1371,6 +1386,7 @@
if (this.field_184238_ar) {
p_189511_1_.func_74757_a("Glowing", this.field_184238_ar);
}
@ -125,7 +139,7 @@
if (!this.field_184236_aF.isEmpty()) {
NBTTagList nbttaglist = new NBTTagList();
@@ -1382,6 +1392,10 @@
@@ -1382,6 +1398,10 @@
p_189511_1_.func_74782_a("Tags", nbttaglist);
}
@ -136,7 +150,7 @@
this.func_70014_b(p_189511_1_);
if (this.func_184207_aI()) {
NBTTagList nbttaglist1 = new NBTTagList();
@@ -1467,6 +1481,9 @@
@@ -1467,6 +1487,9 @@
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"));
@ -146,7 +160,7 @@
if (p_70020_1_.func_150297_b("Tags", 9)) {
this.field_184236_aF.clear();
NBTTagList nbttaglist1 = p_70020_1_.func_150295_c("Tags", 8);
@@ -1547,6 +1564,8 @@
@@ -1547,6 +1570,8 @@
} else {
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();
@ -155,7 +169,7 @@
this.field_70170_p.func_72838_d(entityitem);
return entityitem;
}
@@ -1596,6 +1615,7 @@
@@ -1596,6 +1621,7 @@
this.field_70159_w = 0.0D;
this.field_70181_x = 0.0D;
this.field_70179_y = 0.0D;
@ -163,7 +177,7 @@
this.func_70071_h_();
if (this.func_184218_aH()) {
entity.func_184232_k(this);
@@ -1637,6 +1657,7 @@
@@ -1637,6 +1663,7 @@
}
}
@ -171,7 +185,7 @@
if (p_184205_2_ || this.func_184228_n(p_184205_1_) && p_184205_1_.func_184219_q(this)) {
if (this.func_184218_aH()) {
this.func_184210_p();
@@ -1664,6 +1685,7 @@
@@ -1664,6 +1691,7 @@
public void func_184210_p() {
if (this.field_184239_as != null) {
Entity entity = this.field_184239_as;
@ -179,7 +193,7 @@
this.field_184239_as = null;
entity.func_184225_p(this);
}
@@ -1790,6 +1812,7 @@
@@ -1790,6 +1818,7 @@
return !this.func_184188_bt().isEmpty();
}
@ -187,7 +201,7 @@
public boolean func_205710_ba() {
return true;
}
@@ -1991,7 +2014,7 @@
@@ -1991,7 +2020,7 @@
func_207712_c(itextcomponent1);
return itextcomponent1;
} else {
@ -196,7 +210,7 @@
}
}
@@ -2054,6 +2077,14 @@
@@ -2054,6 +2083,14 @@
@Nullable
public Entity func_212321_a(DimensionType p_212321_1_) {
@ -211,7 +225,7 @@
if (!this.field_70170_p.field_72995_K && !this.field_70128_L) {
this.field_70170_p.field_72984_F.func_76320_a("changeDimension");
MinecraftServer minecraftserver = this.func_184102_h();
@@ -2061,7 +2092,7 @@
@@ -2061,25 +2098,25 @@
WorldServer worldserver = minecraftserver.func_71218_a(dimensiontype);
WorldServer worldserver1 = minecraftserver.func_71218_a(p_212321_1_);
this.field_71093_bK = p_212321_1_;
@ -220,8 +234,11 @@
worldserver1 = minecraftserver.func_71218_a(DimensionType.OVERWORLD);
this.field_71093_bK = DimensionType.OVERWORLD;
}
@@ -2070,16 +2101,16 @@
this.field_70128_L = false;
- this.field_70170_p.func_72900_e(this);
- this.field_70128_L = false;
+ this.field_70170_p.removeEntity(this, true); //Forge: Keep data until we copy.
+ this.revive();
this.field_70170_p.field_72984_F.func_76320_a("reposition");
BlockPos blockpos;
- if (p_212321_1_ == DimensionType.THE_END) {
@ -243,7 +260,7 @@
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);
}
@@ -2088,8 +2119,7 @@
@@ -2088,8 +2125,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);
@ -253,7 +270,7 @@
blockpos = new BlockPos(this);
}
@@ -2098,7 +2128,7 @@
@@ -2098,7 +2134,7 @@
Entity entity = this.func_200600_R().func_200721_a(worldserver1);
if (entity != null) {
entity.func_180432_n(this);
@ -262,7 +279,16 @@
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 {
@@ -2592,4 +2622,57 @@
@@ -2112,7 +2148,7 @@
worldserver1.func_72866_a(entity, false);
}
- this.field_70128_L = true;
+ this.remove(false); //Forge: now invalidate old entity
this.field_70170_p.field_72984_F.func_76319_b();
worldserver.func_82742_i();
worldserver1.func_82742_i();
@@ -2592,4 +2628,60 @@
public double func_212107_bY() {
return this.field_211517_W;
}
@ -319,4 +345,7 @@
+
+ @Override
+ public void onRemovedFromWorld() { this.isAddedToWorld = false; }
+
+ @Override
+ public void revive() { this.field_70128_L = false; }
}

View file

@ -371,7 +371,7 @@
this.field_184627_bm.func_77974_b(this.field_70170_p, this, this.func_184605_cv());
}
@@ -2363,4 +2423,60 @@
@@ -2363,4 +2423,62 @@
@OnlyIn(Dist.CLIENT)
public void func_191987_a(BlockPos p_191987_1_, boolean p_191987_2_) {
}
@ -417,7 +417,7 @@
+
+ @Override
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable EnumFacing facing) {
+ if (!this.field_70128_L && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
+ if (this.func_70089_S() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
+ if (facing == null) return handlers[2].cast();
+ else if (facing.func_176740_k().func_200128_b()) return handlers[0].cast();
+ else if (facing.func_176740_k().func_176722_c()) return handlers[1].cast();
@ -426,9 +426,11 @@
+ }
+
+ @Override
+ public void func_70106_y() {
+ super.func_70106_y();
+ for (int x = 0; x < handlers.length; x++)
+ handlers[x].invalidate();
+ public void remove(boolean keepData) {
+ super.remove(keepData);
+ if (!keepData) {
+ for (int x = 0; x < handlers.length; x++)
+ handlers[x].invalidate();
+ }
+ }
}

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/entity/item/EntityMinecartContainer.java
+++ b/net/minecraft/entity/item/EntityMinecartContainer.java
@@ -120,10 +120,11 @@
@@ -120,18 +120,26 @@
return 64;
}
@ -14,15 +14,23 @@
}
public void func_70106_y() {
@@ -132,6 +133,7 @@
+ super.func_70106_y();
+ }
+
+ @Override
+ public void remove(boolean keepData) {
if (this.field_94112_b) {
InventoryHelper.func_180176_a(this.field_70170_p, this, this);
}
super.func_70106_y();
+ itemHandler.invalidate();
- super.func_70106_y();
+ super.remove(keepData);
+ if (!keepData)
+ itemHandler.invalidate();
}
public void func_184174_b(boolean p_184174_1_) {
@@ -164,6 +166,7 @@
@@ -164,6 +172,7 @@
}
public boolean func_184230_a(EntityPlayer p_184230_1_, EnumHand p_184230_2_) {
@ -30,7 +38,7 @@
if (!this.field_70170_p.field_72995_K) {
p_184230_1_.func_71007_a(this);
}
@@ -216,9 +219,9 @@
@@ -216,9 +225,9 @@
random = new Random(this.field_184291_d);
}
@ -42,7 +50,7 @@
}
loottable.func_186460_a(this, random, lootcontext$builder.func_186471_a());
@@ -239,4 +242,13 @@
@@ -239,4 +248,13 @@
public ResourceLocation func_184276_b() {
return this.field_184290_c;
}
@ -51,7 +59,7 @@
+
+ @Override
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.util.EnumFacing facing) {
+ if (!this.field_70128_L && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
+ if (this.func_70089_S() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
+ return itemHandler.cast();
+ return super.getCapability(capability, facing);
+ }

View file

@ -1,5 +1,14 @@
--- a/net/minecraft/entity/monster/EntitySlime.java
+++ b/net/minecraft/entity/monster/EntitySlime.java
@@ -113,7 +113,7 @@
public void func_70071_h_() {
if (!this.field_70170_p.field_72995_K && this.field_70170_p.func_175659_aa() == EnumDifficulty.PEACEFUL && this.func_70809_q() > 0) {
- this.field_70128_L = true;
+ this.func_70106_y(); //Forge: Kill entity with notification to caps/subclasses.
}
this.field_70811_b += (this.field_70813_a - this.field_70811_b) * 0.5F;
@@ -122,6 +122,7 @@
if (this.field_70122_E && !this.field_175452_bi) {
int i = this.func_70809_q();

View file

@ -8,7 +8,7 @@
}
protected void func_110232_cE() {
@@ -960,4 +961,19 @@
@@ -960,4 +961,22 @@
return p_204210_2_;
}
@ -17,14 +17,17 @@
+
+ @Override
+ public <T> net.minecraftforge.common.util.LazyOptional<T> getCapability(net.minecraftforge.common.capabilities.Capability<T> capability, @Nullable net.minecraft.util.EnumFacing facing) {
+ if (!this.field_70128_L && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && itemHandler != null)
+ if (this.func_70089_S() && capability == net.minecraftforge.items.CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && itemHandler != null)
+ return itemHandler.cast();
+ return super.getCapability(capability, facing);
+ }
+
+ @Override
+ public void func_70106_y() {
+ super.func_70106_y();
+ itemHandler.invalidate();
+ public void remove(boolean keepData) {
+ super.remove(keepData);
+ if (!keepData && itemHandler != null) {
+ itemHandler.invalidate();
+ itemHandler = null;
+ }
+ }
}

View file

@ -119,3 +119,14 @@
}
protected void func_70670_a(PotionEffect p_70670_1_) {
@@ -1179,8 +1203,8 @@
this.field_71093_bK = p_200619_1_.field_73011_w.func_186058_p();
this.field_71135_a.func_147359_a(new SPacketRespawn(this.field_71093_bK, worldserver.func_175659_aa(), worldserver.func_72912_H().func_76067_t(), this.field_71134_c.func_73081_b()));
this.field_71133_b.func_184103_al().func_187243_f(this);
- worldserver.func_72973_f(this);
- this.field_70128_L = false;
+ worldserver.removeEntityDangerously(this, true); //Forge: The player entity itself is moved, and not cloned. So we need to keep the data alive with no matching invalidate call later.
+ this.revive();
this.func_70012_b(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_);
if (this.func_70089_S()) {
worldserver.func_72866_a(this, false);

View file

@ -130,9 +130,11 @@
- p_187242_1_.field_71135_a.func_147359_a(new SPacketRespawn(p_187242_1_.field_71093_bK, p_187242_1_.field_70170_p.func_175659_aa(), p_187242_1_.field_70170_p.func_72912_H().func_76067_t(), p_187242_1_.field_71134_c.func_73081_b()));
+ p_187242_1_.field_71135_a.func_147359_a(new SPacketRespawn(p_187242_1_.field_71093_bK, worldserver1.func_175659_aa(), worldserver1.func_72912_H().func_76067_t(), p_187242_1_.field_71134_c.func_73081_b()));
this.func_187243_f(p_187242_1_);
worldserver.func_72973_f(p_187242_1_);
p_187242_1_.field_70128_L = false;
- worldserver.func_72973_f(p_187242_1_);
- p_187242_1_.field_70128_L = false;
- this.func_82448_a(p_187242_1_, dimensiontype, worldserver, worldserver1);
+ worldserver.removeEntityDangerously(p_187242_1_, true); //Forge: the player entity is moved to the new world, NOT cloned. So keep the data alive with no matching invalidate call.
+ p_187242_1_.revive();
+ this.transferEntityToWorld(p_187242_1_, dimensiontype, worldserver, worldserver1, teleporter);
this.func_72375_a(p_187242_1_, worldserver);
p_187242_1_.field_71135_a.func_147364_a(p_187242_1_.field_70165_t, p_187242_1_.field_70163_u, p_187242_1_.field_70161_v, p_187242_1_.field_70177_z, p_187242_1_.field_70125_A);

View file

@ -194,7 +194,7 @@
}
public void func_72847_b(Entity p_72847_1_) {
@@ -777,6 +828,7 @@
@@ -777,9 +828,14 @@
this.field_73021_x.get(i).func_72709_b(p_72847_1_);
}
@ -202,7 +202,37 @@
}
public void func_72900_e(Entity p_72900_1_) {
@@ -819,24 +871,31 @@
+ this.removeEntity(p_72900_1_, false);
+ }
+
+ public void removeEntity(Entity p_72900_1_, boolean keepData) {
if (p_72900_1_.func_184207_aI()) {
p_72900_1_.func_184226_ay();
}
@@ -788,7 +844,7 @@
p_72900_1_.func_184210_p();
}
- p_72900_1_.func_70106_y();
+ p_72900_1_.remove(keepData);
if (p_72900_1_ instanceof EntityPlayer) {
this.field_73010_i.remove(p_72900_1_);
this.func_72854_c();
@@ -798,8 +854,12 @@
}
public void func_72973_f(Entity p_72973_1_) {
+ this.removeEntityDangerously(p_72973_1_, false);
+ }
+
+ public void removeEntityDangerously(Entity p_72973_1_, boolean keepData) {
p_72973_1_.func_184174_b(false);
- p_72973_1_.func_70106_y();
+ p_72973_1_.remove(keepData);
if (p_72973_1_ instanceof EntityPlayer) {
this.field_73010_i.remove(p_72973_1_);
this.func_72854_c();
@@ -819,24 +879,31 @@
this.field_73021_x.add(p_72954_1_);
}
@ -237,7 +267,7 @@
float f = this.func_72826_c(p_72971_1_);
float f1 = 1.0F - (MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.2F);
f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F);
@@ -848,6 +907,11 @@
@@ -848,6 +915,11 @@
@OnlyIn(Dist.CLIENT)
public Vec3d func_72833_a(Entity p_72833_1_, float p_72833_2_) {
@ -249,7 +279,7 @@
float f = this.func_72826_c(p_72833_2_);
float f1 = MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F;
f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F);
@@ -855,9 +919,7 @@
@@ -855,9 +927,7 @@
int j = MathHelper.func_76128_c(p_72833_1_.field_70163_u);
int k = MathHelper.func_76128_c(p_72833_1_.field_70161_v);
BlockPos blockpos = new BlockPos(i, j, k);
@ -260,7 +290,7 @@
float f3 = (float)(l >> 16 & 255) / 255.0F;
float f4 = (float)(l >> 8 & 255) / 255.0F;
float f5 = (float)(l & 255) / 255.0F;
@@ -904,6 +966,10 @@
@@ -904,6 +974,10 @@
@OnlyIn(Dist.CLIENT)
public Vec3d func_72824_f(float p_72824_1_) {
@ -271,7 +301,7 @@
float f = this.func_72826_c(p_72824_1_);
float f1 = MathHelper.func_76134_b(f * ((float)Math.PI * 2F)) * 2.0F + 0.5F;
f1 = MathHelper.func_76131_a(f1, 0.0F, 1.0F);
@@ -942,10 +1008,7 @@
@@ -942,10 +1016,7 @@
@OnlyIn(Dist.CLIENT)
public float func_72880_h(float p_72880_1_) {
@ -283,7 +313,7 @@
}
public void func_72939_s() {
@@ -957,6 +1020,7 @@
@@ -957,6 +1028,7 @@
try {
++entity.field_70173_aa;
@ -291,7 +321,7 @@
entity.func_70071_h_();
} catch (Throwable throwable2) {
CrashReport crashreport = CrashReport.func_85055_a(throwable2, "Ticking entity");
@@ -967,6 +1031,10 @@
@@ -967,6 +1039,10 @@
entity.func_85029_a(crashreportcategory);
}
@ -302,7 +332,7 @@
throw new ReportedException(crashreport);
}
@@ -1009,11 +1077,17 @@
@@ -1009,11 +1085,17 @@
this.field_72984_F.func_76320_a("tick");
if (!entity2.field_70128_L && !(entity2 instanceof EntityPlayerMP)) {
try {
@ -320,7 +350,7 @@
throw new ReportedException(crashreport1);
}
}
@@ -1035,30 +1109,41 @@
@@ -1035,30 +1117,41 @@
}
this.field_72984_F.func_76318_c("blockEntities");
@ -366,7 +396,7 @@
throw new ReportedException(crashreport2);
}
}
@@ -1068,7 +1153,10 @@
@@ -1068,7 +1161,10 @@
iterator.remove();
this.field_147482_g.remove(tileentity);
if (this.func_175667_e(tileentity.func_174877_v())) {
@ -378,7 +408,7 @@
}
}
}
@@ -1103,10 +1191,15 @@
@@ -1103,10 +1199,15 @@
}
public boolean func_175700_a(TileEntity p_175700_1_) {
@ -394,7 +424,7 @@
if (this.field_72995_K) {
BlockPos blockpos = p_175700_1_.func_174877_v();
@@ -1119,6 +1212,11 @@
@@ -1119,6 +1220,11 @@
public void func_147448_a(Collection<TileEntity> p_147448_1_) {
if (this.field_147481_N) {
@ -406,7 +436,7 @@
this.field_147484_a.addAll(p_147448_1_);
} else {
for(TileEntity tileentity : p_147448_1_) {
@@ -1137,9 +1235,10 @@
@@ -1137,9 +1243,10 @@
int i = MathHelper.func_76128_c(p_72866_1_.field_70165_t);
int j = MathHelper.func_76128_c(p_72866_1_.field_70161_v);
int k = 32;
@ -420,7 +450,7 @@
}
p_72866_1_.field_70142_S = p_72866_1_.field_70165_t;
@@ -1153,7 +1252,7 @@
@@ -1153,7 +1260,7 @@
p_72866_1_.func_70098_U();
} else {
this.field_72984_F.func_194340_a(() -> {
@ -429,7 +459,7 @@
});
p_72866_1_.func_70071_h_();
this.field_72984_F.func_76319_b();
@@ -1200,6 +1299,7 @@
@@ -1200,6 +1307,7 @@
if (p_72866_2_ && p_72866_1_.field_70175_ag) {
for(Entity entity : p_72866_1_.func_184188_bt()) {
if (!entity.field_70128_L && entity.func_184187_bx() == p_72866_1_) {
@ -437,7 +467,7 @@
this.func_72870_g(entity);
} else {
entity.func_184210_p();
@@ -1239,7 +1339,7 @@
@@ -1239,7 +1347,7 @@
for(int l1 = k; l1 < l; ++l1) {
for(int i2 = i1; i2 < j1; ++i2) {
IBlockState iblockstate = this.func_180495_p(blockpos$pooledmutableblockpos.func_181079_c(k1, l1, i2));
@ -446,7 +476,7 @@
boolean flag = true;
return flag;
}
@@ -1263,10 +1363,13 @@
@@ -1263,10 +1371,13 @@
for(int k1 = i; k1 < j; ++k1) {
for(int l1 = k; l1 < l; ++l1) {
for(int i2 = i1; i2 < j1; ++i2) {
@ -461,7 +491,7 @@
}
}
}
@@ -1346,6 +1449,7 @@
@@ -1346,6 +1457,7 @@
if (p_211529_2_ != null) {
explosion.func_199592_a(p_211529_2_);
}
@ -469,7 +499,7 @@
explosion.func_77278_a();
explosion.func_77279_a(true);
@@ -1439,10 +1543,13 @@
@@ -1439,10 +1551,13 @@
}
public void func_175690_a(BlockPos p_175690_1_, @Nullable TileEntity p_175690_2_) {
@ -483,7 +513,7 @@
Iterator<TileEntity> iterator = this.field_147484_a.iterator();
while(iterator.hasNext()) {
@@ -1455,7 +1562,8 @@
@@ -1455,7 +1570,8 @@
this.field_147484_a.add(p_175690_2_);
} else {
@ -493,7 +523,7 @@
this.func_175700_a(p_175690_2_);
}
}
@@ -1468,6 +1576,8 @@
@@ -1468,6 +1584,8 @@
if (tileentity != null && this.field_147481_N) {
tileentity.func_145843_s();
this.field_147484_a.remove(tileentity);
@ -502,7 +532,7 @@
} else {
if (tileentity != null) {
this.field_147484_a.remove(tileentity);
@@ -1477,6 +1587,7 @@
@@ -1477,6 +1595,7 @@
this.func_175726_f(p_175713_1_).func_177425_e(p_175713_1_);
}
@ -510,7 +540,7 @@
}
@@ -1498,7 +1609,7 @@
@@ -1498,7 +1617,7 @@
}
public boolean func_195595_w(BlockPos p_195595_1_) {
@ -519,7 +549,7 @@
}
public void func_72966_v() {
@@ -1512,6 +1623,7 @@
@@ -1512,6 +1631,7 @@
public void func_72891_a(boolean p_72891_1_, boolean p_72891_2_) {
this.field_72985_G = p_72891_1_;
this.field_72992_H = p_72891_2_;
@ -527,7 +557,7 @@
}
public void func_72835_b(BooleanSupplier p_72835_1_) {
@@ -1520,6 +1632,10 @@
@@ -1520,6 +1640,10 @@
}
protected void func_72947_a() {
@ -538,7 +568,7 @@
if (this.field_72986_A.func_76059_o()) {
this.field_73004_o = 1.0F;
if (this.field_72986_A.func_76061_m()) {
@@ -1534,6 +1650,10 @@
@@ -1534,6 +1658,10 @@
}
protected void func_72979_l() {
@ -549,7 +579,7 @@
if (this.field_73011_w.func_191066_m()) {
if (!this.field_72995_K) {
boolean flag = this.func_82736_K().func_82766_b("doWeatherCycle");
@@ -1620,9 +1740,9 @@
@@ -1620,9 +1748,9 @@
return 15;
} else {
IBlockState iblockstate = this.func_180495_p(p_175638_1_);
@ -561,7 +591,7 @@
j = 1;
}
@@ -1631,7 +1751,7 @@
@@ -1631,7 +1759,7 @@
}
if (j >= 15) {
@ -570,7 +600,7 @@
} else if (i >= 14) {
return i;
} else {
@@ -1656,11 +1776,12 @@
@@ -1656,11 +1784,12 @@
}
public boolean func_180500_c(EnumLightType p_180500_1_, BlockPos p_180500_2_) {
@ -584,7 +614,7 @@
this.field_72984_F.func_76320_a("getBrightness");
int k = this.func_175642_b(p_180500_1_, p_180500_2_);
int l = this.func_175638_a(p_180500_2_, p_180500_1_);
@@ -1686,7 +1807,7 @@
@@ -1686,7 +1815,7 @@
int j3 = MathHelper.func_76130_a(i2 - i1);
int k3 = MathHelper.func_76130_a(j2 - j1);
int l3 = MathHelper.func_76130_a(k2 - k1);
@ -593,7 +623,7 @@
try (BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.func_185346_s()) {
for(EnumFacing enumfacing : field_200007_a) {
int i4 = i2 + enumfacing.func_82601_c();
@@ -1726,7 +1847,7 @@
@@ -1726,7 +1855,7 @@
int l6 = Math.abs(k5 - j1);
int i7 = Math.abs(l5 - k1);
boolean flag = j < this.field_72994_J.length - 6;
@ -602,7 +632,7 @@
if (this.func_175642_b(p_180500_1_, blockpos1.func_177976_e()) < j6) {
this.field_72994_J[j++] = j5 - 1 - i1 + 32 + (k5 - j1 + 32 << 6) + (l5 - k1 + 32 << 12);
}
@@ -1767,10 +1888,10 @@
@@ -1767,10 +1896,10 @@
public List<Entity> func_175674_a(@Nullable Entity p_175674_1_, AxisAlignedBB p_175674_2_, @Nullable Predicate<? super Entity> p_175674_3_) {
List<Entity> list = Lists.newArrayList();
@ -617,7 +647,7 @@
for(int i1 = i; i1 <= j; ++i1) {
for(int j1 = k; j1 <= l; ++j1) {
@@ -1812,10 +1933,10 @@
@@ -1812,10 +1941,10 @@
}
public <T extends Entity> List<T> func_175647_a(Class<? extends T> p_175647_1_, AxisAlignedBB p_175647_2_, @Nullable Predicate<? super T> p_175647_3_) {
@ -632,7 +662,7 @@
List<T> list = Lists.newArrayList();
for(int i1 = i; i1 < j; ++i1) {
@@ -1891,7 +2012,7 @@
@@ -1891,7 +2020,7 @@
}
public void func_212420_a(Stream<Entity> p_212420_1_) {
@ -641,7 +671,7 @@
this.field_72996_f.add(p_212418_1_);
this.func_72923_a(p_212418_1_);
});
@@ -1958,7 +2079,7 @@
@@ -1958,7 +2087,7 @@
public int func_175651_c(BlockPos p_175651_1_, EnumFacing p_175651_2_) {
IBlockState iblockstate = this.func_180495_p(p_175651_1_);
@ -650,7 +680,7 @@
}
public boolean func_175640_z(BlockPos p_175640_1_) {
@@ -2096,6 +2217,8 @@
@@ -2096,6 +2225,8 @@
d2 *= MoreObjects.firstNonNull(p_184150_11_.apply(entityplayer1), 1.0D);
}
@ -659,7 +689,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;
entityplayer = entityplayer1;
@@ -2144,7 +2267,7 @@
@@ -2144,7 +2275,7 @@
}
public long func_72905_C() {
@ -668,7 +698,7 @@
}
public long func_82737_E() {
@@ -2152,15 +2275,15 @@
@@ -2152,15 +2283,15 @@
}
public long func_72820_D() {
@ -687,7 +717,7 @@
if (!this.func_175723_af().func_177746_a(blockpos)) {
blockpos = this.func_205770_a(Heightmap.Type.MOTION_BLOCKING, new BlockPos(this.func_175723_af().func_177731_f(), 0.0D, this.func_175723_af().func_177721_g()));
}
@@ -2169,7 +2292,7 @@
@@ -2169,7 +2300,7 @@
}
public void func_175652_B(BlockPos p_175652_1_) {
@ -696,7 +726,7 @@
}
@OnlyIn(Dist.CLIENT)
@@ -2185,12 +2308,17 @@
@@ -2185,12 +2316,17 @@
}
if (!this.field_72996_f.contains(p_72897_1_)) {
@ -714,7 +744,7 @@
return true;
}
@@ -2265,8 +2393,7 @@
@@ -2265,8 +2401,7 @@
}
public boolean func_180502_D(BlockPos p_180502_1_) {
@ -724,7 +754,7 @@
}
@Nullable
@@ -2303,16 +2430,15 @@
@@ -2303,16 +2438,15 @@
}
public int func_72800_K() {
@ -744,7 +774,7 @@
}
public CrashReportCategory func_72914_a(CrashReport p_72914_1_) {
@@ -2349,16 +2475,16 @@
@@ -2349,16 +2483,16 @@
public abstract Scoreboard func_96441_U();
public void func_175666_e(BlockPos p_175666_1_, Block p_175666_2_) {
@ -766,7 +796,7 @@
iblockstate.func_189546_a(this, blockpos, p_175666_2_, p_175666_1_);
}
}
@@ -2464,4 +2590,40 @@
@@ -2464,4 +2598,40 @@
public abstract RecipeManager func_199532_z();
public abstract NetworkTagManager func_205772_D();

View file

@ -225,4 +225,11 @@ public interface IForgeEntity extends ICapabilitySerializable<NBTTagCompound>
* to prevent MC-136995.
*/
void onRemovedFromWorld();
/**
* Revives an entity that has been removed from a world.
* Used as replacement for entity.removed = true. Having it as a function allows
* the entity to react to being revived.
*/
void revive();
}

View file

@ -3,6 +3,7 @@ net/minecraft/block/BlockNetherWart.getDrops(Lnet/minecraft/block/state/IBlockSt
net/minecraft/block/BlockRailPowered.<init>(Lnet/minecraft/block/Block$Properties;Z)=|p_i48349_1_,isActivator
net/minecraft/block/BlockRedstoneWire.canConnectTo(Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/world/IBlockReader;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/EnumFacing;)Z=|p_176343_0_,world,pos,p_176343_1_
net/minecraft/client/multiplayer/WorldClient.removeEntity(Lnet/minecraft/entity/Entity;Z)V=|p_72900_1_,keepData
net/minecraft/client/renderer/model/BakedQuad.<init>([IILnet/minecraft/util/EnumFacing;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;ZLnet/minecraft/client/renderer/vertex/VertexFormat;)V=|p_i46574_1_,p_i46574_2_,p_i46574_3_,p_i46574_4_,applyDiffuseLighting,format
net/minecraft/client/renderer/model/FaceBakery.makeBakedQuad(Lnet/minecraft/client/renderer/Vector3f;Lnet/minecraft/client/renderer/Vector3f;Lnet/minecraft/client/renderer/model/BlockPartFace;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;Lnet/minecraftforge/common/model/ITransformation;Lnet/minecraft/client/renderer/model/BlockPartRotation;ZZ)Lnet/minecraft/client/renderer/model/BakedQuad;=|p_199332_1_,p_199332_2_,p_199332_3_,p_199332_4_,p_199332_5_,p_199332_6_,p_199332_7_,p_199332_8_,p_199332_9_
net/minecraft/client/renderer/model/FaceBakery.makeQuadVertexData(Lnet/minecraft/client/renderer/model/BlockFaceUV;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;Lnet/minecraft/util/EnumFacing;[FLnet/minecraftforge/common/model/ITransformation;Lnet/minecraft/client/renderer/model/BlockPartRotation;Z)[I=|p_188012_1_,p_188012_2_,p_188012_3_,p_188012_4_,p_188012_5_,p_188012_6_,p_188012_7_
@ -43,6 +44,8 @@ net/minecraft/world/World.getSunBrightnessFactor(F)F=|p_72967_1_
net/minecraft/world/World.getSunBrightnessBody(F)F=|p_72971_1_
net/minecraft/world/World.getSkyColorBody(Lnet/minecraft/entity/Entity;F)Lnet/minecraft/util/math/Vec3d;=|p_72833_1_,p_72833_2_
net/minecraft/world/World.getCloudColorBody(F)Lnet/minecraft/util/math/Vec3d;=|p_72824_1_
net/minecraft/world/World.removeEntity(Lnet/minecraft/entity/Entity;Z)V=|p_72900_1_,keepData
net/minecraft/world/World.removeEntityDangerously(Lnet/minecraft/entity/Entity;Z)V=|p_72973_1_,keepData
net/minecraft/world/WorldServer.canMineBlockBody(Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/util/math/BlockPos;)Z=|p_175660_1_,p_175660_2_
net/minecraft/world/WorldEntitySpawner.canSpawnAtBody(Lnet/minecraft/entity/EntitySpawnPlacementRegistry$SpawnPlacementType;Lnet/minecraft/world/IWorldReaderBase;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/EntityType;)Z=|p_209382_0_,p_209382_1_,p_209382_2_,p_209382_3_
net/minecraft/world/storage/SaveFormatOld.getWorldData(Ljava/io/File;Lcom/mojang/datafixers/DataFixer;Lnet/minecraft/world/storage/SaveHandler;)Lnet/minecraft/world/storage/WorldInfo;=|p_186353_0_,p_186353_1_,saveHandler