Remove hardcoding of heightmap compressed long size (#1668)

Dieser Commit ist enthalten in:
Jordan 2022-03-18 21:28:25 +00:00 committet von GitHub
Ursprung 05f80f23b9
Commit 465c81d193
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
3 geänderte Dateien mit 9 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -11,6 +11,7 @@ import com.fastasyncworldedit.core.queue.IChunkGet;
import com.fastasyncworldedit.core.queue.IChunkSet; import com.fastasyncworldedit.core.queue.IChunkSet;
import com.fastasyncworldedit.core.queue.implementation.QueueHandler; import com.fastasyncworldedit.core.queue.implementation.QueueHandler;
import com.fastasyncworldedit.core.queue.implementation.blocks.CharGetBlocks; import com.fastasyncworldedit.core.queue.implementation.blocks.CharGetBlocks;
import com.fastasyncworldedit.core.util.MathMan;
import com.fastasyncworldedit.core.util.collection.AdaptedMap; import com.fastasyncworldedit.core.util.collection.AdaptedMap;
import com.google.common.base.Suppliers; import com.google.common.base.Suppliers;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
@ -173,7 +174,8 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
@Override @Override
public void setHeightmapToGet(HeightMapType type, int[] data) { public void setHeightmapToGet(HeightMapType type, int[] data) {
BitArrayUnstretched bitArray = new BitArrayUnstretched(9, 256); // height + 1 to match server internal
BitArrayUnstretched bitArray = new BitArrayUnstretched(MathMan.log2nlz(getChunk().getHeight() + 1), 256);
bitArray.fromRaw(data); bitArray.fromRaw(data);
Heightmap.Types nativeType = Heightmap.Types.valueOf(type.name()); Heightmap.Types nativeType = Heightmap.Types.valueOf(type.name());
Heightmap heightMap = getChunk().heightmaps.get(nativeType); Heightmap heightMap = getChunk().heightmaps.get(nativeType);

Datei anzeigen

@ -11,6 +11,7 @@ import com.fastasyncworldedit.core.queue.IChunkGet;
import com.fastasyncworldedit.core.queue.IChunkSet; import com.fastasyncworldedit.core.queue.IChunkSet;
import com.fastasyncworldedit.core.queue.implementation.QueueHandler; import com.fastasyncworldedit.core.queue.implementation.QueueHandler;
import com.fastasyncworldedit.core.queue.implementation.blocks.CharGetBlocks; import com.fastasyncworldedit.core.queue.implementation.blocks.CharGetBlocks;
import com.fastasyncworldedit.core.util.MathMan;
import com.fastasyncworldedit.core.util.collection.AdaptedMap; import com.fastasyncworldedit.core.util.collection.AdaptedMap;
import com.google.common.base.Suppliers; import com.google.common.base.Suppliers;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
@ -175,7 +176,8 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
@Override @Override
public void setHeightmapToGet(HeightMapType type, int[] data) { public void setHeightmapToGet(HeightMapType type, int[] data) {
BitArrayUnstretched bitArray = new BitArrayUnstretched(9, 256); // height + 1 to match server internal
BitArrayUnstretched bitArray = new BitArrayUnstretched(MathMan.log2nlz(getChunk().getHeight() + 1), 256);
bitArray.fromRaw(data); bitArray.fromRaw(data);
Heightmap.Types nativeType = Heightmap.Types.valueOf(type.name()); Heightmap.Types nativeType = Heightmap.Types.valueOf(type.name());
Heightmap heightMap = getChunk().heightmaps.get(nativeType); Heightmap heightMap = getChunk().heightmaps.get(nativeType);

Datei anzeigen

@ -11,6 +11,7 @@ import com.fastasyncworldedit.core.queue.IChunkGet;
import com.fastasyncworldedit.core.queue.IChunkSet; import com.fastasyncworldedit.core.queue.IChunkSet;
import com.fastasyncworldedit.core.queue.implementation.QueueHandler; import com.fastasyncworldedit.core.queue.implementation.QueueHandler;
import com.fastasyncworldedit.core.queue.implementation.blocks.CharGetBlocks; import com.fastasyncworldedit.core.queue.implementation.blocks.CharGetBlocks;
import com.fastasyncworldedit.core.util.MathMan;
import com.fastasyncworldedit.core.util.collection.AdaptedMap; import com.fastasyncworldedit.core.util.collection.AdaptedMap;
import com.google.common.base.Suppliers; import com.google.common.base.Suppliers;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
@ -178,7 +179,8 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
@Override @Override
public void setHeightmapToGet(HeightMapType type, int[] data) { public void setHeightmapToGet(HeightMapType type, int[] data) {
BitArrayUnstretched bitArray = new BitArrayUnstretched(9, 256); // height + 1 to match server internal
BitArrayUnstretched bitArray = new BitArrayUnstretched(MathMan.log2nlz(getChunk().getHeight() + 1), 256);
bitArray.fromRaw(data); bitArray.fromRaw(data);
Heightmap.Types nativeType = Heightmap.Types.valueOf(type.name()); Heightmap.Types nativeType = Heightmap.Types.valueOf(type.name());
Heightmap heightMap = getChunk().heightmaps.get(nativeType); Heightmap heightMap = getChunk().heightmaps.get(nativeType);