Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-28 09:00:09 +01:00
Use integer for y coordinate in Position
Dieser Commit ist enthalten in:
Ursprung
3aa35395f4
Commit
e56ff898eb
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
};
|
||||
|
||||
|
@ -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:
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren