Save the get blocks to the set chunk after history is written when post-processing

This commit is contained in:
dordsor21
2020-12-17 14:09:54 +00:00
parent f347e0f5f5
commit b57c472b86
10 changed files with 101 additions and 21 deletions

View File

@ -357,13 +357,18 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
if (!set.hasSection(layer)) {
continue;
}
if (createCopy) {
copy.storeSection(layer);
}
bitMask |= 1 << layer;
char[] setArr = set.load(layer);
// If we're creating a copy, it's because we're delaying history so we do not want to write to
// the chunkSet yet.
if (createCopy) {
setArr = setArr.clone();
copy.storeSection(layer);
copy.storeSetBlocks(layer, setArr);
}
ChunkSection newSection;
ChunkSection existingSection = sections[layer];
if (existingSection == null) {

View File

@ -2,6 +2,7 @@ package com.boydti.fawe.bukkit.adapter.mc1_15_2;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IChunkGetCopy;
import com.boydti.fawe.bukkit.adapter.mc1_15_2.nbt.LazyCompoundTag_1_15_2;
import com.google.common.base.Suppliers;
import com.sk89q.jnbt.CompoundTag;
@ -28,12 +29,13 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
public class BukkitGetBlocks_1_15_2_Copy extends BukkitGetBlocks_1_15_2 {
public class BukkitGetBlocks_1_15_2_Copy extends BukkitGetBlocks_1_15_2 implements IChunkGetCopy {
private final Map<BlockVector3, CompoundTag> tiles = new HashMap<>();
private final Set<CompoundTag> entities = new HashSet<>();
private BiomeStorage biomeStorage;
private final char[][] blocks = new char[16][4096];
private final char[][] newSetBlocks = new char[16][];
protected BukkitGetBlocks_1_15_2_Copy(WorldServer world, int X, int Z) {
super(world, X, Z);
@ -126,4 +128,13 @@ public class BukkitGetBlocks_1_15_2_Copy extends BukkitGetBlocks_1_15_2 {
final int index = (y & 15) << 8 | z << 4 | x;
return blocks[layer][index];
}
protected void storeSetBlocks(int layer, char[] blocks) {
newSetBlocks[layer] = blocks;
}
@Override
public char[] getNewSetArr(int layer) {
return newSetBlocks[layer];
}
}

View File

@ -357,13 +357,18 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
if (!set.hasSection(layer)) {
continue;
}
if (createCopy) {
copy.storeSection(layer);
}
bitMask |= 1 << layer;
char[] setArr = set.load(layer);
// If we're creating a copy, it's because we're delaying history so we do not want to write to
// the chunkSet yet.
if (createCopy) {
setArr = setArr.clone();
copy.storeSection(layer);
copy.storeSetBlocks(layer, setArr);
}
ChunkSection newSection;
ChunkSection existingSection = sections[layer];
if (existingSection == null) {

View File

@ -2,6 +2,7 @@ package com.boydti.fawe.bukkit.adapter.mc1_16_1;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IChunkGetCopy;
import com.boydti.fawe.bukkit.adapter.mc1_16_1.nbt.LazyCompoundTag_1_16_1;
import com.google.common.base.Suppliers;
import com.sk89q.jnbt.CompoundTag;
@ -29,12 +30,13 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
public class BukkitGetBlocks_1_16_1_Copy extends BukkitGetBlocks_1_16_1 {
public class BukkitGetBlocks_1_16_1_Copy extends BukkitGetBlocks_1_16_1 implements IChunkGetCopy {
private final Map<BlockVector3, CompoundTag> tiles = new HashMap<>();
private final Set<CompoundTag> entities = new HashSet<>();
private BiomeStorage biomeStorage;
private final char[][] blocks = new char[16][4096];
private final char[][] newSetBlocks = new char[16][];
protected BukkitGetBlocks_1_16_1_Copy(WorldServer world, int X, int Z) {
super(world, X, Z);
@ -127,4 +129,13 @@ public class BukkitGetBlocks_1_16_1_Copy extends BukkitGetBlocks_1_16_1 {
final int index = (y & 15) << 8 | z << 4 | x;
return blocks[layer][index];
}
protected void storeSetBlocks(int layer, char[] blocks) {
newSetBlocks[layer] = blocks;
}
@Override
public char[] getNewSetArr(int layer) {
return newSetBlocks[layer];
}
}

View File

@ -360,13 +360,18 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks {
if (!set.hasSection(layer)) {
continue;
}
if (createCopy) {
copy.storeSection(layer);
}
bitMask |= 1 << layer;
char[] setArr = set.load(layer);
// If we're creating a copy, it's because we're delaying history so we do not want to write to
// the chunkSet yet.
if (createCopy) {
setArr = setArr.clone();
copy.storeSection(layer);
copy.storeSetBlocks(layer, setArr);
}
ChunkSection newSection;
ChunkSection existingSection = sections[layer];
if (existingSection == null) {

View File

@ -2,6 +2,7 @@ package com.boydti.fawe.bukkit.adapter.mc1_16_2;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IChunkGetCopy;
import com.boydti.fawe.bukkit.adapter.mc1_16_2.nbt.LazyCompoundTag_1_16_2;
import com.google.common.base.Suppliers;
import com.sk89q.jnbt.CompoundTag;
@ -29,12 +30,13 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
public class BukkitGetBlocks_1_16_2_Copy extends BukkitGetBlocks_1_16_2 {
public class BukkitGetBlocks_1_16_2_Copy extends BukkitGetBlocks_1_16_2 implements IChunkGetCopy {
private final Map<BlockVector3, CompoundTag> tiles = new HashMap<>();
private final Set<CompoundTag> entities = new HashSet<>();
private BiomeStorage biomeStorage;
private final char[][] blocks = new char[16][4096];
private final char[][] newSetBlocks = new char[16][];
protected BukkitGetBlocks_1_16_2_Copy(WorldServer world, int X, int Z) {
super(world, X, Z);
@ -127,4 +129,13 @@ public class BukkitGetBlocks_1_16_2_Copy extends BukkitGetBlocks_1_16_2 {
final int index = (y & 15) << 8 | z << 4 | x;
return blocks[layer][index];
}
protected void storeSetBlocks(int layer, char[] blocks) {
newSetBlocks[layer] = blocks;
}
@Override
public char[] getNewSetArr(int layer) {
return newSetBlocks[layer];
}
}

View File

@ -360,13 +360,18 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks {
if (!set.hasSection(layer)) {
continue;
}
if (createCopy) {
copy.storeSection(layer);
}
bitMask |= 1 << layer;
char[] setArr = set.load(layer);
// If we're creating a copy, it's because we're delaying history so we do not want to write to
// the chunkSet yet.
if (createCopy) {
setArr = setArr.clone();
copy.storeSection(layer);
copy.storeSetBlocks(layer, setArr);
}
ChunkSection newSection;
ChunkSection existingSection = sections[layer];
if (existingSection == null) {

View File

@ -2,6 +2,7 @@ package com.boydti.fawe.bukkit.adapter.mc1_16_4;
import com.boydti.fawe.FaweCache;
import com.boydti.fawe.beta.IChunkGetCopy;
import com.boydti.fawe.bukkit.adapter.mc1_16_4.nbt.LazyCompoundTag_1_16_4;
import com.google.common.base.Suppliers;
import com.sk89q.jnbt.CompoundTag;
@ -29,12 +30,13 @@ import java.util.Map;
import java.util.Set;
import java.util.UUID;
public class BukkitGetBlocks_1_16_4_Copy extends BukkitGetBlocks_1_16_4 {
public class BukkitGetBlocks_1_16_4_Copy extends BukkitGetBlocks_1_16_4 implements IChunkGetCopy {
private final Map<BlockVector3, CompoundTag> tiles = new HashMap<>();
private final Set<CompoundTag> entities = new HashSet<>();
private BiomeStorage biomeStorage;
private final char[][] blocks = new char[16][4096];
private final char[][] newSetBlocks = new char[16][];
protected BukkitGetBlocks_1_16_4_Copy(WorldServer world, int X, int Z) {
super(world, X, Z);
@ -127,4 +129,13 @@ public class BukkitGetBlocks_1_16_4_Copy extends BukkitGetBlocks_1_16_4 {
final int index = (y & 15) << 8 | z << 4 | x;
return blocks[layer][index];
}
protected void storeSetBlocks(int layer, char[] blocks) {
newSetBlocks[layer] = blocks;
}
@Override
public char[] getNewSetArr(int layer) {
return newSetBlocks[layer];
}
}