Add UpdateViewPositionPacket constructor

This commit is contained in:
TheMode 2021-07-27 07:00:04 +02:00
parent d61b1d48b7
commit de76ac5aad
2 changed files with 9 additions and 8 deletions

View File

@ -1570,10 +1570,7 @@ public class Player extends LivingEntity implements CommandSender, Localizable,
* @param chunkZ the chunk Z
*/
public void updateViewPosition(int chunkX, int chunkZ) {
UpdateViewPositionPacket updateViewPositionPacket = new UpdateViewPositionPacket();
updateViewPositionPacket.chunkX = chunkX;
updateViewPositionPacket.chunkZ = chunkZ;
playerConnection.sendPacket(updateViewPositionPacket);
playerConnection.sendPacket(new UpdateViewPositionPacket(chunkX, chunkZ));
}
public int getNextTeleportId() {

View File

@ -10,10 +10,14 @@ public class UpdateViewPositionPacket implements ServerPacket {
public int chunkX, chunkZ;
/**
* Default constructor, required for reflection operations.
*/
public UpdateViewPositionPacket() {}
public UpdateViewPositionPacket(int chunkX, int chunkZ) {
this.chunkX = chunkX;
this.chunkZ = chunkZ;
}
public UpdateViewPositionPacket() {
this(0, 0);
}
@Override
public void write(@NotNull BinaryWriter writer) {