Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 18:40:05 +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.BukkitGetBlocks;
|
||||||
import com.fastasyncworldedit.bukkit.adapter.DelegateSemaphore;
|
import com.fastasyncworldedit.bukkit.adapter.DelegateSemaphore;
|
||||||
|
import com.fastasyncworldedit.bukkit.adapter.NativeEntityFunctionSet;
|
||||||
import com.fastasyncworldedit.core.Fawe;
|
import com.fastasyncworldedit.core.Fawe;
|
||||||
import com.fastasyncworldedit.core.FaweCache;
|
import com.fastasyncworldedit.core.FaweCache;
|
||||||
import com.fastasyncworldedit.core.configuration.Settings;
|
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.NbtUtils;
|
||||||
import com.fastasyncworldedit.core.util.collection.AdaptedMap;
|
import com.fastasyncworldedit.core.util.collection.AdaptedMap;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
|
import com.sk89q.worldedit.bukkit.BukkitEntity;
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
import com.sk89q.worldedit.internal.Constants;
|
import com.sk89q.worldedit.internal.Constants;
|
||||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||||
@ -147,11 +149,13 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
this.chunkPos = new IntPair(chunkX, chunkZ);
|
this.chunkPos = new IntPair(chunkX, chunkZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getChunkX() {
|
@Override
|
||||||
|
public int getX() {
|
||||||
return chunkX;
|
return chunkX;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getChunkZ() {
|
@Override
|
||||||
|
public int getZ() {
|
||||||
return chunkZ;
|
return chunkZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,50 +374,24 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<FaweCompoundTag> entities() {
|
public Collection<FaweCompoundTag> entities() {
|
||||||
ensureLoaded(serverLevel, chunkX, chunkZ);
|
List<Entity> entities = PaperweightPlatformAdapter.getEntities(ensureLoaded(serverLevel, chunkX, chunkZ));
|
||||||
List<Entity> entities = PaperweightPlatformAdapter.getEntities(getChunk());
|
|
||||||
if (entities.isEmpty()) {
|
if (entities.isEmpty()) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
int size = entities.size();
|
return new NativeEntityFunctionSet<>(entities, Entity::getUUID, e -> {
|
||||||
return new AbstractCollection<>() {
|
net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag();
|
||||||
@Override
|
e.save(tag);
|
||||||
public int size() {
|
return FaweCompoundTag.of(() -> (LinCompoundTag) adapter.toNativeLin(tag));
|
||||||
return size;
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isEmpty() {
|
public Set<com.sk89q.worldedit.entity.Entity> getFullEntities() {
|
||||||
return false;
|
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()));
|
||||||
@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();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeEntity(Entity entity) {
|
private void removeEntity(Entity entity) {
|
||||||
|
@ -47,6 +47,8 @@ public class PaperweightGetBlocks_Copy implements IChunkGet {
|
|||||||
private final char[][] blocks;
|
private final char[][] blocks;
|
||||||
private final int minHeight;
|
private final int minHeight;
|
||||||
private final int maxHeight;
|
private final int maxHeight;
|
||||||
|
private final int chunkX;
|
||||||
|
private final int chunkZ;
|
||||||
final ServerLevel serverLevel;
|
final ServerLevel serverLevel;
|
||||||
final LevelChunk levelChunk;
|
final LevelChunk levelChunk;
|
||||||
private Holder<Biome>[][] biomes = null;
|
private Holder<Biome>[][] biomes = null;
|
||||||
@ -57,6 +59,8 @@ public class PaperweightGetBlocks_Copy implements IChunkGet {
|
|||||||
this.minHeight = serverLevel.getMinY();
|
this.minHeight = serverLevel.getMinY();
|
||||||
this.maxHeight = serverLevel.getMaxY() - 1; // Minecraft max limit is exclusive.
|
this.maxHeight = serverLevel.getMaxY() - 1; // Minecraft max limit is exclusive.
|
||||||
this.blocks = new char[getSectionCount()][];
|
this.blocks = new char[getSectionCount()][];
|
||||||
|
this.chunkX = levelChunk.locX;
|
||||||
|
this.chunkZ = levelChunk.locZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void storeTile(BlockEntity blockEntity) {
|
protected void storeTile(BlockEntity blockEntity) {
|
||||||
@ -87,6 +91,11 @@ public class PaperweightGetBlocks_Copy implements IChunkGet {
|
|||||||
return this.entities;
|
return this.entities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Set<com.sk89q.worldedit.entity.Entity> getFullEntities() {
|
||||||
|
throw new UnsupportedOperationException("Cannot get full entities from GET copy.");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable FaweCompoundTag entity(final UUID uuid) {
|
public @Nullable FaweCompoundTag entity(final UUID uuid) {
|
||||||
for (FaweCompoundTag tag : entities) {
|
for (FaweCompoundTag tag : entities) {
|
||||||
@ -139,6 +148,16 @@ public class PaperweightGetBlocks_Copy implements IChunkGet {
|
|||||||
return minHeight >> 4;
|
return minHeight >> 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getX() {
|
||||||
|
return chunkX;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getZ() {
|
||||||
|
return chunkZ;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BiomeType getBiomeType(int x, int y, int z) {
|
public BiomeType getBiomeType(int x, int y, int z) {
|
||||||
Holder<Biome> biome = biomes[(y >> 4) - getMinSectionPosition()][(y & 12) << 2 | (z & 12) | (x & 12) >> 2];
|
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
|
@Override
|
||||||
public ProcessorScope getScope() {
|
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) {
|
private boolean wasAdjacentToWater(char[] get, char[] set, int i, int x, int y, int z) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren