mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-11 20:13:55 +00:00
Looks like working block setting and removal
This commit is contained in:
@ -58,6 +58,7 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
private boolean listeningImages;
|
||||
private BukkitImageListener imageListener;
|
||||
private CFIPacketListener packetListener;
|
||||
private final boolean chunksStretched;
|
||||
|
||||
public VaultUtil getVault() {
|
||||
return this.vault;
|
||||
@ -99,6 +100,8 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
// The tick limiter
|
||||
new ChunkListener_9();
|
||||
});
|
||||
|
||||
chunksStretched = Integer.parseInt(Bukkit.getMinecraftVersion().split("\\.")[1]) >= 16;
|
||||
}
|
||||
|
||||
@Override // Please don't delete this again, it's WIP
|
||||
@ -302,6 +305,11 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isChunksStretched() {
|
||||
return chunksStretched;
|
||||
}
|
||||
|
||||
private void setupPlotSquared() {
|
||||
Plugin plotSquared = this.plugin.getServer().getPluginManager().getPlugin("PlotSquared");
|
||||
if (plotSquared == null)
|
||||
|
@ -5,7 +5,7 @@ import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.bukkit.adapter.DelegateLock;
|
||||
import com.boydti.fawe.bukkit.adapter.NMSAdapter;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.collection.BitArray;
|
||||
import com.boydti.fawe.object.collection.BitArrayUnstretched;
|
||||
import com.boydti.fawe.util.MathMan;
|
||||
import com.boydti.fawe.util.ReflectionUtils;
|
||||
import com.boydti.fawe.util.TaskManager;
|
||||
@ -232,11 +232,13 @@ public final class BukkitAdapter_1_16_1 extends NMSAdapter {
|
||||
bitsPerEntry = Math.max(bitsPerEntry, 1); // For some reason minecraft needs 4096 bits to store 0 entries
|
||||
}
|
||||
|
||||
final int blockBitArrayEnd = (bitsPerEntry * 4096) >> 6;
|
||||
final int blocksPerLong = MathMan.floorZero((double) 64 / bitsPerEntry);
|
||||
final int blockBitArrayEnd = MathMan.ceilZero((float) 4096 / blocksPerLong);
|
||||
|
||||
if (num_palette == 1) {
|
||||
for (int i = 0; i < blockBitArrayEnd; i++) blockStates[i] = 0;
|
||||
} else {
|
||||
final BitArray bitArray = new BitArray(bitsPerEntry, 4096, blockStates);
|
||||
final BitArrayUnstretched bitArray = new BitArrayUnstretched(bitsPerEntry, blockStates);
|
||||
bitArray.fromRaw(blocksCopy);
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ import com.boydti.fawe.bukkit.adapter.DelegateLock;
|
||||
import com.boydti.fawe.bukkit.adapter.mc1_16_1.nbt.LazyCompoundTag_1_16_1;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.object.collection.AdaptedMap;
|
||||
import com.boydti.fawe.object.collection.BitArray;
|
||||
import com.boydti.fawe.object.collection.BitArrayUnstretched;
|
||||
import com.google.common.base.Suppliers;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
@ -553,7 +553,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
|
||||
final int bitsPerEntry = (int) BukkitAdapter_1_16_1.fieldBitsPerEntry.get(bits);
|
||||
final long[] blockStates = bits.a();
|
||||
|
||||
new BitArray(bitsPerEntry, 4096, blockStates).toRaw(data);
|
||||
new BitArrayUnstretched(bitsPerEntry, blockStates).toRaw(data);
|
||||
|
||||
int num_palette;
|
||||
if (palette instanceof DataPaletteLinear) {
|
||||
|
Reference in New Issue
Block a user