3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-09-08 22:02:50 +02:00

Use integer for y coordinate in Position

Dieser Commit ist enthalten in:
KennyTV 2020-12-03 11:14:46 +01:00
Ursprung 3aa35395f4
Commit e56ff898eb
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
5 geänderte Dateien mit 14 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -2,9 +2,15 @@ package us.myles.ViaVersion.api.minecraft;
public class Position {
private final int x;
private final short y;
private final int y;
private final int z;
public Position(int x, int y, int z) {
this.x = x;
this.y = y;
this.z = z;
}
public Position(int x, short y, int z) {
this.x = x;
this.y = y;
@ -23,7 +29,7 @@ public class Position {
return x;
}
public short getY() {
public int getY() {
return y;
}
@ -44,7 +50,7 @@ public class Position {
@Override
public int hashCode() {
int result = x;
result = 31 * result + (int) y;
result = 31 * result + y;
result = 31 * result + z;
return result;
}

Datei anzeigen

@ -19,7 +19,8 @@ public class OptPosition1_14Type extends Type<Position> {
@Override
public void write(ByteBuf buffer, Position object) throws Exception {
buffer.writeBoolean(object != null);
if (object != null)
if (object != null) {
Type.POSITION1_14.write(buffer, object);
}
}
}

Datei anzeigen

@ -17,7 +17,7 @@ public class Position1_14Type extends Type<Position> {
long y = val << 52 >> 52;
long z = val << 26 >> 38;
return new Position((int) x, (short) y, (int) z);
return new Position((int) x, (int) y, (int) z);
}
@Override

Datei anzeigen

@ -61,7 +61,7 @@ public class Protocol1_13To1_12_2 extends Protocol<ClientboundPackets1_12_1, Cli
public static final PacketHandler POS_TO_3_INT = wrapper -> {
Position position = wrapper.read(Type.POSITION);
wrapper.write(Type.INT, position.getX());
wrapper.write(Type.INT, (int) position.getY());
wrapper.write(Type.INT, position.getY());
wrapper.write(Type.INT, position.getZ());
};

Datei anzeigen

@ -343,7 +343,7 @@ public class WorldPackets {
return;
Position p = wrapper.get(Type.POSITION, 0);
int x = p.getX();
short y = p.getY();
int y = p.getY();
int z = p.getZ();
switch (face) {
case 0: