Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-19 17:30:08 +01:00
Add changes to 1.20.4 adapters
Dieser Commit ist enthalten in:
Ursprung
874311f017
Commit
01b980a24d
@ -19,6 +19,7 @@ import com.sk89q.jnbt.ListTag;
|
||||
import com.sk89q.jnbt.StringTag;
|
||||
import com.sk89q.jnbt.Tag;
|
||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||
import com.sk89q.worldedit.bukkit.BukkitEntity;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R3.nbt.PaperweightLazyCompoundTag;
|
||||
import com.sk89q.worldedit.internal.Constants;
|
||||
@ -116,11 +117,13 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
this.biomeHolderIdMap = biomeRegistry.asHolderIdMap();
|
||||
}
|
||||
|
||||
public int getChunkX() {
|
||||
@Override
|
||||
public int getX() {
|
||||
return chunkX;
|
||||
}
|
||||
|
||||
public int getChunkZ() {
|
||||
@Override
|
||||
public int getZ() {
|
||||
return chunkZ;
|
||||
}
|
||||
|
||||
@ -382,6 +385,51 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<com.sk89q.worldedit.entity.Entity> getFullEntities() {
|
||||
List<Entity> entities = PaperweightPlatformAdapter.getEntities(ensureLoaded(serverLevel, chunkX, chunkZ));
|
||||
if (entities.isEmpty()) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
int size = entities.size();
|
||||
return new AbstractSet<>() {
|
||||
@Override
|
||||
public int size() {
|
||||
return size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object get) {
|
||||
if (!(get instanceof com.sk89q.worldedit.entity.Entity e)) {
|
||||
return false;
|
||||
}
|
||||
UUID getUUID = e.getState().getNbtData().getUUID();
|
||||
for (Entity entity : entities) {
|
||||
UUID uuid = entity.getUUID();
|
||||
if (uuid.equals(getUUID)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Iterator<com.sk89q.worldedit.entity.Entity> iterator() {
|
||||
Iterable<com.sk89q.worldedit.entity.Entity> result = entities
|
||||
.stream()
|
||||
.map(input -> new BukkitEntity(input.getBukkitEntity()))
|
||||
.collect(Collectors.toList());
|
||||
return result.iterator();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void removeEntity(Entity entity) {
|
||||
entity.discard();
|
||||
}
|
||||
|
@ -43,6 +43,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 PalettedContainer<Holder<Biome>>[] biomes = null;
|
||||
@ -53,6 +55,8 @@ public class PaperweightGetBlocks_Copy implements IChunkGet {
|
||||
this.minHeight = serverLevel.getMinBuildHeight();
|
||||
this.maxHeight = serverLevel.getMaxBuildHeight() - 1; // Minecraft max limit is exclusive.
|
||||
this.blocks = new char[getSectionCount()][];
|
||||
this.chunkX = levelChunk.locX;
|
||||
this.chunkZ = levelChunk.locZ;
|
||||
}
|
||||
|
||||
protected void storeTile(BlockEntity blockEntity) {
|
||||
@ -90,6 +94,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 CompoundTag getEntity(UUID uuid) {
|
||||
for (CompoundTag tag : entities) {
|
||||
@ -142,6 +151,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()].get(x >> 2, (y & 15) >> 2, z >> 2);
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren