Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-09-06 08:02:50 +02:00
Ensure chunk sections are reloaded for every edit/chunk read
Add an option for force-reloading the cached chunk sections when a layer is updated
Dieser Commit ist enthalten in:
Ursprung
d379b0af9b
Commit
884ec322b8
@ -397,7 +397,7 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
||||
this.nmsChunk = nmsChunk;
|
||||
this.sections = null;
|
||||
this.reset();
|
||||
} else if (existingSection != getSections()[layer]) {
|
||||
} else if (existingSection != getSections(false)[layer]) {
|
||||
this.sections[layer] = existingSection;
|
||||
this.reset();
|
||||
} else if (!Arrays.equals(update(layer, new char[4096]), load(layer))) {
|
||||
@ -642,7 +642,7 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
||||
|
||||
@Override
|
||||
public synchronized char[] update(int layer, char[] data) {
|
||||
ChunkSection section = getSections()[layer];
|
||||
ChunkSection section = getSections(true)[layer];
|
||||
// Section is null, return empty array
|
||||
if (section == null) {
|
||||
data = new char[4096];
|
||||
@ -757,7 +757,10 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
||||
}
|
||||
}
|
||||
|
||||
public ChunkSection[] getSections() {
|
||||
public ChunkSection[] getSections(boolean force) {
|
||||
if (force) {
|
||||
return sections = getChunk().getSections().clone();
|
||||
}
|
||||
ChunkSection[] tmp = sections;
|
||||
if (tmp == null) {
|
||||
synchronized (this) {
|
||||
@ -809,7 +812,7 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
||||
|
||||
@Override
|
||||
public boolean hasSection(int layer) {
|
||||
return getSections()[layer] != null;
|
||||
return getSections(false)[layer] != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -825,7 +828,7 @@ public class BukkitGetBlocks_1_15_2 extends CharGetBlocks {
|
||||
if (!hasSection(i) || super.sections[i] == CharBlocks.EMPTY) {
|
||||
continue;
|
||||
}
|
||||
ChunkSection existing = getSections()[i];
|
||||
ChunkSection existing = getSections(false)[i];
|
||||
try {
|
||||
final DataPaletteBlock<IBlockData> blocksExisting = existing.getBlocks();
|
||||
|
||||
|
@ -397,7 +397,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
|
||||
this.nmsChunk = nmsChunk;
|
||||
this.sections = null;
|
||||
this.reset();
|
||||
} else if (existingSection != getSections()[layer]) {
|
||||
} else if (existingSection != getSections(false)[layer]) {
|
||||
this.sections[layer] = existingSection;
|
||||
this.reset();
|
||||
} else if (!Arrays.equals(update(layer, new char[4096]), load(layer))) {
|
||||
@ -644,7 +644,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
|
||||
|
||||
@Override
|
||||
public synchronized char[] update(int layer, char[] data) {
|
||||
ChunkSection section = getSections()[layer];
|
||||
ChunkSection section = getSections(true)[layer];
|
||||
// Section is null, return empty array
|
||||
if (section == null) {
|
||||
data = new char[4096];
|
||||
@ -759,7 +759,10 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
|
||||
}
|
||||
}
|
||||
|
||||
public ChunkSection[] getSections() {
|
||||
public ChunkSection[] getSections(boolean force) {
|
||||
if (force) {
|
||||
return sections = getChunk().getSections().clone();
|
||||
}
|
||||
ChunkSection[] tmp = sections;
|
||||
if (tmp == null) {
|
||||
synchronized (this) {
|
||||
@ -811,7 +814,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
|
||||
|
||||
@Override
|
||||
public boolean hasSection(int layer) {
|
||||
return getSections()[layer] != null;
|
||||
return getSections(false)[layer] != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -827,7 +830,7 @@ public class BukkitGetBlocks_1_16_1 extends CharGetBlocks {
|
||||
if (!hasSection(i) || super.sections[i] == CharBlocks.EMPTY) {
|
||||
continue;
|
||||
}
|
||||
ChunkSection existing = getSections()[i];
|
||||
ChunkSection existing = getSections(false)[i];
|
||||
try {
|
||||
final DataPaletteBlock<IBlockData> blocksExisting = existing.getBlocks();
|
||||
|
||||
|
@ -400,7 +400,7 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks {
|
||||
this.nmsChunk = nmsChunk;
|
||||
this.sections = null;
|
||||
this.reset();
|
||||
} else if (existingSection != getSections()[layer]) {
|
||||
} else if (existingSection != getSections(false)[layer]) {
|
||||
this.sections[layer] = existingSection;
|
||||
this.reset();
|
||||
} else if (!Arrays.equals(update(layer, new char[4096]), load(layer))) {
|
||||
@ -647,7 +647,7 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks {
|
||||
|
||||
@Override
|
||||
public synchronized char[] update(int layer, char[] data) {
|
||||
ChunkSection section = getSections()[layer];
|
||||
ChunkSection section = getSections(true)[layer];
|
||||
// Section is null, return empty array
|
||||
if (section == null) {
|
||||
data = new char[4096];
|
||||
@ -762,7 +762,10 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks {
|
||||
}
|
||||
}
|
||||
|
||||
public ChunkSection[] getSections() {
|
||||
public ChunkSection[] getSections(boolean force) {
|
||||
if (force) {
|
||||
return sections = getChunk().getSections().clone();
|
||||
}
|
||||
ChunkSection[] tmp = sections;
|
||||
if (tmp == null) {
|
||||
synchronized (this) {
|
||||
@ -814,7 +817,7 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks {
|
||||
|
||||
@Override
|
||||
public boolean hasSection(int layer) {
|
||||
return getSections()[layer] != null;
|
||||
return getSections(false)[layer] != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -830,7 +833,7 @@ public class BukkitGetBlocks_1_16_2 extends CharGetBlocks {
|
||||
if (!hasSection(i) || super.sections[i] == CharBlocks.EMPTY) {
|
||||
continue;
|
||||
}
|
||||
ChunkSection existing = getSections()[i];
|
||||
ChunkSection existing = getSections(false)[i];
|
||||
try {
|
||||
final DataPaletteBlock<IBlockData> blocksExisting = existing.getBlocks();
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.boydti.fawe.bukkit.adapter.mc1_16_4;
|
||||
|
||||
import com.boydti.fawe.Fawe;
|
||||
import com.boydti.fawe.FaweAPI;
|
||||
import com.boydti.fawe.FaweCache;
|
||||
import com.boydti.fawe.beta.IChunkGet;
|
||||
import com.boydti.fawe.beta.IChunkSet;
|
||||
@ -27,8 +28,10 @@ import com.sk89q.worldedit.internal.Constants;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import com.sk89q.worldedit.world.block.BlockTypesCache;
|
||||
import net.minecraft.server.v1_16_R3.BiomeBase;
|
||||
import net.minecraft.server.v1_16_R3.BiomeStorage;
|
||||
import net.minecraft.server.v1_16_R3.Block;
|
||||
import net.minecraft.server.v1_16_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_16_R3.Chunk;
|
||||
import net.minecraft.server.v1_16_R3.ChunkSection;
|
||||
@ -400,7 +403,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks {
|
||||
this.nmsChunk = nmsChunk;
|
||||
this.sections = null;
|
||||
this.reset();
|
||||
} else if (existingSection != getSections()[layer]) {
|
||||
} else if (existingSection != getSections(false)[layer]) {
|
||||
this.sections[layer] = existingSection;
|
||||
this.reset();
|
||||
} else if (!Arrays.equals(update(layer, new char[4096]), load(layer))) {
|
||||
@ -647,7 +650,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks {
|
||||
|
||||
@Override
|
||||
public synchronized char[] update(int layer, char[] data) {
|
||||
ChunkSection section = getSections()[layer];
|
||||
ChunkSection section = getSections(true)[layer];
|
||||
// Section is null, return empty array
|
||||
if (section == null) {
|
||||
data = new char[4096];
|
||||
@ -762,7 +765,10 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks {
|
||||
}
|
||||
}
|
||||
|
||||
public ChunkSection[] getSections() {
|
||||
public ChunkSection[] getSections(boolean force) {
|
||||
if (force) {
|
||||
return sections = getChunk().getSections().clone();
|
||||
}
|
||||
ChunkSection[] tmp = sections;
|
||||
if (tmp == null) {
|
||||
synchronized (this) {
|
||||
@ -814,7 +820,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks {
|
||||
|
||||
@Override
|
||||
public boolean hasSection(int layer) {
|
||||
return getSections()[layer] != null;
|
||||
return getSections(false)[layer] != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -830,7 +836,7 @@ public class BukkitGetBlocks_1_16_4 extends CharGetBlocks {
|
||||
if (!hasSection(i) || super.sections[i] == CharBlocks.EMPTY) {
|
||||
continue;
|
||||
}
|
||||
ChunkSection existing = getSections()[i];
|
||||
ChunkSection existing = getSections(false)[i];
|
||||
try {
|
||||
final DataPaletteBlock<IBlockData> blocksExisting = existing.getBlocks();
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren