Fixed player invalid position when changing dimension

This commit is contained in:
Unknown 2019-08-25 10:14:32 +02:00 committed by unknown
parent 4c7699a2a7
commit 121bc241b9
4 changed files with 9 additions and 6 deletions

View file

@ -1006,7 +1006,8 @@ public class Commons {
if (entity instanceof EntityPlayerMP) {
final EntityPlayerMP player = (EntityPlayerMP) entity;
server.getPlayerList().transferPlayerToDimension(player, worldDestination.provider.getDimension(), teleporter);
// player.sendPlayerAbilities();
player.invulnerableDimensionChange = true;
player.connection.captureCurrentPosition();
} else {
server.getPlayerList().transferEntityToWorld(entity, worldSource.provider.getDimension(), worldServerFrom, worldServerTo, teleporter);
}

View file

@ -99,8 +99,9 @@ public class WorldHandler {
@SubscribeEvent
public void onPlayerChangedDimension(final PlayerChangedDimensionEvent event) {
WarpDrive.logger.info(String.format("onPlayerChangedDimension %s %d -> %d",
event.player.getName(), event.fromDim, event.toDim ));
WarpDrive.logger.info(String.format("onPlayerChangedDimension %s %d -> %d (%.1f %.1f %.1f)",
event.player.getName(), event.fromDim, event.toDim,
event.player.posX, event.player.posY, event.player.posZ ));
WarpDrive.cloaks.onPlayerJoinWorld((EntityPlayerMP) event.player, ((EntityPlayerMP) event.player).world);
}

View file

@ -23,10 +23,9 @@ public class SpaceTeleporter implements ITeleporter {
@Override
public void placeEntity(final World world, @Nonnull final Entity entity, final float yaw) {
entity.setLocationAndAngles(v3Destination.x, v3Destination.y, v3Destination.z, entity.rotationYaw, entity.rotationPitch);
if (entity instanceof EntityPlayerMP) {
((EntityPlayerMP)entity).connection.setPlayerLocation(v3Destination.x, v3Destination.y, v3Destination.z, yaw, entity.rotationPitch);
} else {
entity.setLocationAndAngles(v3Destination.x, v3Destination.y, v3Destination.z, entity.rotationYaw, entity.rotationPitch);
((EntityPlayerMP) entity).connection.setPlayerLocation(v3Destination.x, v3Destination.y, v3Destination.z, yaw, entity.rotationPitch);
}
}
}

View file

@ -13,6 +13,8 @@ public net.minecraft.item.ItemAxe field_150917_c # blocksEffectiveAgainst
# public net.minecraft.util.RegistrySimple field_82596_a # registryObjects
# public-f net.minecraft.util.RegistryNamespaced field_148759_a # underlyingIntegerMap
# public net.minecraft.world.World field_72998_d # collidingBoundingBoxes
public net.minecraft.entity.player.EntityPlayerMP field_184851_cj # invulnerableDimensionChange
public net.minecraft.network.NetHandlerPlayServer func_184342_d()V # captureCurrentPosition
# Explosion source
public net.minecraft.world.Explosion field_77283_e # exploder