Reimplement ITeleporter Patches (#6886)

This commit is contained in:
Richard Freimer authored and GitHub committed 2020-07-06 13:45:22 -07:00
1 parent a567ddaa10
commit 91a2b02590
9 files changed
+151 -33

No files matched your search

@@ -216,7 +216,56 @@
}
public boolean func_70028_i(Entity p_70028_1_) {
@@ -2159,10 +2187,12 @@
@@ -2072,10 +2100,15 @@
@Nullable
public Entity func_241206_a_(ServerWorld p_241206_1_) {
+ return this.changeDimension(p_241206_1_, p_241206_1_.func_85176_s());
+ }
+ @Nullable
+ public Entity changeDimension(ServerWorld p_241206_1_, net.minecraftforge.common.util.ITeleporter teleporter) {
if (this.field_70170_p instanceof ServerWorld && !this.field_70128_L) {
this.field_70170_p.func_217381_Z().func_76320_a("changeDimension");
this.func_213319_R();
this.field_70170_p.func_217381_Z().func_76320_a("reposition");
+ Entity transportedEntity = teleporter.placeEntity(this, (ServerWorld) this.field_70170_p, p_241206_1_, this.field_70177_z, spawnPortal -> { //Forge: Start vanilla logic
Vector3d vector3d = this.func_213322_ci();
float f = 0.0F;
BlockPos blockpos;
@@ -2105,6 +2138,7 @@
d1 = MathHelper.func_151237_a(d1, d4, d6);
Vector3d vector3d1 = this.func_181014_aG();
blockpos = new BlockPos(d0, this.func_226278_cu_(), d1);
+ if (spawnPortal) {
BlockPattern.PortalInfo blockpattern$portalinfo = p_241206_1_.func_85176_s().func_222272_a(blockpos, vector3d, this.func_181012_aH(), vector3d1.field_72450_a, vector3d1.field_72448_b, this instanceof PlayerEntity);
if (blockpattern$portalinfo == null) {
return null;
@@ -2113,6 +2147,7 @@
blockpos = new BlockPos(blockpattern$portalinfo.field_222505_a);
vector3d = blockpattern$portalinfo.field_222506_b;
f = (float)blockpattern$portalinfo.field_222507_c;
+ }
}
this.field_70170_p.func_217381_Z().func_219895_b("reloading");
@@ -2126,13 +2161,15 @@
ServerWorld.func_241121_a_(p_241206_1_);
}
}
+ return entity;
+ });//Forge: End vanilla logic
this.func_241204_bJ_();
this.field_70170_p.func_217381_Z().func_76319_b();
((ServerWorld)this.field_70170_p).func_82742_i();
p_241206_1_.func_82742_i();
this.field_70170_p.func_217381_Z().func_76319_b();
- return entity;
+ return transportedEntity;
} else {
return null;
}
@@ -2159,10 +2196,12 @@
}
public Vector3d func_181014_aG() {
@@ -229,7 +278,7 @@
return this.field_181018_ap;
}
@@ -2295,7 +2325,7 @@
@@ -2295,7 +2334,7 @@
Pose pose = this.func_213283_Z();
EntitySize entitysize1 = this.func_213305_a(pose);
this.field_213325_aI = entitysize1;
@@ -238,7 +287,7 @@
if (entitysize1.field_220315_a < entitysize.field_220315_a) {
double d0 = (double)entitysize1.field_220315_a / 2.0D;
this.func_174826_a(new AxisAlignedBB(this.func_226277_ct_() - d0, this.func_226278_cu_(), this.func_226281_cx_() - d0, this.func_226277_ct_() + d0, this.func_226278_cu_() + (double)entitysize1.field_220316_b, this.func_226281_cx_() + d0));
@@ -2769,6 +2799,7 @@
@@ -2769,6 +2808,7 @@
this.field_233555_aA_ = true;
}
@@ -246,7 +295,7 @@
}
@@ -2779,4 +2810,69 @@
@@ -2779,4 +2819,69 @@
public interface IMoveCallback {
void accept(Entity p_accept_1_, double p_accept_2_, double p_accept_4_, double p_accept_6_);
}