I forgot about sponge
This commit is contained in:
parent
8a40320a64
commit
dc3ab46803
@ -77,11 +77,13 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||
protected static Field fieldBiomes2;
|
||||
protected static Field fieldGenLayer1;
|
||||
protected static Field fieldGenLayer2;
|
||||
protected static ExtendedBlockStorage emptySection;
|
||||
|
||||
private static MutableGenLayer genLayer;
|
||||
|
||||
static {
|
||||
try {
|
||||
emptySection = new ExtendedBlockStorage(0, false);
|
||||
Class<?> converter = Class.forName("com.sk89q.worldedit.sponge.nms.NBTConverter");
|
||||
methodFromNative = converter.getDeclaredMethod("toNative", Tag.class);
|
||||
methodToNative = converter.getDeclaredMethod("fromNative", NBTBase.class);
|
||||
@ -441,10 +443,15 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshChunk(FaweChunk fc) {
|
||||
SpongeChunk_1_11 fs = (SpongeChunk_1_11) fc;
|
||||
ensureChunkLoaded(fc.getX(), fc.getZ());
|
||||
Chunk nmsChunk = fs.getChunk();
|
||||
public void sendChunk(int x, int z, int bitMask) {
|
||||
if (!isChunkLoaded(x, z)) {
|
||||
return;
|
||||
}
|
||||
Chunk chunk = getChunk(getImpWorld(), x, z);
|
||||
sendChunk(chunk, bitMask);
|
||||
}
|
||||
|
||||
public void sendChunk(Chunk nmsChunk, int mask) {
|
||||
if (!nmsChunk.isLoaded()) {
|
||||
return;
|
||||
}
|
||||
@ -463,7 +470,14 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||
players.add(input);
|
||||
return false;
|
||||
});
|
||||
int mask = fc.getBitMask();
|
||||
boolean empty = false;
|
||||
ExtendedBlockStorage[] sections = nmsChunk.getBlockStorageArray();
|
||||
for (int i = 0; i < sections.length; i++) {
|
||||
if (sections[i] == null) {
|
||||
sections[i] = emptySection;
|
||||
empty = true;
|
||||
}
|
||||
}
|
||||
if (mask == 0 || mask == 65535 && hasEntities(nmsChunk)) {
|
||||
SPacketChunkData packet = new SPacketChunkData(nmsChunk, 65280);
|
||||
for (EntityPlayerMP player : players) {
|
||||
@ -475,11 +489,26 @@ public class SpongeQueue_1_11 extends NMSMappedFaweQueue<World, net.minecraft.wo
|
||||
for (EntityPlayerMP player : players) {
|
||||
player.connection.sendPacket(packet);
|
||||
}
|
||||
if (empty) {
|
||||
for (int i = 0; i < sections.length; i++) {
|
||||
if (sections[i] == emptySection) {
|
||||
sections[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
MainUtil.handleError(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshChunk(FaweChunk fc) {
|
||||
SpongeChunk_1_11 fs = (SpongeChunk_1_11) fc;
|
||||
ensureChunkLoaded(fc.getX(), fc.getZ());
|
||||
Chunk nmsChunk = fs.getChunk();
|
||||
sendChunk(nmsChunk, fc.getBitMask());
|
||||
}
|
||||
|
||||
public boolean hasEntities(Chunk nmsChunk) {
|
||||
ClassInheritanceMultiMap<Entity>[] entities = nmsChunk.getEntityLists();
|
||||
for (int i = 0; i < entities.length; i++) {
|
||||
|
Loading…
Reference in New Issue
Block a user