The Twilight Forest

The Twilight Forest

143M Downloads

Player spawn over the TF portal when the portal is larger than 2x2

lucom opened this issue ยท 1 comments

commented

Forge version: 1.12.2-forge1.12.2-14.23.3.2698
Twilight Forest version: 1.12.2-3.7.424
Link to crash log: -

Steps to reproduce:

  1. Create a large pool (at least 4x4 water blocks) and surround it with plants, drop a diamond in it. A TF portal should now be created.
  2. Jump into the portal. You should now be in the TF.
  3. Get back to the over world through the automatically generated portal in TF (should be 2x2 portal blocks)

What I expected to happen:
I should stand next to the TF portal on a solid block.

What happened instead:
I spawn above the TF portal and fall back into it.

This seems to depend on the alignment of the portals in TF and the over world. Depending on which side I enter the portal from the TF it might happen that I land next to and not in the portal in the overworld.

commented

Probably this needs updating now portals aren't always 2x2:

// TF - replace with our own placement logic
double portalX = blockpos.getX() + 0.5D;
double portalY = blockpos.getY() + 0.5D;
double portalZ = blockpos.getZ() + 0.5D;
if (isBlockPortal(world, blockpos.west())) {
portalX -= 0.5D;
}
if (isBlockPortal(world, blockpos.east())) {
portalX += 0.5D;
}
if (isBlockPortal(world, blockpos.north())) {
portalZ -= 0.5D;
}
if (isBlockPortal(world, blockpos.south())) {
portalZ += 0.5D;
}
int xOffset = 0;
int zOffset = 0;
while (xOffset == zOffset && xOffset == 0) {
xOffset = random.nextInt(3) - random.nextInt(3);
zOffset = random.nextInt(3) - random.nextInt(3);
}
entityIn.motionX = entityIn.motionY = entityIn.motionZ = 0.0D;
if (entityIn instanceof EntityPlayerMP) {
((EntityPlayerMP) entityIn).connection.setPlayerLocation(portalX + xOffset, portalY + 1, portalZ + zOffset, entityIn.rotationYaw, entityIn.rotationPitch);
} else {
entityIn.setLocationAndAngles(portalX + xOffset, portalY + 1, portalZ + zOffset, entityIn.rotationYaw, entityIn.rotationPitch);
}