geforkt von Mirrors/FastAsyncWorldEdit
Merge pull request 'main' (#2) from Mirrors/FastAsyncWorldEdit:main into upstream
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Einige Prüfungen sind fehlgeschlagen
SteamWarCI Build failed
Reviewed-on: #2
Dieser Commit ist enthalten in:
Commit
2553f169aa
20
.github/workflows/upload-release-assets.yml
vendored
20
.github/workflows/upload-release-assets.yml
vendored
@ -26,3 +26,23 @@ jobs:
|
|||||||
files: 'worldedit-bukkit/build/libs/FastAsyncWorldEdit-Bukkit-*.jar'
|
files: 'worldedit-bukkit/build/libs/FastAsyncWorldEdit-Bukkit-*.jar'
|
||||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
release-tag: ${{ github.event.release.tag_name }}
|
release-tag: ${{ github.event.release.tag_name }}
|
||||||
|
- name: Upload release to CurseForge
|
||||||
|
uses: Kir-Antipov/mc-publish@v3.2
|
||||||
|
with:
|
||||||
|
curseforge-id: 103525
|
||||||
|
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}
|
||||||
|
|
||||||
|
files-primary: 'worldedit-bukkit/build/libs/FastAsyncWorldEdit-Bukkit-*.jar'
|
||||||
|
|
||||||
|
name: FastAsyncWorldEdit ${{ github.event.release.tag_name }}
|
||||||
|
version: ${{ github.event.release.tag_name }}
|
||||||
|
version-type: release
|
||||||
|
|
||||||
|
game-versions: |
|
||||||
|
1.19.1
|
||||||
|
1.19
|
||||||
|
1.18.2
|
||||||
|
1.18.1
|
||||||
|
1.18
|
||||||
|
1.17
|
||||||
|
1.16
|
||||||
|
@ -12,7 +12,7 @@ griefprevention = "16.18"
|
|||||||
griefdefender = "2.1.0-SNAPSHOT"
|
griefdefender = "2.1.0-SNAPSHOT"
|
||||||
mcore = "7.0.1"
|
mcore = "7.0.1"
|
||||||
residence = "4.5._13.1"
|
residence = "4.5._13.1"
|
||||||
towny = "0.98.3.5"
|
towny = "0.98.3.6"
|
||||||
redprotect = "1.9.6"
|
redprotect = "1.9.6"
|
||||||
|
|
||||||
# Third party
|
# Third party
|
||||||
|
@ -473,7 +473,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static List<Entity> getEntities(LevelChunk chunk) {
|
static List<Entity> getEntities(LevelChunk chunk) {
|
||||||
return chunk.level.entityManager.getEntities(new ChunkPos(chunk.locX, chunk.locZ));
|
return chunk.level.entityManager.getEntities(chunk.getPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -79,6 +79,7 @@ import java.util.Collections;
|
|||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.OptionalLong;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@ -217,10 +218,10 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
|
|||||||
BiomeProvider biomeProvider = getBiomeProvider();
|
BiomeProvider biomeProvider = getBiomeProvider();
|
||||||
|
|
||||||
MinecraftServer server = originalServerWorld.getCraftServer().getServer();
|
MinecraftServer server = originalServerWorld.getCraftServer().getServer();
|
||||||
PrimaryLevelData levelProperties = (PrimaryLevelData) server.getWorldData();
|
WorldGenSettings originalOpts = originalWorldData.worldGenSettings();
|
||||||
|
WorldGenSettings newOpts = options.getSeed().isPresent()
|
||||||
WorldGenSettings newOpts = levelProperties.worldGenSettings()
|
? originalOpts.withSeed(originalWorldData.isHardcore(), OptionalLong.of(seed))
|
||||||
.withSeed(originalWorldData.settings.hardcore(), options.getSeed());
|
: originalOpts;
|
||||||
LevelSettings newWorldSettings = new LevelSettings(
|
LevelSettings newWorldSettings = new LevelSettings(
|
||||||
"faweregentempworld",
|
"faweregentempworld",
|
||||||
originalWorldData.settings.gameType(),
|
originalWorldData.settings.gameType(),
|
||||||
|
@ -588,7 +588,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static List<Entity> getEntities(LevelChunk chunk) {
|
static List<Entity> getEntities(LevelChunk chunk) {
|
||||||
return chunk.level.entityManager.getEntities(new ChunkPos(chunk.locX, chunk.locZ));
|
return chunk.level.entityManager.getEntities(chunk.getPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
record FakeIdMapBlock(int size) implements IdMap<net.minecraft.world.level.block.state.BlockState> {
|
record FakeIdMapBlock(int size) implements IdMap<net.minecraft.world.level.block.state.BlockState> {
|
||||||
|
@ -213,10 +213,9 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
|
|||||||
BiomeProvider biomeProvider = getBiomeProvider();
|
BiomeProvider biomeProvider = getBiomeProvider();
|
||||||
|
|
||||||
MinecraftServer server = originalServerWorld.getCraftServer().getServer();
|
MinecraftServer server = originalServerWorld.getCraftServer().getServer();
|
||||||
PrimaryLevelData levelProperties = (PrimaryLevelData) server.getWorldData();
|
WorldGenSettings originalOpts = originalWorldData.worldGenSettings();
|
||||||
WorldGenSettings originalOpts = levelProperties.worldGenSettings();
|
|
||||||
WorldGenSettings newOpts = options.getSeed().isPresent()
|
WorldGenSettings newOpts = options.getSeed().isPresent()
|
||||||
? originalOpts.withSeed(levelProperties.isHardcore(), OptionalLong.of(seed))
|
? originalOpts.withSeed(originalWorldData.isHardcore(), OptionalLong.of(seed))
|
||||||
: originalOpts;
|
: originalOpts;
|
||||||
LevelSettings newWorldSettings = new LevelSettings(
|
LevelSettings newWorldSettings = new LevelSettings(
|
||||||
"faweregentempworld",
|
"faweregentempworld",
|
||||||
|
@ -585,23 +585,6 @@ public final class PaperweightFaweAdapter extends CachedBukkitAdapter implements
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<org.bukkit.entity.Entity> getEntities(org.bukkit.World world) {
|
|
||||||
// Quickly add each entity to a list copy.
|
|
||||||
List<Entity> mcEntities = new ArrayList<>();
|
|
||||||
((CraftWorld) world).getHandle().entityManager.getEntityGetter().getAll().forEach(mcEntities::add);
|
|
||||||
|
|
||||||
List<org.bukkit.entity.Entity> list = new ArrayList<>();
|
|
||||||
mcEntities.forEach((mcEnt) -> {
|
|
||||||
org.bukkit.entity.Entity bukkitEntity = mcEnt.getBukkitEntity();
|
|
||||||
if (bukkitEntity.isValid()) {
|
|
||||||
list.add(bukkitEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BaseItemStack adapt(org.bukkit.inventory.ItemStack itemStack) {
|
public BaseItemStack adapt(org.bukkit.inventory.ItemStack itemStack) {
|
||||||
final ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack);
|
final ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack);
|
||||||
|
@ -676,7 +676,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
|
|||||||
}
|
}
|
||||||
if (Settings.settings().EXPERIMENTAL.REMOVE_ENTITY_FROM_WORLD_ON_CHUNK_FAIL) {
|
if (Settings.settings().EXPERIMENTAL.REMOVE_ENTITY_FROM_WORLD_ON_CHUNK_FAIL) {
|
||||||
for (UUID uuid : entityRemoves) {
|
for (UUID uuid : entityRemoves) {
|
||||||
Entity entity = nmsWorld.entityManager.getEntityGetter().get(uuid);
|
Entity entity = nmsWorld.getEntities().get(uuid);
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
removeEntity(entity);
|
removeEntity(entity);
|
||||||
}
|
}
|
||||||
|
@ -278,20 +278,21 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ChunkPos coordIntPair = new ChunkPos(chunkX, chunkZ);
|
ChunkPos coordIntPair = new ChunkPos(chunkX, chunkZ);
|
||||||
// UNLOADED_CHUNK
|
LevelChunk levelChunk;
|
||||||
Optional<LevelChunk> optional = ((Either) chunkHolder
|
|
||||||
.getTickingChunkFuture()
|
|
||||||
.getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left();
|
|
||||||
if (PaperLib.isPaper()) {
|
if (PaperLib.isPaper()) {
|
||||||
// getChunkAtIfLoadedImmediately is paper only
|
// getChunkAtIfLoadedImmediately is paper only
|
||||||
optional = optional.or(() -> Optional.ofNullable(nmsWorld
|
levelChunk = nmsWorld
|
||||||
.getChunkSource()
|
.getChunkSource()
|
||||||
.getChunkAtIfLoadedImmediately(chunkX, chunkZ)));
|
.getChunkAtIfLoadedImmediately(chunkX, chunkZ);
|
||||||
|
} else {
|
||||||
|
levelChunk = ((Optional<LevelChunk>) ((Either) chunkHolder
|
||||||
|
.getTickingChunkFuture() // method is not present with new paper chunk system
|
||||||
|
.getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left())
|
||||||
|
.orElse(null);
|
||||||
}
|
}
|
||||||
if (optional.isEmpty()) {
|
if (levelChunk == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LevelChunk levelChunk = optional.get();
|
|
||||||
TaskManager.taskManager().task(() -> {
|
TaskManager.taskManager().task(() -> {
|
||||||
ClientboundLevelChunkWithLightPacket packet;
|
ClientboundLevelChunkWithLightPacket packet;
|
||||||
if (PaperLib.isPaper()) {
|
if (PaperLib.isPaper()) {
|
||||||
@ -589,7 +590,10 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static List<Entity> getEntities(LevelChunk chunk) {
|
static List<Entity> getEntities(LevelChunk chunk) {
|
||||||
return chunk.level.entityManager.getEntities(new ChunkPos(chunk.locX, chunk.locZ));
|
if (PaperLib.isPaper()) {
|
||||||
|
return Arrays.asList(chunk.entities.getRawData());
|
||||||
|
}
|
||||||
|
return chunk.level.entityManager.getEntities(chunk.getPos());
|
||||||
}
|
}
|
||||||
|
|
||||||
record FakeIdMapBlock(int size) implements IdMap<net.minecraft.world.level.block.state.BlockState> {
|
record FakeIdMapBlock(int size) implements IdMap<net.minecraft.world.level.block.state.BlockState> {
|
||||||
|
@ -214,10 +214,9 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
|
|||||||
PrimaryLevelData originalWorldData = originalServerWorld.serverLevelData;
|
PrimaryLevelData originalWorldData = originalServerWorld.serverLevelData;
|
||||||
|
|
||||||
MinecraftServer server = originalServerWorld.getCraftServer().getServer();
|
MinecraftServer server = originalServerWorld.getCraftServer().getServer();
|
||||||
PrimaryLevelData levelProperties = (PrimaryLevelData) server.getWorldData();
|
WorldGenSettings originalOpts = originalWorldData.worldGenSettings();
|
||||||
WorldGenSettings originalOpts = levelProperties.worldGenSettings();
|
|
||||||
WorldGenSettings newOpts = options.getSeed().isPresent()
|
WorldGenSettings newOpts = options.getSeed().isPresent()
|
||||||
? originalOpts.withSeed(levelProperties.isHardcore(), OptionalLong.of(seed))
|
? originalOpts.withSeed(originalWorldData.isHardcore(), OptionalLong.of(seed))
|
||||||
: originalOpts;
|
: originalOpts;
|
||||||
LevelSettings newWorldSettings = new LevelSettings(
|
LevelSettings newWorldSettings = new LevelSettings(
|
||||||
"faweregentempworld",
|
"faweregentempworld",
|
||||||
|
@ -141,10 +141,9 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<com.sk89q.worldedit.entity.Entity> getEntities(Region region) {
|
public List<com.sk89q.worldedit.entity.Entity> getEntities(Region region) {
|
||||||
//FAWE start - allow async entity retrieval
|
World world = getWorld();
|
||||||
List<Entity> ents = WorldEditPlugin.getInstance().getBukkitImplAdapter().getEntities(getWorld());
|
|
||||||
//FAWE end
|
|
||||||
|
|
||||||
|
List<Entity> ents = world.getEntities();
|
||||||
List<com.sk89q.worldedit.entity.Entity> entities = new ArrayList<>();
|
List<com.sk89q.worldedit.entity.Entity> entities = new ArrayList<>();
|
||||||
for (Entity ent : ents) {
|
for (Entity ent : ents) {
|
||||||
if (region.contains(BukkitAdapter.asBlockVector(ent.getLocation()))) {
|
if (region.contains(BukkitAdapter.asBlockVector(ent.getLocation()))) {
|
||||||
@ -157,9 +156,7 @@ public class BukkitWorld extends AbstractWorld {
|
|||||||
@Override
|
@Override
|
||||||
public List<com.sk89q.worldedit.entity.Entity> getEntities() {
|
public List<com.sk89q.worldedit.entity.Entity> getEntities() {
|
||||||
List<com.sk89q.worldedit.entity.Entity> list = new ArrayList<>();
|
List<com.sk89q.worldedit.entity.Entity> list = new ArrayList<>();
|
||||||
//FAWE start - allow async entity retrieval
|
for (Entity entity : getWorld().getEntities()) {
|
||||||
for (Entity entity : WorldEditPlugin.getInstance().getBukkitImplAdapter().getEntities(getWorld())) {
|
|
||||||
//FAWE end
|
|
||||||
list.add(BukkitAdapter.adapt(entity));
|
list.add(BukkitAdapter.adapt(entity));
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
@ -455,7 +455,7 @@ public class DefaultBlockParser extends InputParser<BaseBlock> {
|
|||||||
state = item.getType().getBlockType().getDefaultState();
|
state = item.getType().getBlockType().getDefaultState();
|
||||||
nbt = item.getNbtData();
|
nbt = item.getNbtData();
|
||||||
} else {
|
} else {
|
||||||
BlockType type = BlockTypes.parse(typeString.toLowerCase(Locale.ROOT));
|
BlockType type = BlockTypes.parse(typeString.toLowerCase(Locale.ROOT), context);
|
||||||
|
|
||||||
if (type != null) {
|
if (type != null) {
|
||||||
state = type.getDefaultState();
|
state = type.getDefaultState();
|
||||||
|
@ -484,7 +484,12 @@ public class MCEditSchematicReader extends NBTSchematicReader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private BlockState getBlockState(int id, int data) {
|
private BlockState getBlockState(int id, int data) {
|
||||||
return LegacyMapper.getInstance().getBlockFromLegacy(id, data);
|
BlockState foundBlock = LegacyMapper.getInstance().getBlockFromLegacy(id, data);
|
||||||
|
if (foundBlock == null && data != 0) {
|
||||||
|
// Some schematics contain invalid data values, so try without the data value
|
||||||
|
return LegacyMapper.getInstance().getBlockFromLegacy(id, 0);
|
||||||
|
}
|
||||||
|
return foundBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -23,6 +23,7 @@ import com.fastasyncworldedit.core.command.SuggestInputParseException;
|
|||||||
import com.fastasyncworldedit.core.util.JoinedCharSequence;
|
import com.fastasyncworldedit.core.util.JoinedCharSequence;
|
||||||
import com.fastasyncworldedit.core.util.StringMan;
|
import com.fastasyncworldedit.core.util.StringMan;
|
||||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||||
|
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||||
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
import com.sk89q.worldedit.world.registry.LegacyMapper;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
@ -1948,6 +1949,9 @@ public final class BlockTypes {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
public static BlockType parse(final String type) throws InputParseException {
|
public static BlockType parse(final String type) throws InputParseException {
|
||||||
|
return parse(type, new ParserContext());
|
||||||
|
}
|
||||||
|
public static BlockType parse(final String type, final ParserContext context) throws InputParseException {
|
||||||
final String inputLower = type.toLowerCase(Locale.ROOT);
|
final String inputLower = type.toLowerCase(Locale.ROOT);
|
||||||
String input = inputLower;
|
String input = inputLower;
|
||||||
|
|
||||||
@ -1958,7 +1962,7 @@ public final class BlockTypes {
|
|||||||
if (result != null) {
|
if (result != null) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
if (context.isTryingLegacy()) {
|
||||||
try {
|
try {
|
||||||
BlockStateHolder<BlockState> block = LegacyMapper.getInstance().getBlockFromLegacy(input);
|
BlockStateHolder<BlockState> block = LegacyMapper.getInstance().getBlockFromLegacy(input);
|
||||||
if (block != null) {
|
if (block != null) {
|
||||||
@ -1966,6 +1970,7 @@ public final class BlockTypes {
|
|||||||
}
|
}
|
||||||
} catch (NumberFormatException | IndexOutOfBoundsException ignored) {
|
} catch (NumberFormatException | IndexOutOfBoundsException ignored) {
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
throw new SuggestInputParseException("Does not match a valid block type: " + inputLower, inputLower, () -> Stream.of(
|
throw new SuggestInputParseException("Does not match a valid block type: " + inputLower, inputLower, () -> Stream.of(
|
||||||
BlockTypesCache.values)
|
BlockTypesCache.values)
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren