Fix negative chunk coordinate conversion
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
Lixfel 2023-09-13 21:37:35 +02:00
Ursprung 5797d0e0be
Commit 307fe08bd6

Datei anzeigen

@ -46,13 +46,16 @@ public class SetBlockPacketListener implements AxiomPacketListener {
int x = getX.invoke(pos);
int y = getY.invoke(pos);
int z = getZ.invoke(pos);
int cx = x / 16 - (x < 0 ? 1 : 0);
int cy = y / 16 - (y < 0 ? 1 : 0);
int cz = z / 16 - (z < 0 ? 1 : 0);
// Update blocks
if(RegionProtection.getProtection.apply(player, world).canBuildInSection(x / 16, y / 16, z / 16)) {
if(RegionProtection.getProtection.apply(player, world).canBuildInSection(cx, cy, cz)) {
if (updateNeighbors) {
setBlock.invoke(AxiomPaper.convert(player.getWorld()), pos, state, 3);
} else {
ChunkSectionModifier section = new ChunkSectionModifier(player.getWorld(), x / 16, y / 16, z / 16);
ChunkSectionModifier section = new ChunkSectionModifier(player.getWorld(), cx, cy, cz);
section.setState(x & 0xF, y & 0xF, z & 0xF, state);
section.finish();
}