use of net.minecraft.network.NetHandlerPlayServer in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class ITransformablePacket method doPreProcessing.
/**
* Puts the player into local coordinates and makes a record of where they used to be.
*/
default void doPreProcessing(INetHandlerPlayServer server, boolean callingFromSponge) {
if (isPacketOnMainThread(server, callingFromSponge)) {
// System.out.println("Pre packet process");
NetHandlerPlayServer serverHandler = (NetHandlerPlayServer) server;
EntityPlayerMP player = serverHandler.player;
ShipData physicsObject = getPacketParent(serverHandler);
if (physicsObject != null) {
// First make a backup of the player position
ICapabilityEntityBackup entityBackup = player.getCapability(VSCapabilityRegistry.VS_ENTITY_BACKUP, null);
entityBackup.backupEntityPosition(player);
// Then put the player into ship coordinates.
physicsObject.getShipTransform().transform(player, TransformType.GLOBAL_TO_SUBSPACE, true);
}
}
}
Aggregations