Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 02:20:07 +01:00
Add for 1.21.3
Dieser Commit ist enthalten in:
Ursprung
021f0646ab
Commit
421fb568c4
@ -2,6 +2,7 @@ package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_21_3;
|
||||
|
||||
import com.fastasyncworldedit.bukkit.adapter.BukkitGetBlocks;
|
||||
import com.fastasyncworldedit.bukkit.adapter.DelegateSemaphore;
|
||||
import com.fastasyncworldedit.bukkit.adapter.NativeEntityFunctionSet;
|
||||
import com.fastasyncworldedit.core.Fawe;
|
||||
import com.fastasyncworldedit.core.FaweCache;
|
||||
import com.fastasyncworldedit.core.configuration.Settings;
|
||||
@ -17,6 +18,7 @@ import com.fastasyncworldedit.core.util.MathMan;
|
||||
import com.fastasyncworldedit.core.util.NbtUtils;
|
||||
import com.fastasyncworldedit.core.util.collection.AdaptedMap;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.bukkit.BukkitEntity;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldedit.internal.Constants;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
@ -147,11 +149,13 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
this.chunkPos = new IntPair(chunkX, chunkZ);
|
||||
}
|
||||
|
||||
public int getChunkX() {
|
||||
@Override
|
||||
public int getX() {
|
||||
return chunkX;
|
||||
}
|
||||
|
||||
public int getChunkZ() {
|
||||
@Override
|
||||
public int getZ() {
|
||||
return chunkZ;
|
||||
}
|
||||
|
||||
@ -370,50 +374,24 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
|
||||
@Override
|
||||
public Collection<FaweCompoundTag> entities() {
|
||||
ensureLoaded(serverLevel, chunkX, chunkZ);
|
||||
List<Entity> entities = PaperweightPlatformAdapter.getEntities(getChunk());
|
||||
List<Entity> entities = PaperweightPlatformAdapter.getEntities(ensureLoaded(serverLevel, chunkX, chunkZ));
|
||||
if (entities.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
int size = entities.size();
|
||||
return new AbstractCollection<>() {
|
||||
@Override
|
||||
public int size() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object get) {
|
||||
if (!(get instanceof FaweCompoundTag getTag)) {
|
||||
return false;
|
||||
}
|
||||
UUID getUUID = NbtUtils.uuid(getTag);
|
||||
for (Entity entity : entities) {
|
||||
UUID uuid = entity.getUUID();
|
||||
if (uuid.equals(getUUID)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Iterator<FaweCompoundTag> iterator() {
|
||||
Iterable<FaweCompoundTag> result = entities.stream().map(input -> {
|
||||
CompoundTag tag = new CompoundTag();
|
||||
input.save(tag);
|
||||
return FaweCompoundTag.of((LinCompoundTag) adapter.toNativeLin(tag));
|
||||
})::iterator;
|
||||
return result.iterator();
|
||||
}
|
||||
};
|
||||
return new NativeEntityFunctionSet<>(entities, Entity::getUUID, e -> {
|
||||
net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag();
|
||||
e.save(tag);
|
||||
return FaweCompoundTag.of(() -> (LinCompoundTag) adapter.toNativeLin(tag));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<com.sk89q.worldedit.entity.Entity> getFullEntities() {
|
||||
List<Entity> entities = PaperweightPlatformAdapter.getEntities(ensureLoaded(serverLevel, chunkX, chunkZ));
|
||||
if (entities.isEmpty()) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
return new NativeEntityFunctionSet<>(entities, Entity::getUUID, e -> new BukkitEntity(e.getBukkitEntity()));
|
||||
}
|
||||
|
||||
private void removeEntity(Entity entity) {
|
||||
|
@ -47,6 +47,8 @@ public class PaperweightGetBlocks_Copy implements IChunkGet {
|
||||
private final char[][] blocks;
|
||||
private final int minHeight;
|
||||
private final int maxHeight;
|
||||
private final int chunkX;
|
||||
private final int chunkZ;
|
||||
final ServerLevel serverLevel;
|
||||
final LevelChunk levelChunk;
|
||||
private Holder<Biome>[][] biomes = null;
|
||||
@ -57,6 +59,8 @@ public class PaperweightGetBlocks_Copy implements IChunkGet {
|
||||
this.minHeight = serverLevel.getMinY();
|
||||
this.maxHeight = serverLevel.getMaxY() - 1; // Minecraft max limit is exclusive.
|
||||
this.blocks = new char[getSectionCount()][];
|
||||
this.chunkX = levelChunk.locX;
|
||||
this.chunkZ = levelChunk.locZ;
|
||||
}
|
||||
|
||||
protected void storeTile(BlockEntity blockEntity) {
|
||||
@ -87,6 +91,11 @@ public class PaperweightGetBlocks_Copy implements IChunkGet {
|
||||
return this.entities;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<com.sk89q.worldedit.entity.Entity> getFullEntities() {
|
||||
throw new UnsupportedOperationException("Cannot get full entities from GET copy.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable FaweCompoundTag entity(final UUID uuid) {
|
||||
for (FaweCompoundTag tag : entities) {
|
||||
@ -139,6 +148,16 @@ public class PaperweightGetBlocks_Copy implements IChunkGet {
|
||||
return minHeight >> 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getX() {
|
||||
return chunkX;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getZ() {
|
||||
return chunkZ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeType getBiomeType(int x, int y, int z) {
|
||||
Holder<Biome> biome = biomes[(y >> 4) - getMinSectionPosition()][(y & 12) << 2 | (z & 12) | (x & 12) >> 2];
|
||||
|
@ -112,7 +112,7 @@ public class PaperweightPostProcessor implements IBatchProcessor {
|
||||
|
||||
@Override
|
||||
public ProcessorScope getScope() {
|
||||
return ProcessorScope.READING_SET_BLOCKS;
|
||||
return ProcessorScope.READING_BLOCKS;
|
||||
}
|
||||
|
||||
private boolean wasAdjacentToWater(char[] get, char[] set, int i, int x, int y, int z) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren