use of org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutPlayerPositionAndLook in project LanternServer by LanternPowered.
the class LanternPlayer method setLocationAndRotation.
@Override
public boolean setLocationAndRotation(Location<World> location, Vector3d rotation, EnumSet<RelativePositions> relativePositions) {
final World oldWorld = getWorld();
final boolean success = super.setLocationAndRotation(location, rotation, relativePositions);
if (success) {
final World world = location.getExtent();
// Only send this if the world isn't changed, otherwise will the position be resend anyway
if (oldWorld == world) {
final Vector3d pos = location.getPosition();
final MessagePlayOutPlayerPositionAndLook message = new MessagePlayOutPlayerPositionAndLook(pos.getX(), pos.getY(), pos.getZ(), (float) rotation.getX(), (float) rotation.getY(), Sets.immutableEnumSet(relativePositions), 0);
this.session.send(message);
}
}
return success;
}
use of org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutPlayerPositionAndLook in project LanternServer by LanternPowered.
the class LanternPlayer method setPositionAndWorld.
@Override
public boolean setPositionAndWorld(World world, Vector3d position) {
final LanternWorld oldWorld = this.getWorld();
final boolean success = super.setPositionAndWorld(world, position);
if (success && world == oldWorld) {
this.session.send(new MessagePlayOutPlayerPositionAndLook(position.getX(), position.getY(), position.getZ(), 0, 0, RELATIVE_ROTATION, 0));
}
return success;
}
use of org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutPlayerPositionAndLook in project LanternServer by LanternPowered.
the class LanternPlayer method setLocationAndRotation.
@Override
public boolean setLocationAndRotation(Location<World> location, Vector3d rotation) {
final World oldWorld = getWorld();
final boolean success = super.setLocationAndRotation(location, rotation);
if (success) {
final World world = location.getExtent();
// Only send this if the world isn't changed, otherwise will the position be resend anyway
if (oldWorld == world) {
final Vector3d pos = location.getPosition();
final MessagePlayOutPlayerPositionAndLook message = new MessagePlayOutPlayerPositionAndLook(pos.getX(), pos.getY(), pos.getZ(), (float) rotation.getX(), (float) rotation.getY(), Collections.emptySet(), 0);
this.session.send(message);
}
}
return success;
}
use of org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutPlayerPositionAndLook in project LanternServer by LanternPowered.
the class LanternPlayer method setRotation.
@Override
public void setRotation(Vector3d rotation) {
super.setRotation(rotation);
final LanternWorld world = getWorld();
if (world != null) {
this.session.send(new MessagePlayOutPlayerPositionAndLook(0, 0, 0, (float) rotation.getX(), (float) rotation.getY(), RELATIVE_POSITION, 0));
}
}
use of org.lanternpowered.server.network.vanilla.message.type.play.MessagePlayOutPlayerPositionAndLook in project LanternServer by LanternPowered.
the class LanternPlayer method setPosition.
@Override
public void setPosition(Vector3d position) {
super.setPosition(position);
final LanternWorld world = getWorld();
if (world != null) {
this.session.send(new MessagePlayOutPlayerPositionAndLook(position.getX(), position.getY(), position.getZ(), 0, 0, RELATIVE_ROTATION, 0));
}
}
Aggregations