Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-20 15:00:11 +01:00
Fix ChunkPosition
Dieser Commit ist enthalten in:
Ursprung
9008036ee4
Commit
3615ec2b90
@ -27,12 +27,14 @@ package org.geysermc.connector.world.chunk;
|
|||||||
|
|
||||||
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
|
import com.github.steveice10.mc.protocol.data.game.entity.metadata.Position;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
public class ChunkPosition {
|
public class ChunkPosition {
|
||||||
|
|
||||||
private int x;
|
private int x;
|
||||||
@ -43,16 +45,9 @@ public class ChunkPosition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Position getChunkBlock(int x, int y, int z) {
|
public Position getChunkBlock(int x, int y, int z) {
|
||||||
int chunkX = x % 16;
|
int chunkX = x & 15;
|
||||||
int chunkY = y % 16;
|
int chunkY = y & 15;
|
||||||
int chunkZ = z % 16;
|
int chunkZ = z & 15;
|
||||||
|
|
||||||
if (chunkX < 0)
|
|
||||||
chunkX = -chunkX;
|
|
||||||
if (chunkY < 0)
|
|
||||||
chunkY = -chunkY;
|
|
||||||
if (chunkZ < 0)
|
|
||||||
chunkZ = -chunkZ;
|
|
||||||
|
|
||||||
return new Position(chunkX, chunkY, chunkZ);
|
return new Position(chunkX, chunkY, chunkZ);
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren