mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Fix ProtocolSupport compatibility
This commit is contained in:
parent
afda4c271c
commit
ce0dda5931
@ -120,6 +120,9 @@ public class FaweBukkit implements IFawe, Listener {
|
||||
|
||||
// Registered delayed Event Listeners
|
||||
TaskManager.IMP.task(() -> {
|
||||
// Fix for ProtocolSupport
|
||||
Settings.IMP.PROTOCOL_SUPPORT_FIX = Bukkit.getPluginManager().isPluginEnabled("ProtocolSupport");
|
||||
|
||||
// This class
|
||||
Bukkit.getPluginManager().registerEvents(FaweBukkit.this, FaweBukkit.this.plugin);
|
||||
|
||||
|
@ -238,7 +238,7 @@ public class BukkitChunk_1_13 extends IntFaweChunk<Chunk, BukkitQueue_1_13> {
|
||||
if (current == null) {
|
||||
continue;
|
||||
}
|
||||
sectionPalettes[i] = copy(current);
|
||||
copy.sectionPalettes[i] = copy(current);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
MainUtil.handleError(e);
|
||||
|
@ -6,6 +6,7 @@ import com.boydti.fawe.bukkit.BukkitPlayer;
|
||||
import com.boydti.fawe.bukkit.adapter.v1_13_1.BlockMaterial_1_13;
|
||||
import com.boydti.fawe.bukkit.adapter.v1_13_1.Spigot_v1_13_R2;
|
||||
import com.boydti.fawe.bukkit.v0.BukkitQueue_0;
|
||||
import com.boydti.fawe.config.Settings;
|
||||
import com.boydti.fawe.example.IntFaweChunk;
|
||||
import com.boydti.fawe.jnbt.anvil.BitArray4096;
|
||||
import com.boydti.fawe.object.FaweChunk;
|
||||
@ -867,11 +868,17 @@ public class BukkitQueue_1_13 extends BukkitQueue_0<net.minecraft.server.v1_13_R
|
||||
|
||||
// BlockStates
|
||||
int bitsPerEntry = MathMan.log2nlz(num_palette - 1);
|
||||
if (Settings.IMP.PROTOCOL_SUPPORT_FIX) {
|
||||
bitsPerEntry = Math.max(bitsPerEntry, 4); // Protocol support breaks <4 bits per entry
|
||||
} else {
|
||||
bitsPerEntry = 1; // For some reason minecraft needs 4096 bits to store 0 entries
|
||||
}
|
||||
|
||||
|
||||
int blockBitArrayEnd = (bitsPerEntry * 4096) >> 6;
|
||||
if (num_palette == 1) {
|
||||
// Set a value, because minecraft needs it for some reason
|
||||
blockstates[0] = 0;
|
||||
blockBitArrayEnd = 1;
|
||||
// Set a value, because minecraft needs it for some reason even if the array is empty
|
||||
for (int i = 0; i < blockBitArrayEnd; i++) blockstates[i] = 0;
|
||||
} else {
|
||||
BitArray4096 bitArray = new BitArray4096(blockstates, bitsPerEntry);
|
||||
bitArray.fromRaw(blocksCopy);
|
||||
@ -886,7 +893,7 @@ public class BukkitQueue_1_13 extends BukkitQueue_0<net.minecraft.server.v1_13_R
|
||||
DataBits nmsBits = new DataBits(bitsPerEntry, 4096, bits);
|
||||
DataPalette<IBlockData> palette;
|
||||
// DataPaletteHash<IBlockData> hash = new DataPaletteHash<>(Block.REGISTRY_ID, num_palette, dataPaletteBlocks, GameProfileSerializer::d, GameProfileSerializer::a);
|
||||
palette = new DataPaletteLinear<>(Block.REGISTRY_ID, num_palette, dataPaletteBlocks, GameProfileSerializer::d);
|
||||
palette = new DataPaletteLinear<>(Block.REGISTRY_ID, bitsPerEntry, dataPaletteBlocks, GameProfileSerializer::d);
|
||||
// set palette
|
||||
for (int i = 0; i < num_palette; i++) {
|
||||
int ordinal = paletteToBlock[i];
|
||||
@ -903,6 +910,7 @@ public class BukkitQueue_1_13 extends BukkitQueue_0<net.minecraft.server.v1_13_R
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return section;
|
||||
} catch (Throwable e){
|
||||
Arrays.fill(blockToPalette, Integer.MAX_VALUE);
|
||||
|
@ -9,6 +9,9 @@ public class Settings extends Config {
|
||||
@Ignore
|
||||
public static final Settings IMP = new Settings();
|
||||
|
||||
@Ignore
|
||||
public boolean PROTOCOL_SUPPORT_FIX = false;
|
||||
|
||||
@Comment("These first 6 aren't configurable") // This is a comment
|
||||
@Final // Indicates that this value isn't configurable
|
||||
public String ISSUES = "https://github.com/boy0001/FastAsyncWorldedit/issues";
|
||||
|
Loading…
Reference in New Issue
Block a user