Add Forge dimension-changing hooks to spectator handling code (#5212)

This commit is contained in:
Ben Staddon 2019-04-11 15:05:19 +01:00 committed by tterrag
parent 1aae18d4bc
commit 1f0467b864
2 changed files with 26 additions and 2 deletions

View file

@ -119,9 +119,16 @@
}
protected void func_70670_a(PotionEffect p_70670_1_) {
@@ -1179,8 +1203,8 @@
@@ -1174,13 +1198,13 @@
this.func_184210_p();
if (p_200619_1_ == this.field_70170_p) {
this.field_71135_a.func_147364_a(p_200619_2_, p_200619_4_, p_200619_6_, p_200619_8_, p_200619_9_);
- } else {
+ } else if (net.minecraftforge.common.ForgeHooks.onTravelToDimension(this, p_200619_1_.field_73011_w.func_186058_p())) {
WorldServer worldserver = this.func_71121_q();
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_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_71135_a.func_147359_a(new SPacketRespawn(this.field_71093_bK, p_200619_1_.func_175659_aa(), p_200619_1_.func_72912_H().func_76067_t(), this.field_71134_c.func_73081_b())); // Forge: Use new dimensions information
this.field_71133_b.func_184103_al().func_187243_f(this);
- worldserver.func_72973_f(this);
- this.field_70128_L = false;
@ -130,3 +137,11 @@
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);
@@ -1194,6 +1218,7 @@
this.field_71134_c.func_73080_a(p_200619_1_);
this.field_71133_b.func_184103_al().func_72354_b(this, p_200619_1_);
this.field_71133_b.func_184103_al().func_72385_f(this);
+ net.minecraftforge.fml.hooks.BasicEventHooks.firePlayerChangedDimensionEvent(this, p_200619_1_.field_73011_w.func_186058_p(), this.field_71093_bK);
}
}

View file

@ -107,6 +107,15 @@
} else {
entityplayermp.field_71135_a.func_147359_a(new SPacketChangeGameState(0, 0.0F));
}
@@ -434,7 +458,7 @@
entityplayermp.func_70107_b(entityplayermp.field_70165_t, entityplayermp.field_70163_u + 1.0D, entityplayermp.field_70161_v);
}
- entityplayermp.field_71135_a.func_147359_a(new SPacketRespawn(entityplayermp.field_71093_bK, entityplayermp.field_70170_p.func_175659_aa(), entityplayermp.field_70170_p.func_72912_H().func_76067_t(), entityplayermp.field_71134_c.func_73081_b()));
+ entityplayermp.field_71135_a.func_147359_a(new SPacketRespawn(entityplayermp.field_71093_bK, world.func_175659_aa(), world.func_72912_H().func_76067_t(), entityplayermp.field_71134_c.func_73081_b())); // Forge: Use new dimensions information
BlockPos blockpos2 = worldserver.func_175694_M();
entityplayermp.field_71135_a.func_147364_a(entityplayermp.field_70165_t, entityplayermp.field_70163_u, entityplayermp.field_70161_v, entityplayermp.field_70177_z, entityplayermp.field_70125_A);
entityplayermp.field_71135_a.func_147359_a(new SPacketSpawnPosition(blockpos2));
@@ -447,6 +471,7 @@
this.field_177454_f.put(entityplayermp.func_110124_au(), entityplayermp);
entityplayermp.func_71116_b();