From e4158ac08401c293f98fe5ce85b7a64a1d299aef Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 13 Apr 2023 17:34:05 +0100 Subject: [PATCH 001/161] fix: invalidate cached FaweMask when a plot is unlinked (#2157) * fix: invalidate cached FaweMask when a plot is unlinked - Fixes IntellectualSites/PlotSquared#3998 * Use a weakly-referenced copy of the copnncted plots set --- .../plotsquared/PlotSquaredFeature.java | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java index 34e5aeaaa..cd6f5ae22 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java @@ -23,6 +23,7 @@ import com.sk89q.worldedit.world.World; import org.apache.logging.log4j.Logger; import org.bukkit.Bukkit; +import java.lang.ref.WeakReference; import java.util.List; import java.util.Locale; import java.util.Set; @@ -176,15 +177,28 @@ public class PlotSquaredFeature extends FaweMaskManager { maskedRegion = new RegionIntersection(world, weRegions); } - return new FaweMask(maskedRegion) { - @Override - public boolean isValid(Player player, MaskType type) { - if (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(finalPlot)) { - return false; - } - return isAllowed(player, finalPlot, type); + return new PlotSquaredMask(maskedRegion, finalPlot); + } + + private final class PlotSquaredMask extends FaweMask { + + private final Plot plot; + private final WeakReference> connectedPlots; + + private PlotSquaredMask(Region region, Plot plot) { + super(region); + this.plot = plot; + connectedPlots = new WeakReference<>(plot.getConnectedPlots()); + } + + @Override + public boolean isValid(Player player, MaskType type) { + if (!connectedPlots.refersTo(plot.getConnectedPlots()) || (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot))) { + return false; } - }; + return isAllowed(player, plot, type); + } + } } From 5cd9616507311b70a72e380a48f6b1a8235ad777 Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 13 Apr 2023 17:34:16 +0100 Subject: [PATCH 002/161] fix: Ensure BaseBlock is not returned when a BlockState is wanted in BlockTransformExtent (#2161 - NBT will be handled appropriately at another point - Fixes #2085 --- .../worldedit/extent/transform/BlockTransformExtent.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java index 8382319c9..f22d7036d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java @@ -555,10 +555,11 @@ public class BlockTransformExtent extends ResettableExtent { int transformedId = transformState(state, transform); BlockState transformed = BlockState.getFromInternalId(transformedId); - if (block.hasNbtData()) { + boolean baseBlock = block instanceof BaseBlock; + if (baseBlock && block.hasNbtData()) { return (B) transformBaseBlockNBT(transformed, block.getNbtData(), transform); } - return (B) (block instanceof BaseBlock ? transformed.toBaseBlock() : transformed); + return (B) (baseBlock? transformed.toBaseBlock() : transformed); //FAWE end } From 86acb1c4d4444554dca543c7b9e33c1c7e2bd0bd Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Tue, 18 Apr 2023 17:28:38 +0200 Subject: [PATCH 003/161] Simplify command dispatch to ensure command order (#2131) --- .../platform/PlatformCommandManager.java | 43 ++++++++----------- 1 file changed, 19 insertions(+), 24 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java index 3922710fc..7b493cf98 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformCommandManager.java @@ -678,31 +678,26 @@ public final class PlatformCommandManager { Actor actor = event.getActor(); String args = event.getArguments(); - TaskManager.taskManager().taskNow(() -> { - if (!Fawe.isMainThread()) { - Thread.currentThread().setName("FAWE Thread for player: " + actor.getName()); + int space0 = args.indexOf(' '); + String arg0 = space0 == -1 ? args : args.substring(0, space0); + Optional optional = commandManager.getCommand(arg0); + if (optional.isEmpty()) { + return; + } + Command cmd = optional.get(); + PermissionCondition queued = cmd.getCondition().as(PermissionCondition.class).orElse(null); + if (queued != null && !queued.isQueued()) { + TaskManager.taskManager().taskNow(() -> handleCommandOnCurrentThread(event), Fawe.isMainThread()); + return; + } else { + actor.decline(); + } + actor.runAction(() -> { + SessionKey key = actor.getSessionKey(); + if (key.isActive()) { + PlatformCommandManager.this.handleCommandOnCurrentThread(event); } - int space0 = args.indexOf(' '); - String arg0 = space0 == -1 ? args : args.substring(0, space0); - Optional optional = commandManager.getCommand(arg0); - if (!optional.isPresent()) { - return; - } - Command cmd = optional.get(); - PermissionCondition queued = cmd.getCondition().as(PermissionCondition.class).orElse(null); - if (queued != null && !queued.isQueued()) { - handleCommandOnCurrentThread(event); - return; - } else { - actor.decline(); - } - actor.runAction(() -> { - SessionKey key = actor.getSessionKey(); - if (key.isActive()) { - PlatformCommandManager.this.handleCommandOnCurrentThread(event); - } - }, false, true); - }, Fawe.isMainThread()); + }, false, true); } public void handleCommandOnCurrentThread(CommandEvent event) { From 05afaf00a912d0bf4c0eb0b54c2e73321f96bf84 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Sat, 22 Apr 2023 00:21:50 +0200 Subject: [PATCH 004/161] Address incompatibilities after CraftChunk changes in spigot (#2179) --- .../adapters/adapter-1_19_4/build.gradle.kts | 2 +- .../fawe/v1_19_R3/PaperweightFaweAdapter.java | 48 ------------------- .../PaperweightFaweWorldNativeAccess.java | 2 +- .../v1_19_R3/PaperweightPlatformAdapter.java | 33 +++++++++++-- .../fawe/v1_19_R3/regen/PaperweightRegen.java | 7 ++- 5 files changed, 37 insertions(+), 55 deletions(-) diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts index 8fb3980de..4d1c1ada5 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts +++ b/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts @@ -9,6 +9,6 @@ repositories { } dependencies { - paperDevBundle("1.19.4-R0.1-20230331.112431-38") + paperDevBundle("1.19.4-R0.1-20230412.010331-64") compileOnly("io.papermc:paperlib") } diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweAdapter.java index 5edcb8618..e23e18a2e 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweAdapter.java @@ -306,54 +306,6 @@ public final class PaperweightFaweAdapter extends CachedBukkitAdapter implements return SideEffectSet.defaults().getSideEffectsToApply(); } - public boolean setBlock(org.bukkit.Chunk chunk, int x, int y, int z, BlockStateHolder state, boolean update) { - CraftChunk craftChunk = (CraftChunk) chunk; - LevelChunk levelChunk = craftChunk.getHandle(); - Level level = levelChunk.getLevel(); - - BlockPos blockPos = new BlockPos(x, y, z); - net.minecraft.world.level.block.state.BlockState blockState = ((PaperweightBlockMaterial) state.getMaterial()).getState(); - LevelChunkSection[] levelChunkSections = levelChunk.getSections(); - int y4 = y >> 4; - LevelChunkSection section = levelChunkSections[y4]; - - net.minecraft.world.level.block.state.BlockState existing; - if (section == null) { - existing = ((PaperweightBlockMaterial) BlockTypes.AIR.getDefaultState().getMaterial()).getState(); - } else { - existing = section.getBlockState(x & 15, y & 15, z & 15); - } - - levelChunk.removeBlockEntity(blockPos); // Force delete the old tile entity - - CompoundBinaryTag compoundTag = state instanceof BaseBlock ? state.getNbt() : null; - if (compoundTag != null || existing instanceof TileEntityBlock) { - level.setBlock(blockPos, blockState, 0); - // remove tile - if (compoundTag != null) { - // We will assume that the tile entity was created for us, - // though we do not do this on the Forge version - BlockEntity blockEntity = level.getBlockEntity(blockPos); - if (blockEntity != null) { - net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) fromNativeBinary(compoundTag); - tag.put("x", IntTag.valueOf(x)); - tag.put("y", IntTag.valueOf(y)); - tag.put("z", IntTag.valueOf(z)); - blockEntity.load(tag); // readTagIntoTileEntity - load data - } - } - } else { - if (existing == blockState) { - return true; - } - levelChunk.setBlockState(blockPos, blockState, false); - } - if (update) { - level.getMinecraftWorld().sendBlockUpdated(blockPos, existing, blockState, 0); - } - return true; - } - @Override public WorldNativeAccess createWorldNativeAccess(org.bukkit.World world) { return new PaperweightFaweWorldNativeAccess( diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweWorldNativeAccess.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweWorldNativeAccess.java index 4dead58fa..dbe0150a9 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweWorldNativeAccess.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweWorldNativeAccess.java @@ -102,7 +102,7 @@ public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess currentTick; if (nextTick || cachedChanges.size() >= 1024) { if (nextTick) { diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java index 115246ce3..33be73c69 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java @@ -41,6 +41,8 @@ import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.GlobalPalette; import net.minecraft.world.level.chunk.HashMapPalette; import net.minecraft.world.level.chunk.LevelChunk; @@ -57,6 +59,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; @@ -74,6 +77,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Semaphore; import java.util.function.Function; +import static java.lang.invoke.MethodType.methodType; import static net.minecraft.core.registries.Registries.BIOME; public final class PaperweightPlatformAdapter extends NMSAdapter { @@ -103,6 +107,12 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { private static final MethodHandle methodRemoveGameEventListener; private static final MethodHandle methodremoveTickingBlockEntity; + /* + * This is a workaround for the changes from https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/1fddefce1cdce44010927b888432bf70c0e88cde#src/main/java/org/bukkit/craftbukkit/CraftChunk.java + * and is only needed to support 1.19.4 versions before *and* after this change. + */ + private static final MethodHandle CRAFT_CHUNK_GET_HANDLE; + private static final Field fieldRemove; static final boolean POST_CHUNK_REWRITE; @@ -111,6 +121,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { private static Field SERVER_LEVEL_ENTITY_MANAGER; static { + final MethodHandles.Lookup lookup = MethodHandles.lookup(); try { fieldData = PalettedContainer.class.getDeclaredField(Refraction.pickName("data", "d")); fieldData.setAccessible(true); @@ -136,7 +147,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { "b" ), long.class); getVisibleChunkIfPresent.setAccessible(true); - methodGetVisibleChunk = MethodHandles.lookup().unreflect(getVisibleChunkIfPresent); + methodGetVisibleChunk = lookup.unreflect(getVisibleChunkIfPresent); Unsafe unsafe = ReflectionUtils.getUnsafe(); if (!PaperLib.isPaper()) { @@ -160,7 +171,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { ServerLevel.class ); removeGameEventListener.setAccessible(true); - methodRemoveGameEventListener = MethodHandles.lookup().unreflect(removeGameEventListener); + methodRemoveGameEventListener = lookup.unreflect(removeGameEventListener); Method removeBlockEntityTicker = LevelChunk.class.getDeclaredMethod( Refraction.pickName( @@ -169,7 +180,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { ), BlockPos.class ); removeBlockEntityTicker.setAccessible(true); - methodremoveTickingBlockEntity = MethodHandles.lookup().unreflect(removeBlockEntityTicker); + methodremoveTickingBlockEntity = lookup.unreflect(removeBlockEntityTicker); fieldRemove = BlockEntity.class.getDeclaredField(Refraction.pickName("remove", "p")); fieldRemove.setAccessible(true); @@ -208,6 +219,20 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { rethrow.printStackTrace(); throw new RuntimeException(rethrow); } + MethodHandle craftChunkGetHandle; + final MethodType type = methodType(ChunkAccess.class); + try { + craftChunkGetHandle = lookup.findVirtual(CraftChunk.class, "getHandle", type); + } catch (NoSuchMethodException | IllegalAccessException e) { + try { + final MethodType newType = methodType(ChunkAccess.class, ChunkStatus.class); + craftChunkGetHandle = lookup.findVirtual(CraftChunk.class, "getHandle", newType); + craftChunkGetHandle = MethodHandles.insertArguments(craftChunkGetHandle, 1, ChunkStatus.FULL); + } catch (NoSuchMethodException | IllegalAccessException ex) { + throw new RuntimeException(ex); + } + } + CRAFT_CHUNK_GET_HANDLE = craftChunkGetHandle; } static boolean setSectionAtomic( @@ -280,7 +305,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { CompletableFuture future = serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true); try { CraftChunk chunk = (CraftChunk) future.get(); - return chunk.getHandle(); + return (LevelChunk) CRAFT_CHUNK_GET_HANDLE.invoke(chunk); } catch (Throwable e) { e.printStackTrace(); } diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/regen/PaperweightRegen.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/regen/PaperweightRegen.java index 282baeb21..4f22e8734 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/regen/PaperweightRegen.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/regen/PaperweightRegen.java @@ -60,6 +60,7 @@ import net.minecraft.world.level.storage.LevelStorageSource; import net.minecraft.world.level.storage.PrimaryLevelData; import org.apache.logging.log4j.Logger; import org.bukkit.Bukkit; +import org.bukkit.Chunk; import org.bukkit.craftbukkit.v1_19_R3.CraftServer; import org.bukkit.craftbukkit.v1_19_R3.CraftWorld; import org.bukkit.craftbukkit.v1_19_R3.generator.CustomChunkGenerator; @@ -440,7 +441,11 @@ public class PaperweightRegen extends Regenerator blockPopulator.populate(freshWorld.getWorld(), random, levelChunk.getBukkitChunk())); + TaskManager.taskManager().task(() -> { + final CraftWorld world = freshWorld.getWorld(); + final Chunk chunk = world.getChunkAt(levelChunk.locX, levelChunk.locZ); + blockPopulator.populate(world, random, chunk); + }); } @Override From 8cfb8cb322e46a613df0909bcf5cc6995c614375 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sat, 22 Apr 2023 10:45:02 +0100 Subject: [PATCH 005/161] chore: add chunk tickets to all chunks accessed (#2163) - This isn't necessarily targeting any fix, but I think we should be ensuring a ticket is being added to chunks "access asynchronously", as done by the getChunkAtAsync method --- .../fawe/v1_17_R1_2/PaperweightPlatformAdapter.java | 11 +++++++++++ .../fawe/v1_18_R2/PaperweightPlatformAdapter.java | 11 +++++++++++ .../fawe/v1_19_R1/PaperweightPlatformAdapter.java | 11 +++++++++++ .../fawe/v1_19_R2/PaperweightPlatformAdapter.java | 11 +++++++++++ .../fawe/v1_19_R3/PaperweightPlatformAdapter.java | 12 ++++++++++++ 5 files changed, 56 insertions(+) diff --git a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightPlatformAdapter.java index 3ea9df730..69ab5fe9b 100644 --- a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightPlatformAdapter.java @@ -29,7 +29,9 @@ import net.minecraft.server.level.ChunkHolder; import net.minecraft.server.level.ChunkMap; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.level.TicketType; import net.minecraft.util.BitStorage; +import net.minecraft.util.Unit; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.LevelAccessor; @@ -209,10 +211,12 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { } else { LevelChunk nmsChunk = serverLevel.getChunkSource().getChunkAtIfCachedImmediately(chunkX, chunkZ); if (nmsChunk != null) { + addTicket(serverLevel, chunkX, chunkZ); return nmsChunk; } nmsChunk = serverLevel.getChunkSource().getChunkAtIfLoadedImmediately(chunkX, chunkZ); if (nmsChunk != null) { + addTicket(serverLevel, chunkX, chunkZ); return nmsChunk; } // Avoid "async" methods from the main thread. @@ -230,6 +234,13 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { return TaskManager.taskManager().sync(() -> serverLevel.getChunk(chunkX, chunkZ)); } + private static void addTicket(ServerLevel serverLevel, int chunkX, int chunkZ) { + // Ensure chunk is definitely loaded before applying a ticket + net.minecraft.server.MCUtil.MAIN_EXECUTOR.execute(() -> serverLevel + .getChunkSource() + .addRegionTicket(TicketType.PLUGIN, new ChunkPos(chunkX, chunkZ), 0, Unit.INSTANCE)); + } + public static ChunkHolder getPlayerChunk(ServerLevel nmsWorld, final int chunkX, final int chunkZ) { ChunkMap chunkMap = nmsWorld.getChunkSource().chunkMap; try { diff --git a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightPlatformAdapter.java index 9de310b96..8e982a84e 100644 --- a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightPlatformAdapter.java @@ -29,9 +29,11 @@ import net.minecraft.server.level.ChunkHolder; import net.minecraft.server.level.ChunkMap; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.level.TicketType; import net.minecraft.util.BitStorage; import net.minecraft.util.SimpleBitStorage; import net.minecraft.util.ThreadingDetector; +import net.minecraft.util.Unit; import net.minecraft.util.ZeroBitStorage; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.ChunkPos; @@ -237,10 +239,12 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { } else { LevelChunk nmsChunk = serverLevel.getChunkSource().getChunkAtIfCachedImmediately(chunkX, chunkZ); if (nmsChunk != null) { + addTicket(serverLevel, chunkX, chunkZ); return nmsChunk; } nmsChunk = serverLevel.getChunkSource().getChunkAtIfLoadedImmediately(chunkX, chunkZ); if (nmsChunk != null) { + addTicket(serverLevel, chunkX, chunkZ); return nmsChunk; } // Avoid "async" methods from the main thread. @@ -258,6 +262,13 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { return TaskManager.taskManager().sync(() -> serverLevel.getChunk(chunkX, chunkZ)); } + private static void addTicket(ServerLevel serverLevel, int chunkX, int chunkZ) { + // Ensure chunk is definitely loaded before applying a ticket + net.minecraft.server.MCUtil.MAIN_EXECUTOR.execute(() -> serverLevel + .getChunkSource() + .addRegionTicket(TicketType.PLUGIN, new ChunkPos(chunkX, chunkZ), 0, Unit.INSTANCE)); + } + public static ChunkHolder getPlayerChunk(ServerLevel nmsWorld, final int chunkX, final int chunkZ) { ChunkMap chunkMap = nmsWorld.getChunkSource().chunkMap; try { diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightPlatformAdapter.java index 0423a03a7..2fcb72225 100644 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightPlatformAdapter.java @@ -29,10 +29,12 @@ import net.minecraft.server.level.ChunkHolder; import net.minecraft.server.level.ChunkMap; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.level.TicketType; import net.minecraft.util.BitStorage; import net.minecraft.util.ExceptionCollector; import net.minecraft.util.SimpleBitStorage; import net.minecraft.util.ThreadingDetector; +import net.minecraft.util.Unit; import net.minecraft.util.ZeroBitStorage; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.ChunkPos; @@ -270,10 +272,12 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { } else { LevelChunk nmsChunk = serverLevel.getChunkSource().getChunkAtIfCachedImmediately(chunkX, chunkZ); if (nmsChunk != null) { + addTicket(serverLevel, chunkX, chunkZ); return nmsChunk; } nmsChunk = serverLevel.getChunkSource().getChunkAtIfLoadedImmediately(chunkX, chunkZ); if (nmsChunk != null) { + addTicket(serverLevel, chunkX, chunkZ); return nmsChunk; } // Avoid "async" methods from the main thread. @@ -291,6 +295,13 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { return TaskManager.taskManager().sync(() -> serverLevel.getChunk(chunkX, chunkZ)); } + private static void addTicket(ServerLevel serverLevel, int chunkX, int chunkZ) { + // Ensure chunk is definitely loaded before applying a ticket + io.papermc.paper.util.MCUtil.MAIN_EXECUTOR.execute(() -> serverLevel + .getChunkSource() + .addRegionTicket(TicketType.PLUGIN, new ChunkPos(chunkX, chunkZ), 0, Unit.INSTANCE)); + } + public static ChunkHolder getPlayerChunk(ServerLevel nmsWorld, final int chunkX, final int chunkZ) { ChunkMap chunkMap = nmsWorld.getChunkSource().chunkMap; try { diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightPlatformAdapter.java index 1a4d3e523..5f8e39940 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightPlatformAdapter.java @@ -29,10 +29,12 @@ import net.minecraft.server.level.ChunkHolder; import net.minecraft.server.level.ChunkMap; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.level.TicketType; import net.minecraft.util.BitStorage; import net.minecraft.util.ExceptionCollector; import net.minecraft.util.SimpleBitStorage; import net.minecraft.util.ThreadingDetector; +import net.minecraft.util.Unit; import net.minecraft.util.ZeroBitStorage; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.ChunkPos; @@ -267,10 +269,12 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { } else { LevelChunk nmsChunk = serverLevel.getChunkSource().getChunkAtIfCachedImmediately(chunkX, chunkZ); if (nmsChunk != null) { + addTicket(serverLevel, chunkX, chunkZ); return nmsChunk; } nmsChunk = serverLevel.getChunkSource().getChunkAtIfLoadedImmediately(chunkX, chunkZ); if (nmsChunk != null) { + addTicket(serverLevel, chunkX, chunkZ); return nmsChunk; } // Avoid "async" methods from the main thread. @@ -288,6 +292,13 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { return TaskManager.taskManager().sync(() -> serverLevel.getChunk(chunkX, chunkZ)); } + private static void addTicket(ServerLevel serverLevel, int chunkX, int chunkZ) { + // Ensure chunk is definitely loaded before applying a ticket + io.papermc.paper.util.MCUtil.MAIN_EXECUTOR.execute(() -> serverLevel + .getChunkSource() + .addRegionTicket(TicketType.PLUGIN, new ChunkPos(chunkX, chunkZ), 0, Unit.INSTANCE)); + } + public static ChunkHolder getPlayerChunk(ServerLevel nmsWorld, final int chunkX, final int chunkZ) { ChunkMap chunkMap = nmsWorld.getChunkSource().chunkMap; try { diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java index 33be73c69..11dadaf1e 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java @@ -29,10 +29,12 @@ import net.minecraft.server.level.ChunkHolder; import net.minecraft.server.level.ChunkMap; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.level.TicketType; import net.minecraft.util.BitStorage; import net.minecraft.util.ExceptionCollector; import net.minecraft.util.SimpleBitStorage; import net.minecraft.util.ThreadingDetector; +import net.minecraft.util.Unit; import net.minecraft.util.ZeroBitStorage; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.ChunkPos; @@ -292,10 +294,12 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { } else { LevelChunk nmsChunk = serverLevel.getChunkSource().getChunkAtIfCachedImmediately(chunkX, chunkZ); if (nmsChunk != null) { + addTicket(serverLevel, chunkX, chunkZ); return nmsChunk; } nmsChunk = serverLevel.getChunkSource().getChunkAtIfLoadedImmediately(chunkX, chunkZ); if (nmsChunk != null) { + addTicket(serverLevel, chunkX, chunkZ); return nmsChunk; } // Avoid "async" methods from the main thread. @@ -305,6 +309,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { CompletableFuture future = serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true); try { CraftChunk chunk = (CraftChunk) future.get(); + addTicket(serverLevel, chunkX, chunkZ); return (LevelChunk) CRAFT_CHUNK_GET_HANDLE.invoke(chunk); } catch (Throwable e) { e.printStackTrace(); @@ -313,6 +318,13 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { return TaskManager.taskManager().sync(() -> serverLevel.getChunk(chunkX, chunkZ)); } + private static void addTicket(ServerLevel serverLevel, int chunkX, int chunkZ) { + // Ensure chunk is definitely loaded before applying a ticket + io.papermc.paper.util.MCUtil.MAIN_EXECUTOR.execute(() -> serverLevel + .getChunkSource() + .addRegionTicket(TicketType.UNLOAD_COOLDOWN, new ChunkPos(chunkX, chunkZ), 0, Unit.INSTANCE)); + } + public static ChunkHolder getPlayerChunk(ServerLevel nmsWorld, final int chunkX, final int chunkZ) { ChunkMap chunkMap = nmsWorld.getChunkSource().chunkMap; try { From 488a2e5de4aaf2545cede0a44e9e6dd2e9e6f352 Mon Sep 17 00:00:00 2001 From: 360shvit <54532500+360shvit@users.noreply.github.com> Date: Sat, 22 Apr 2023 18:48:59 +0200 Subject: [PATCH 006/161] Add an explanation to Disallowed-Blocks Comment (#2186) Improve user experience by adding an explanation to Disallowed-Blocks Configblock (#2183) --- .../java/com/fastasyncworldedit/core/configuration/Settings.java | 1 + 1 file changed, 1 insertion(+) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java index c2cb7704d..502e9dbf3 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java @@ -394,6 +394,7 @@ public class Settings extends Config { "Where block properties are specified, any blockstate with the property will be disallowed (e.g. all directions", "of a waterlogged fence). For blocking/remapping of all occurrences of a property like waterlogged, see", "remap-properties below.", + "To generate a blank list, substitute the default content with a set of square brackets [] instead.", "Example block property blocking:", " - \"minecraft:conduit[waterlogged=true]\"", " - \"minecraft:piston[extended=false,facing=west]\"", From c86dfe45df049d5df7285df68ecfa03a2117af51 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Sun, 23 Apr 2023 22:15:37 +0200 Subject: [PATCH 007/161] Ensure regen step not running on the main thread (#2185) --- .../bukkit/adapter/Regenerator.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/Regenerator.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/Regenerator.java index 8f3b4d118..c95fbc580 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/Regenerator.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/Regenerator.java @@ -253,10 +253,13 @@ public abstract class Regenerator { + for (long xz : coords) { + chunkStatus.processChunkSave(xz, worldlimits.get(radius).get(xz)); + } + }).get(); // wait until finished this step } } From abe120291f99a505ec68ec2d8dd902f2e53bda16 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sun, 23 Apr 2023 22:47:30 +0200 Subject: [PATCH 008/161] Release 2.6.1 --- .github/workflows/announce-release-on-discord.yml | 2 +- build.gradle.kts | 4 ++-- buildSrc/build.gradle.kts | 2 +- worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts | 2 +- worldedit-bukkit/build.gradle.kts | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/announce-release-on-discord.yml b/.github/workflows/announce-release-on-discord.yml index 810366540..77fa89732 100644 --- a/.github/workflows/announce-release-on-discord.yml +++ b/.github/workflows/announce-release-on-discord.yml @@ -13,7 +13,7 @@ jobs: DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} DISCORD_USERNAME: FastAsyncWorldEdit Release DISCORD_AVATAR: https://raw.githubusercontent.com/IntellectualSites/Assets/main/plugins/FastAsyncWorldEdit/FastAsyncWorldEdit.png - uses: Ilshidur/action-discord@0c4b27844ba47cb1c7bee539c8eead5284ce9fa9 # ratchet:Ilshidur/action-discord@0.3.2 + uses: Ilshidur/action-discord@0.3.2 with: args: | "<@&525015715300900875> <@&706463154804097105> <@&671372968462516240>" diff --git a/build.gradle.kts b/build.gradle.kts index 5bbde35da..2167d306b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,7 +34,7 @@ logger.lifecycle(""" ******************************************* """) -var rootVersion by extra("2.6.0") +var rootVersion by extra("2.6.1") var snapshot by extra("SNAPSHOT") var revision: String by extra("") var buildNumber by extra("") @@ -52,7 +52,7 @@ ext { } } -version = String.format("%s-%s", rootVersion, buildNumber) +version = String.format("%s", rootVersion) if (!project.hasProperty("gitCommitHash")) { apply(plugin = "org.ajoberstar.grgit") diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 15237a86e..d664f0c61 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -24,7 +24,7 @@ dependencies { implementation(gradleApi()) implementation("org.ajoberstar.grgit:grgit-gradle:5.0.0") implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.2") - implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.5.3") + implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.5.4") } kotlin { diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts index 4d1c1ada5..cf00f80f2 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts +++ b/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts @@ -9,6 +9,6 @@ repositories { } dependencies { - paperDevBundle("1.19.4-R0.1-20230412.010331-64") + paperDevBundle("1.19.4-R0.1-20230423.020222-72") compileOnly("io.papermc:paperlib") } diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index 41242611f..a6c5147ad 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -3,7 +3,7 @@ import io.papermc.paperweight.userdev.attribute.Obfuscation plugins { `java-library` - id("com.modrinth.minotaur") version "2.+" + id("com.modrinth.minotaur") version "2.7.5" } project.description = "Bukkit" From 9f3c909254994d53c6574d0d27031406166fd399 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sun, 23 Apr 2023 23:01:03 +0200 Subject: [PATCH 009/161] Back to snapshot for development --- build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 2167d306b..a58e32833 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,7 +34,7 @@ logger.lifecycle(""" ******************************************* """) -var rootVersion by extra("2.6.1") +var rootVersion by extra("2.6.2") var snapshot by extra("SNAPSHOT") var revision: String by extra("") var buildNumber by extra("") @@ -52,7 +52,7 @@ ext { } } -version = String.format("%s", rootVersion) +version = String.format("%s-%s", rootVersion, buildNumber) if (!project.hasProperty("gitCommitHash")) { apply(plugin = "org.ajoberstar.grgit") From ffe704d890927f613d62f4aff86997ceece43827 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 1 May 2023 10:03:49 +0200 Subject: [PATCH 010/161] Update dependency org.mockito:mockito-core to v5.3.1 (#2204) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- worldedit-sponge/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d450d7ad9..4e852c642 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -36,7 +36,7 @@ text = "3.0.4" piston = "0.5.7" # Tests -mockito = "5.2.0" +mockito = "5.3.1" # Gradle plugins pluginyml = "0.5.3" diff --git a/worldedit-sponge/build.gradle.kts b/worldedit-sponge/build.gradle.kts index 76828b320..e895e2989 100644 --- a/worldedit-sponge/build.gradle.kts +++ b/worldedit-sponge/build.gradle.kts @@ -28,7 +28,7 @@ dependencies { }) api("org.apache.logging.log4j:log4j-api") api("org.bstats:bstats-sponge:1.7") - testImplementation("org.mockito:mockito-core:5.2.0") + testImplementation("org.mockito:mockito-core:5.3.1") } <<<<<<< HEAD From 909b7d27b88d1850c243ee6c3ec4861b65133c81 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 1 May 2023 10:04:49 +0200 Subject: [PATCH 011/161] Update dependency org.ajoberstar.grgit:grgit-gradle to v5.2.0 (#2203) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- buildSrc/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index d664f0c61..1f1aded61 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -22,7 +22,7 @@ val properties = Properties().also { props -> dependencies { implementation(gradleApi()) - implementation("org.ajoberstar.grgit:grgit-gradle:5.0.0") + implementation("org.ajoberstar.grgit:grgit-gradle:5.2.0") implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.2") implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.5.4") } From 4779bd4916e893d4a6e2bab719249dd3cb1d97d6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 1 May 2023 10:20:24 +0200 Subject: [PATCH 012/161] Update plugin xyz.jpenilla.run-paper to v2.1.0 (#2205) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index a58e32833..2879f6107 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ import xyz.jpenilla.runpaper.task.RunServer plugins { id("io.github.gradle-nexus.publish-plugin") version "1.3.0" - id("xyz.jpenilla.run-paper") version "2.0.1" + id("xyz.jpenilla.run-paper") version "2.1.0" } if (!File("$rootDir/.git").exists()) { From 950a3f9430eec5e0a3ab82696874c8bc5a65a27f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 1 May 2023 10:22:18 +0200 Subject: [PATCH 013/161] Update dependency com.github.TownyAdvanced:Towny to v0.99.0.5 (#2202) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4e852c642..6d1869213 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,7 +11,7 @@ mapmanager = "1.8.0-SNAPSHOT" griefprevention = "16.18.1" griefdefender = "2.1.0-SNAPSHOT" residence = "4.5._13.1" -towny = "0.98.4.18" +towny = "0.99.0.5" # Third party bstats = "3.0.2" From 92a6ff5f88592714b364d5f95f98a7d6b87aa9bf Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 1 May 2023 10:22:27 +0200 Subject: [PATCH 014/161] Update dependency io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin to v1.5.5 (#2201) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- buildSrc/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 1f1aded61..461e9deaa 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -24,7 +24,7 @@ dependencies { implementation(gradleApi()) implementation("org.ajoberstar.grgit:grgit-gradle:5.2.0") implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.2") - implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.5.4") + implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.5.5") } kotlin { From e08720b31093cfe6ecded6e52888e5ac6147000e Mon Sep 17 00:00:00 2001 From: Phillipp Glanz Date: Thu, 4 May 2023 18:30:10 +0200 Subject: [PATCH 015/161] Improve git ignore (#2206) * Exclude run-server for all version * Exclude run-server for all version * Exclude run-server for all version * Exclude run-server for all version * Exclude run-server for all version * Remove unsless entry --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 14ba6416a..0a9d6020d 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,5 @@ worldedit-core/src/main/resources/lang/* /worldedit-core/.factorypath .DS_Store +### Run server ignore +run-* From 2987550e9b4ee0ab1d54fdfa5320773f6060abd2 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Thu, 4 May 2023 18:33:04 +0200 Subject: [PATCH 016/161] Actually delegate in AbstractDelegateExtent (#2196) * actually delegate in AbstractDelegateExtent * exclude enableHistory method --- .../extent/AbstractDelegateExtent.java | 296 +++++++++++++++++- .../fastasyncworldedit/ArchitecturalTest.java | 30 ++ 2 files changed, 322 insertions(+), 4 deletions(-) create mode 100644 worldedit-core/src/test/java/com/fastasyncworldedit/ArchitecturalTest.java diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java index 9dfd373ea..06b10b62b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java @@ -23,29 +23,43 @@ import com.fastasyncworldedit.core.FaweCache; import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.extent.HistoryExtent; import com.fastasyncworldedit.core.extent.NullExtent; +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; +import com.fastasyncworldedit.core.function.generator.GenBase; +import com.fastasyncworldedit.core.function.generator.Resource; import com.fastasyncworldedit.core.history.changeset.AbstractChangeSet; import com.fastasyncworldedit.core.internal.exception.FaweException; +import com.fastasyncworldedit.core.math.MutableBlockVector3; +import com.fastasyncworldedit.core.queue.Filter; import com.fastasyncworldedit.core.queue.IBatchProcessor; import com.fastasyncworldedit.core.util.ExtentTraverser; import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extent.buffer.ForgetfulExtentBuffer; +import com.sk89q.worldedit.extent.clipboard.Clipboard; +import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.OperationQueue; +import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.internal.util.LogManagerCompat; +import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.session.ClipboardHolder; +import com.sk89q.worldedit.util.Countable; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; import org.apache.logging.log4j.Logger; import javax.annotation.Nullable; import java.util.List; +import java.util.Set; import java.util.UUID; import static com.google.common.base.Preconditions.checkNotNull; @@ -53,9 +67,7 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * A base class for {@link Extent}s that merely passes extents onto another. */ -//FAWE start - made none abstract -public class AbstractDelegateExtent implements Extent { -//FAWE end +public abstract class AbstractDelegateExtent implements Extent { private static final Logger LOGGER = LogManagerCompat.getLogger(); @@ -68,7 +80,7 @@ public class AbstractDelegateExtent implements Extent { * * @param extent the extent */ - public AbstractDelegateExtent(Extent extent) { + protected AbstractDelegateExtent(Extent extent) { checkNotNull(extent); this.extent = extent; } @@ -115,6 +127,12 @@ public class AbstractDelegateExtent implements Extent { //FAWE end } + @SuppressWarnings("deprecation") + @Override + public BiomeType getBiome(final BlockVector2 position) { + return extent.getBiome(position); + } + @Override public BlockVector3 getMinimumPoint() { return extent.getMinimumPoint(); @@ -225,11 +243,220 @@ public class AbstractDelegateExtent implements Extent { } } + @Override + public boolean isWorld() { + return extent.isWorld(); + } + + @Override + public boolean regenerateChunk( + final int x, + final int z, + @Nullable final BiomeType type, + @Nullable final Long seed + ) { + return extent.regenerateChunk(x, z, type, seed); + } + + @Override + public int getHighestTerrainBlock(final int x, final int z, final int minY, final int maxY) { + return extent.getHighestTerrainBlock(x, z, minY, maxY); + } + + @Override + public int getHighestTerrainBlock(final int x, final int z, final int minY, final int maxY, final Mask filter) { + return extent.getHighestTerrainBlock(x, z, minY, maxY, filter); + } + + @Override + public int getNearestSurfaceLayer(final int x, final int z, final int y, final int minY, final int maxY) { + return extent.getNearestSurfaceLayer(x, z, y, minY, maxY); + } + + @Override + public int getNearestSurfaceTerrainBlock( + final int x, + final int z, + final int y, + final int minY, + final int maxY, + final int failedMin, + final int failedMax, + final Mask mask + ) { + return extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, mask); + } + + @Override + public int getNearestSurfaceTerrainBlock( + final int x, + final int z, + final int y, + final int minY, + final int maxY, + final boolean ignoreAir + ) { + return extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, ignoreAir); + } + + @Override + public int getNearestSurfaceTerrainBlock(final int x, final int z, final int y, final int minY, final int maxY) { + return extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY); + } + + @Override + public int getNearestSurfaceTerrainBlock( + final int x, + final int z, + final int y, + final int minY, + final int maxY, + final int failedMin, + final int failedMax + ) { + return extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax); + } + + @Override + public int getNearestSurfaceTerrainBlock( + final int x, + final int z, + final int y, + final int minY, + final int maxY, + final int failedMin, + final int failedMax, + final boolean ignoreAir + ) { + return extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, ignoreAir); + } + + @Override + public void addCaves(final Region region) throws WorldEditException { + extent.addCaves(region); + } + + @Override + public void generate(final Region region, final GenBase gen) throws WorldEditException { + extent.generate(region, gen); + } + + @Override + public void addSchems( + final Region region, + final Mask mask, + final List clipboards, + final int rarity, + final boolean rotate + ) throws WorldEditException { + extent.addSchems(region, mask, clipboards, rarity, rotate); + } + + @Override + public void spawnResource(final Region region, final Resource gen, final int rarity, final int frequency) throws + WorldEditException { + extent.spawnResource(region, gen, rarity, frequency); + } + + @Override + public boolean contains(final BlockVector3 pt) { + return extent.contains(pt); + } + + @Override + public boolean contains(final int x, final int y, final int z) { + return extent.contains(x, y, z); + } + + @Override + public void addOre( + final Region region, + final Mask mask, + final Pattern material, + final int size, + final int frequency, + final int rarity, + final int minY, + final int maxY + ) throws WorldEditException { + extent.addOre(region, mask, material, size, frequency, rarity, minY, maxY); + } + + @Override + public void addOres(final Region region, final Mask mask) throws WorldEditException { + extent.addOres(region, mask); + } + + @Override + public List> getBlockDistribution(final Region region) { + return extent.getBlockDistribution(region); + } + + @Override + public List> getBlockDistributionWithData(final Region region) { + return extent.getBlockDistributionWithData(region); + } + @Override public int getMaxY() { return extent.getMaxY(); } + @Override + public Clipboard lazyCopy(final Region region) { + return extent.lazyCopy(region); + } + + @Override + public int countBlocks(final Region region, final Set searchBlocks) { + return extent.countBlocks(region, searchBlocks); + } + + @Override + public int countBlocks(final Region region, final Mask searchMask) { + return extent.countBlocks(region, searchMask); + } + + @Override + public > int setBlocks(final Region region, final B block) throws MaxChangedBlocksException { + return extent.setBlocks(region, block); + } + + @Override + public int setBlocks(final Region region, final Pattern pattern) throws MaxChangedBlocksException { + return extent.setBlocks(region, pattern); + } + + @Override + public > int replaceBlocks( + final Region region, + final Set filter, + final B replacement + ) throws MaxChangedBlocksException { + return extent.replaceBlocks(region, filter, replacement); + } + + @Override + public int replaceBlocks(final Region region, final Set filter, final Pattern pattern) throws + MaxChangedBlocksException { + return extent.replaceBlocks(region, filter, pattern); + } + + @Override + public int replaceBlocks(final Region region, final Mask mask, final Pattern pattern) throws MaxChangedBlocksException { + return extent.replaceBlocks(region, mask, pattern); + } + + @Override + public int center(final Region region, final Pattern pattern) throws MaxChangedBlocksException { + return extent.center(region, pattern); + } + + @Override + public int setBlocks(final Set vset, final Pattern pattern) { + return extent.setBlocks(vset, pattern); + } + @Override public int getMinY() { return extent.getMinY(); @@ -295,6 +522,16 @@ public class AbstractDelegateExtent implements Extent { return this; } + @Override + public T apply(final Region region, final T filter, final boolean full) { + return extent.apply(region, filter, full); + } + + @Override + public T apply(final Iterable positions, final T filter) { + return extent.apply(positions, filter); + } + protected Operation commitBefore() { return null; } @@ -308,6 +545,11 @@ public class AbstractDelegateExtent implements Extent { public BiomeType getBiome(BlockVector3 position) { return extent.getBiome(position); } + + @Override + public int getEmittedLight(final BlockVector3 position) { + return extent.getEmittedLight(position); + } /* History */ @@ -317,16 +559,41 @@ public class AbstractDelegateExtent implements Extent { return extent.getEmittedLight(x, y, z); } + @Override + public int getSkyLight(final MutableBlockVector3 position) { + return extent.getSkyLight(position); + } + @Override public int getSkyLight(int x, int y, int z) { return extent.getSkyLight(x, y, z); } + @Override + public int getBrightness(final MutableBlockVector3 position) { + return extent.getBrightness(position); + } + @Override public int getBrightness(int x, int y, int z) { return extent.getBrightness(x, y, z); } + @Override + public int getOpacity(final MutableBlockVector3 position) { + return extent.getOpacity(position); + } + + @Override + public int getOpacity(final int x, final int y, final int z) { + return extent.getOpacity(x, y, z); + } + + @Override + public int[] getHeightMap(final HeightMapType type) { + return extent.getHeightMap(type); + } + public void setChangeSet(AbstractChangeSet changeSet) { if (extent instanceof HistoryExtent) { HistoryExtent history = ((HistoryExtent) extent); @@ -366,6 +633,12 @@ public class AbstractDelegateExtent implements Extent { return extent.fullySupports3DBiomes(); } + @SuppressWarnings("deprecation") + @Override + public boolean setBiome(final BlockVector2 position, final BiomeType biome) { + return extent.setBiome(position, biome); + } + @Override public boolean setBiome(int x, int y, int z, BiomeType biome) { return extent.setBiome(x, y, z, biome); @@ -376,16 +649,31 @@ public class AbstractDelegateExtent implements Extent { return extent.setBiome(position.getX(), position.getY(), position.getZ(), biome); } + @Override + public void setBlockLight(final BlockVector3 position, final int value) { + extent.setBlockLight(position, value); + } + @Override public void setBlockLight(int x, int y, int z, int value) { extent.setSkyLight(x, y, z, value); } + @Override + public void setSkyLight(final BlockVector3 position, final int value) { + extent.setSkyLight(position, value); + } + @Override public void setSkyLight(int x, int y, int z, int value) { extent.setSkyLight(x, y, z, value); } + @Override + public void setHeightMap(final HeightMapType type, final int[] heightMap) { + extent.setHeightMap(type, heightMap); + } + @Override public String toString() { return super.toString() + ":" + (extent == this ? "" : extent.toString()); diff --git a/worldedit-core/src/test/java/com/fastasyncworldedit/ArchitecturalTest.java b/worldedit-core/src/test/java/com/fastasyncworldedit/ArchitecturalTest.java new file mode 100644 index 000000000..1db8f6526 --- /dev/null +++ b/worldedit-core/src/test/java/com/fastasyncworldedit/ArchitecturalTest.java @@ -0,0 +1,30 @@ +package com.fastasyncworldedit; + +import com.sk89q.worldedit.extent.AbstractDelegateExtent; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import java.lang.reflect.Method; +import java.util.Arrays; +import java.util.stream.Stream; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class ArchitecturalTest { + + public static Stream abstractDelegateExtentMethods() { + return Arrays.stream(AbstractDelegateExtent.class.getMethods()) + .filter(m -> m.getDeclaringClass() != Object.class) // ignore methods inherited from java.lang.Object + // TODO: figure out why enableHistory returns STQE instead of PQE when overriding + .filter(m -> !m.getName().equals("enableHistory")) + .map(Arguments::of); + } + + @ParameterizedTest + @MethodSource("abstractDelegateExtentMethods") + void testAbstractDelegateExtentOverridesAllMethods(Method method) { + assertEquals(AbstractDelegateExtent.class, method.getDeclaringClass()); + } + +} From dd6197922c199da9d1054b14b26c69015fbdb324 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 10 May 2023 17:27:44 +0100 Subject: [PATCH 017/161] fix: remove invalid file length check - NBT is stored at the end of the clipboard file - Fixes #2209 --- .../clipboard/DiskOptimizedClipboard.java | 27 ------------------- 1 file changed, 27 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java index 100e3265f..b54c075fc 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java @@ -173,7 +173,6 @@ public class DiskOptimizedClipboard extends LinearClipboard { nbtMap = new HashMap<>(); try { this.file = file; - checkFileLength(file); this.braf = new RandomAccessFile(file, "rw"); braf.setLength(file.length()); this.nbtBytesRemaining = Integer.MAX_VALUE - (int) file.length(); @@ -202,32 +201,6 @@ public class DiskOptimizedClipboard extends LinearClipboard { } } - private void checkFileLength(File file) throws IOException { - long expectedFileSize = headerSize + ((long) getVolume() << 1); - if (file.length() > Integer.MAX_VALUE) { - if (expectedFileSize >= Integer.MAX_VALUE) { - throw new IOException(String.format( - "Cannot load clipboard of file size: %d > 2147483647 bytes (2.147 GiB), " + "volume: %d blocks", - file.length(), - getVolume() - )); - } else { - throw new IOException(String.format( - "Cannot load clipboard of file size > 2147483647 bytes (2.147 GiB). Possible corrupt file? Mismatch" + - " between volume `%d` and file length `%d`!", - file.length(), - getVolume() - )); - } - } else if (expectedFileSize != file.length()) { - throw new IOException(String.format( - "Possible corrupt clipboard file? Mismatch between expected file size `%d` and actual file size `%d`!", - expectedFileSize, - file.length() - )); - } - } - /** * Attempt to load a file into a new {@link DiskOptimizedClipboard} instance. Will attempt to recover on version mismatch * failure. From c57fee5b86aecc8dc7904b6777f24bb6507ed419 Mon Sep 17 00:00:00 2001 From: Phillipp Glanz Date: Fri, 12 May 2023 13:12:08 +0200 Subject: [PATCH 018/161] Fixes command context for bukkit console command sender (#2193) --- .../java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java | 6 +++++- .../worldedit/command/util/annotation/ConfirmHandler.java | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index 876517dd6..f1edf65f7 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -112,11 +112,15 @@ public class WorldEditPlugin extends JavaPlugin { private BukkitServerInterface platform; private BukkitConfiguration config; private BukkitPermissionAttachmentManager permissionAttachmentManager; + // Fawe start + private BukkitCommandSender bukkitConsoleCommandSender; + // Fawe end @Override public void onLoad() { //FAWE start + this.bukkitConsoleCommandSender = new BukkitCommandSender(this, Bukkit.getConsoleSender()); // This is already covered by Spigot, however, a more pesky warning with a proper explanation over "Ambiguous plugin name..." can't hurt. Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins(); for (Plugin p : plugins) { @@ -594,7 +598,7 @@ public class WorldEditPlugin extends JavaPlugin { return new BukkitBlockCommandSender(this, (BlockCommandSender) sender); } - return new BukkitCommandSender(this, sender); + return bukkitConsoleCommandSender; } public BukkitServerInterface getInternalPlatform() { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/ConfirmHandler.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/ConfirmHandler.java index 5bf1ccc6c..067f9cfeb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/ConfirmHandler.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/util/annotation/ConfirmHandler.java @@ -24,7 +24,7 @@ public class ConfirmHandler implements CommandCallListener { } Optional actorOpt = parameters.injectedValue(Key.of(Actor.class)); - if (!actorOpt.isPresent()) { + if (actorOpt.isEmpty()) { return; } Actor actor = actorOpt.get(); From 71bac009db7d470aeb2dcd37b3a4a856955d0958 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Fri, 12 May 2023 23:13:35 +0200 Subject: [PATCH 019/161] Properly scale the random in SimpleRandomCollection (#2220) --- .../core/util/collection/SimpleRandomCollection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/SimpleRandomCollection.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/SimpleRandomCollection.java index d67227abe..dc2107559 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/SimpleRandomCollection.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/collection/SimpleRandomCollection.java @@ -36,7 +36,7 @@ public class SimpleRandomCollection extends RandomCollection { @Override public E next(int x, int y, int z) { - return map.ceilingEntry(getRandom().nextDouble(x, y, z)).getValue(); + return map.ceilingEntry(getRandom().nextDouble(x, y, z) * this.total).getValue(); } } From 319cb636e5721337ebfc8f84529cb15ab1a9c16f Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Fri, 12 May 2023 14:46:38 -0700 Subject: [PATCH 020/161] Simplify Java location in Jenkinsfile (#2221) --- Jenkinsfile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ec2813783..8c6ece0eb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,14 +4,13 @@ pipeline { disableConcurrentBuilds() } stages { - stage('Set JDK 17') { - steps { - tool name: 'Temurin-17.0.6+10', type: 'jdk' - } - } stage('Build') { steps { - sh './gradlew clean build' + withEnv([ + "PATH+JAVA=${tool 'Temurin-17.0.6+10'}/bin" + ]) { + sh './gradlew clean build' + } } } stage('Archive artifacts') { From a14035d430c32d49be99b11748034ecdad13f91b Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Tue, 16 May 2023 10:32:03 +0200 Subject: [PATCH 021/161] Revert "Actually delegate in AbstractDelegateExtent" (#2229) --- .../extent/AbstractDelegateExtent.java | 296 +----------------- .../fastasyncworldedit/ArchitecturalTest.java | 30 -- 2 files changed, 4 insertions(+), 322 deletions(-) delete mode 100644 worldedit-core/src/test/java/com/fastasyncworldedit/ArchitecturalTest.java diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java index 06b10b62b..9dfd373ea 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java @@ -23,43 +23,29 @@ import com.fastasyncworldedit.core.FaweCache; import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.extent.HistoryExtent; import com.fastasyncworldedit.core.extent.NullExtent; -import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; -import com.fastasyncworldedit.core.function.generator.GenBase; -import com.fastasyncworldedit.core.function.generator.Resource; import com.fastasyncworldedit.core.history.changeset.AbstractChangeSet; import com.fastasyncworldedit.core.internal.exception.FaweException; -import com.fastasyncworldedit.core.math.MutableBlockVector3; -import com.fastasyncworldedit.core.queue.Filter; import com.fastasyncworldedit.core.queue.IBatchProcessor; import com.fastasyncworldedit.core.util.ExtentTraverser; import com.sk89q.jnbt.CompoundTag; -import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.extent.buffer.ForgetfulExtentBuffer; -import com.sk89q.worldedit.extent.clipboard.Clipboard; -import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.OperationQueue; -import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.internal.util.LogManagerCompat; -import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.session.ClipboardHolder; -import com.sk89q.worldedit.util.Countable; import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; -import com.sk89q.worldedit.world.block.BlockType; import org.apache.logging.log4j.Logger; import javax.annotation.Nullable; import java.util.List; -import java.util.Set; import java.util.UUID; import static com.google.common.base.Preconditions.checkNotNull; @@ -67,7 +53,9 @@ import static com.google.common.base.Preconditions.checkNotNull; /** * A base class for {@link Extent}s that merely passes extents onto another. */ -public abstract class AbstractDelegateExtent implements Extent { +//FAWE start - made none abstract +public class AbstractDelegateExtent implements Extent { +//FAWE end private static final Logger LOGGER = LogManagerCompat.getLogger(); @@ -80,7 +68,7 @@ public abstract class AbstractDelegateExtent implements Extent { * * @param extent the extent */ - protected AbstractDelegateExtent(Extent extent) { + public AbstractDelegateExtent(Extent extent) { checkNotNull(extent); this.extent = extent; } @@ -127,12 +115,6 @@ public abstract class AbstractDelegateExtent implements Extent { //FAWE end } - @SuppressWarnings("deprecation") - @Override - public BiomeType getBiome(final BlockVector2 position) { - return extent.getBiome(position); - } - @Override public BlockVector3 getMinimumPoint() { return extent.getMinimumPoint(); @@ -243,220 +225,11 @@ public abstract class AbstractDelegateExtent implements Extent { } } - @Override - public boolean isWorld() { - return extent.isWorld(); - } - - @Override - public boolean regenerateChunk( - final int x, - final int z, - @Nullable final BiomeType type, - @Nullable final Long seed - ) { - return extent.regenerateChunk(x, z, type, seed); - } - - @Override - public int getHighestTerrainBlock(final int x, final int z, final int minY, final int maxY) { - return extent.getHighestTerrainBlock(x, z, minY, maxY); - } - - @Override - public int getHighestTerrainBlock(final int x, final int z, final int minY, final int maxY, final Mask filter) { - return extent.getHighestTerrainBlock(x, z, minY, maxY, filter); - } - - @Override - public int getNearestSurfaceLayer(final int x, final int z, final int y, final int minY, final int maxY) { - return extent.getNearestSurfaceLayer(x, z, y, minY, maxY); - } - - @Override - public int getNearestSurfaceTerrainBlock( - final int x, - final int z, - final int y, - final int minY, - final int maxY, - final int failedMin, - final int failedMax, - final Mask mask - ) { - return extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, mask); - } - - @Override - public int getNearestSurfaceTerrainBlock( - final int x, - final int z, - final int y, - final int minY, - final int maxY, - final boolean ignoreAir - ) { - return extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, ignoreAir); - } - - @Override - public int getNearestSurfaceTerrainBlock(final int x, final int z, final int y, final int minY, final int maxY) { - return extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY); - } - - @Override - public int getNearestSurfaceTerrainBlock( - final int x, - final int z, - final int y, - final int minY, - final int maxY, - final int failedMin, - final int failedMax - ) { - return extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax); - } - - @Override - public int getNearestSurfaceTerrainBlock( - final int x, - final int z, - final int y, - final int minY, - final int maxY, - final int failedMin, - final int failedMax, - final boolean ignoreAir - ) { - return extent.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, ignoreAir); - } - - @Override - public void addCaves(final Region region) throws WorldEditException { - extent.addCaves(region); - } - - @Override - public void generate(final Region region, final GenBase gen) throws WorldEditException { - extent.generate(region, gen); - } - - @Override - public void addSchems( - final Region region, - final Mask mask, - final List clipboards, - final int rarity, - final boolean rotate - ) throws WorldEditException { - extent.addSchems(region, mask, clipboards, rarity, rotate); - } - - @Override - public void spawnResource(final Region region, final Resource gen, final int rarity, final int frequency) throws - WorldEditException { - extent.spawnResource(region, gen, rarity, frequency); - } - - @Override - public boolean contains(final BlockVector3 pt) { - return extent.contains(pt); - } - - @Override - public boolean contains(final int x, final int y, final int z) { - return extent.contains(x, y, z); - } - - @Override - public void addOre( - final Region region, - final Mask mask, - final Pattern material, - final int size, - final int frequency, - final int rarity, - final int minY, - final int maxY - ) throws WorldEditException { - extent.addOre(region, mask, material, size, frequency, rarity, minY, maxY); - } - - @Override - public void addOres(final Region region, final Mask mask) throws WorldEditException { - extent.addOres(region, mask); - } - - @Override - public List> getBlockDistribution(final Region region) { - return extent.getBlockDistribution(region); - } - - @Override - public List> getBlockDistributionWithData(final Region region) { - return extent.getBlockDistributionWithData(region); - } - @Override public int getMaxY() { return extent.getMaxY(); } - @Override - public Clipboard lazyCopy(final Region region) { - return extent.lazyCopy(region); - } - - @Override - public int countBlocks(final Region region, final Set searchBlocks) { - return extent.countBlocks(region, searchBlocks); - } - - @Override - public int countBlocks(final Region region, final Mask searchMask) { - return extent.countBlocks(region, searchMask); - } - - @Override - public > int setBlocks(final Region region, final B block) throws MaxChangedBlocksException { - return extent.setBlocks(region, block); - } - - @Override - public int setBlocks(final Region region, final Pattern pattern) throws MaxChangedBlocksException { - return extent.setBlocks(region, pattern); - } - - @Override - public > int replaceBlocks( - final Region region, - final Set filter, - final B replacement - ) throws MaxChangedBlocksException { - return extent.replaceBlocks(region, filter, replacement); - } - - @Override - public int replaceBlocks(final Region region, final Set filter, final Pattern pattern) throws - MaxChangedBlocksException { - return extent.replaceBlocks(region, filter, pattern); - } - - @Override - public int replaceBlocks(final Region region, final Mask mask, final Pattern pattern) throws MaxChangedBlocksException { - return extent.replaceBlocks(region, mask, pattern); - } - - @Override - public int center(final Region region, final Pattern pattern) throws MaxChangedBlocksException { - return extent.center(region, pattern); - } - - @Override - public int setBlocks(final Set vset, final Pattern pattern) { - return extent.setBlocks(vset, pattern); - } - @Override public int getMinY() { return extent.getMinY(); @@ -522,16 +295,6 @@ public abstract class AbstractDelegateExtent implements Extent { return this; } - @Override - public T apply(final Region region, final T filter, final boolean full) { - return extent.apply(region, filter, full); - } - - @Override - public T apply(final Iterable positions, final T filter) { - return extent.apply(positions, filter); - } - protected Operation commitBefore() { return null; } @@ -545,11 +308,6 @@ public abstract class AbstractDelegateExtent implements Extent { public BiomeType getBiome(BlockVector3 position) { return extent.getBiome(position); } - - @Override - public int getEmittedLight(final BlockVector3 position) { - return extent.getEmittedLight(position); - } /* History */ @@ -559,41 +317,16 @@ public abstract class AbstractDelegateExtent implements Extent { return extent.getEmittedLight(x, y, z); } - @Override - public int getSkyLight(final MutableBlockVector3 position) { - return extent.getSkyLight(position); - } - @Override public int getSkyLight(int x, int y, int z) { return extent.getSkyLight(x, y, z); } - @Override - public int getBrightness(final MutableBlockVector3 position) { - return extent.getBrightness(position); - } - @Override public int getBrightness(int x, int y, int z) { return extent.getBrightness(x, y, z); } - @Override - public int getOpacity(final MutableBlockVector3 position) { - return extent.getOpacity(position); - } - - @Override - public int getOpacity(final int x, final int y, final int z) { - return extent.getOpacity(x, y, z); - } - - @Override - public int[] getHeightMap(final HeightMapType type) { - return extent.getHeightMap(type); - } - public void setChangeSet(AbstractChangeSet changeSet) { if (extent instanceof HistoryExtent) { HistoryExtent history = ((HistoryExtent) extent); @@ -633,12 +366,6 @@ public abstract class AbstractDelegateExtent implements Extent { return extent.fullySupports3DBiomes(); } - @SuppressWarnings("deprecation") - @Override - public boolean setBiome(final BlockVector2 position, final BiomeType biome) { - return extent.setBiome(position, biome); - } - @Override public boolean setBiome(int x, int y, int z, BiomeType biome) { return extent.setBiome(x, y, z, biome); @@ -649,31 +376,16 @@ public abstract class AbstractDelegateExtent implements Extent { return extent.setBiome(position.getX(), position.getY(), position.getZ(), biome); } - @Override - public void setBlockLight(final BlockVector3 position, final int value) { - extent.setBlockLight(position, value); - } - @Override public void setBlockLight(int x, int y, int z, int value) { extent.setSkyLight(x, y, z, value); } - @Override - public void setSkyLight(final BlockVector3 position, final int value) { - extent.setSkyLight(position, value); - } - @Override public void setSkyLight(int x, int y, int z, int value) { extent.setSkyLight(x, y, z, value); } - @Override - public void setHeightMap(final HeightMapType type, final int[] heightMap) { - extent.setHeightMap(type, heightMap); - } - @Override public String toString() { return super.toString() + ":" + (extent == this ? "" : extent.toString()); diff --git a/worldedit-core/src/test/java/com/fastasyncworldedit/ArchitecturalTest.java b/worldedit-core/src/test/java/com/fastasyncworldedit/ArchitecturalTest.java deleted file mode 100644 index 1db8f6526..000000000 --- a/worldedit-core/src/test/java/com/fastasyncworldedit/ArchitecturalTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.fastasyncworldedit; - -import com.sk89q.worldedit.extent.AbstractDelegateExtent; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.Arguments; -import org.junit.jupiter.params.provider.MethodSource; - -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.stream.Stream; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -class ArchitecturalTest { - - public static Stream abstractDelegateExtentMethods() { - return Arrays.stream(AbstractDelegateExtent.class.getMethods()) - .filter(m -> m.getDeclaringClass() != Object.class) // ignore methods inherited from java.lang.Object - // TODO: figure out why enableHistory returns STQE instead of PQE when overriding - .filter(m -> !m.getName().equals("enableHistory")) - .map(Arguments::of); - } - - @ParameterizedTest - @MethodSource("abstractDelegateExtentMethods") - void testAbstractDelegateExtentOverridesAllMethods(Method method) { - assertEquals(AbstractDelegateExtent.class, method.getDeclaringClass()); - } - -} From 52723439dd76741e6a0e7a301f0420760615475d Mon Sep 17 00:00:00 2001 From: Marco Neuhaus Date: Sat, 20 May 2023 11:57:13 +0200 Subject: [PATCH 022/161] Fix reading of tile entities with "id" instead of "Id" tag (#2211) --- .../worldedit/extent/clipboard/io/SpongeSchematicReader.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java index 9ad799b4c..464ef3e4f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java @@ -266,8 +266,8 @@ public class SpongeSchematicReader extends NBTSchematicReader { if (id == null) { continue; } + values.put("id", id); //FAWE end - values.put("id", values.get("Id")); values.remove("Id"); values.remove("Pos"); if (fixer != null) { From 2a08ad28a43a3e179c2b78178b27918ffd3c96a3 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sat, 20 May 2023 15:21:11 +0100 Subject: [PATCH 023/161] fix: correct issues with processor scopes (#2230) --- .../core/extent/DisallowedBlocksExtent.java | 6 +++--- .../fastasyncworldedit/core/extent/FaweRegionExtent.java | 2 +- .../core/extent/processor/MultiBatchProcessor.java | 2 +- .../core/extent/processor/ProcessorScope.java | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/DisallowedBlocksExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/DisallowedBlocksExtent.java index db270fa16..f1c523ce3 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/DisallowedBlocksExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/DisallowedBlocksExtent.java @@ -141,7 +141,7 @@ public class DisallowedBlocksExtent extends AbstractDelegateExtent implements IB BlockState state = BlockTypesCache.states[block]; if (blockedBlocks != null) { if (blockedBlocks.contains(state.getBlockType().getId())) { - blocks[i] = 0; + blocks[i] = BlockTypesCache.ReservedIDs.__RESERVED__; continue; } } @@ -150,7 +150,7 @@ public class DisallowedBlocksExtent extends AbstractDelegateExtent implements IB } for (FuzzyBlockState fuzzy : blockedStates) { if (fuzzy.equalsFuzzy(state)) { - blocks[i] = 0; + blocks[i] = BlockTypesCache.ReservedIDs.__RESERVED__; continue it; } } @@ -178,7 +178,7 @@ public class DisallowedBlocksExtent extends AbstractDelegateExtent implements IB @Override public ProcessorScope getScope() { - return ProcessorScope.CHANGING_BLOCKS; + return ProcessorScope.REMOVING_BLOCKS; } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/FaweRegionExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/FaweRegionExtent.java index 6fa2767e0..84044f9b2 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/FaweRegionExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/FaweRegionExtent.java @@ -168,7 +168,7 @@ public abstract class FaweRegionExtent extends ResettableExtent implements IBatc @Override public ProcessorScope getScope() { - return ProcessorScope.READING_SET_BLOCKS; + return ProcessorScope.REMOVING_BLOCKS; } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/MultiBatchProcessor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/MultiBatchProcessor.java index 85fe20986..e57ccb490 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/MultiBatchProcessor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/MultiBatchProcessor.java @@ -257,7 +257,7 @@ public class MultiBatchProcessor implements IBatchProcessor { for (IBatchProcessor processor : processors) { scope = Math.max(scope, processor.getScope().intValue()); } - return ProcessorScope.valueOf(0); + return ProcessorScope.valueOf(scope); } /** diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/ProcessorScope.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/ProcessorScope.java index 7fdd3e67a..e3f09e0a3 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/ProcessorScope.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/ProcessorScope.java @@ -3,9 +3,9 @@ package com.fastasyncworldedit.core.extent.processor; /** * The scope of a processor. * Order in which processors are executed: - * - ADDING_BLOCKS (processors that strictly ADD blocks to an edit ONLY) - * - CHANGING_BLOCKS (processors that strictly ADD or CHANGE blocks being set) - * - REMOVING_BLOCKS (processors that string ADD, CHANGE or REMOVE blocks being set) + * - ADDING_BLOCKS (processors that may ADD blocks to an edit ONLY) + * - CHANGING_BLOCKS (processors that may ADD or CHANGE blocks being set) + * - REMOVING_BLOCKS (processors that may ADD, CHANGE or REMOVE blocks being set) * - CUSTOM (processors that do not specify a SCOPE) * - READING_SET_BLOCKS (processors that do not alter blocks at all, and read the blocks that are actually going to set, e.g. history processors) */ From e9b781d1273c6de119df87a9d33775df8e4086d5 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sat, 20 May 2023 15:22:02 +0100 Subject: [PATCH 024/161] fix: correctly in initialise unlimited limit (#2231) --- .../java/com/fastasyncworldedit/core/limit/FaweLimit.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/limit/FaweLimit.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/limit/FaweLimit.java index c899c668d..01d18db31 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/limit/FaweLimit.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/limit/FaweLimit.java @@ -2,6 +2,7 @@ package com.fastasyncworldedit.core.limit; import com.fastasyncworldedit.core.FaweCache; +import java.util.Collections; import java.util.Set; public class FaweLimit { @@ -114,10 +115,10 @@ public class FaweLimit { MAX.FAST_PLACEMENT = true; MAX.CONFIRM_LARGE = true; MAX.RESTRICT_HISTORY_TO_REGIONS = false; - MAX.STRIP_NBT = null; + MAX.STRIP_NBT = Collections.emptySet(); MAX.UNIVERSAL_DISALLOWED_BLOCKS = false; - MAX.DISALLOWED_BLOCKS = null; - MAX.REMAP_PROPERTIES = null; + MAX.DISALLOWED_BLOCKS = Collections.emptySet(); + MAX.REMAP_PROPERTIES = Collections.emptySet(); } public boolean MAX_CHANGES() { From 3a13c4aaa7155acf54cc57a1b0ad724670b3dc92 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sat, 20 May 2023 15:25:24 +0100 Subject: [PATCH 025/161] chore: remove firework-chunk-loading prevention and default tick limiter to false (#2234) - It's very resource-intensive and probably doesn't work anyway - Tick limiter should not be enabled by default, it confuses a lot of people with the console logs --- .../bukkit/listener/ChunkListener.java | 42 ------------------- .../core/configuration/Settings.java | 8 +--- 2 files changed, 1 insertion(+), 49 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/listener/ChunkListener.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/listener/ChunkListener.java index 5d2e35335..7b9599084 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/listener/ChunkListener.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/listener/ChunkListener.java @@ -371,48 +371,6 @@ public abstract class ChunkListener implements Listener { } } - /** - * Prevent firework from loading chunks. - */ - @EventHandler(priority = EventPriority.LOWEST) - public void onChunkLoad(ChunkLoadEvent event) { - if (!Settings.settings().TICK_LIMITER.FIREWORKS_LOAD_CHUNKS) { - Chunk chunk = event.getChunk(); - Entity[] entities = chunk.getEntities(); - World world = chunk.getWorld(); - - Exception e = new Exception(); - int start = 14; - int end = 22; - int depth = Math.min(end, getDepth(e)); - - for (int frame = start; frame < depth; frame++) { - StackTraceElement elem = getElement(e, frame); - if (elem == null) { - return; - } - String className = elem.getClassName(); - int len = className.length(); - if (len > 15 && className.charAt(len - 15) == 'E' && className - .endsWith("EntityFireworks")) { - for (Entity ent : world.getEntities()) { - if (ent.getType() == EntityType.FIREWORK) { - Vector velocity = ent.getVelocity(); - double vertical = Math.abs(velocity.getY()); - if (Math.abs(velocity.getX()) > vertical - || Math.abs(velocity.getZ()) > vertical) { - LOGGER.warn( - "[FAWE `tick-limiter`] Detected and cancelled rogue FireWork at {}", - ent.getLocation()); - ent.remove(); - } - } - } - } - } - } - } - @EventHandler(priority = EventPriority.LOWEST) public void onItemSpawn(ItemSpawnEvent event) { if (physicsFreeze) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java index 502e9dbf3..44e211461 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java @@ -695,7 +695,7 @@ public class Settings extends Config { public static class TICK_LIMITER { @Comment("Enable the limiter") - public boolean ENABLED = true; + public boolean ENABLED = false; @Comment("The interval in ticks") public int INTERVAL = 20; @Comment("Max falling blocks per interval (per chunk)") @@ -704,12 +704,6 @@ public class Settings extends Config { public int PHYSICS_MS = 10; @Comment("Max item spawns per interval (per chunk)") public int ITEMS = 256; - @Comment({ - "Whether fireworks can load chunks", - " - Fireworks usually travel vertically so do not load any chunks", - " - Horizontal fireworks can be hacked in to crash a server" - }) - public boolean FIREWORKS_LOAD_CHUNKS = false; } From 1b0fb9ed482a5e72f1248b57d35861c4c48232a5 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sat, 20 May 2023 19:32:38 +0100 Subject: [PATCH 026/161] fix: more intuitive limit permissions (#2233) - immediately return limit if unlimited (limit combination take the "higher" value) - add fawe.limit.unlimited permission and it's an intuitive permission to give --- .../fastasyncworldedit/core/configuration/Settings.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java index 44e211461..50b515257 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java @@ -102,11 +102,10 @@ public class Settings extends Config { public FaweLimit getLimit(Actor actor) { FaweLimit limit; - if (actor.hasPermission("fawe.limit.*") || actor.hasPermission("fawe.bypass")) { - limit = FaweLimit.MAX.copy(); - } else { - limit = new FaweLimit(); + if (actor.hasPermission("fawe.bypass") || actor.hasPermission("fawe.limit.unlimited")) { + return FaweLimit.MAX.copy(); } + limit = new FaweLimit(); ArrayList keys = new ArrayList<>(LIMITS.getSections()); if (keys.remove("default")) { keys.add("default"); From 85f5006a0b9efb2034c3df5d44a129bb81fda857 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sat, 20 May 2023 19:33:18 +0100 Subject: [PATCH 027/161] fix: correctly handle creation of extents in EditSessionBuilder (#2232) - Add regionExtent process to the queue (fixes #2227) - Correctly wrap extents in each other --- .../sk89q/worldedit/EditSessionBuilder.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java index c235ca784..012bac992 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java @@ -531,16 +531,14 @@ public final class EditSessionBuilder { } if (allowedRegions == null && Settings.settings().REGION_RESTRICTIONS) { if (actor != null && !actor.hasPermission("fawe.bypass.regions")) { - if (actor instanceof Player) { - Player player = (Player) actor; + if (actor instanceof Player player) { allowedRegions = player.getAllowedRegions(); } } } if (disallowedRegions == null && Settings.settings().REGION_RESTRICTIONS && Settings.settings().REGION_RESTRICTIONS_OPTIONS.ALLOW_BLACKLISTS) { if (actor != null && !actor.hasPermission("fawe.bypass.regions")) { - if (actor instanceof Player) { - Player player = (Player) actor; + if (actor instanceof Player player) { disallowedRegions = player.getDisallowedRegions(); } } @@ -561,6 +559,9 @@ public final class EditSessionBuilder { } } } + if (placeChunks && regionExtent != null) { + queue.addProcessor(regionExtent); + } // There's no need to do the below (and it'll also just be a pain to implement) if we're not placing chunks if (placeChunks) { if (((relightMode != null && relightMode != RelightMode.NONE) || (relightMode == null && Settings.settings().LIGHTING.MODE > 0))) { @@ -597,10 +598,9 @@ public final class EditSessionBuilder { this.extent = regionExtent; } if (this.limit != null && this.limit.STRIP_NBT != null && !this.limit.STRIP_NBT.isEmpty()) { + this.extent = new StripNBTExtent(this.extent, this.limit.STRIP_NBT); if (placeChunks) { - queue.addProcessor(new StripNBTExtent(this.extent, this.limit.STRIP_NBT)); - } else { - this.extent = new StripNBTExtent(this.extent, this.limit.STRIP_NBT); + queue.addProcessor((IBatchProcessor) this.extent); } } if (this.limit != null && !this.limit.isUnlimited()) { @@ -613,10 +613,9 @@ public final class EditSessionBuilder { } Set> remaps = this.limit.REMAP_PROPERTIES; if (!limitBlocks.isEmpty() || (remaps != null && !remaps.isEmpty())) { + this.extent = new DisallowedBlocksExtent(this.extent, limitBlocks, remaps); if (placeChunks) { - queue.addProcessor(new DisallowedBlocksExtent(this.extent, limitBlocks, remaps)); - } else { - this.extent = new DisallowedBlocksExtent(this.extent, limitBlocks, remaps); + queue.addProcessor((IBatchProcessor) this.extent); } } } From 264185a323d40c8ee5944977486f1bace20e1e33 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sat, 20 May 2023 20:52:03 +0200 Subject: [PATCH 028/161] Add method to check initialize state in PlatformManager, deny access to registries when uninitialized --- .../extension/platform/PlatformManager.java | 14 ++++++++++++++ .../worldedit/registry/NamespacedRegistry.java | 10 +++++++++- .../com/sk89q/worldedit/registry/Registry.java | 13 +++++++++++++ .../com/sk89q/worldedit/world/biome/BiomeType.java | 2 +- .../sk89q/worldedit/world/block/BlockCategory.java | 2 +- .../com/sk89q/worldedit/world/block/BlockType.java | 2 +- .../sk89q/worldedit/world/entity/EntityType.java | 2 +- .../com/sk89q/worldedit/world/item/ItemType.java | 2 +- .../internal/expression/BaseExpressionTest.java | 2 ++ .../worldedit/util/collection/BlockMapTest.java | 7 +++++++ 10 files changed, 50 insertions(+), 6 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java index 406964c24..9f798e21c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/PlatformManager.java @@ -321,10 +321,24 @@ public class PlatformManager { return queryCapability(Capability.CONFIGURATION).getConfiguration(); } + /** + * Get the current supported {@link SideEffect}s. + * + * @return the supported side effects + * @throws NoCapablePlatformException thrown if no platform is capable + */ public Collection getSupportedSideEffects() { return queryCapability(Capability.WORLD_EDITING).getSupportedSideEffects(); } + /** + * Get the initialized state of the Platform. + * {@return if the platform manager is initialized} + */ + public boolean isInitialized() { + return initialized.get(); + } + /** * You shouldn't have been calling this anyways, but this is now deprecated. Either don't * fire this event at all, or fire the new event via the event bus if you're a platform. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/NamespacedRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/NamespacedRegistry.java index 5fca65799..e6715907c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/NamespacedRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/NamespacedRegistry.java @@ -47,8 +47,16 @@ public final class NamespacedRegistry extends Registry { this(name, MINECRAFT_NAMESPACE); } + public NamespacedRegistry(final String name, final boolean checkInitialized) { + this(name, MINECRAFT_NAMESPACE, checkInitialized); + } + public NamespacedRegistry(final String name, final String defaultNamespace) { - super(name); + this(name, defaultNamespace, false); + } + + public NamespacedRegistry(final String name, final String defaultNamespace, final boolean checkInitialized) { + super(name, checkInitialized); this.defaultNamespace = defaultNamespace; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/Registry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/Registry.java index 2bb20010a..b29af49e8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/registry/Registry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/registry/Registry.java @@ -19,6 +19,8 @@ package com.sk89q.worldedit.registry; +import com.sk89q.worldedit.WorldEdit; + import javax.annotation.Nullable; import java.util.Collection; import java.util.Collections; @@ -35,9 +37,15 @@ public class Registry implements Iterable { private final Map map = new HashMap<>(); private final String name; + private final boolean checkInitialized; public Registry(final String name) { + this(name, false); + } + + public Registry(final String name, final boolean checkInitialized) { this.name = name; + this.checkInitialized = checkInitialized; } public String getName() { @@ -53,6 +61,11 @@ public class Registry implements Iterable { @Nullable public V get(final String key) { checkState(key.equals(key.toLowerCase(Locale.ROOT)), "key must be lowercase: %s", key); + if (this.checkInitialized) { + checkState( + WorldEdit.getInstance().getPlatformManager().isInitialized(), + "WorldEdit is not initialized yet."); + } return this.map.get(key); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeType.java index ab503e1fb..e8501da69 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeType.java @@ -32,7 +32,7 @@ import com.sk89q.worldedit.registry.NamespacedRegistry; public class BiomeType implements RegistryItem, Keyed, BiomePattern { //FAWE end - public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("biome type"); + public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("biome type", true); private final String id; private int legacyId = -1; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategory.java index 3ed6f7a3f..29d8ee53b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategory.java @@ -36,7 +36,7 @@ public class BlockCategory extends Category implements Keyed { //FAWE start private boolean[] flatMap; //FAWE end - public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("block tag"); + public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("block tag", true); public BlockCategory(final String id) { super(id); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java index 043a89bf5..01a5d5c8a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java @@ -56,7 +56,7 @@ import static com.google.common.base.Preconditions.checkArgument; public class BlockType implements Keyed, Pattern { //FAWE end - public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("block type"); + public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("block type", true); private static final Logger LOGGER = LogManagerCompat.getLogger(); private final String id; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityType.java index 98a70b7e5..5a530c8a6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityType.java @@ -27,7 +27,7 @@ import com.sk89q.worldedit.registry.NamespacedRegistry; public class EntityType implements RegistryItem, Keyed { //FAWE end - public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("entity type"); + public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("entity type", true); private final String id; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java index 97549320d..ecba92f8b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java @@ -39,7 +39,7 @@ import javax.annotation.Nullable; public class ItemType implements RegistryItem, Keyed { //FAWE end - public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("item type"); + public static final NamespacedRegistry REGISTRY = new NamespacedRegistry<>("item type", true); private final String id; @SuppressWarnings("deprecation") diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/BaseExpressionTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/BaseExpressionTest.java index 0fbf9556a..3491347a4 100644 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/BaseExpressionTest.java +++ b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/BaseExpressionTest.java @@ -35,6 +35,7 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; @@ -63,6 +64,7 @@ class BaseExpressionTest { }); WorldEdit.getInstance().getPlatformManager().register(mockPlat); WorldEdit.getInstance().getEventBus().post(new PlatformsRegisteredEvent()); + assertTrue(WorldEdit.getInstance().getPlatformManager().isInitialized(), "Platform is not initialized"); WorldEdit.getInstance().getConfiguration().calculationTimeout = 1_000; } diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/util/collection/BlockMapTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/util/collection/BlockMapTest.java index 1bb09ee17..595993919 100644 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/util/collection/BlockMapTest.java +++ b/worldedit-core/src/test/java/com/sk89q/worldedit/util/collection/BlockMapTest.java @@ -87,10 +87,17 @@ class BlockMapTest { Stream.of(Capability.values()) .collect(Collectors.toMap(Function.identity(), __ -> Preference.NORMAL)) ); + when(MOCKED_PLATFORM.getConfiguration()).thenReturn(new LocalConfiguration() { + @Override + public void load() { + } + }); PlatformManager platformManager = WorldEdit.getInstance().getPlatformManager(); platformManager.register(MOCKED_PLATFORM); WorldEdit.getInstance().getEventBus().post(new PlatformsRegisteredEvent()); + assertTrue(WorldEdit.getInstance().getPlatformManager().isInitialized(), "Platform is not initialized"); + registerBlock("minecraft:air"); registerBlock("minecraft:oak_wood"); } From 85214c944f83028d7c3ab6becdc4981ef0fb1194 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sat, 20 May 2023 20:54:52 +0200 Subject: [PATCH 029/161] Keep extending cuboid selector after //paste -s/n --- .../com/sk89q/worldedit/command/ClipboardCommands.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java index 0cb9f6798..2e7b53440 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java @@ -74,6 +74,7 @@ import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.regions.RegionIntersection; import com.sk89q.worldedit.regions.RegionSelector; import com.sk89q.worldedit.regions.selector.CuboidRegionSelector; +import com.sk89q.worldedit.regions.selector.ExtendingCuboidRegionSelector; import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TextComponent; @@ -546,7 +547,12 @@ public class ClipboardCommands { Vector3 max = realTo.add(holder .getTransform() .apply(region.getMaximumPoint().subtract(region.getMinimumPoint()).toVector3())); - RegionSelector selector = new CuboidRegionSelector(world, realTo.toBlockPoint(), max.toBlockPoint()); + final CuboidRegionSelector selector; + if (session.getRegionSelector(world) instanceof ExtendingCuboidRegionSelector) { + selector = new ExtendingCuboidRegionSelector(world, realTo.toBlockPoint(), max.toBlockPoint()); + } else { + selector = new CuboidRegionSelector(world, realTo.toBlockPoint(), max.toBlockPoint()); + } session.setRegionSelector(world, selector); selector.learnChanges(); selector.explainRegionAdjust(actor, session); From 3cac28ea8415bd6b9cb00de4b73fcc2a5fd728cf Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sat, 20 May 2023 20:56:37 +0200 Subject: [PATCH 030/161] Keep extending cuboid selector after //cli selectworld --- .../java/com/sk89q/worldedit/cli/CLIExtraCommands.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/worldedit-cli/src/main/java/com/sk89q/worldedit/cli/CLIExtraCommands.java b/worldedit-cli/src/main/java/com/sk89q/worldedit/cli/CLIExtraCommands.java index 9f6389463..27cc08821 100644 --- a/worldedit-cli/src/main/java/com/sk89q/worldedit/cli/CLIExtraCommands.java +++ b/worldedit-cli/src/main/java/com/sk89q/worldedit/cli/CLIExtraCommands.java @@ -23,6 +23,7 @@ import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.regions.selector.CuboidRegionSelector; +import com.sk89q.worldedit.regions.selector.ExtendingCuboidRegionSelector; import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.util.task.Task; import com.sk89q.worldedit.world.World; @@ -39,9 +40,12 @@ public class CLIExtraCommands { desc = "Select the entire world" ) public void selectWorld(Actor actor, World world, LocalSession session) { - session.setRegionSelector(world, new CuboidRegionSelector( - world, world.getMinimumPoint(), world.getMaximumPoint() - )); + final CuboidRegionSelector selector; + if (session.getRegionSelector(world) instanceof ExtendingCuboidRegionSelector) { + selector = new ExtendingCuboidRegionSelector(world, world.getMinimumPoint(), world.getMaximumPoint()); + } else { + selector = new CuboidRegionSelector(world, world.getMinimumPoint(), world.getMaximumPoint()); + } actor.printInfo(TextComponent.of("Selected the entire world.")); } From 2c7b529f67ddaae565930217e9a94330cb1dcf16 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sat, 20 May 2023 19:56:46 +0100 Subject: [PATCH 031/161] fix: create single threaded executor for use with non-concurrent generators (#2236) - Fixes #2228 --- .../com/fastasyncworldedit/bukkit/adapter/Regenerator.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/Regenerator.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/Regenerator.java index c95fbc580..7c00ebb2b 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/Regenerator.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/Regenerator.java @@ -165,7 +165,11 @@ public abstract class Regenerator Date: Sat, 20 May 2023 20:58:47 +0200 Subject: [PATCH 032/161] fix(core): Properly reinit convex CUI selection on primary click --- .../regions/selector/ConvexPolyhedralRegionSelector.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java index ced04eddf..70471ceae 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/selector/ConvexPolyhedralRegionSelector.java @@ -26,6 +26,7 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.internal.cui.CUIRegion; import com.sk89q.worldedit.internal.cui.SelectionPointEvent; import com.sk89q.worldedit.internal.cui.SelectionPolygonEvent; +import com.sk89q.worldedit.internal.cui.SelectionShapeEvent; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.ConvexPolyhedralRegion; @@ -206,6 +207,7 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion checkNotNull(session); checkNotNull(pos); + session.dispatchCUIEvent(player, new SelectionShapeEvent(getTypeID())); session.describeCUI(player); player.print(Caption.of("worldedit.selection.convex.explain.primary", TextComponent.of(pos.toString()))); @@ -226,6 +228,7 @@ public class ConvexPolyhedralRegionSelector implements RegionSelector, CUIRegion public void explainRegionAdjust(Actor player, LocalSession session) { checkNotNull(player); checkNotNull(session); + session.dispatchCUIEvent(player, new SelectionShapeEvent(getTypeID())); session.describeCUI(player); } From 5e3222c55dff0cc66c309030fa2f7fa95e18a59e Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sat, 20 May 2023 21:00:35 +0200 Subject: [PATCH 033/161] Ensure blockmap uniqueness across TE values --- .../util/collection/Int2BaseBlockMap.java | 2 +- .../util/collection/BlockMapTest.java | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/Int2BaseBlockMap.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/Int2BaseBlockMap.java index bf8e3bed5..fca089a68 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/Int2BaseBlockMap.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/collection/Int2BaseBlockMap.java @@ -170,7 +170,7 @@ class Int2BaseBlockMap extends AbstractInt2ObjectMap { return old; } int oldId = commonMap.put(key, internalId); - return assumeAsBlock(oldId); + return BlockStateIdAccess.isValidInternalId(oldId) ? assumeAsBlock(oldId) : uncommonMap.remove(key); } @Override diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/util/collection/BlockMapTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/util/collection/BlockMapTest.java index 595993919..9558ac0bb 100644 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/util/collection/BlockMapTest.java +++ b/worldedit-core/src/test/java/com/sk89q/worldedit/util/collection/BlockMapTest.java @@ -21,6 +21,8 @@ package com.sk89q.worldedit.util.collection; import com.google.common.collect.ImmutableMap; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.StringTag; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.event.platform.PlatformsRegisteredEvent; import com.sk89q.worldedit.extension.platform.Capability; @@ -100,6 +102,7 @@ class BlockMapTest { registerBlock("minecraft:air"); registerBlock("minecraft:oak_wood"); + registerBlock("minecraft:chest"); } @AfterAll @@ -123,6 +126,7 @@ class BlockMapTest { private final BaseBlock air = checkNotNull(BlockTypes.AIR).getDefaultState().toBaseBlock(); private final BaseBlock oakWood = checkNotNull(BlockTypes.OAK_WOOD).getDefaultState().toBaseBlock(); + private final BaseBlock chestWithNbt = checkNotNull(BlockTypes.CHEST).getDefaultState().toBaseBlock(new CompoundTag(ImmutableMap.of("dummy", new StringTag("value")))); private AutoCloseable mocks; @@ -748,6 +752,22 @@ class BlockMapTest { }); } + @SuppressWarnings("OverwrittenKey") + @Test + @DisplayName("put with valid and invalid keys doesn't duplicate") + void putWithInvalidAndValid() { + generator.makeVectorsStream().forEach(vec -> { + BlockMap map = BlockMap.createForBaseBlock(); + // This tests https://github.com/EngineHub/WorldEdit/issues/2250 + // Due to two internal maps, a bug existed where both could have the same value + map.put(vec, chestWithNbt); + map.put(vec, air); + + assertEquals(1, map.size()); + assertEquals(air, map.get(vec)); + }); + } + } @Test From 86f06b75271cbfce381d5e121dc80f5020c14f7c Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sat, 20 May 2023 21:01:34 +0200 Subject: [PATCH 034/161] Add -Penginehub.obf.none=true gradle property to build mojmap worldedit-bukkit. --- worldedit-bukkit/build.gradle.kts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index a6c5147ad..461d36c99 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -47,7 +47,13 @@ val adapters = configurations.create("adapters") { isCanBeResolved = true shouldResolveConsistentlyWith(configurations["runtimeClasspath"]) attributes { - attribute(Obfuscation.OBFUSCATION_ATTRIBUTE, objects.named(Obfuscation.OBFUSCATED)) + attribute(Obfuscation.OBFUSCATION_ATTRIBUTE, + if ((project.findProperty("enginehub.obf.none") as String?).toBoolean()) { + objects.named(Obfuscation.NONE) + } else { + objects.named(Obfuscation.OBFUSCATED) + } + ) } } From 4c0b535e6e177ccdfde5932e2ca5f87c141ea963 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sun, 21 May 2023 09:50:10 +0200 Subject: [PATCH 035/161] Ensure non-Double types are boxed in expression function calls. --- .../java/com/sk89q/worldedit/internal/expression/Functions.java | 1 + 1 file changed, 1 insertion(+) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Functions.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Functions.java index 369694f0b..6f3a63787 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Functions.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/expression/Functions.java @@ -75,6 +75,7 @@ public final class Functions { ); handle = handle.asType(handle.type().changeReturnType(Number.class)); handle = filterReturnValue(handle, DOUBLE_VALUE); + handle = handle.asType(handle.type().wrap()); } // return vararg-ity if (wasVarargs) { From 2bdc925b0f1d2eb60de7598f4c092610a5f0c464 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sun, 21 May 2023 09:51:59 +0200 Subject: [PATCH 036/161] Add regression tests to the round Expression function --- .../worldedit/internal/expression/ExpressionTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java index ec175bd72..a1d418f85 100644 --- a/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java +++ b/worldedit-core/src/test/java/com/sk89q/worldedit/internal/expression/ExpressionTest.java @@ -449,4 +449,14 @@ class ExpressionTest extends BaseExpressionTest { assertTrue(e.getMessage().contains("Calculations exceeded time limit")); } + @Test + public void testRound() { + checkTestCase("round(1.3)", 1); + checkTestCase("round(0.9)", 1); + checkTestCase("round(-1.1)", -1); + checkTestCase("round(-0.9)", -1); + checkTestCase("round(1.5)", 2); + checkTestCase("round(-1.5)", -1); + } + } From 74aff920a8c00618ec47a1fe0070cce5a15180b6 Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 22 May 2023 19:32:36 +0100 Subject: [PATCH 037/161] fix: fix universal disallowed blocks logic in limit and EditSession compilation (#2237) - Fixes #2184 --- .../main/java/com/fastasyncworldedit/core/limit/FaweLimit.java | 2 +- .../src/main/java/com/sk89q/worldedit/EditSessionBuilder.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/limit/FaweLimit.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/limit/FaweLimit.java index 01d18db31..00a47178c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/limit/FaweLimit.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/limit/FaweLimit.java @@ -242,7 +242,7 @@ public class FaweLimit { && FAST_PLACEMENT && !RESTRICT_HISTORY_TO_REGIONS && (STRIP_NBT == null || STRIP_NBT.isEmpty()) - && !UNIVERSAL_DISALLOWED_BLOCKS + // && !UNIVERSAL_DISALLOWED_BLOCKS --> do not include this, it effectively has no relevance && (DISALLOWED_BLOCKS == null || DISALLOWED_BLOCKS.isEmpty()) && (REMAP_PROPERTIES == null || REMAP_PROPERTIES.isEmpty()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java index 012bac992..2512af96c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java @@ -605,7 +605,7 @@ public final class EditSessionBuilder { } if (this.limit != null && !this.limit.isUnlimited()) { Set limitBlocks = new HashSet<>(); - if ((getActor() == null || getActor().hasPermission("worldedit.anyblock")) && this.limit.UNIVERSAL_DISALLOWED_BLOCKS) { + if (getActor() != null && !getActor().hasPermission("worldedit.anyblock") && this.limit.UNIVERSAL_DISALLOWED_BLOCKS) { limitBlocks.addAll(WorldEdit.getInstance().getConfiguration().disallowedBlocks); } if (this.limit.DISALLOWED_BLOCKS != null && !this.limit.DISALLOWED_BLOCKS.isEmpty()) { From 7c01c1e95e9e8b35e23ad852f8260a08a3a02e8b Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 22 May 2023 19:32:56 +0100 Subject: [PATCH 038/161] feat: allow captions in SuggestInputParseException (#2239) - Deprecate for removal methods using string message - Fixes #2026 --- .../command/SuggestInputParseException.java | 72 ++++++++++++++++--- .../factory/parser/mask/RichMaskParser.java | 4 +- .../parser/pattern/RichPatternParser.java | 4 +- .../core/function/mask/BlockMaskBuilder.java | 7 +- .../worldedit/world/block/BlockState.java | 10 +-- .../worldedit/world/block/BlockTypes.java | 4 +- 6 files changed, 76 insertions(+), 25 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/SuggestInputParseException.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/SuggestInputParseException.java index c38b38888..bd10e6d20 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/SuggestInputParseException.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/SuggestInputParseException.java @@ -1,6 +1,8 @@ package com.fastasyncworldedit.core.command; +import com.fastasyncworldedit.core.configuration.Caption; import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.util.formatting.text.Component; import java.lang.reflect.InvocationTargetException; import java.util.List; @@ -13,33 +15,81 @@ public class SuggestInputParseException extends InputParseException { private final InputParseException cause; private final Supplier> getSuggestions; - private String prefix; + /** + * @deprecated Use {@link SuggestInputParseException#SuggestInputParseException(Component, Supplier)} + */ + @Deprecated(forRemoval = true, since = "TODO") public SuggestInputParseException(String msg, String prefix, Supplier> getSuggestions) { - this(new InputParseException(msg), prefix, getSuggestions); + this(new InputParseException(msg), getSuggestions); } + /** + * @deprecated Use {@link SuggestInputParseException#of(Throwable, Supplier)} + */ + @Deprecated(forRemoval = true, since = "TODO") public static SuggestInputParseException of(Throwable other, String prefix, Supplier> getSuggestions) { if (other instanceof InputParseException) { - return of((InputParseException) other, prefix, getSuggestions); + return of((InputParseException) other, getSuggestions); } - return of(new InputParseException(other.getMessage()), prefix, getSuggestions); + return of(new InputParseException(other.getMessage()), getSuggestions); } + /** + * @deprecated Use {@link SuggestInputParseException#of(InputParseException, Supplier)} + */ + @Deprecated(forRemoval = true, since = "TODO") public static SuggestInputParseException of(InputParseException other, String prefix, Supplier> getSuggestions) { if (other instanceof SuggestInputParseException) { return (SuggestInputParseException) other; } - return new SuggestInputParseException(other, prefix, getSuggestions); + return new SuggestInputParseException(other, getSuggestions); } + /** + * @deprecated Use {@link SuggestInputParseException#SuggestInputParseException(InputParseException, Supplier)} + */ + @Deprecated(forRemoval = true, since = "TODO") public SuggestInputParseException(InputParseException other, String prefix, Supplier> getSuggestions) { - super(other.getMessage()); + super(other.getRichMessage()); + checkNotNull(getSuggestions); + checkNotNull(other); + this.cause = other; + this.getSuggestions = getSuggestions; + } + + /** + * Create a new SuggestInputParseException instance + * + * @param message Message to send + * @param getSuggestions Supplier of list of sugegstions to give to user + * @since TODO + */ + public SuggestInputParseException(Component message, Supplier> getSuggestions) { + this(new InputParseException(message), getSuggestions); + } + + public static SuggestInputParseException of(Throwable other, Supplier> getSuggestions) { + if (other instanceof InputParseException) { + return of((InputParseException) other, getSuggestions); + } + //noinspection deprecation + return of(new InputParseException(other.getMessage()), getSuggestions); + } + + public static SuggestInputParseException of(InputParseException other, Supplier> getSuggestions) { + if (other instanceof SuggestInputParseException) { + return (SuggestInputParseException) other; + } + return new SuggestInputParseException(other, getSuggestions); + } + + public SuggestInputParseException(InputParseException other, Supplier> getSuggestions) { + super(other.getRichMessage()); checkNotNull(getSuggestions); checkNotNull(other); this.cause = other; this.getSuggestions = getSuggestions; - this.prefix = prefix; } public static SuggestInputParseException get(InvocationTargetException e) { @@ -54,7 +104,7 @@ public class SuggestInputParseException extends InputParseException { } public static SuggestInputParseException of(String input, List values) { - throw new SuggestInputParseException("No value: " + input, input, () -> + throw new SuggestInputParseException(Caption.of("fawe.error.no-value-for-input", input), () -> values.stream() .map(Object::toString) .filter(v -> v.startsWith(input)) @@ -76,8 +126,12 @@ public class SuggestInputParseException extends InputParseException { return getSuggestions.get(); } + /** + * @deprecated Unused + */ + @Deprecated(forRemoval = true, since = "TODO") public SuggestInputParseException prepend(String input) { - this.prefix = input + prefix; + // Do nothing return this; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/RichMaskParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/RichMaskParser.java index 31c8f3d3e..f86645b67 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/RichMaskParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/RichMaskParser.java @@ -50,7 +50,7 @@ public class RichMaskParser extends FaweParser { @Override public Mask parseFromInput(String input, ParserContext context) throws InputParseException { if (input.isEmpty()) { - throw new SuggestInputParseException("No input provided", "", () -> Stream + throw new SuggestInputParseException(Caption.of("fawe.error.no-input-provided"), () -> Stream .of("#", ",", "&") .map(n -> n + ":") .collect(Collectors.toList()) @@ -95,7 +95,6 @@ public class RichMaskParser extends FaweParser { "https://intellectualsites.github.io/fastasyncworldedit-documentation/patterns/patterns" )) )), - full, () -> { if (full.length() == 1) { return new ArrayList<>(worldEdit.getMaskFactory().getSuggestions("")); @@ -162,7 +161,6 @@ public class RichMaskParser extends FaweParser { "https://intellectualsites.github.io/fastasyncworldedit-documentation/masks/masks" )) )), - full, () -> { if (full.length() == 1) { return new ArrayList<>(worldEdit.getMaskFactory().getSuggestions("")); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RichPatternParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RichPatternParser.java index 4971ee878..3ebd84fa6 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RichPatternParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RichPatternParser.java @@ -47,8 +47,7 @@ public class RichPatternParser extends FaweParser { public Pattern parseFromInput(String input, ParserContext context) throws InputParseException { if (input.isEmpty()) { throw new SuggestInputParseException( - "No input provided", - "", + Caption.of("fawe.error.no-input-provided"), () -> Stream .concat(Stream.of("#", ",", "&"), BlockTypes.getNameSpaces().stream().map(n -> n + ":")) .collect(Collectors.toList()) @@ -88,7 +87,6 @@ public class RichPatternParser extends FaweParser { "https://intellectualsites.github.io/fastasyncworldedit-documentation/patterns/patterns" )) )), - full, () -> { if (full.length() == 1) { return new ArrayList<>(worldEdit.getPatternFactory().getSuggestions("")); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/BlockMaskBuilder.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/BlockMaskBuilder.java index 0b89e0ada..5bfeb766c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/BlockMaskBuilder.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/BlockMaskBuilder.java @@ -178,8 +178,7 @@ public class BlockMaskBuilder { } if (operator == null) { throw new SuggestInputParseException( - "No operator for " + input, - "", + Caption.of("fawe.error.no-operator-for-input", input), () -> Arrays.asList("=", "~", "!", "<", ">", "<=", ">=") ); } @@ -195,7 +194,7 @@ public class BlockMaskBuilder { String value = charSequence.toString(); final PropertyKey fKey = key; Collection types = type != null ? Collections.singleton(type) : blockTypeList; - throw new SuggestInputParseException("No value for " + input, input, () -> { + throw new SuggestInputParseException(Caption.of("fawe.error.no-value-for-input", input), () -> { HashSet values = new HashSet<>(); types.stream().filter(t -> t.hasProperty(fKey)).forEach(t -> { Property p = t.getProperty(fKey); @@ -287,7 +286,7 @@ public class BlockMaskBuilder { } private void suggest(String input, String property, Collection finalTypes) throws InputParseException { - throw new SuggestInputParseException(input + " does not have: " + property, input, () -> { + throw new SuggestInputParseException(Caption.of("worldedit.error.parser.unknown-property", property, input), () -> { Set keys = PropertyKeySet.empty(); finalTypes.forEach(t -> t.getProperties().forEach(p -> keys.add(p.getKey()))); return keys.stream().map(PropertyKey::getName) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java index 87959ebe6..f08675fc5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java @@ -20,6 +20,7 @@ package com.sk89q.worldedit.world.block; import com.fastasyncworldedit.core.command.SuggestInputParseException; +import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.function.mask.SingleBlockStateMask; import com.fastasyncworldedit.core.queue.ITileInput; import com.fastasyncworldedit.core.registry.state.PropertyKey; @@ -43,6 +44,7 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.registry.state.AbstractProperty; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.util.concurrency.LazyReference; +import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; import com.sk89q.worldedit.world.registry.BlockMaterial; @@ -150,7 +152,7 @@ public class BlockState implements BlockStateHolder, Pattern { type = BlockTypes.get(key); if (type == null) { String input = key.toString(); - throw new SuggestInputParseException("Does not match a valid block type: " + input, input, () -> Stream.of( + throw new SuggestInputParseException(Caption.of("fawe.error.invalid-block-type", TextComponent.of(input)), () -> Stream.of( BlockTypesCache.values) .map(BlockType::getId) .filter(id -> StringMan.blockStateMatches(input, id)) @@ -211,8 +213,7 @@ public class BlockState implements BlockStateHolder, Pattern { String input = charSequence.toString(); BlockType finalType = type; throw new SuggestInputParseException( - "Invalid property " + key + ":" + input + " for type " + type, - input, + Caption.of("worldedit.error.parser.unknown-property", key + ":" + input, type), () -> finalType.getProperties().stream() .map(Property::getName) @@ -222,8 +223,7 @@ public class BlockState implements BlockStateHolder, Pattern { ); } else { throw new SuggestInputParseException( - "No operator for " + state, - "", + Caption.of("fawe.error.no-operator-for-input", state), () -> Collections.singletonList("=") ); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java index e79a9af5a..b8af4bce5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java @@ -20,9 +20,11 @@ package com.sk89q.worldedit.world.block; import com.fastasyncworldedit.core.command.SuggestInputParseException; +import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.util.StringMan; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.world.registry.LegacyMapper; import javax.annotation.Nullable; @@ -1967,7 +1969,7 @@ public final class BlockTypes { } } - throw new SuggestInputParseException("Does not match a valid block type: " + inputLower, inputLower, () -> Stream.of( + throw new SuggestInputParseException(Caption.of("fawe.error.invalid-block-type", TextComponent.of(input)), () -> Stream.of( BlockTypesCache.values) .filter(b -> StringMan.blockStateMatches(inputLower, b.getId())) .map(BlockType::getId) From 435161d566e8d80341d90cb19a4d5fbf23276e8c Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 22 May 2023 19:33:15 +0100 Subject: [PATCH 039/161] fix: only send invalid region messages with debug true (#2238) - Addresses #2188 --- .../main/java/com/fastasyncworldedit/core/util/WEManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/WEManager.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/WEManager.java index 85f4eb2d1..439b486e3 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/WEManager.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/WEManager.java @@ -130,7 +130,9 @@ public class WEManager { backupRegions.add(region); } } else { - player.print(Caption.of("fawe.error.region-mask-invalid", mask.getClass().getSimpleName())); + if (Settings.settings().ENABLED_COMPONENTS.DEBUG) { + player.printDebug(Caption.of("fawe.error.region-mask-invalid", mask.getClass().getSimpleName())); + } removed = true; iterator.remove(); } From 5dca925bc30774f1205197c034a2b7cbd7bcb8c1 Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 22 May 2023 19:33:59 +0100 Subject: [PATCH 040/161] feat: make more commands unqueued (#2235) * feat: make more commands unqueued - Effectively fixes the very specific "issue" in #2223 I guess - Use this opportunity to clean up the command classes a bit * Address comments --- .../worldedit/command/BiomeCommands.java | 5 +- .../worldedit/command/BrushCommands.java | 85 ++++++++++--------- .../worldedit/command/ChunkCommands.java | 10 ++- .../worldedit/command/ClipboardCommands.java | 64 ++++++-------- .../worldedit/command/GeneralCommands.java | 27 +++--- .../worldedit/command/GenerationCommands.java | 48 +++++------ .../worldedit/command/HistorySubCommands.java | 24 ++++-- .../worldedit/command/NavigationCommands.java | 25 ++++-- .../worldedit/command/RegionCommands.java | 37 +++++--- .../worldedit/command/SchematicCommands.java | 25 +++--- .../worldedit/command/SelectionCommands.java | 16 +++- .../worldedit/command/SnapshotCommands.java | 8 +- .../command/SnapshotUtilCommands.java | 2 +- .../worldedit/command/ToolUtilCommands.java | 4 +- .../worldedit/command/UtilityCommands.java | 54 ++++++------ 15 files changed, 233 insertions(+), 201 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java index 149af4eed..0b2bd576d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BiomeCommands.java @@ -82,7 +82,10 @@ public class BiomeCommands { aliases = {"biomels", "/biomelist", "/listbiomes"}, desc = "Gets all biomes available." ) - @CommandPermissions("worldedit.biome.list") + @CommandPermissions( + value = "worldedit.biome.list", + queued = false + ) public void biomeList( Actor actor, @ArgFlag(name = 'p', desc = "Page number.", def = "1") diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java index 5c87d9136..2149951e0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java @@ -310,11 +310,11 @@ public class BrushCommands { }, desc = "Join multiple objects together in a curve", descFooter = - "Click to select some objects,click the same block twice to connect the objects.\n" - + "Insufficient brush radius, or clicking the the wrong spot will result in undesired shapes. The shapes must be simple lines or loops.\n" - + "Pic1: http://i.imgur.com/CeRYAoV.jpg -> http://i.imgur.com/jtM0jA4.png\n" - + "Pic2: http://i.imgur.com/bUeyc72.png -> http://i.imgur.com/tg6MkcF.png" - + "Tutorial: https://www.planetminecraft.com/blog/fawe-tutorial/" + """ + Click to select some objects,click the same block twice to connect the objects. + Insufficient brush radius, or clicking the the wrong spot will result in undesired shapes. The shapes must be simple lines or loops. + Pic1: http://i.imgur.com/CeRYAoV.jpg -> http://i.imgur.com/jtM0jA4.png + Pic2: http://i.imgur.com/bUeyc72.png -> http://i.imgur.com/tg6MkcF.pngTutorial: https://www.planetminecraft.com/blog/fawe-tutorial/""" ) @CommandPermissions("worldedit.brush.spline") public void splineBrush( @@ -337,9 +337,10 @@ public class BrushCommands { "vaesweep" }, desc = "Sweep your clipboard content along a curve", - descFooter = "Sweeps your clipboard content along a curve.\n" - + "Define a curve by selecting the individual points with a brush\n" - + "Set [copies] to a value > 0 if you want to have your selection pasted a limited amount of times equally spaced on the curve" + descFooter = """ + Sweeps your clipboard content along a curve. + Define a curve by selecting the individual points with a brush + Set [copies] to a value > 0 if you want to have your selection pasted a limited amount of times equally spaced on the curve""" ) @CommandPermissions("worldedit.brush.sweep") public void sweepBrush( @@ -636,10 +637,10 @@ public class BrushCommands { @Command( name = "layer", desc = "Replaces terrain with a layer.", - descFooter = "Replaces terrain with a layer.\n" - + "Example: /br layer 5 oak_planks,orange_stained_glass,magenta_stained_glass,black_wool - Places several " + - "layers on a surface\n" - + "Pic: https://i.imgur.com/XV0vYoX.png" + descFooter = """ + Replaces terrain with a layer. + Example: /br layer 5 oak_planks,orange_stained_glass,magenta_stained_glass,black_wool - Places several layers on a surface + Pic: https://i.imgur.com/XV0vYoX.png""" ) @CommandPermissions("worldedit.brush.layer") public void surfaceLayer( @@ -658,11 +659,11 @@ public class BrushCommands { @Command( name = "splatter", desc = "Splatter a pattern on a surface", - descFooter = "Sets a bunch of blocks randomly on a surface.\n" - + "Pic: https://i.imgur.com/hMD29oO.png\n" - + "Example: /br splatter stone,dirt 30 15\n" - + "Note: The seeds define how many splotches there are, recursion defines how large, " - + "solid defines whether the pattern is applied per seed, else per block." + descFooter = """ + Sets a bunch of blocks randomly on a surface. + Pic: https://i.imgur.com/hMD29oO.png + Example: /br splatter stone,dirt 30 15 + Note: The seeds define how many splotches there are, recursion defines how large, solid defines whether the pattern is applied per seed, else per block.""" ) @CommandPermissions("worldedit.brush.splatter") public void splatterBrush( @@ -691,9 +692,10 @@ public class BrushCommands { "scommand" }, desc = "Run commands at random points on a surface", - descFooter = "Run commands at random points on a surface\n" - + " - Your selection will be expanded to the specified size around each point\n" - + " - Placeholders: {x}, {y}, {z}, {world}, {size}" + descFooter = """ + Run commands at random points on a surface + - Your selection will be expanded to the specified size around each point + - Placeholders: {x}, {y}, {z}, {world}, {size}""" ) @CommandPermissions("worldedit.brush.scattercommand") public void scatterCommandBrush( @@ -723,9 +725,10 @@ public class BrushCommands { name = "height", aliases = {"heightmap"}, desc = "Raise or lower terrain using a heightmap", - descFooter = "This brush raises and lowers land.\n" - + "Note: Use a negative yscale to reduce height\n" - + "Snow Pic: https://i.imgur.com/Hrzn0I4.png" + descFooter = """ + This brush raises and lowers land. + Note: Use a negative yscale to reduce height + Snow Pic: https://i.imgur.com/Hrzn0I4.png""" ) @CommandPermissions("worldedit.brush.height") public void heightBrush( @@ -890,9 +893,11 @@ public class BrushCommands { "copypasta" }, desc = "Copy Paste brush", - descFooter = "Left click the base of an object to copy.\n" + "Right click to paste\n" - + "Note: Works well with the clipboard scroll action\n" - + "Video: https://www.youtube.com/watch?v=RPZIaTbqoZw" + descFooter = """ + Left click the base of an object to copy. + Right click to paste + Note: Works well with the clipboard scroll action + Video: https://www.youtube.com/watch?v=RPZIaTbqoZw""" ) @CommandPermissions("worldedit.brush.copy") public void copy( @@ -914,9 +919,10 @@ public class BrushCommands { name = "command", aliases = {"cmd"}, desc = "Command brush", - descFooter = "Run the commands at the clicked position.\n" - + " - Your selection will be expanded to the specified size around each point\n" - + " - Placeholders: {x}, {y}, {z}, {world}, {size}" + descFooter = """ + Run the commands at the clicked position. + - Your selection will be expanded to the specified size around each point + - Placeholders: {x}, {y}, {z}, {world}, {size}""" ) @CommandPermissions("worldedit.brush.command") public void command( @@ -1036,7 +1042,7 @@ public class BrushCommands { ) throws WorldEditException { WorldEdit.getInstance().checkMaxBrushRadius(radius); - BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); + BrushTool tool = session.getBrushTool(player); tool.setSize(radius); tool.setFill(null); tool.setBrush(new OperationFactoryBrush(factory, shape, session), permission); @@ -1196,17 +1202,12 @@ public class BrushCommands { brush = new HollowSphereBrush(); } else { //FAWE start - Suggest different brush material if sand or gravel is used - if (pattern instanceof BlockStateHolder) { - BlockType type = ((BlockStateHolder) pattern).getBlockType(); - switch (type.getId()) { - case "minecraft:sand": - case "minecraft:gravel": - player.print( - Caption.of("fawe.worldedit.brush.brush.try.other")); - falling = true; - break; - default: - break; + if (pattern instanceof BlockStateHolder holder) { + BlockType type = holder.getBlockType(); + if (type == BlockTypes.SAND || type == BlockTypes.GRAVEL) { + player.print( + Caption.of("fawe.worldedit.brush.brush.try.other")); + falling = true; } } if (falling) { @@ -1361,7 +1362,7 @@ public class BrushCommands { iterations = Math.min(limit.MAX_ITERATIONS, iterations); //FAWE end - set(context, new SnowSmoothBrush(iterations, mask), "worldedit.brush.snowsmooth").setSize(radius); + set(context, new SnowSmoothBrush(iterations, snowBlockCount, mask), "worldedit.brush.snowsmooth").setSize(radius); player.print(Caption.of( "worldedit.brush.smooth.equip", radius, diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java index d1b9084fb..c36252f85 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ChunkCommands.java @@ -79,7 +79,10 @@ public class ChunkCommands { aliases = {"/chunkinfo"}, desc = "Get information about the chunk you're inside" ) - @CommandPermissions("worldedit.chunkinfo") + @CommandPermissions( + value = "worldedit.chunkinfo", + queued = false + ) public void chunkInfo(Player player) { Location pos = player.getBlockLocation(); int chunkX = (int) Math.floor(pos.getBlockX() / 16.0); @@ -99,7 +102,10 @@ public class ChunkCommands { aliases = {"/listchunks"}, desc = "List chunks that your selection includes" ) - @CommandPermissions("worldedit.listchunks") + @CommandPermissions( + value = "worldedit.listchunks", + queued = false + ) public void listChunks( Actor actor, World world, LocalSession session, @ArgFlag(name = 'p', desc = "Page number.", def = "1") int page diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java index 2e7b53440..40ca530c8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java @@ -160,35 +160,7 @@ public class ClipboardCommands { session.getPlacementPosition(actor)); ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint()); copy.setCopyingEntities(copyEntities); - copy.setCopyingBiomes(copyBiomes); - - Mask sourceMask = editSession.getSourceMask(); - Region[] regions = editSession.getAllowedRegions(); - Region allowedRegion; - if (regions == null || regions.length == 0) { - allowedRegion = new NullRegion(); - } else { - allowedRegion = new RegionIntersection(regions); - } - final Mask firstSourceMask = mask != null ? mask : sourceMask; - final Mask finalMask = MaskIntersection.of(firstSourceMask, new RegionMask(allowedRegion)).optimize(); - if (finalMask != Masks.alwaysTrue()) { - copy.setSourceMask(finalMask); - } - if (sourceMask != null) { - editSession.setSourceMask(null); - new MaskTraverser(sourceMask).reset(editSession); - editSession.setSourceMask(null); - } - - try { - Operations.completeLegacy(copy); - } catch (Throwable e) { - throw e; - } finally { - clipboard.flush(); - } - session.setClipboard(new ClipboardHolder(clipboard)); + createCopy(session, editSession, copyBiomes, mask, clipboard, copy); copy.getStatusMessages().forEach(actor::print); //FAWE end @@ -299,7 +271,25 @@ public class ClipboardCommands { copy.setSourceFunction(new BlockReplace(editSession, leavePattern)); copy.setCopyingEntities(copyEntities); copy.setRemovingEntities(true); + createCopy(session, editSession, copyBiomes, mask, clipboard, copy); + + if (!actor.hasPermission("fawe.tips")) { + actor.print(Caption.of("fawe.tips.tip.lazycut")); + } + copy.getStatusMessages().forEach(actor::print); + //FAWE end + } + + private void createCopy( + final LocalSession session, + final EditSession editSession, + final boolean copyBiomes, + final Mask mask, + final Clipboard clipboard, + final ForwardExtentCopy copy + ) { copy.setCopyingBiomes(copyBiomes); + Mask sourceMask = editSession.getSourceMask(); Region[] regions = editSession.getAllowedRegions(); Region allowedRegion; @@ -318,20 +308,13 @@ public class ClipboardCommands { new MaskTraverser(sourceMask).reset(editSession); editSession.setSourceMask(null); } + try { Operations.completeLegacy(copy); - } catch (Throwable e) { - throw e; } finally { clipboard.flush(); } session.setClipboard(new ClipboardHolder(clipboard)); - - if (!actor.hasPermission("fawe.tips")) { - actor.print(Caption.of("fawe.tips.tip.lazycut")); - } - copy.getStatusMessages().forEach(actor::print); - //FAWE end } //FAWE start @@ -583,9 +566,10 @@ public class ClipboardCommands { @Command( name = "/rotate", desc = "Rotate the contents of the clipboard", - descFooter = "Non-destructively rotate the contents of the clipboard.\n" - + "Angles are provided in degrees and a positive angle will result in a clockwise rotation. " - + "Multiple rotations can be stacked. Interpolation is not performed so angles should be a multiple of 90 degrees.\n" + descFooter = """ + Non-destructively rotate the contents of the clipboard. + Angles are provided in degrees and a positive angle will result in a clockwise rotation. Multiple rotations can be stacked. Interpolation is not performed so angles should be a multiple of 90 degrees. + """ ) @CommandPermissions("worldedit.clipboard.rotate") public void rotate( diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java index 3d54e40a7..0cf5b1a78 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GeneralCommands.java @@ -149,14 +149,11 @@ public class GeneralCommands { String arg0 = args.get(0).toLowerCase(Locale.ENGLISH); String flipped; switch (arg0) { - case "on": - flipped = "off"; - break; - case "off": - flipped = "on"; - break; - default: + case "on" -> flipped = "off"; + case "off" -> flipped = "on"; + default -> { return TextComponent.of("There is no replacement for //fast " + arg0); + } } return CommandUtil.createNewCommandReplacementText("//perf " + flipped); } @@ -362,7 +359,10 @@ public class GeneralCommands { descFooter = "This is dependent on platform implementation. " + "Not all platforms support watchdog hooks, or contain a watchdog." ) - @CommandPermissions("worldedit.watchdog") + @CommandPermissions( + value = "worldedit.watchdog", + queued = false + ) public void watchdog( Actor actor, LocalSession session, @Arg(desc = "The mode to set the watchdog hook to", def = "") @@ -424,7 +424,10 @@ public class GeneralCommands { aliases = {"/searchitem", "/l", "/search"}, desc = "Search for an item" ) - @CommandPermissions("worldedit.searchitem") + @CommandPermissions( + value = "worldedit.searchitem", + queued = false + ) public void searchItem( Actor actor, @Switch(name = 'b', desc = "Only search for blocks") @@ -573,7 +576,10 @@ public class GeneralCommands { aliases = {"tips"}, desc = "Toggle FAWE tips" ) - @CommandPermissions("fawe.tips") + @CommandPermissions( + value = "fawe.tips", + queued = false + ) public void tips(Actor actor, LocalSession session) throws WorldEditException { if (actor.togglePermission("fawe.tips")) { actor.print(Caption.of("fawe.info.worldedit.toggle.tips.on")); @@ -627,7 +633,6 @@ public class GeneralCommands { String command = "/searchitem " + (blocksOnly ? "-b " : "") + (itemsOnly ? "-i " : "") + "-p %page% " + search; Map results = new TreeMap<>(); String idMatch = search.replace(' ', '_'); - String nameMatch = search.toLowerCase(Locale.ROOT); for (ItemType searchType : ItemType.REGISTRY) { if (blocksOnly && !searchType.hasBlockType()) { continue; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java index dabc1dc92..a1e6034f5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java @@ -119,18 +119,15 @@ public class GenerationCommands { final double radiusX; final double radiusZ; switch (radii.size()) { - case 1: - radiusX = radiusZ = Math.max(1, radii.get(0)); - break; - - case 2: + case 1 -> radiusX = radiusZ = Math.max(1, radii.get(0)); + case 2 -> { radiusX = Math.max(1, radii.get(0)); radiusZ = Math.max(1, radii.get(1)); - break; - - default: + } + default -> { actor.print(Caption.of("worldedit.cyl.invalid-radius")); return 0; + } } worldEdit.checkMaxRadius(radiusX); worldEdit.checkMaxRadius(radiusZ); @@ -169,18 +166,15 @@ public class GenerationCommands { final double radiusX; final double radiusZ; switch (radii.size()) { - case 1: - radiusX = radiusZ = Math.max(1, radii.get(0)); - break; - - case 2: + case 1 -> radiusX = radiusZ = Math.max(1, radii.get(0)); + case 2 -> { radiusX = Math.max(1, radii.get(0)); radiusZ = Math.max(1, radii.get(1)); - break; - - default: + } + default -> { actor.print(Caption.of("worldedit.cyl.invalid-radius")); return 0; + } } worldEdit.checkMaxRadius(radiusX); @@ -234,19 +228,16 @@ public class GenerationCommands { final double radiusY; final double radiusZ; switch (radii.size()) { - case 1: - radiusX = radiusY = radiusZ = Math.max(0, radii.get(0)); - break; - - case 3: + case 1 -> radiusX = radiusY = radiusZ = Math.max(0, radii.get(0)); + case 3 -> { radiusX = Math.max(0, radii.get(0)); radiusY = Math.max(0, radii.get(1)); radiusZ = Math.max(0, radii.get(2)); - break; - - default: + } + default -> { actor.print(Caption.of("worldedit.sphere.invalid-radius")); return 0; + } } worldEdit.checkMaxRadius(radiusX); @@ -437,9 +428,10 @@ public class GenerationCommands { name = "/generatebiome", aliases = {"/genbiome", "/gb"}, desc = "Sets biome according to a formula.", - descFooter = "Formula must return positive numbers (true) if the point is inside the shape\n" - + "Sets the biome of blocks in that shape.\n" - + "For details, see https://ehub.to/we/expr" + descFooter = """ + Formula must return positive numbers (true) if the point is inside the shape + Sets the biome of blocks in that shape. + For details, see https://ehub.to/we/expr""" ) @CommandPermissions("worldedit.generation.shape.biome") @Logging(ALL) @@ -626,14 +618,12 @@ public class GenerationCommands { BlockVector3 pos1 = session.getPlacementPosition(actor); BlockVector3 pos2 = pos1.add(image.getWidth() - 1, 0, image.getHeight() - 1); CuboidRegion region = new CuboidRegion(pos1, pos2); - int[] count = new int[1]; final BufferedImage finalImage = image; RegionVisitor visitor = new RegionVisitor(region, pos -> { int x = pos.getBlockX() - pos1.getBlockX(); int z = pos.getBlockZ() - pos1.getBlockZ(); int color = finalImage.getRGB(x, z); BlockType block = tu.getNearestBlock(color); - count[0]++; if (block != null) { return editSession.setBlock(pos, block.getDefaultState()); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java index 3688041d4..452d5084c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/HistorySubCommands.java @@ -223,7 +223,10 @@ public class HistorySubCommands { aliases = {"summary", "summarize"}, desc = "Summarize an edit" ) - @CommandPermissions("worldedit.history.info") + @CommandPermissions( + value = "worldedit.history.info", + queued = false + ) public synchronized void summary( Player player, RollbackDatabase database, Arguments arguments, @Arg(desc = "Player uuid/name") @@ -314,8 +317,7 @@ public class HistorySubCommands { public Component apply(@Nullable Supplier input) { ChangeSet edit = input.get(); - if (edit instanceof RollbackOptimizedHistory) { - RollbackOptimizedHistory rollback = (RollbackOptimizedHistory) edit; + if (edit instanceof RollbackOptimizedHistory rollback) { UUID uuid = rollback.getUUID(); int index = rollback.getIndex(); @@ -368,7 +370,10 @@ public class HistorySubCommands { aliases = {"inspect", "search", "near"}, desc = "Find nearby edits" ) - @CommandPermissions("worldedit.history.find") + @CommandPermissions( + value = "worldedit.history.find", + queued = false + ) public synchronized void find( Player player, World world, RollbackDatabase database, Arguments arguments, @ArgFlag(name = 'u', def = "", desc = "String user") @@ -429,7 +434,10 @@ public class HistorySubCommands { aliases = {"distribution"}, desc = "View block distribution for an edit" ) - @CommandPermissions("worldedit.history.distr") + @CommandPermissions( + value = "worldedit.history.distr", + queued = false + ) public void distr( Player player, LocalSession session, RollbackDatabase database, Arguments arguments, @Arg(desc = "Player uuid/name") @@ -468,7 +476,10 @@ public class HistorySubCommands { name = "list", desc = "List your history" ) - @CommandPermissions("worldedit.history.list") + @CommandPermissions( + value = "worldedit.history.list", + queued = false + ) public void list( Player player, LocalSession session, RollbackDatabase database, Arguments arguments, @Arg(desc = "Player uuid/name") @@ -476,7 +487,6 @@ public class HistorySubCommands { @ArgFlag(name = 'p', desc = "Page to view.", def = "") Integer page ) { - int index = session.getHistoryIndex(); List> history = Lists.transform( session.getHistory(), (Function>) input -> () -> input diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java index 22e8a12ec..239105cd2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/NavigationCommands.java @@ -60,7 +60,10 @@ public class NavigationCommands { aliases = {"!", "/unstuck"}, desc = "Escape from being stuck inside a block" ) - @CommandPermissions("worldedit.navigation.unstuck") + @CommandPermissions( + value = "worldedit.navigation.unstuck", + queued = false + ) public void unstuck(Player player) throws WorldEditException { player.findFreePosition(); player.print(Caption.of("worldedit.unstuck.moved")); @@ -71,7 +74,10 @@ public class NavigationCommands { aliases = {"asc", "/asc", "/ascend"}, desc = "Go up a floor" ) - @CommandPermissions("worldedit.navigation.ascend") + @CommandPermissions( + value = "worldedit.navigation.ascend", + queued = false + ) public void ascend( Player player, @Arg(desc = "# of levels to ascend", def = "1") @@ -96,7 +102,10 @@ public class NavigationCommands { aliases = {"desc", "/desc", "/descend"}, desc = "Go down a floor" ) - @CommandPermissions("worldedit.navigation.descend") + @CommandPermissions( + value = "worldedit.navigation.descend", + queued = false + ) public void descend( Player player, @Arg(desc = "# of levels to descend", def = "1") @@ -147,7 +156,10 @@ public class NavigationCommands { aliases = {"/thru"}, desc = "Pass through walls" ) - @CommandPermissions("worldedit.navigation.thru.command") + @CommandPermissions( + value = "worldedit.navigation.thru.command", + queued = false + ) public void thru(Player player) throws WorldEditException { if (player.passThroughForwardWall(6)) { player.print(Caption.of("worldedit.thru.moved")); @@ -161,7 +173,10 @@ public class NavigationCommands { aliases = {"j", "/jumpto", "/j"}, desc = "Teleport to a location" ) - @CommandPermissions("worldedit.navigation.jumpto.command") + @CommandPermissions( + value = "worldedit.navigation.jumpto.command", + queued = false + ) public void jumpTo( Player player, @Arg(desc = "Location to jump to", def = "") diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java index 5d3fb30e8..a72cba4b3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/RegionCommands.java @@ -140,7 +140,10 @@ public class RegionCommands { name = "/test", desc = "test region" ) - @CommandPermissions("worldedit.region.test") + @CommandPermissions( + value = "worldedit.region.test", + queued = false + ) @Logging(REGION) public void test( Actor actor, EditSession editSession, @@ -175,7 +178,10 @@ public class RegionCommands { aliases = "/nbt", desc = "View nbt info for a block" ) - @CommandPermissions("worldedit.nbtinfo") + @CommandPermissions( + value = "worldedit.nbtinfo", + queued = false + ) public void nbtinfo(Player player, EditSession editSession) { Location pos = player.getBlockTrace(128); if (pos == null) { @@ -228,13 +234,12 @@ public class RegionCommands { @Switch(name = 'h', desc = "Generate only a shell") boolean shell ) throws WorldEditException { - if (!(region instanceof CuboidRegion)) { + if (!(region instanceof CuboidRegion cuboidregion)) { actor.print(Caption.of("worldedit.line.cuboid-only")); return 0; } checkCommandArgument(thickness >= 0, "Thickness must be >= 0"); - CuboidRegion cuboidregion = (CuboidRegion) region; BlockVector3 pos1 = cuboidregion.getPos1(); BlockVector3 pos2 = cuboidregion.getPos2(); int blocksChanged = editSession.drawLine(pattern, pos1, pos2, thickness, !shell); @@ -261,13 +266,12 @@ public class RegionCommands { @Switch(name = 'h', desc = "Generate only a shell") boolean shell ) throws WorldEditException { - if (!(region instanceof ConvexPolyhedralRegion)) { + if (!(region instanceof ConvexPolyhedralRegion cpregion)) { actor.print(Caption.of("worldedit.curve.invalid-type")); return 0; } checkCommandArgument(thickness >= 0, "Thickness must be >= 0"); - ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region; List vectors = new ArrayList<>(cpregion.getVertices()); int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell); @@ -468,7 +472,10 @@ public class RegionCommands { desc = "Bypass region restrictions", descFooter = "Bypass region restrictions" ) - @CommandPermissions("fawe.admin") + @CommandPermissions( + value = "fawe.admin", + queued = false + ) public void wea(Actor actor) throws WorldEditException { if (actor.togglePermission("fawe.bypass")) { actor.print(Caption.of("fawe.info.worldedit.bypassed")); @@ -697,7 +704,7 @@ public class RegionCommands { actor.print(Caption.of("fawe.regen.time")); //FAWE end RegenOptions options = RegenOptions.builder() - .seed(!randomSeed ? seed : new Long(ThreadLocalRandom.current().nextLong())) + .seed(!randomSeed ? seed : Long.valueOf(ThreadLocalRandom.current().nextLong())) .regenBiomes(regenBiomes) .biomeType(biomeType) .build(); @@ -718,9 +725,10 @@ public class RegionCommands { @Command( name = "/deform", desc = "Deforms a selected region with an expression", - descFooter = "The expression is executed for each block and is expected\n" - + "to modify the variables x, y and z to point to a new block\n" - + "to fetch. For details, see https://ehub.to/we/expr" + descFooter = """ + The expression is executed for each block and is expected + to modify the variables x, y and z to point to a new block + to fetch. For details, see https://ehub.to/we/expr""" ) @CommandPermissions("worldedit.region.deform") @Logging(ALL) @@ -794,9 +802,10 @@ public class RegionCommands { @Command( name = "/hollow", desc = "Hollows out the object contained in this selection", - descFooter = "Hollows out the object contained in this selection.\n" - + "Optionally fills the hollowed out part with the given block.\n" - + "Thickness is measured in manhattan distance." + descFooter = """ + Hollows out the object contained in this selection. + Optionally fills the hollowed out part with the given block. + Thickness is measured in manhattan distance.""" ) @CommandPermissions("worldedit.region.hollow") @Logging(REGION) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java index 03d19e72c..20dee10c3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java @@ -26,7 +26,6 @@ import com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder; import com.fastasyncworldedit.core.extent.clipboard.URIClipboardHolder; import com.fastasyncworldedit.core.extent.clipboard.io.schematic.MinecraftStructure; import com.fastasyncworldedit.core.util.MainUtil; -import com.google.common.base.Function; import com.google.common.collect.Multimap; import com.sk89q.worldedit.LocalConfiguration; import com.sk89q.worldedit.LocalSession; @@ -90,6 +89,7 @@ import java.util.Map; import java.util.Objects; import java.util.UUID; import java.util.concurrent.Callable; +import java.util.function.Function; import java.util.regex.Pattern; import static com.fastasyncworldedit.core.util.ReflectionUtils.as; @@ -209,11 +209,9 @@ public class SchematicCommands { } ClipboardHolder clipboard = session.getClipboard(); - if (clipboard instanceof URIClipboardHolder) { - URIClipboardHolder identifiable = (URIClipboardHolder) clipboard; + if (clipboard instanceof URIClipboardHolder identifiable) { if (identifiable.contains(uri)) { - if (identifiable instanceof MultiClipboardHolder) { - MultiClipboardHolder multi = (MultiClipboardHolder) identifiable; + if (identifiable instanceof MultiClipboardHolder multi) { multi.remove(uri); if (multi.getHolders().isEmpty()) { session.setClipboard(null); @@ -319,7 +317,7 @@ public class SchematicCommands { LocalConfiguration config = worldEdit.getConfiguration(); //FAWE start - ClipboardFormat format = null; + ClipboardFormat format; InputStream in = null; try { URI uri; @@ -526,7 +524,10 @@ public class SchematicCommands { aliases = {"listformats", "f"}, desc = "List available formats" ) - @CommandPermissions("worldedit.schematic.formats") + @CommandPermissions( + value = "worldedit.schematic.formats", + queued = false + ) public void formats(Actor actor) { actor.print(Caption.of("worldedit.schematic.formats.title")); StringBuilder builder; @@ -552,7 +553,10 @@ public class SchematicCommands { desc = "List saved schematics", descFooter = "Note: Format is not fully verified until loading." ) - @CommandPermissions("worldedit.schematic.list") + @CommandPermissions( + value = "worldedit.schematic.list", + queued = false + ) public void list( Actor actor, LocalSession session, @ArgFlag(name = 'p', desc = "Page to view.", def = "1") @@ -823,7 +827,6 @@ public class SchematicCommands { final String SCHEMATIC_NAME = file.getName(); double oldKbOverwritten = 0; - String overwrittenPath = curFilepath; int numFiles = -1; if (checkFilesize) { @@ -839,10 +842,10 @@ public class SchematicCommands { if (overwrite) { oldKbOverwritten = Files.size(Paths.get(file.getAbsolutePath())) / 1000.0; int iter = 1; - while (new File(overwrittenPath + "." + iter + "." + format.getPrimaryFileExtension()).exists()) { + while (new File(curFilepath + "." + iter + "." + format.getPrimaryFileExtension()).exists()) { iter++; } - file = new File(overwrittenPath + "." + iter + "." + format.getPrimaryFileExtension()); + file = new File(curFilepath + "." + iter + "." + format.getPrimaryFileExtension()); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java index e6e06e9a2..64e3c8a81 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SelectionCommands.java @@ -314,7 +314,10 @@ public class SelectionCommands { name = "/wand", desc = "Get the wand object" ) - @CommandPermissions("worldedit.wand") + @CommandPermissions( + value = "worldedit.wand", + queued = false + ) public void wand( Player player, LocalSession session, @Switch(name = 'n', desc = "Get a navigation wand") boolean navWand @@ -348,7 +351,10 @@ public class SelectionCommands { aliases = {"/toggleeditwand"}, desc = "Remind the user that the wand is now a tool and can be unbound with /tool none." ) - @CommandPermissions("worldedit.wand.toggle") + @CommandPermissions( + value = "worldedit.wand.toggle", + queued = false + ) public void toggleWand(Player player) { player.print( Caption.of( @@ -499,7 +505,10 @@ public class SelectionCommands { name = "/size", desc = "Get information about the selection" ) - @CommandPermissions("worldedit.selection.size") + @CommandPermissions( + value = "worldedit.selection.size", + queued = false + ) public void size( Actor actor, World world, LocalSession session, @Switch(name = 'c', desc = "Get clipboard info instead") @@ -734,6 +743,7 @@ public class SelectionCommands { box.appendCommand("sphere", Caption.of("worldedit.select.sphere.description"), "//sel sphere"); box.appendCommand("cyl", Caption.of("worldedit.select.cyl.description"), "//sel cyl"); box.appendCommand("convex", Caption.of("worldedit.select.convex.description"), "//sel convex"); + //FAWE start box.appendCommand("polyhedral", Caption.of("fawe.selection.sel.polyhedral"), "//sel polyhedral"); box.appendCommand("fuzzy[=]", Caption.of("fawe.selection.sel.fuzzy-instruction"), "//sel fuzzy[=]"); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java index 66cfdd853..6d9bda084 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotCommands.java @@ -98,7 +98,10 @@ public class SnapshotCommands { name = "list", desc = "List snapshots" ) - @CommandPermissions("worldedit.snapshots.list") + @CommandPermissions( + value = "worldedit.snapshots.list", + queued = false + ) void list( Actor actor, World world, @ArgFlag(name = 'p', desc = "Page of results to return", def = "1") @@ -127,8 +130,7 @@ public class SnapshotCommands { TextComponent.of(world.getName()) )); - if (config.snapshotDatabase instanceof FileSystemSnapshotDatabase) { - FileSystemSnapshotDatabase db = (FileSystemSnapshotDatabase) config.snapshotDatabase; + if (config.snapshotDatabase instanceof FileSystemSnapshotDatabase db) { Path root = db.getRoot(); if (Files.isDirectory(root)) { WorldEdit.logger.info("No snapshots were found for world '" diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotUtilCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotUtilCommands.java index 8de52f6aa..b98785631 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotUtilCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SnapshotUtilCommands.java @@ -95,7 +95,7 @@ public class SnapshotUtilCommands { if (snapshotName != null) { URI uri = resolveSnapshotName(config, snapshotName); Optional snapOpt = config.snapshotDatabase.getSnapshot(uri); - if (!snapOpt.isPresent()) { + if (snapOpt.isEmpty()) { actor.print(Caption.of("worldedit.restore.not-available")); return; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java index 6f47132f7..0694b2af3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ToolUtilCommands.java @@ -140,7 +140,7 @@ public class ToolUtilCommands { @Arg(desc = "The range of the brush") int range ) throws WorldEditException { - session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setRange(range); + session.getBrushTool(player).setRange(range); player.print(Caption.of("worldedit.tool.range.set")); } @@ -156,7 +156,7 @@ public class ToolUtilCommands { ) throws WorldEditException { we.checkMaxBrushRadius(size); - session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setSize(size); + session.getBrushTool(player).setSize(size); player.print(Caption.of("worldedit.tool.size.set")); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java index b3403bba4..f064868b4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java @@ -29,7 +29,6 @@ import com.fastasyncworldedit.core.util.StringMan; import com.fastasyncworldedit.core.util.TaskManager; import com.fastasyncworldedit.core.util.image.ImageUtil; import com.fastasyncworldedit.core.util.task.DelegateConsumer; -import com.google.common.base.Function; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.LocalConfiguration; @@ -98,6 +97,7 @@ import java.util.Locale; import java.util.Map; import java.util.UUID; import java.util.function.Consumer; +import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -130,7 +130,10 @@ public class UtilityCommands { aliases = {"/hmi", "hmi"}, desc = "Generate the heightmap interface: https://github.com/IntellectualSites/HeightMap" ) - @CommandPermissions("fawe.admin") + @CommandPermissions( + value = "fawe.admin", + queued = false + ) public void heightmapInterface( Actor actor, @Arg(name = "min", desc = "int", def = "100") int min, @@ -145,12 +148,9 @@ public class UtilityCommands { final int sub = srcFolder.getAbsolutePath().length(); List images = new ArrayList<>(); MainUtil.iterateFiles(srcFolder, file -> { - switch (file.getName().substring(file.getName().lastIndexOf('.')).toLowerCase(Locale.ROOT)) { - case ".png": - case ".jpeg": - break; - default: - return; + String s = file.getName().substring(file.getName().lastIndexOf('.')).toLowerCase(Locale.ROOT); + if (!s.equals(".png") && !s.equals(".jpeg")) { + return; } try { String name = file.getAbsolutePath().substring(sub); @@ -187,7 +187,7 @@ public class UtilityCommands { StringBuilder config = new StringBuilder(); config.append("var images = [\n"); for (String image : images) { - config.append('"' + image.replace(File.separator, "/") + "\",\n"); + config.append('"').append(image.replace(File.separator, "/")).append("\",\n"); } config.append("];\n"); config.append("// The low res images (they should all be the same size)\n"); @@ -805,7 +805,10 @@ public class UtilityCommands { name = "/help", desc = "Displays help for WorldEdit commands" ) - @CommandPermissions("worldedit.help") + @CommandPermissions( + value = "worldedit.help", + queued = false + ) public void help( Actor actor, @Switch(name = 's', desc = "List sub-commands of the given command, if applicable") @@ -859,7 +862,6 @@ public class UtilityCommands { URI uri = input.getKey(); String path = input.getValue(); - boolean url = false; boolean loaded = isLoaded.apply(uri); URIType type = URIType.FILE; @@ -959,21 +961,13 @@ public class UtilityCommands { if (len > 0) { for (String arg : args) { switch (arg.toLowerCase(Locale.ROOT)) { - case "me": - case "mine": - case "local": - case "private": - listMine = true; - break; - case "public": - case "global": - listGlobal = true; - break; - case "all": + case "me", "mine", "local", "private" -> listMine = true; + case "public", "global" -> listGlobal = true; + case "all" -> { listMine = true; listGlobal = true; - break; - default: + } + default -> { if (arg.endsWith("/") || arg.endsWith(File.separator)) { arg = arg.replace("/", File.separator); String newDirFilter = dirFilter + arg; @@ -995,7 +989,7 @@ public class UtilityCommands { } else { filters.add(arg); } - break; + } } } } @@ -1005,7 +999,7 @@ public class UtilityCommands { List toFilter = new ArrayList<>(); if (!filters.isEmpty()) { - forEachFile = new DelegateConsumer(forEachFile) { + forEachFile = new DelegateConsumer<>(forEachFile) { @Override public void accept(File file) { toFilter.add(file); @@ -1015,7 +1009,7 @@ public class UtilityCommands { if (formatName != null) { final ClipboardFormat cf = ClipboardFormats.findByAlias(formatName); - forEachFile = new DelegateConsumer(forEachFile) { + forEachFile = new DelegateConsumer<>(forEachFile) { @Override public void accept(File file) { if (cf.isFormat(file)) { @@ -1024,7 +1018,7 @@ public class UtilityCommands { } }; } else { - forEachFile = new DelegateConsumer(forEachFile) { + forEachFile = new DelegateConsumer<>(forEachFile) { @Override public void accept(File file) { if (!file.toString().endsWith(".cached")) { @@ -1062,7 +1056,7 @@ public class UtilityCommands { } if (listGlobal) { File rel = MainUtil.resolveRelative(new File(dir, dirFilter)); - forEachFile = new DelegateConsumer(forEachFile) { + forEachFile = new DelegateConsumer<>(forEachFile) { @Override public void accept(File f) { try { @@ -1172,7 +1166,7 @@ public class UtilityCommands { StringBuilder name = new StringBuilder(); if (relative.isAbsolute()) { relative = root.toURI().relativize(file.toURI()); - name.append(".." + File.separator); + name.append("..").append(File.separator); } name.append(relative.getPath()); return name.toString(); From 362f6cc6e10b56032dcae6822e9ee42bc6c68ac9 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Mon, 22 May 2023 19:43:21 +0100 Subject: [PATCH 041/161] fix #2009 --- .../core/extension/factory/parser/mask/RichMaskParser.java | 1 + 1 file changed, 1 insertion(+) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/RichMaskParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/RichMaskParser.java index f86645b67..4e0fbfa91 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/RichMaskParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/mask/RichMaskParser.java @@ -147,6 +147,7 @@ public class RichMaskParser extends FaweParser { try { builder.addRegex(full); } catch (InputParseException ignored) { + builder.clear(); context.setPreferringWildcard(false); context.setRestricted(false); BaseBlock block = worldEdit.getBlockFactory().parseFromInput(full, context); From 3041ff3e50fa420e41be1cb6232445175d3942fc Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 25 May 2023 18:06:20 +0100 Subject: [PATCH 042/161] feat: add -r (random rotate) flag to schem load and clipboard brush (#2244) - Implements #1873 --- .../worldedit/command/BrushCommands.java | 15 ++++---- .../worldedit/command/SchematicCommands.java | 14 +++++++- .../command/tool/brush/ClipboardBrush.java | 36 +++++++++++++++++++ 3 files changed, 58 insertions(+), 7 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java index 2149951e0..d378decb1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java @@ -1259,13 +1259,12 @@ public class BrushCommands { @Command( name = "clipboard", - desc = "@Deprecated use instead: `/br copypaste`)", + desc = "Paste your clipboard at the brush location. Includes any transforms.", descFooter = "Choose the clipboard brush.\n" + "Without the -o flag, the paste will appear centered at the target location. " + "With the flag, then the paste will appear relative to where you had " + "stood relative to the copied area when you copied it." ) - @Deprecated @CommandPermissions("worldedit.brush.clipboard") public void clipboardBrush( Player player, LocalSession session, @@ -1279,7 +1278,11 @@ public class BrushCommands { boolean pasteBiomes, @ArgFlag(name = 'm', desc = "Skip blocks matching this mask in the clipboard") @ClipboardMask - Mask sourceMask, InjectedValueAccess context + Mask sourceMask, InjectedValueAccess context, + //FAWE start - random rotation + @Switch(name = 'r', desc = "Apply random rotation on paste, combines with existing clipboard transforms") + boolean randomRotate + //FAWE end ) throws WorldEditException { ClipboardHolder holder = session.getClipboard(); @@ -1295,9 +1298,9 @@ public class BrushCommands { set( context, - new ClipboardBrush(newHolder, ignoreAir, usingOrigin, pasteEntities, pasteBiomes, - sourceMask - ), + //FAWE start - random rotation + new ClipboardBrush(newHolder, ignoreAir, usingOrigin, pasteEntities, pasteBiomes, sourceMask, randomRotate), + //FAWE end "worldedit.brush.clipboard" ); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java index 20dee10c3..c677734ef 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/SchematicCommands.java @@ -45,6 +45,7 @@ import com.sk89q.worldedit.extent.clipboard.io.ClipboardReader; import com.sk89q.worldedit.extent.clipboard.io.ClipboardWriter; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.internal.util.LogManagerCompat; +import com.sk89q.worldedit.math.transform.AffineTransform; import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.util.formatting.component.ErrorFormat; @@ -89,6 +90,7 @@ import java.util.Map; import java.util.Objects; import java.util.UUID; import java.util.concurrent.Callable; +import java.util.concurrent.ThreadLocalRandom; import java.util.function.Function; import java.util.regex.Pattern; @@ -312,7 +314,11 @@ public class SchematicCommands { @Arg(desc = "File name.") String filename, @Arg(desc = "Format name.", def = "fast") - String formatName + String formatName, + //FAWE start - random rotation + @Switch(name = 'r', desc = "Apply random rotation to the clipboard") + boolean randomRotate + //FAWE end ) throws FilenameException { LocalConfiguration config = worldEdit.getConfiguration(); @@ -394,6 +400,12 @@ public class SchematicCommands { uri = file.toURI(); } format.hold(actor, uri, in); + if (randomRotate) { + AffineTransform transform = new AffineTransform(); + int rotate = 90 * ThreadLocalRandom.current().nextInt(4); + transform = transform.rotateY(rotate); + session.getClipboard().setTransform(transform); + } actor.print(Caption.of("fawe.worldedit.schematic.schematic.loaded", filename)); } catch (IllegalArgumentException e) { actor.print(Caption.of("worldedit.schematic.unknown-filename", TextComponent.of(filename))); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ClipboardBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ClipboardBrush.java index aac36df2f..b9c7dc45c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ClipboardBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ClipboardBrush.java @@ -27,9 +27,13 @@ import com.sk89q.worldedit.function.operation.Operation; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.math.transform.AffineTransform; +import com.sk89q.worldedit.math.transform.Transform; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.session.ClipboardHolder; +import java.util.concurrent.ThreadLocalRandom; + public class ClipboardBrush implements Brush { private final ClipboardHolder holder; @@ -38,6 +42,9 @@ public class ClipboardBrush implements Brush { private final boolean pasteEntities; private final boolean pasteBiomes; private final Mask sourceMask; + //FAWE start - random rotation + private final boolean randomRotate; + //FAWE end public ClipboardBrush(ClipboardHolder holder, boolean ignoreAirBlocks, boolean usingOrigin) { this.holder = holder; @@ -46,23 +53,48 @@ public class ClipboardBrush implements Brush { this.pasteBiomes = false; this.pasteEntities = false; this.sourceMask = null; + //FAWE start - random rotation + this.randomRotate = false; + //FAWE end } public ClipboardBrush( ClipboardHolder holder, boolean ignoreAirBlocks, boolean usingOrigin, boolean pasteEntities, boolean pasteBiomes, Mask sourceMask ) { + //FAWE start - random rotation + this(holder, ignoreAirBlocks, usingOrigin, pasteEntities, pasteBiomes, sourceMask, false); + } + + public ClipboardBrush( + ClipboardHolder holder, boolean ignoreAirBlocks, boolean usingOrigin, boolean pasteEntities, + boolean pasteBiomes, Mask sourceMask, boolean randomRotate + ) { + //FAWE end this.holder = holder; this.ignoreAirBlocks = ignoreAirBlocks; this.usingOrigin = usingOrigin; this.pasteEntities = pasteEntities; this.pasteBiomes = pasteBiomes; this.sourceMask = sourceMask; + this.randomRotate = true; } @Override public void build(EditSession editSession, BlockVector3 position, Pattern pattern, double size) throws MaxChangedBlocksException { + //FAWE start - random rotation + Transform originalTransform = holder.getTransform(); + Transform transform = new AffineTransform(); + if (this.randomRotate) { + int rotate = 90 * ThreadLocalRandom.current().nextInt(4); + transform = ((AffineTransform) transform).rotateY(rotate); + if (originalTransform != null) { + transform = originalTransform.combine(transform); + } + } + holder.setTransform(transform); + //FAWE end Clipboard clipboard = holder.getClipboard(); Region region = clipboard.getRegion(); BlockVector3 centerOffset = region.getCenter().toBlockPoint().subtract(clipboard.getOrigin()); @@ -77,6 +109,10 @@ public class ClipboardBrush implements Brush { .build(); Operations.completeLegacy(operation); + //FAWE start - random rotation + // reset transform + holder.setTransform(originalTransform); + //FAWE end } } From a553961c05df12693a625f46e0587e0bc3e7c44b Mon Sep 17 00:00:00 2001 From: Jordan Date: Sat, 27 May 2023 13:25:07 +0100 Subject: [PATCH 043/161] refactor: switch to EnumSet for heightmaps to improve performance (#2248) --- .../java/com/fastasyncworldedit/core/queue/IChunkSet.java | 4 ++-- .../core/queue/implementation/blocks/CharSetBlocks.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkSet.java index 79aed9f23..6d1f5c430 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkSet.java @@ -9,7 +9,7 @@ import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockStateHolder; import javax.annotation.Nullable; -import java.util.HashMap; +import java.util.EnumMap; import java.util.Map; import java.util.Set; import java.util.UUID; @@ -95,7 +95,7 @@ public interface IChunkSet extends IBlocks, OutputExtent { } default Map getHeightMaps() { - return new HashMap<>(); + return new EnumMap<>(HeightMapType.class); } @Override diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java index 291a3cf57..6f5129f4f 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java @@ -15,7 +15,7 @@ import com.sk89q.worldedit.world.block.BlockTypesCache; import java.util.Arrays; import java.util.Collections; -import java.util.HashMap; +import java.util.EnumMap; import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -40,7 +40,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet { public BlockVector3ChunkMap tiles; public HashSet entities; public HashSet entityRemoves; - public Map heightMaps; + public EnumMap heightMaps; private boolean fastMode = false; private int bitMask = -1; @@ -93,7 +93,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet { @Override public Map getHeightMaps() { - return heightMaps == null ? new HashMap<>() : heightMaps; + return heightMaps == null ? new EnumMap<>(HeightMapType.class) : heightMaps; } @Override @@ -177,7 +177,7 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet { @Override public void setHeightMap(HeightMapType type, int[] heightMap) { if (heightMaps == null) { - heightMaps = new HashMap<>(); + heightMaps = new EnumMap<>(HeightMapType.class); } heightMaps.put(type, heightMap); } From 03487718e7a293fe93457dba7ae1d2d25230406d Mon Sep 17 00:00:00 2001 From: Jordan Date: Wed, 31 May 2023 16:48:45 +0100 Subject: [PATCH 044/161] feat: configurable image hosts (#2243) --- .../core/configuration/Settings.java | 8 ++++++++ .../core/util/MainUtil.java | 19 ++++++++++++++++--- .../core/util/image/ImageUtil.java | 7 +++++-- .../worldedit/command/BrushCommands.java | 7 +++---- .../worldedit/command/GenerationCommands.java | 7 +++---- 5 files changed, 35 insertions(+), 13 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java index 50b515257..0c895adf9 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java @@ -671,6 +671,14 @@ public class Settings extends Config { }) public int MAX_IMAGE_SIZE = 8294400; + @Comment({ + "Whitelist of hostnames to allow images to be downloaded from", + " - Adding '*' to the list will allow any host, but this is NOT adviseable", + " - Crash exploits exist with malformed images", + " - See: https://medium.com/chargebee-engineering/perils-of-parsing-pixel-flood-attack-on-java-imageio-a97aeb06637d" + }) + public List ALLOWED_IMAGE_HOSTS = new ArrayList<>(Collections.singleton(("i.imgur.com"))); + } public static class EXTENT { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MainUtil.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MainUtil.java index 8deb59d13..8122a840c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MainUtil.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/MainUtil.java @@ -52,6 +52,7 @@ import java.io.PrintWriter; import java.lang.reflect.Array; import java.net.HttpURLConnection; import java.net.MalformedURLException; +import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.net.URLConnection; @@ -68,7 +69,6 @@ import java.nio.file.StandardCopyOption; import java.nio.file.attribute.BasicFileAttributes; import java.util.ArrayList; import java.util.Arrays; -import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Locale; @@ -81,10 +81,8 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.function.BiConsumer; import java.util.function.Consumer; import java.util.regex.Pattern; -import java.util.zip.DataFormatException; import java.util.zip.Deflater; import java.util.zip.GZIPInputStream; -import java.util.zip.Inflater; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -533,6 +531,21 @@ public class MainUtil { return readImage(new FileInputStream(file)); } + public static void checkImageHost(URI uri) throws IOException { + if (Settings.settings().WEB.ALLOWED_IMAGE_HOSTS.contains("*")) { + return; + } + String host = uri.getHost(); + if (Settings.settings().WEB.ALLOWED_IMAGE_HOSTS.stream().anyMatch(host::equalsIgnoreCase)) { + return; + } + throw new IOException(String.format( + "Host `%s` not allowed! Whitelisted image hosts are: %s", + host, + StringMan.join(Settings.settings().WEB.ALLOWED_IMAGE_HOSTS, ", ") + )); + } + public static BufferedImage toRGB(BufferedImage src) { if (src == null) { return src; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/image/ImageUtil.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/image/ImageUtil.java index a8998e1f0..f99a17e6f 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/image/ImageUtil.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/image/ImageUtil.java @@ -203,6 +203,7 @@ public class ImageUtil { arg = "https://i.imgur.com/" + arg.split("imgur.com/")[1] + ".png"; } URL url = new URL(arg); + MainUtil.checkImageHost(url.toURI()); BufferedImage img = MainUtil.readImage(url); if (img == null) { throw new IOException("Failed to read " + url + ", please try again later"); @@ -218,7 +219,7 @@ public class ImageUtil { return MainUtil.readImage(file); } throw new InputParseException(Caption.of("fawe.error.invalid-image", TextComponent.of(arg))); - } catch (IOException e) { + } catch (IOException | URISyntaxException e) { throw new InputParseException(TextComponent.of(e.getMessage())); } } @@ -229,7 +230,9 @@ public class ImageUtil { if (arg.contains("imgur.com") && !arg.contains("i.imgur.com")) { arg = "https://i.imgur.com/" + arg.split("imgur.com/")[1] + ".png"; } - return new URL(arg).toURI(); + URI uri = new URI(arg); + MainUtil.checkImageHost(uri); + return uri; } if (arg.startsWith("file:/")) { arg = arg.replaceFirst("file:/+", ""); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java index d378decb1..358f75413 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java @@ -134,6 +134,7 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.URI; +import java.net.URISyntaxException; import java.net.URL; import java.nio.file.FileSystems; import java.util.List; @@ -521,11 +522,9 @@ public class BrushCommands { @Switch(name = 'a', desc = "Use image Alpha") boolean alpha, @Switch(name = 'f', desc = "Blend the image with existing terrain") boolean fadeOut ) - throws WorldEditException, IOException { + throws WorldEditException, IOException, URISyntaxException { URL url = new URL(imageURL); - if (!url.getHost().equalsIgnoreCase("i.imgur.com")) { - throw new IOException("Only i.imgur.com links are allowed!"); - } + MainUtil.checkImageHost(url.toURI()); BufferedImage image = MainUtil.readImage(url); worldEdit.checkMaxBrushRadius(radius); if (yscale != 1) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java index a1e6034f5..ca67ad132 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java @@ -65,6 +65,7 @@ import org.jetbrains.annotations.Range; import java.awt.RenderingHints; import java.awt.image.BufferedImage; import java.io.IOException; +import java.net.URISyntaxException; import java.net.URL; import java.util.List; import java.util.concurrent.ExecutorService; @@ -580,12 +581,10 @@ public class GenerationCommands { @Arg(desc = "boolean", def = "true") boolean randomize, @Arg(desc = "TODO", def = "100") int threshold, @Arg(desc = "BlockVector2", def = "") BlockVector2 dimensions - ) throws WorldEditException, IOException { + ) throws WorldEditException, IOException, URISyntaxException { TextureUtil tu = Fawe.instance().getCachedTextureUtil(randomize, 0, threshold); URL url = new URL(imageURL); - if (!url.getHost().equalsIgnoreCase("i.imgur.com")) { - throw new IOException("Only i.imgur.com links are allowed!"); - } + MainUtil.checkImageHost(url.toURI()); if (dimensions != null) { checkCommandArgument( (long) dimensions.getX() * dimensions.getZ() <= Settings.settings().WEB.MAX_IMAGE_SIZE, From 7ce17e5834dc5dad9f4286e5d61bf1a384c54277 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 1 Jun 2023 09:23:17 +0200 Subject: [PATCH 045/161] Update dependency com.sk89q.worldguard:worldguard-bukkit to v7.0.8 (#2255) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6d1869213..388f45d9b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ log4j = "2.19.0" # Plugins dummypermscompat = "1.10" -worldguard-bukkit = "7.0.7" +worldguard-bukkit = "7.0.8" mapmanager = "1.8.0-SNAPSHOT" griefprevention = "16.18.1" griefdefender = "2.1.0-SNAPSHOT" From 228e84e5552f6eacde25a3236925161d5373bd7a Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 1 Jun 2023 15:11:16 +0100 Subject: [PATCH 046/161] fix: Improve edit processing (#2247) --- .../com/fastasyncworldedit/core/Fawe.java | 5 +- .../core/configuration/Settings.java | 4 +- .../core/math/BlockVector3ChunkMap.java | 15 +- .../core/queue/IChunkSet.java | 12 + .../queue/implementation/QueueHandler.java | 3 +- .../SingleThreadQueueExtent.java | 16 +- .../implementation/blocks/CharSetBlocks.java | 68 ++- .../blocks/ThreadUnsafeCharBlocks.java | 536 ++++++++++++++++++ .../implementation/chunk/ChunkHolder.java | 2 +- 9 files changed, 638 insertions(+), 23 deletions(-) create mode 100644 worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java index edde8ed49..8b8e6c530 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java @@ -339,9 +339,10 @@ public class Fawe { Settings.settings().QUEUE.TARGET_SIZE, Settings.settings().QUEUE.PARALLEL_THREADS ); - if (Settings.settings().QUEUE.TARGET_SIZE < 2 * Settings.settings().QUEUE.PARALLEL_THREADS) { + if (Settings.settings().QUEUE.TARGET_SIZE < 4 * Settings.settings().QUEUE.PARALLEL_THREADS) { LOGGER.error( - "queue.target_size is {}, and queue.parallel_threads is {}. It is HIGHLY recommended that queue" + ".target_size be at least twice queue.parallel_threads or higher.", + "queue.target_size is {}, and queue.parallel_threads is {}. It is HIGHLY recommended that queue" + + ".target_size be at least four times queue.parallel_threads or greater.", Settings.settings().QUEUE.TARGET_SIZE, Settings.settings().QUEUE.PARALLEL_THREADS ); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java index 0c895adf9..5eba1f01f 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java @@ -520,10 +520,10 @@ public class Settings extends Config { " - A smaller value will reduce memory usage", " - A value too small may break some operations (deform?)", " - Values smaller than the configurated parallel-threads are not accepted", - " - It is recommended this option be at least 2x greater than parallel-threads" + " - It is recommended this option be at least 4x greater than parallel-threads" }) - public int TARGET_SIZE = 64; + public int TARGET_SIZE = 8 * Runtime.getRuntime().availableProcessors(); @Comment({ "Force FAWE to start placing chunks regardless of whether an edit is finished processing", " - A larger value will use slightly less CPU time", diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BlockVector3ChunkMap.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BlockVector3ChunkMap.java index 775f96e4d..a9f8a0210 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BlockVector3ChunkMap.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/BlockVector3ChunkMap.java @@ -9,7 +9,20 @@ import java.util.Map; public class BlockVector3ChunkMap implements IAdaptedMap { - private final Int2ObjectArrayMap map = new Int2ObjectArrayMap<>(); + private final Int2ObjectArrayMap map; + + public BlockVector3ChunkMap() { + map = new Int2ObjectArrayMap<>(); + } + + /** + * Create a new instance that is a copy of an existing map + * + * @param map existing map to copy + */ + public BlockVector3ChunkMap(BlockVector3ChunkMap map) { + this.map = new Int2ObjectArrayMap<>(map.getParent()); + } @Override public Map getParent() { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkSet.java index 6d1f5c430..1af60b3a2 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkSet.java @@ -8,6 +8,7 @@ import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BlockStateHolder; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.EnumMap; import java.util.Map; @@ -115,4 +116,15 @@ public interface IChunkSet extends IBlocks, OutputExtent { */ boolean hasBiomes(int layer); + /** + * Create an entirely distinct copy of this SET instance. All mutable data must be copied to sufficiently prevent leakage + * between the copy and the original. + * + * @return distinct new {@link IChunkSet instance} + */ + @Nonnull + default IChunkSet createCopy() { + return this; + } + } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java index 49ebd84ca..2091a0bb9 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java @@ -53,7 +53,6 @@ public abstract class QueueHandler implements Trimable, Runnable { */ private long last; private long allocate = 50; - private double targetTPS = 18; public QueueHandler() { TaskManager.taskManager().repeat(this, 1); @@ -87,7 +86,7 @@ public abstract class QueueHandler implements Trimable, Runnable { private long getAllocate() { long now = System.currentTimeMillis(); - targetTPS = 18 - Math.max(Settings.settings().QUEUE.EXTRA_TIME_MS * 0.05, 0); + double targetTPS = 18 - Math.max(Settings.settings().QUEUE.EXTRA_TIME_MS * 0.05, 0); long diff = 50 + this.last - (this.last = now); long absDiff = Math.abs(diff); if (diff == 0) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java index 8ad257c76..a41d8786b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java @@ -275,8 +275,8 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen * Get a new IChunk from either the pool, or create a new one
+ Initialize it at the * coordinates * - * @param chunkX - * @param chunkZ + * @param chunkX X chunk coordinate + * @param chunkZ Z chunk coordinate * @return IChunk */ private ChunkHolder poolOrCreate(int chunkX, int chunkZ) { @@ -309,19 +309,11 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen // If queueing is enabled AND either of the following // - memory is low & queue size > num threads + 8 // - queue size > target size and primary queue has less than num threads submissions - if (enabledQueue && ((lowMem && size > Settings.settings().QUEUE.PARALLEL_THREADS + 8) || (size > Settings.settings().QUEUE.TARGET_SIZE && Fawe - .instance() - .getQueueHandler() - .isUnderutilized()))) { + int targetSize = lowMem ? Settings.settings().QUEUE.PARALLEL_THREADS + 8 : Settings.settings().QUEUE.TARGET_SIZE; + if (enabledQueue && size > targetSize && (lowMem || Fawe.instance().getQueueHandler().isUnderutilized())) { chunk = chunks.removeFirst(); final Future future = submitUnchecked(chunk); if (future != null && !future.isDone()) { - final int targetSize; - if (lowMem) { - targetSize = Settings.settings().QUEUE.PARALLEL_THREADS + 8; - } else { - targetSize = Settings.settings().QUEUE.TARGET_SIZE; - } pollSubmissions(targetSize, lowMem); submissions.add(future); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java index 6f5129f4f..b29c2f18e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java @@ -20,7 +20,6 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.UUID; -import java.util.stream.IntStream; public class CharSetBlocks extends CharBlocks implements IChunkSet { @@ -306,8 +305,12 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet { || (heightMaps != null && !heightMaps.isEmpty())) { return false; } - //noinspection SimplifyStreamApiCallChains - this is faster than using #noneMatch - return !IntStream.range(minSectionPosition, maxSectionPosition + 1).anyMatch(this::hasSection); + for (int i = minSectionPosition; i <= maxSectionPosition; i++) { + if (hasSection(i)) { + return false; + } + } + return true; } @Override @@ -316,6 +319,9 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet { tiles = null; entities = null; entityRemoves = null; + light = null; + skyLight = null; + heightMaps = null; super.reset(); return null; } @@ -329,6 +335,62 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet { return biomes != null && biomes[layer] != null; } + @Override + public ThreadUnsafeCharBlocks createCopy() { + char[][] blocksCopy = new char[sectionCount][]; + for (int i = 0; i < sectionCount; i++) { + if (blocks[i] != null) { + blocksCopy[i] = new char[FaweCache.INSTANCE.BLOCKS_PER_LAYER]; + System.arraycopy(blocks[i], 0, blocksCopy[i], 0, FaweCache.INSTANCE.BLOCKS_PER_LAYER); + } + } + BiomeType[][] biomesCopy; + if (biomes == null) { + biomesCopy = null; + } else { + biomesCopy = new BiomeType[sectionCount][]; + for (int i = 0; i < sectionCount; i++) { + if (biomes[i] != null) { + biomesCopy[i] = new BiomeType[biomes[i].length]; + System.arraycopy(biomes[i], 0, biomesCopy[i], 0, biomes[i].length); + } + } + } + char[][] lightCopy = createLightCopy(light, sectionCount); + char[][] skyLightCopy = createLightCopy(skyLight, sectionCount); + return new ThreadUnsafeCharBlocks( + blocksCopy, + minSectionPosition, + maxSectionPosition, + biomesCopy, + sectionCount, + lightCopy, + skyLightCopy, + tiles != null ? new BlockVector3ChunkMap<>(tiles) : null, + entities != null ? new HashSet<>(entities) : null, + entityRemoves != null ? new HashSet<>(entityRemoves) : null, + heightMaps != null ? new EnumMap<>(heightMaps) : null, + defaultOrdinal(), + fastMode, + bitMask + ); + } + + static char[][] createLightCopy(char[][] lightArr, int sectionCount) { + if (lightArr == null) { + return null; + } else { + char[][] lightCopy = new char[sectionCount][]; + for (int i = 0; i < sectionCount; i++) { + if (lightArr[i] != null) { + lightCopy[i] = new char[lightArr[i].length]; + System.arraycopy(lightArr[i], 0, lightCopy[i], 0, lightArr[i].length); + } + } + return lightCopy; + } + } + @Override public char[] load(final int layer) { updateSectionIndexRange(layer); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java new file mode 100644 index 000000000..a423b3286 --- /dev/null +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java @@ -0,0 +1,536 @@ +package com.fastasyncworldedit.core.queue.implementation.blocks; + +import com.fastasyncworldedit.core.Fawe; +import com.fastasyncworldedit.core.FaweCache; +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; +import com.fastasyncworldedit.core.math.BlockVector3ChunkMap; +import com.fastasyncworldedit.core.queue.IBlocks; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.internal.util.LogManagerCompat; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypesCache; +import org.apache.logging.log4j.Logger; +import org.jetbrains.annotations.Nullable; + +import java.util.Arrays; +import java.util.Collections; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; + +/** + * Equivalent to {@link CharSetBlocks} without any attempt to make thread-safe for improved performance. + * This is currently only used as a "copy" of {@link CharSetBlocks} to provide to + * {@link com.fastasyncworldedit.core.queue.IBatchProcessor} instances for processing without overlapping the continuing edit. + * + * @since TODO + */ +public class ThreadUnsafeCharBlocks implements IChunkSet, IBlocks { + + private static final Logger LOGGER = LogManagerCompat.getLogger(); + + private final char defaultOrdinal; + private char[][] blocks; + private int minSectionPosition; + private int maxSectionPosition; + private int sectionCount; + private BiomeType[][] biomes; + private char[][] light; + private char[][] skyLight; + private BlockVector3ChunkMap tiles; + private HashSet entities; + private HashSet entityRemoves; + private Map heightMaps; + private boolean fastMode; + private int bitMask; + + /** + * New instance given the data stored in a {@link CharSetBlocks} instance. + * + * @since TODO + */ + ThreadUnsafeCharBlocks( + char[][] blocks, + int minSectionPosition, + int maxSectionPosition, + BiomeType[][] biomes, + int sectionCount, + char[][] light, + char[][] skyLight, + BlockVector3ChunkMap tiles, + HashSet entities, + HashSet entityRemoves, + Map heightMaps, + char defaultOrdinal, + boolean fastMode, + int bitMask + ) { + this.blocks = blocks; + this.minSectionPosition = minSectionPosition; + this.maxSectionPosition = maxSectionPosition; + this.biomes = biomes; + this.sectionCount = sectionCount; + this.light = light; + this.skyLight = skyLight; + this.tiles = tiles; + this.entities = entities; + this.entityRemoves = entityRemoves; + this.heightMaps = heightMaps; + this.defaultOrdinal = defaultOrdinal; + this.fastMode = fastMode; + this.bitMask = bitMask; + } + + @Override + public boolean hasSection(int layer) { + layer -= minSectionPosition; + return layer >= 0 && layer < blocks.length && blocks[layer] != null && blocks[layer].length == FaweCache.INSTANCE.BLOCKS_PER_LAYER; + } + + @Override + public char[] load(int layer) { + updateSectionIndexRange(layer); + layer -= minSectionPosition; + return blocks[layer]; + } + + @Nullable + @Override + public char[] loadIfPresent(int layer) { + layer -= minSectionPosition; + return blocks[layer]; + } + + @Override + public Map getTiles() { + return tiles == null ? Collections.emptyMap() : tiles; + } + + @Override + public CompoundTag getTile(int x, int y, int z) { + return tiles.get(x, y, z); + } + + @Override + public Set getEntities() { + return entities == null ? Collections.emptySet() : entities; + } + + @Override + public Map getHeightMaps() { + return heightMaps == null ? new HashMap<>() : heightMaps; + } + + @Override + public void removeSectionLighting(int layer, boolean sky) { + updateSectionIndexRange(layer); + layer -= minSectionPosition; + if (light == null) { + light = new char[sectionCount][]; + } + if (light[layer] == null) { + light[layer] = new char[4096]; + } + Arrays.fill(light[layer], (char) 0); + if (sky) { + if (skyLight == null) { + skyLight = new char[sectionCount][]; + } + if (skyLight[layer] == null) { + skyLight[layer] = new char[4096]; + } + Arrays.fill(skyLight[layer], (char) 0); + } + } + + @Override + public boolean trim(boolean aggressive, int layer) { + return false; + } + + @Override + public int getSectionCount() { + return sectionCount; + } + + @Override + public int getMaxSectionPosition() { + return maxSectionPosition; + } + + @Override + public int getMinSectionPosition() { + return minSectionPosition; + } + + public char get(int x, int y, int z) { + int layer = (y >> 4); + if (!hasSection(layer)) { + return defaultOrdinal; + } + final int index = (y & 15) << 8 | z << 4 | x; + return blocks[layer - minSectionPosition][index]; + } + + @Override + public BiomeType getBiomeType(int x, int y, int z) { + int layer; + if (biomes == null || (y >> 4) < minSectionPosition || (y >> 4) > maxSectionPosition) { + return null; + } else if (biomes[(layer = (y >> 4) - minSectionPosition)] == null) { + return null; + } + return biomes[layer][(y & 15) >> 2 | (z >> 2) << 2 | x >> 2]; + } + + @Override + public BlockState getBlock(int x, int y, int z) { + return BlockTypesCache.states[get(x, y, z)]; + } + + @Override + public boolean setBiome(int x, int y, int z, BiomeType biome) { + updateSectionIndexRange(y >> 4); + int layer = (y >> 4) - minSectionPosition; + if (biomes == null) { + biomes = new BiomeType[sectionCount][]; + biomes[layer] = new BiomeType[64]; + } else if (biomes[layer] == null) { + biomes[layer] = new BiomeType[64]; + } + biomes[layer][(y & 12) << 2 | (z & 12) | (x & 12) >> 2] = biome; + return true; + } + + @Override + public boolean setBiome(BlockVector3 position, BiomeType biome) { + return setBiome(position.getX(), position.getY(), position.getZ(), biome); + } + + public void set(int x, int y, int z, char value) { + final int layer = y >> 4; + final int index = (y & 15) << 8 | z << 4 | x; + try { + blocks[layer][index] = value; + } catch (ArrayIndexOutOfBoundsException exception) { + LOGGER.error("Tried setting block at coordinates (" + x + "," + y + "," + z + ")"); + assert Fawe.platform() != null; + LOGGER.error("Layer variable was = {}", layer, exception); + } + } + + @Override + public > boolean setBlock(int x, int y, int z, T holder) { + updateSectionIndexRange(y >> 4); + set(x, y, z, holder.getOrdinalChar()); + holder.applyTileEntity(this, x, y, z); + return true; + } + + @Override + public void setBlocks(int layer, char[] data) { + updateSectionIndexRange(layer); + layer -= minSectionPosition; + this.blocks[layer] = data; + } + + @Override + public boolean isEmpty() { + if (biomes != null + || light != null + || skyLight != null + || (entities != null && !entities.isEmpty()) + || (tiles != null && !tiles.isEmpty()) + || (entityRemoves != null && !entityRemoves.isEmpty()) + || (heightMaps != null && !heightMaps.isEmpty())) { + return false; + } + for (int i = minSectionPosition; i <= maxSectionPosition; i++) { + if (hasSection(i)) { + return false; + } + } + return true; + } + + @Override + public boolean setTile(int x, int y, int z, CompoundTag tile) { + updateSectionIndexRange(y >> 4); + if (tiles == null) { + tiles = new BlockVector3ChunkMap<>(); + } + tiles.put(x, y, z, tile); + return true; + } + + @Override + public void setBlockLight(int x, int y, int z, int value) { + updateSectionIndexRange(y >> 4); + if (light == null) { + light = new char[sectionCount][]; + } + final int layer = (y >> 4) - minSectionPosition; + if (light[layer] == null) { + char[] c = new char[4096]; + Arrays.fill(c, (char) 16); + light[layer] = c; + } + final int index = (y & 15) << 8 | (z & 15) << 4 | (x & 15); + light[layer][index] = (char) value; + } + + @Override + public void setSkyLight(int x, int y, int z, int value) { + updateSectionIndexRange(y >> 4); + if (skyLight == null) { + skyLight = new char[sectionCount][]; + } + final int layer = (y >> 4) - minSectionPosition; + if (skyLight[layer] == null) { + char[] c = new char[4096]; + Arrays.fill(c, (char) 16); + skyLight[layer] = c; + } + final int index = (y & 15) << 8 | (z & 15) << 4 | (x & 15); + skyLight[layer][index] = (char) value; + } + + @Override + public void setHeightMap(HeightMapType type, int[] heightMap) { + if (heightMaps == null) { + heightMaps = new EnumMap<>(HeightMapType.class); + } + heightMaps.put(type, heightMap); + } + + @Override + public void setLightLayer(int layer, char[] toSet) { + updateSectionIndexRange(layer); + if (light == null) { + light = new char[sectionCount][]; + } + layer -= minSectionPosition; + light[layer] = toSet; + } + + @Override + public void setSkyLightLayer(int layer, char[] toSet) { + updateSectionIndexRange(layer); + if (skyLight == null) { + skyLight = new char[sectionCount][]; + } + layer -= minSectionPosition; + skyLight[layer] = toSet; + } + + @Override + public void setFullBright(int layer) { + updateSectionIndexRange(layer); + layer -= minSectionPosition; + if (light == null) { + light = new char[sectionCount][]; + } + if (light[layer] == null) { + light[layer] = new char[4096]; + } + if (skyLight == null) { + skyLight = new char[sectionCount][]; + } + if (skyLight[layer] == null) { + skyLight[layer] = new char[4096]; + } + Arrays.fill(light[layer], (char) 15); + Arrays.fill(skyLight[layer], (char) 15); + } + + @Override + public void setEntity(CompoundTag tag) { + if (entities == null) { + entities = new HashSet<>(); + } + entities.add(tag); + } + + @Override + public void removeEntity(UUID uuid) { + if (entityRemoves == null) { + entityRemoves = new HashSet<>(); + } + entityRemoves.add(uuid); + } + + @Override + public void setFastMode(boolean fastMode) { + this.fastMode = fastMode; + } + + @Override + public boolean isFastMode() { + return fastMode; + } + + @Override + public void setBitMask(int bitMask) { + this.bitMask = bitMask; + } + + @Override + public int getBitMask() { + return bitMask; + } + + @Override + public Set getEntityRemoves() { + return entityRemoves == null ? Collections.emptySet() : entityRemoves; + } + + @Override + public BiomeType[][] getBiomes() { + return biomes; + } + + @Override + public boolean hasBiomes() { + return IChunkSet.super.hasBiomes(); + } + + @Override + public char[][] getLight() { + return light; + } + + @Override + public char[][] getSkyLight() { + return skyLight; + } + + @Override + public boolean hasLight() { + return IChunkSet.super.hasLight(); + } + + @Override + public IChunkSet reset() { + blocks = new char[sectionCount][]; + biomes = new BiomeType[sectionCount][]; + light = new char[sectionCount][]; + skyLight = new char[sectionCount][]; + tiles.clear(); + entities.clear(); + entityRemoves.clear(); + heightMaps.clear(); + return this; + } + + @Override + public boolean hasBiomes(int layer) { + layer -= minSectionPosition; + return layer >= 0 && layer < biomes.length && biomes[layer] != null && biomes[layer].length > 0; + } + + @Override + public IChunkSet createCopy() { + char[][] blocksCopy = new char[sectionCount][]; + for (int i = 0; i < sectionCount; i++) { + if (blocks[i] != null) { + blocksCopy[i] = new char[FaweCache.INSTANCE.BLOCKS_PER_LAYER]; + System.arraycopy(blocks[i], 0, blocksCopy[i], 0, FaweCache.INSTANCE.BLOCKS_PER_LAYER); + } + } + BiomeType[][] biomesCopy; + if (biomes == null) { + biomesCopy = null; + } else { + biomesCopy = new BiomeType[sectionCount][]; + for (int i = 0; i < sectionCount; i++) { + if (biomes[i] != null) { + biomesCopy[i] = new BiomeType[biomes[i].length]; + System.arraycopy(biomes[i], 0, biomesCopy[i], 0, biomes[i].length); + } + } + } + char[][] lightCopy = CharSetBlocks.createLightCopy(light, sectionCount); + char[][] skyLightCopy = CharSetBlocks.createLightCopy(skyLight, sectionCount); + return new ThreadUnsafeCharBlocks( + blocksCopy, + minSectionPosition, + maxSectionPosition, + biomesCopy, + sectionCount, + lightCopy, + skyLightCopy, + tiles != null ? new BlockVector3ChunkMap<>(tiles) : null, + entities != null ? new HashSet<>(entities) : null, + entityRemoves != null ? new HashSet<>(entityRemoves) : null, + heightMaps != null ? new HashMap<>(heightMaps) : null, + defaultOrdinal, + fastMode, + bitMask + ); + } + + @Override + public boolean trim(boolean aggressive) { + return false; + } + + // Checks and updates the various section arrays against the new layer index + private void updateSectionIndexRange(int layer) { + if (layer >= minSectionPosition && layer <= maxSectionPosition) { + return; + } + if (layer < minSectionPosition) { + int diff = minSectionPosition - layer; + sectionCount += diff; + char[][] tmpBlocks = new char[sectionCount][]; + System.arraycopy(blocks, 0, tmpBlocks, diff, blocks.length); + blocks = tmpBlocks; + minSectionPosition = layer; + if (biomes != null) { + BiomeType[][] tmpBiomes = new BiomeType[sectionCount][64]; + System.arraycopy(biomes, 0, tmpBiomes, diff, biomes.length); + biomes = tmpBiomes; + } + if (light != null) { + char[][] tmplight = new char[sectionCount][]; + System.arraycopy(light, 0, tmplight, diff, light.length); + light = tmplight; + } + if (skyLight != null) { + char[][] tmplight = new char[sectionCount][]; + System.arraycopy(skyLight, 0, tmplight, diff, skyLight.length); + skyLight = tmplight; + } + } else { + int diff = layer - maxSectionPosition; + sectionCount += diff; + char[][] tmpBlocks = new char[sectionCount][]; + System.arraycopy(blocks, 0, tmpBlocks, 0, blocks.length); + blocks = tmpBlocks; + maxSectionPosition = layer; + if (biomes != null) { + BiomeType[][] tmpBiomes = new BiomeType[sectionCount][64]; + System.arraycopy(biomes, 0, tmpBiomes, 0, biomes.length); + biomes = tmpBiomes; + } + if (light != null) { + char[][] tmplight = new char[sectionCount][]; + System.arraycopy(light, 0, tmplight, 0, light.length); + light = tmplight; + } + if (skyLight != null) { + char[][] tmplight = new char[sectionCount][]; + System.arraycopy(skyLight, 0, tmplight, 0, skyLight.length); + skyLight = tmplight; + } + } + } + +} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java index 9347ecf59..7390758bc 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java @@ -1044,7 +1044,7 @@ public class ChunkHolder> implements IQueueChunk { if (chunkSet != null && !chunkSet.isEmpty()) { chunkSet.setBitMask(bitMask); try { - return this.call(chunkSet, () -> { + return this.call(chunkSet.createCopy(), () -> { this.delegate = NULL; chunkSet = null; calledLock.unlock(stamp); From 03c4bafc4542e5478cd3385600223c4d8ac2afd8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 1 Jun 2023 23:01:56 +0200 Subject: [PATCH 047/161] Update antlr4 to v4.13.0 (#2256) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 388f45d9b..ff364ea0f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -23,7 +23,7 @@ auto-value = "1.10.1" findbugs = "3.0.2" rhino-runtime = "1.7.14" zstd-jni = "1.4.8-1" # Not latest as it can be difficult to obtain latest ZSTD libs -antlr4 = "4.12.0" +antlr4 = "4.13.0" json-simple = "1.1.1" jlibnoise = "1.0.0" jchronic = "0.2.4a" From 7646a067eb09e5999f4b0cf6f43fe7bd10efbbb7 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Fri, 2 Jun 2023 11:40:34 +0200 Subject: [PATCH 048/161] Avoid many threads blocking on AbstractChangeSet#processSet (#2226) --- .../history/changeset/AbstractChangeSet.java | 104 +++++++++++------- .../changeset/AbstractDelegateChangeSet.java | 2 - .../changeset/FaweStreamChangeSet.java | 2 +- 3 files changed, 64 insertions(+), 44 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java index e52ef0cba..b06fc7926 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java @@ -39,19 +39,27 @@ import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.Future; +import java.util.concurrent.Semaphore; import java.util.concurrent.atomic.AtomicInteger; +/** + * This batch processor writes changes to a concrete implementation. + * {@link #processSet(IChunk, IChunkGet, IChunkSet)} is synchronized to guarantee consistency. + * To avoid many blocking threads on this method, changes are enqueued in {@link #queue}. + * This allows to keep other threads free for other work. + */ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor { private static final Logger LOGGER = LogManagerCompat.getLogger(); private final World world; private final AtomicInteger lastException = new AtomicInteger(); - protected AtomicInteger waitingCombined = new AtomicInteger(0); - protected AtomicInteger waitingAsync = new AtomicInteger(0); - - protected boolean closed; + private final Semaphore workerSemaphore = new Semaphore(1, false); + private final ConcurrentLinkedQueue queue = new ConcurrentLinkedQueue<>(); + protected volatile boolean closed; public AbstractChangeSet(World world) { this.world = world; @@ -65,16 +73,11 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor { if (closed) { return; } - waitingAsync.incrementAndGet(); TaskManager.taskManager().async(() -> { - waitingAsync.decrementAndGet(); - synchronized (waitingAsync) { - waitingAsync.notifyAll(); - } try { close(); } catch (IOException e) { - e.printStackTrace(); + LOGGER.catching(e); } }); } @@ -82,20 +85,10 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor { @Override public void flush() { try { - if (!Fawe.isMainThread()) { - while (waitingAsync.get() > 0) { - synchronized (waitingAsync) { - waitingAsync.wait(1000); - } - } - } - while (waitingCombined.get() > 0) { - synchronized (waitingCombined) { - waitingCombined.wait(1000); - } - } - } catch (InterruptedException e) { - e.printStackTrace(); + // drain with this thread too + drainQueue(true); + } catch (Exception e) { + LOGGER.catching(e); } } @@ -125,7 +118,7 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor { } @Override - public synchronized IChunkSet processSet(IChunk chunk, IChunkGet get, IChunkSet set) { + public final synchronized IChunkSet processSet(IChunk chunk, IChunkGet get, IChunkSet set) { int bx = chunk.getX() << 4; int bz = chunk.getZ() << 4; @@ -306,12 +299,12 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor { BaseBlock to = change.getCurrent(); add(loc, from, to); } catch (Exception e) { - e.printStackTrace(); + LOGGER.catching(e); } } public boolean isEmpty() { - return waitingCombined.get() == 0 && waitingAsync.get() == 0 && size() == 0; + return queue.isEmpty() && workerSemaphore.availablePermits() == 1 && size() == 0; } public void add(BlockVector3 loc, BaseBlock from, BaseBlock to) { @@ -353,7 +346,7 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor { add(x, y, z, combinedFrom, combinedTo); } catch (Exception e) { - e.printStackTrace(); + LOGGER.catching(e); } } @@ -362,7 +355,6 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor { } public Future addWriteTask(final Runnable writeTask, final boolean completeNow) { - AbstractChangeSet.this.waitingCombined.incrementAndGet(); Runnable wrappedTask = () -> { try { writeTask.run(); @@ -372,25 +364,55 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor { } else { int hash = t.getMessage().hashCode(); if (lastException.getAndSet(hash) != hash) { - t.printStackTrace(); - } - } - } finally { - if (AbstractChangeSet.this.waitingCombined.decrementAndGet() <= 0) { - synchronized (AbstractChangeSet.this.waitingAsync) { - AbstractChangeSet.this.waitingAsync.notifyAll(); - } - synchronized (AbstractChangeSet.this.waitingCombined) { - AbstractChangeSet.this.waitingCombined.notifyAll(); + LOGGER.catching(t); } } } }; if (completeNow) { wrappedTask.run(); - return Futures.immediateCancelledFuture(); + return Futures.immediateVoidFuture(); } else { - return Fawe.instance().getQueueHandler().submit(wrappedTask); + CompletableFuture task = new CompletableFuture<>(); + queue.add(() -> { + wrappedTask.run(); + task.complete(null); + }); + // make sure changes are processed + triggerWorker(); + return task; + } + } + + private void triggerWorker() { + if (workerSemaphore.availablePermits() == 0) { + return; // fast path to avoid additional tasks: a worker is already draining the queue + } + // create a new worker to drain the current queue + Fawe.instance().getQueueHandler().submit(() -> drainQueue(false)); + } + + private void drainQueue(boolean ignoreRunningState) { + if (!workerSemaphore.tryAcquire()) { + if (ignoreRunningState) { + // ignoreRunningState means we want to block + // even if another thread is already draining + try { + workerSemaphore.acquire(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + } else { + return; // another thread is draining the queue already, ignore + } + } + try { + Runnable next; + while ((next = queue.poll()) != null) { // process all tasks in the queue + next.run(); + } + } finally { + workerSemaphore.release(); } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractDelegateChangeSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractDelegateChangeSet.java index ad3173fd6..195a5fdbd 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractDelegateChangeSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractDelegateChangeSet.java @@ -25,8 +25,6 @@ public class AbstractDelegateChangeSet extends AbstractChangeSet { public AbstractDelegateChangeSet(AbstractChangeSet parent) { super(parent.getWorld()); this.parent = parent; - this.waitingCombined = parent.waitingCombined; - this.waitingAsync = parent.waitingAsync; } public final AbstractChangeSet getParent() { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/FaweStreamChangeSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/FaweStreamChangeSet.java index c75a163f7..c2ae362ae 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/FaweStreamChangeSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/FaweStreamChangeSet.java @@ -258,7 +258,7 @@ public abstract class FaweStreamChangeSet extends AbstractChangeSet { if (blockSize > 0) { return false; } - if (waitingCombined.get() != 0 || waitingAsync.get() != 0) { + if (!super.isEmpty()) { return false; } flush(); From 82418155f63127ba85af9b3ef47b81ed444a36a9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 2 Jun 2023 12:21:16 +0000 Subject: [PATCH 049/161] Update dependency com.github.TownyAdvanced:Towny to v0.99.1.0 (#2254) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: dordsor21 --- gradle/libs.versions.toml | 4 ++-- worldedit-bukkit/build.gradle.kts | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index ff364ea0f..d3b4ba434 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,7 +11,7 @@ mapmanager = "1.8.0-SNAPSHOT" griefprevention = "16.18.1" griefdefender = "2.1.0-SNAPSHOT" residence = "4.5._13.1" -towny = "0.99.0.5" +towny = "0.99.1.0" # Third party bstats = "3.0.2" @@ -54,7 +54,7 @@ mapmanager = { group = "com.github.InventivetalentDev", name = "MapManager", ver griefprevention = { group = "com.github.TechFortress", name = "GriefPrevention", version.ref = "griefprevention" } griefdefender = { group = "com.griefdefender", name = "api", version.ref = "griefdefender" } residence = { group = "com.bekvon.bukkit.residence", name = "Residence", version.ref = "residence" } -towny = { group = "com.github.TownyAdvanced", name = "Towny", version.ref = "towny" } +towny = { group = "com.palmergames.bukkit.towny", name = "towny", version.ref = "towny" } # Third Party bstatsBase = { group = "org.bstats", name = "bstats-base", version.ref = "bstats" } diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index 461d36c99..303e8fb0c 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -32,6 +32,10 @@ repositories { name = "OSS Sonatype Snapshots" url = uri("https://oss.sonatype.org/content/repositories/snapshots/") } + maven { + name = "Glaremasters" + url = uri("https://repo.glaremasters.me/repository/towny/") + } flatDir { dir(File("src/main/resources")) } } From 4fa927f996d63913436fbc50ee77f59af024f3a6 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Fri, 2 Jun 2023 19:39:00 +0200 Subject: [PATCH 050/161] Extract common code when resizing arrays (#2257) --- .../implementation/blocks/CharSetBlocks.java | 92 ++++++++----------- .../blocks/ThreadUnsafeCharBlocks.java | 60 +++++------- 2 files changed, 60 insertions(+), 92 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java index b29c2f18e..9ab8734ea 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/CharSetBlocks.java @@ -410,67 +410,47 @@ public class CharSetBlocks extends CharBlocks implements IChunkSet { if (layer < minSectionPosition) { int diff = minSectionPosition - layer; sectionCount += diff; - char[][] tmpBlocks = new char[sectionCount][]; - Section[] tmpSections = new Section[sectionCount]; - Object[] tmpSectionLocks = new Object[sectionCount]; - System.arraycopy(blocks, 0, tmpBlocks, diff, blocks.length); - System.arraycopy(sections, 0, tmpSections, diff, sections.length); - System.arraycopy(sectionLocks, 0, tmpSectionLocks, diff, sections.length); - for (int i = 0; i < diff; i++) { - tmpSections[i] = EMPTY; - tmpSectionLocks[i] = new Object(); - } - blocks = tmpBlocks; - sections = tmpSections; - sectionLocks = tmpSectionLocks; minSectionPosition = layer; - if (biomes != null) { - BiomeType[][] tmpBiomes = new BiomeType[sectionCount][64]; - System.arraycopy(biomes, 0, tmpBiomes, diff, biomes.length); - biomes = tmpBiomes; - } - if (light != null) { - char[][] tmplight = new char[sectionCount][]; - System.arraycopy(light, 0, tmplight, diff, light.length); - light = tmplight; - } - if (skyLight != null) { - char[][] tmplight = new char[sectionCount][]; - System.arraycopy(skyLight, 0, tmplight, diff, skyLight.length); - skyLight = tmplight; - } + resizeSectionsArrays(diff, false); // prepend new layer(s) } else { int diff = layer - maxSectionPosition; sectionCount += diff; - char[][] tmpBlocks = new char[sectionCount][]; - Section[] tmpSections = new Section[sectionCount]; - Object[] tmpSectionLocks = new Object[sectionCount]; - System.arraycopy(blocks, 0, tmpBlocks, 0, blocks.length); - System.arraycopy(sections, 0, tmpSections, 0, sections.length); - System.arraycopy(sectionLocks, 0, tmpSectionLocks, 0, sections.length); - for (int i = sectionCount - diff; i < sectionCount; i++) { - tmpSections[i] = EMPTY; - tmpSectionLocks[i] = new Object(); - } - blocks = tmpBlocks; - sections = tmpSections; - sectionLocks = tmpSectionLocks; maxSectionPosition = layer; - if (biomes != null) { - BiomeType[][] tmpBiomes = new BiomeType[sectionCount][64]; - System.arraycopy(biomes, 0, tmpBiomes, 0, biomes.length); - biomes = tmpBiomes; - } - if (light != null) { - char[][] tmplight = new char[sectionCount][]; - System.arraycopy(light, 0, tmplight, 0, light.length); - light = tmplight; - } - if (skyLight != null) { - char[][] tmplight = new char[sectionCount][]; - System.arraycopy(skyLight, 0, tmplight, 0, skyLight.length); - skyLight = tmplight; - } + resizeSectionsArrays(diff, true); // append new layer(s) + } + } + + private void resizeSectionsArrays(int diff, boolean appendNew) { + char[][] tmpBlocks = new char[sectionCount][]; + Section[] tmpSections = new Section[sectionCount]; + Object[] tmpSectionLocks = new Object[sectionCount]; + int destPos = appendNew ? 0 : diff; + System.arraycopy(blocks, 0, tmpBlocks, destPos, blocks.length); + System.arraycopy(sections, 0, tmpSections, destPos, sections.length); + System.arraycopy(sectionLocks, 0, tmpSectionLocks, destPos, sections.length); + int toFillFrom = appendNew ? sectionCount - diff : 0; + int toFillTo = appendNew ? sectionCount : diff; + for (int i = toFillFrom; i < toFillTo; i++) { + tmpSections[i] = EMPTY; + tmpSectionLocks[i] = new Object(); + } + blocks = tmpBlocks; + sections = tmpSections; + sectionLocks = tmpSectionLocks; + if (biomes != null) { + BiomeType[][] tmpBiomes = new BiomeType[sectionCount][64]; + System.arraycopy(biomes, 0, tmpBiomes, destPos, biomes.length); + biomes = tmpBiomes; + } + if (light != null) { + char[][] tmplight = new char[sectionCount][]; + System.arraycopy(light, 0, tmplight, destPos, light.length); + light = tmplight; + } + if (skyLight != null) { + char[][] tmplight = new char[sectionCount][]; + System.arraycopy(skyLight, 0, tmplight, destPos, skyLight.length); + skyLight = tmplight; } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java index a423b3286..9f0aedc11 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java @@ -489,47 +489,35 @@ public class ThreadUnsafeCharBlocks implements IChunkSet, IBlocks { if (layer < minSectionPosition) { int diff = minSectionPosition - layer; sectionCount += diff; - char[][] tmpBlocks = new char[sectionCount][]; - System.arraycopy(blocks, 0, tmpBlocks, diff, blocks.length); - blocks = tmpBlocks; minSectionPosition = layer; - if (biomes != null) { - BiomeType[][] tmpBiomes = new BiomeType[sectionCount][64]; - System.arraycopy(biomes, 0, tmpBiomes, diff, biomes.length); - biomes = tmpBiomes; - } - if (light != null) { - char[][] tmplight = new char[sectionCount][]; - System.arraycopy(light, 0, tmplight, diff, light.length); - light = tmplight; - } - if (skyLight != null) { - char[][] tmplight = new char[sectionCount][]; - System.arraycopy(skyLight, 0, tmplight, diff, skyLight.length); - skyLight = tmplight; - } + resizeSectionsArrays(layer, diff, false); // prepend new layer(s) } else { int diff = layer - maxSectionPosition; sectionCount += diff; - char[][] tmpBlocks = new char[sectionCount][]; - System.arraycopy(blocks, 0, tmpBlocks, 0, blocks.length); - blocks = tmpBlocks; maxSectionPosition = layer; - if (biomes != null) { - BiomeType[][] tmpBiomes = new BiomeType[sectionCount][64]; - System.arraycopy(biomes, 0, tmpBiomes, 0, biomes.length); - biomes = tmpBiomes; - } - if (light != null) { - char[][] tmplight = new char[sectionCount][]; - System.arraycopy(light, 0, tmplight, 0, light.length); - light = tmplight; - } - if (skyLight != null) { - char[][] tmplight = new char[sectionCount][]; - System.arraycopy(skyLight, 0, tmplight, 0, skyLight.length); - skyLight = tmplight; - } + resizeSectionsArrays(layer, diff, true); // append new layer(s) + } + } + + private void resizeSectionsArrays(int layer, int diff, boolean appendNew) { + char[][] tmpBlocks = new char[sectionCount][]; + int destPos = appendNew ? 0 : diff; + System.arraycopy(blocks, 0, tmpBlocks, destPos, blocks.length); + blocks = tmpBlocks; + if (biomes != null) { + BiomeType[][] tmpBiomes = new BiomeType[sectionCount][64]; + System.arraycopy(biomes, 0, tmpBiomes, destPos, biomes.length); + biomes = tmpBiomes; + } + if (light != null) { + char[][] tmplight = new char[sectionCount][]; + System.arraycopy(light, 0, tmplight, destPos, light.length); + light = tmplight; + } + if (skyLight != null) { + char[][] tmplight = new char[sectionCount][]; + System.arraycopy(skyLight, 0, tmplight, destPos, skyLight.length); + skyLight = tmplight; } } From 048dcaf327d025eac80d7add6131b79fe55615f7 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sat, 3 Jun 2023 16:34:23 +0100 Subject: [PATCH 051/161] fix: do not always set random rotate to true - Fixes #2259 - How'd that even get through --- .../com/sk89q/worldedit/command/tool/brush/ClipboardBrush.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ClipboardBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ClipboardBrush.java index b9c7dc45c..e596298ea 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ClipboardBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/ClipboardBrush.java @@ -77,7 +77,7 @@ public class ClipboardBrush implements Brush { this.pasteEntities = pasteEntities; this.pasteBiomes = pasteBiomes; this.sourceMask = sourceMask; - this.randomRotate = true; + this.randomRotate = randomRotate; } @Override From c9a4a9c8b43acc041379133e35f67f27de0282af Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sun, 4 Jun 2023 12:34:03 +0200 Subject: [PATCH 052/161] Update gradle to 8 (#2262) * Update gradle to 8 * Update codeql.yml --- .github/workflows/codeql.yml | 6 ++++++ buildSrc/build.gradle.kts | 2 +- gradle/wrapper/gradle-wrapper.jar | Bin 61574 -> 62076 bytes gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 11 ++++++----- .../adapters/adapter-1_17_1/build.gradle.kts | 4 +++- .../adapters/adapter-1_18_2/build.gradle.kts | 4 +++- .../adapters/adapter-1_19/build.gradle.kts | 4 +++- .../adapters/adapter-1_19_3/build.gradle.kts | 4 +++- .../adapters/adapter-1_19_4/build.gradle.kts | 4 +++- worldedit-core/doctools/build.gradle.kts | 4 ++-- 11 files changed, 31 insertions(+), 14 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 3c5eb079f..3b21f975b 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -18,6 +18,12 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: temurin + cache: gradle + java-version: 17 - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 461e9deaa..de4d0df68 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -23,7 +23,7 @@ val properties = Properties().also { props -> dependencies { implementation(gradleApi()) implementation("org.ajoberstar.grgit:grgit-gradle:5.2.0") - implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.2") + implementation("com.github.johnrengelman:shadow:8.1.1") implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.5.5") } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cbfa754578e88a3dae77fce6e3dea56edbf..c1962a79e29d3e0ab67b14947c167a862655af9b 100644 GIT binary patch delta 13895 zcmZ8|Wmp``)-~=Hdu)0n3Y-8OvyK$p9^s9MM|Aj$miotNhy-{udLczZyd9uWtD)X_{|!LhIEF9y8(e*Z zW>^w$u&x|i9OjL=#6Nl~*ERulzX>8C-}o;iSMRYdfCU5d`~U{V4>HCg0HG4Xg2uP;fn!>S9+>LbuWbc0bETMQfo9~h}yI*TSv;Oikl~t-+xqI-`P$Rj@yi{mr2zC~s1snMT3!OPBdJ%IDnPXq+pl*Z>=+?qo${lkCSKmwTlVjfb3thU6B8yFjr!tphOs*G6 zwL`RyVAUXj4p=9&@PpWK)m+REuvHaq838TEhY^7W+JAp$ zZ^y;8`Z*@VqJ{sFFj?<|7SKS@G`$Yi)gx%nOi@Lr zCv0IJlFz0bP(eDIW(uWNq?;8zEAb+uGgnkLk;y!4XhA6=Eoa<`+|;6mOq>z`%ir@z$4)Mkd3 zF=hFo zyd{*bRQ4YUe^bU*Y`__)Uhu5NIjVJ~a}{lHp-_7wI?#EB11XcqmdY>pk`JJ) zW9Rt!tK=N>fZ!UDomwMnb`0EOvTjcNl=yW@$c!OAg*=l()GjZwSyJ+o^;Zi#I5*uP z$6qeih8&g8E(pNSneK>93A(8*%gvwv!0V|SqGcj55Y7`=N*@pJx_ig3uVuf-G~LJbm`7nxNcZ>Jgqy(LTHu_C2e>STp^Pm{}f&^)XU}vzuU`UV&>e& zqsXNXSs;Wri|?NhCq0vXC5$>9Cag$adyWz^x@NCiy2${9Dc)Y;J8k1Z933W$3$H}g zCQFU1XwzGm_WUheXvnDisH_%BdzMgNwk2^mHcQu*x>U%iN*B^8U(eVz1~(%`kV1Vb z=9T0xmN?bQMyrrd?u}jer}zV&sCK6zSm!zV8A8dP6THF=4*V{_K*E*K<)I(Q^(eV!m!vu##-2g|G z{RB;{gJB_X-w{ANq?ft_n!@=O8_gj6FxW&zO$7L3@NjWt@R{NxMbpHLk6;=2$0P5P=kKc1_85inX z#s$&s0zhV1cz>nRb#|D#N8Z-=Tphm)sGH>9cz3K3I)6XpimJW0(6$GtLzN(YPu9%R zdFXG9|30AZME4r@joC0IdvBBe08mF@+5Dd97p$h=n|pi80Cn2n{ev!S$llPGLqHva zZ3*OmW%!Qj>C$F!Ffafl7#I_1(gz!aa)b{ebU*=yH%^kr=~N?|2&2Df2o9X=2B?U!#R#+Cj45=f@=EcQx+9J z=X3~A=zbX29Fqn23m3dm}0Voj^Q9BjI=MiG+NZ)YCYn@r^qv(xE3=)&i z=(ML301=rNTptvUt2tnsPb1~G*DWFWoZfv)wV|uNW%?!)jju`jN(K-0$JYi!ofNup z9K%_ucHwutbZsl~vDQ!Jtj8uI6WA6K--@?8+_=t>g|kgUeC=w`IP9m&*fuoO3#A;t z&3@=3;J0>yjM89?h5MG$S`wW+=vyYOWQGhIP`^vScM8^JL{mGan5uTJPvAg$0z}8; z zhMi+S${H#^wF;eU-0UHJDo$QwXDjm{ns>^ltubKXtd>6Bq-=ByF%bHu>2&e&uZj2X zgWIq(l^;Ab7#I@h%#j1AtBIkB`GO*y!i;1K+_SZ-p}4jmP7#%E-=>{ zK(3*ObyAgDLnbBLObTWJWNO7<60SK6*!dD~_7JOWTB*}(*X)ox0{lq5ac$ABkcL~0 z9qCHT8^`QIe_4-BW&mIe*&0VT6w|oJ9hnOO&oZUe!rP+gStQ)h5ZPhBprHZI;So+g5}&;adp<|7#r@DG!wXmtwdwy=7i>a`x1D4 z_N$0`Q)>zTVUU%@RzlG=4Nk1hE=_klWj|6aj`KJ@S`y^%bifkdX`s!A#|mpM-x;SF zg;bju5cA0?a}%hk=3AL^#2B>5X(TSne6PDWY5gRVvn6nKl;vg?SIbv^Uz=+4aPUft z-$}QR)+_U?eX*p)V0%#0@S46_6c($OJL^bPj0Ij}up8}In#GQa&Cp<#%ZPjx(^97{ z8AfEgrNRTg-l9WJrNJzHx1EkI<|n(P3VIwFlTvMxfe=V&NL)4MubdHqZF)&Eq4`+% z7z;>s(sjUsebUfFF;~)_%@3BDl8i085o$H!*yBv%Z27d~)|jfg4DhJ&nMb((B#4hOfeBhL)g+r)f%2be?s2ox zT3j0k+Va^9`gqO)FoUV@F|((*vGxN>?5IlvC!BzW-8cyCy_)Fl8W+eg<&Lz^s>dJx zkly@2Xzzi9Uf%|1pF_Nz-3SgOx*+ShK(x=XUlP?;EfoDqAkkwyR*yjIcD#7-@=|Um z{T+V}q`6)wnSO#*N#Hp8QT7^>6R+H^_o4LBc}$aD^@(1!+Y54YF3@A|Cupsfz@Wt8 z!KwmSb9}3l)u^Y+V6W6(bL3hk;XTY4FNy3hKhID#Ep#xLM88?`xT=lw3xsgN;gKK@ zqpElV*j#e;{w`OPYcb1_szKUtRLygjq2ldhGJ$8ksyH(hF%^w`&FH|zlDK`DfuZ_g zs}!{hMk^~48&b=jWqG2*^m8?ERreHIw8dgR`Ugj*t4Uo`^U*56MmU<^ zNxcuRh+Kc2>W~lzD8S6}Xho3s9f}{o4@tIc)G;lKXi(HJhZV{qSH1-xj>P2$NHEK2 z)TjOy%>(9Ot_zPO)^tp@AsSNd+`R?}_2Vd>=eT{G&TfITkeW@p{F+FTJf(n87##z& z!%w+6-!NJ*?9Z(hbZv^BG$Y1`BOo~*k7jaZ)9%@;H6F+W!Q%IV4qSM85; z0%xWZi_wc=CCc>2rd3Rk3C79_rJH1uG?yFIm4f6Fdmts<41T*;3ek&p z3(NaDK3iIDa)MaUD{_;~fMV6obrT6_K$c+eeRBJ7jd)c%0jldoJX`EWz8M$b1s|DS z)cr6)em!+P%GjM6uQb6CQ!FvUb%_>qbKn=gHl=@K-Z*6_VaD=;!?P9pr$Z?6NrB%a zb_G4M-UkkhI>H@+kP;eS4p->q_f+&(R^7hyRsS9Xl94vA^AYlM%tdNdHQz zFQu?Rau!C@&&Dn;i5iEhn3`y>{O-m^_*h+Jp6C?D+5yn9Vq5XVQoUe#BP3}lqvHa} z@x~UctaNE9PwnRg6+15NJ5k(PC0dETm#QxXY6&uTqupm)GVrsvKC9o)&*mLo9?$Ot z!SFjh+!mr{kYE5A#urFIBv?<(6-HtqfprK#3H4dylz5j`Uc)Hz@1}A9OXe=4gf3_- z$P|^SpeQ89xlL`pftC^4tO3N)JXTqmkbruGAsraU5Y$fyMd~L3r3t8-SfkX{n4<`@ zhBKAeBP_1Rd8q`<3^dio2W9^9iYW?#m-!IKDO7ge{vC%1Y>dWLslyLNrm-!*YU3Dy ze|qm9gwdCJKZlwcvaoV%S_%X-k_?QIf2zuAG&32WtJ6NDr0i+<{w;CG_St&I_7HtR zTiR;!)_1iw&#FKwAGFuBze6(_%DLu?>|K(H5bf{br_f5|#qa zNOuJQhSU1PGQ+dltC{ik3sA?PcKcDJg;_^-LCcLGo+|3VsWx0vMNOpKz3*U1wGG0{Z@O=3gt1Ay|67ZJC zGe%Q2bP}rYtE^Lc+ybPES@Snxwlh7Ydq$c{H?d&8e>!Dvt=dFxeS0fvt=u3$KHuU; zKHr9fCbGGQBeJ~@{wdgJi6Ah40fcT>yGRWEe)%=j!AaG~XDaHNdzsU6*ZJ2XC5>lv z=IT$K4yEi0xt7i<^=rn-$1nOKKRQZ$7df4uU#`?ddlH+Oo~+H_Zq!-}6VK;|?PGiI zhbt$ffNJ|--Bn6(L{pZ#!&ykjgBXEs%hmxg3vB~;GMKcAfeq~#2~f9vw7{>?pTu{T zcxLiHNCP}pJ_fYl3^gBy_}h~U`lx1^?)q|U1cti6s?Nt*RvSgF6WD8U%3uk zwC7lEPg``Bjt5YXNFE!^nq zJC-z}n^zNvd{jVhiv9aKNd}lH0$n97EBjb`Fh+7~amqAtrK{@Sn3QZO3BBiUIo^n$ zsiS{+L+8B0e&`mFnEqM!LCLnzlclx?UwZ(L6!FZ$b53#xA2caP^zn&!GVtipn{W`U zvN9yG-?@6)3`HYt>E;wO*N_UGd``TDMJ+e<*WUe$SGeaBU)dJHbvUp$J?}caKfP>U znZQtJY@$~+#6FOn9R6m86Sq3iiaaWa3kiz1k>ntIk2*6R+6gchFxKLcBi9EMRVQrl zP~vO=WAFX7o6BB76*mwH?R^-5HX?KAu`a^Eplkmc zSXpmBvQ4t(kVfyQIR#|Wi7PYcy+x;(5j|LOp3()IiR>2j9**}<*nO2NiED?Z;)iGh&PH4nB*kN{VVt!lYX*(jAlnZkabB{Fa7)iF?pBFk(T+)xyg(Y5TUd;DX&MX&_}`_=Z_KcQ9;Ok=&YEqPyVul9sRG%P!*byO8nRS# zGwOm?IyLaeqMf=7AGF{L7v%GKmeM+;#U;vPs0=0R1WAo2JIq8N`PGDe}Q zt6VP!Fqln^U#5ZJFp?b?d*Q}Ynd3Q)jTU;{RwiqDncXA=DXTWhkWhiR{XF9aobJH{ zEYYt-`Hdwp@ZQ5$_i&f`=DA1D>lgJ>_PkLE6#)L#3R1Giq@XA zCLtGAgOI35<3Y-&55pCx#&@_R?w|x@%3$Q-X|@=Zhuo`C@cOG0@M*&sW@uXQJz-M; z=ZcUIw+bXwCV+k?WF;Ugyrm6gy8KjZmaobl;Omt^`!m*(!@&}j)uCT=+}RbLo7WiC zM*7VJG5hnkugII&>R-Jyx<}$pNBtEizA`Gn{GbTy^WPi*o!^5_gH8ME&+{<}nBbSA*p<6A z{c--0SNgk{iH@g2s&K3L#wl5fR-H5$YrMAEA$gwfPC&GdtAb=bUk$?Md6^mdF&^vj z+iAp=tz8ZK>*?)QgEVBG?CnAb`($wf9*1w->8@)hg(hpH^%IFjGqTs7<*jz0J-*C! zs)=j2cA@=KgS0+*LX^Qe*))69yFm;(i`r6`?_p2Dfi!AQh43;ix#Kv8_*W|IsGg;f zJ=0%L||IPz~u^1P?ZkuO7VD7>GEfT=K*2JP!?hLF1f0rSkXpoIojW`}iLv zt$qt5Kd$Ty5UwS~N|w!IW4-TDG6g9!ecEoE+JUM(=T{d4yASY8>tlDG_XdEUinvXN zl>XB_*;iM^53IG90-1uxg#z{ov9M-y`(|4~g#J?dVQ&7tJ+a=N9npjr(_lb@G$v24 zPeA4UfgSFXLSe$Ghn!^hh)2|+YuV|~a}U+Y9iy?b*TKn*`y{ADmlq%d|HzJn0mW<0 z5McIquX})(09`s?@%4OLy)I^TdiKP=%}XfT`s{oX5eauP0FS#ZH3$bT&E#E)1%_v48Kc&JbnK@KR+fCJ+WWg`;cXecj9ij8zP$MV%S9InmL z#D$p6%KIKx&U;|#5fPg~KlH~fC7Sh-(Ut}5+tSSriumK>DDF&sl2pa_A|~tu_*8aY z(*Ud4=(+k5;ke&7V(y`$@j|FGqk0(WA5Wc(N${j@=7U}Xs^XNgK(<|>qug3-b1T3( z0=#Hgj}+TLlDhVm<>&!j$jvWXm6SLkMW&2k+;_u9Tq#<8uKtToJ3Q^==VQ0eV{+r6 zQn5p9xfHk@%P_FbqYM3DFnxUSXF^sk#Ms{)T4quYP`fK;T+Tj&gRl6sm|74UbHHrF z7h!QzEST^cpRO6L8_~zXNp!niGl&79$k_8RSj0W{xMrR)D4`>~tNrK~*s0gkO-PC^ zu^*~aOBQF>qG>`%KGd+7W{nGqd5lc0%E_*&rn?MObfYvgPvJ%vawv{il#Km=$-hF* z1V^<{OA_t~X|u>{5ljynGhf844dJ#q31&xuibhPgP;6z{C2qw67U617_1*$=(_{mu z@T$|cK0GIz9sS4`1VcT=#Rqfsfiwbly-A61ih$VWK@T{K(t%VCA4=VJ4(eT` zLP`DnbAKO!X02C>qoh6kk2SEE|nQ8^J~0S)XyHMI1`BA+8Q-{{y-|Sc=j6N9xVnV z3^giq-U}tR!`_$ty{geQQ}xVo!CwzlXx}-}k2&VU3u7n@(1G0xP$36j1GKVJtLydS zm|^pz&9wE!Q>OWGMLY+Y?=$lIM$IKdF`8Pw)uhzhmFGtIyWl(qh0C@9BbzwDR>rEa z2gc62w3u1cW+De8tCw(3SQ8EK+t9l|ef|)GLRlRJz>SleVh^o zSq>XS(iJr>IQL-5^9LMn-MBxnO*FN{K2{7JVUpW5nZ{sz&_Z(dXDW?G7lmn%1nU|B zqC_R`=83Y=g^uel37AnfplTx)W_%O1pY@^^#~MgJg`0^G07b7RHOA>7K6Vzom_M3= zbD)3(BXXoqR6UFGHM9a3uK)SxX-0%jvKG23)#s6{vbq>#o$1tZMI5hU1c`fGME7#Ij+u%*rdsnO7yaltUc zz)OZMW*a=_Q|k2CFQ+lR%Md1Kd~``A8LX7vMtOupY7HV^E*;7o5$|Yq;EZjl%s-BLWa)nM| zOY1bfH5&%ed5t0h_`z*>GNiXhoMBw9+W7 z4U!O;)Tz3n;x64wHcYoivoslIkj9IN05|H7X~GWEx-k619Z-KjWv%8@$1wbIvAFfI z0=AQoH{3yl1z|`pSg$(!>x0)nU|wT@4i`lCchm_nrU@Y;XR$D^5wA!Ftl}*9OwXFZ zai&Zh_YNnlz=LEccY_eUXOEY1;q&Pd;dLtf$RffP4%P#4ZyIjV&0;_13^ zIVGMUzx+5jLyq55_Qz0jPBx~-{DfuUW)hKduk1gv0et-e(ZN8;IIdhtV$3N9Bg((Q zw5eHG)FFs=ewUwfdHfvHb$&&i=h{#epIdWr+=YE9)%453DlIOHLFX;%dv2LDNMrMZ zEWU|CvEYY*(2SE$Y{jAd$QU-wd*Hbe5yO+Lu6Ux|(Y>L}E_jNPR+TX@Ch(#orbP8g zv+Z(oKz1gylHHGKB*FbdpSh7VBM2KVmx2oj>?q8|s72`}5s)jT=s4;lbRw$cKh+N{ zVTxW`s~QW~rRB;e|7pxFoJ_Vm^eVjcddUh0Xp(NhCBZ@Uya;(x_wkvyH*^ds{2_H? zs*PV?33(>MyJC_<)JC=|9II5@I`QnNGgZr z5AfQVuy5}nzXlGQGV~eESn9UcL_U$gw(QjDVEW4b-o=BQGBT*a$1Fk+4bm2n^6m6w z_hn7X46IDL7iQZ8s+_(8yX!fXqM9htq_Ts}08b%snTZMmP}{6(anfizqhpR1cR61k z=sfzRN*!0HP{Z76PDg%PUY)rjwhuy71^5D3f^bR;(fQe>3U#zrWwe0OSYjHZ-eSJV zuKnE7`~*u%-HShx%*b9ZPU~(Rg=`lQI$;iBY#2k^6{Ef6e9D&EK^irorXEpE!h=>^ zVxH#pyrndMgk)Ff-ke*RFsPY@B3AM_;Kj`PIJU@EH^QsIUo1wdl_wfqd48O^9?06@ zt*>img{+gG%WiGU+&V)`jeJUPSDDLhd#nVrUr~dURh(&O#gMnA0dEg-#?fg0Wnp#P z;4QjL{Fv?Unq!!)POdN%ZI&vU*Ww};bqd3@5fb_<7mIa_w@U?X&ed5f1FCQ@57aR@ z)TUphLPht{?j%;+T}Sfla?uiG26R^?7=x!#CUXw+$_TQx_%vLhgg8LVJz@{QVxH;M zGcV^6&Z%`yWalhb>$VS`{^Ex`w@cldtZ8t!!exC zu+Msuk)M-ylAjAz8{yA&TjgR`O%H1H0T&$<*+K{2-<~=1E0~C+w@CzUg>GyIegmx$ z$vp-I6CygcS8Jm9rR{Wt@W?<)IdIk##3DUE741Dg@lQ~Lskm-7=|2%)&XCF_8|780 z9d-AgO*4e1uf}M3*FGo&%&eG;OB^Vm_x8i73V3P?d^qdJMvO&{H(jgc?n6UYZ>-FU zeO%|qJ%xvB;o+$e+CHm+Ot1UgzOrX7_G!pZrt%?TaOs9ZPg>i>-gg^Vuu6p>LEd99 zGlCZbE5(oNfEP{~x>KfOZv6XWA8zfk0@R+{;r7WV?(wWFRaGkg&mR3j$wJa7CBWz= znwfnWiE^@dC=n6jrAY4vvH*;b5{E#wK8AoUW`vT3W+8gyt9<*hPl1ID>F3bkLniI?`*u@J2zcd_cAH2?L5O|qzu1jQs$J^g9=beD zYoEgyA^AIv!P%D3;3T_C#zm7j6=+ACjtf5->)lXATb2p>g%qD7L1EbTMh(z$4oMY) zSZft;+pfN?a7x#%4}(P3Q)Gvt1F^8eu9}_PDW&}_2hhqjF#&SGUnz^`=V(U{;B;`G zt7FmRinElmq%KVXaBZL$+hD> zLe`*wO^B_i5W9q8#>l8J4;5{XbZg#@Z9|D|{gN8}jF1XBNzpi*9R3+-F)w8EbJ~In zEdim4jC?)`IzcZ1_`5oBWd#yPJNc%ajkte>^q1KY$#LzK)`jz_7$%1`N1_tdhr^wG zp92GvW>iDG)!1`I3*Y3;C)Jz7**nV;DaO_d19A_8qX%OCf-KY-GEZ#Nv;2CZQ*ht5 zY`vXc7yAb|?h#Z_dEKDC)Wp}g7hJDlI>P+ctKoq`U4!4az+ECGUSGmfHRpW&m_%7? z(o7gajY+w(Le-L(_Al|yQIvl1gk&lX-5BMZn=+~n-N}$`J#2x5x&B1EG{drVp+i;- zucW)%=6bqw%wNB|=k!-_k($v{gQB1ZX`dn0tu@(Z7b0$g5k88nHYIEE zT{wBh?|8X1yS1ITl!hS_>>{cobd%i3<#)=amBnHn>p;m6f%!T!BSP{_9DL_Wmv{PtyL9hoTep$i_uAr>^@7u^a($-HJh2k0xNsYVmt|v+kCWusAE%8~f zgZeq1{C!DL z7|_)gsX-J$DBwOYs|TpK6>I&l2*#dm_B%7y(JCJ?jaOVZJg!;eleEd~bT^pJkrk>q zB4)r!XRL!mow*tX6z6JA){(LgKapsISwxE@P|Hy&;*5I17ktf2EQSu$>0G&bDc^|D zoB?VpoqIQzg72DO!zOL#jXEsFWVZoyX*Q+>cyNC5+bi$(-R z2PXnAH)~j-X7q#KV*r7K0Tj#Pt=_Ix!xQizqfxG}vfg*swPul)E%ElLW)2B0BOb4U z$5{w|1BT44k;f7uS&T@0UH_mBvgr?Q_m;tun8!5sqbDu3_a@H76e`xzggnje$~Vo7 za$jN9vO%&+?c(NFBWd(HH(c*Tf3txzhrnp4X1859WXnbk!aVPy#xl`hJYOb;9$6q{ zkbx6NHJ;r$;+CoL5@BT|)P$#Nd4mLhJ?! z#V8L2#1$FDnc_k5#=YeMy9&SHkG_wJOT1g%-w$u1eta|QD44f{Y&WqiWW218tS?qy z$ZDkAwNCgrzLY?-u2WO8%SB`AO_vLdwg{s)2>YT(Vp}$u)h6yDPl(o)wFGQ6GTv9!92`>rC_Xgn9)BKfMk>B0lFK$_ux zk^my^G@g^?|Ds?LnEwzyJ7qzahke+uzE$SE-IhBwTL zCnKg33>Lk_tsV;Q?3Nd07IG)>PA43Q@@bD_XViZuJnF+-SR9eSm-b^YbLCU7PG6GQ zJKkO|*b;^O^%Ehg6e-0+bze&Un{k(1?Aom@b7Sm z?b{}WJ!Zfj23oRMKPiLEh^qy6lZ(sff1?M#aP;~C;P0@AuUam$iHH$i(Zc-_8++)) zGiB*fRHaTE_*K_lAl+<$IklN{WiruTjZ?Ir>rocinb-6%~rZb)Z@l>WsZ%cVnF`u(k z3MC-R0(^u8vlUE{9TX~VYef_B+y~v-T`n!_ zJXHL4N_pJy{bQGCGEJ2vO`^5M=(MU>=QoaiN4n$ZmlEhRRC09~b|CV#QExkR{!cxv z-Ih(Yq);JB({7Iv5SqD14A&CD>{9d#mQfp_-1nX*824hiHi&jI!rbzk3^mafyBi2I zXwJzh@J~^n^Qq+Rev`}V%T)Pds`2QDUxGv4pkJOaJP+l=87o}7L-RV1V*p70%Q?kQJ!b+v(*=vXQsHF z#w&NkJNb4_Kvu6hrx0e1Q_pLru87EM%Rez`mTlk~vCAr;IKZqQ$#>gK{ZQNJ$F@r9 z17m<_yD6oKG?O@e`O;WsIhdWwE)Z7*SyABxHvKJ!x|y(wVq*Eg`D2Q%Q#&zSm8c_X zY`zJhB88q%6!2%9%}+RQMhWH=sbw#8{a(embAwu zeRHhkOtBY=U&ubKu7vS#2DPzJ+WbaUn%Eu`p1cjDEU*&qFGKE(o%RZ13w1x?o_-#{ zj3y3uOaJI8nlJ`Rt11>dUer4~gzlg1qwk_n+`w_Q&I230F}#e<84l6$Ub}ga5BLCy z$uT-aXsHnb5x(Q2(qiSxMHMrLS5E#p#t6L)COeA@Vy#t82W3I7zxNN*jGG$^^A3V~ zTr=^dD(liTi!S&uFU(~grGKHPJ3#7Wm91!jh!*X-6-6}Q?cA`2ld(6Q{A_nw+16`p zBq**{Pk_!LEyI8)FurdbBN-IqyhFR52Y9f)rE-#p}V=M?A%c$M#J3kjR;+GEA#vBv7ig$61YKjN2FsuXxl6YE;g-oLfc3d7ixb z(~0wjUXzRlz7@}MhgnS+FRey=b`F|l<3w;qodOa{(-yU^k{7Owq0>0sq7~my3O9?# z;MqUiGm}Q%_f`tMUWXlWG>uF0_?>-d_6ru!DNoiMD&X~fg!7a0H9Z%=3kwQs-Q1{g zxIsDbEXG9ly4o5M4LODy_vvf8k1Dey9QW4T^up55&l zkpg05cG;FhOyo7R#xy!3{&xPzXTpzSZpRkB&$uR(?99to5LDHD?ak+~^R*OGg2wFv zUjX`1J0_eHXV^8UJXLSFxSNPlDSRKCJ@A^Jrtp08!98KQXBT1L%avWTv-8l?va+Jq zHqd)|JwByFcmK%afGyJ=rb@ELtB7tehaH#)iRz5v6?C;mDxZj)`upc|y>)S)VveGb zj?RG?$-D;ms{Mi9UTajprUthRTIksl=OfjZ8iD{zhh{YOLQV$~PKQE~HHn!A-`+on zR*Vi4Qpbff5whUZ9dr@0UMy^6)_zH48Tiz-RM+T2vk9}rr*_Wy-CfoxGjcedo-{zF zI=^!G@*UT_@;VTiU+I>Ht{NTo^Dj&T`?{QK>&9s}PXt=TxQbmKUDW->h6Eh)@|}uY zfxqy8(^9cw%+k#m9NNz`x+UB*DrrBVuFm%-eo5kp!74OI^qtOcOgmD z8KADRYxrHr>DeRsuJG&}MumPmOimcRYf)HcNZ@n+9Z>VwI;H|{kuzD-~H{S8;hQ?c2 zjtv0GZ}PmMOMCz*ca!f8t!=)0eIWsWjJ71-P|23{TZz8yg7Kf_uYY%rfKs-#-mI6~ zWDtv=K%3NLAnu*Falh$e$sp$0L0w!lpwgZ9QTM+QD_m~`Hwd`>zEy>8mki>B7c|Ao z1M1j$C*t3TL;k-)g!W*N|5no|$$~>*LSlkyga9DKJp_ntp?@6S+sqXOyh(8W{uKnw zfCBb--`KW2G6-skzsABWLHJMO%+dg)|G1h+znMw@zb^du$snNhKu5aNu>aTVhA9Aa zypI5ZZuUl#f&d5a@?81@G6)V!kn(}ZTjkqZ1;HA0Zp8~i*?9jK@7DzF5Cwb{M0EJJ zdFQYCg$>j{ouh%B3M1Qs3=ZGV(U(Iq2#NQ~M^NV>2IYUw?*FKE|8LZ9$ASPj2hfxc z)|-fz^uOHyRf8gcfie7#JF3$^?wBCp5zhlK2f^T{`>T=fi_P#-dNmI zGKjp)zxq`<#rm&d{*P?xe});I^_TmbiV9SEit=9}|1ST-{Qv(9yx`vu!D0;he=gX+ z0@?prp8cP``iuSvME>_G8=t*R-p;@1^t1OXT=hnT^!!D1c2WH6hj~s0Vcqu+jSSK~ ze?K{$!~Z?8YDWJup9~X#I?msx!{h`2w0@2N(KYpMNVp(=<47*ZAV}x_uET;%E(l>n J*WbtZ{{Z#P!zlm& delta 13442 zcmY*=Wk4Lu)-CStgS)!~5AMM=xVr|o3>Mr6cNpB=LvVsyAXspBcgQ1o=R5aaest|x zYp|Ud;3g1aLn46!*8mAJI&Z-nf(`=#0paw?iVYg# zKUs^o|DOcGK$5&gPV0aMK}b!cw=e}1HdMgiC8Pg8*>1^32Z5FfsER!G3mZ%qKjJOpfesiQ2!1wa9roW6I&DK_t$shg|m=c2cE{QdM|NtSH0rXoXzvmNP+5U2LV{^QbB?sv0VKm95!eQeL4~+?=ho^^MZI zi4QY0fsKBbqrOh39Z!#mM!z2}i6F-BHKbV_Q&qzRsaF`l1Vjpm1sC-ZseEjRhHlco zfXoyCv0NC5K}!1s)zB(Gd8sKQIBYyB)bFK(2G2GM&K4S`>_HR&4tr1?iRab0FsEbp z*Jv*zm^-fRK+ctLcyDjn-afw<1S1jM(4q5ykfHQzL_}qIFL}{AIQ>4(4ufTO5LOPw z_jW{#M|)nyUycekv0yq3ALu*Gjx4MO>bHe*!#3>nE^vCCDgcN>sA^k$Zux742g7MRGS5YWh9J!2T zS<0JF@`%w;58G&U(_V6*RvcGc?)SP#I!b=^l;;8|2L56hb1X6;bd2imS_1e~0c%T; z1T8HGf8HR3ELFmM^n?Su6+Q7D+$t^=tIK-pWi`W;i!lHwI+jG7m{1RRjBU0~dzp zhN*kX9bAON4=>l-DWvYo*J$Q4Xp~|yYTaabShU@ns@lubZE3xU%6MYv&e|3AuK8?k zu?#J5JQ%%TJ7Bb$Gs;&*)*UAk%Oo-5q=+2(Jm zIuppiu)ZJ9p`Q{Ox6P5{rbDkZk#-Qv`%KHjq9XiNOUl8kb7aZj*E~>vv^dbHH4oOd zczWr1LJT!^o_(O*2>j}6lOtE3Z)Pht?L5pyzPpntJ|r!%j z5uggS6oZWkpVt^698p3fEKA&|+deWq)ldqZGKG?a|~=1V2xdW$8-mayFlC zJWmagu;BBJC#|ZHrUXfE&`4P20AGgWC5=H0HjYm~^E~OwgAnMps?;#CY=ahb7%?H$ ziejQ`%0Proz9+myGwpEQf^)-=KkUK?uyDVM9dcP_xwRPl?asXN_w$2*H zua=Dr(GFqiFLl870&u+1P>>n@QI(3gk(rj0%e8Ar$G7fdFyGel0{sZrPuEX12l`k< z5>lA+*xaiLY{Vo_72dq>E!s&D_ z0I)&YzOCXkxi;^DvcHbfU{x!;>3?+f!px_0&rPIW~iPmIG@n7rmiC;XiLC?f3vTJUz`Gg=p9 zK8)mv-V6dl|9;(R_$VaJ&lBtE0aw!=g-iJ(;|-J>nsF(42in0{Gp)Wy}WNr3llis^vYk0y2t{zC9G7SQW8GEvz>ZPi09E9wH*yE=+9`RdARy$??) z&b{^h_aIn=A*FNBQ7ATjvh&tjsQ~1FV3r;lW1~f8kh24Aagu#Jxb89ZAs>t(Qw(FD zS|S=1m#oMS;Dwi>0@KkG0*-OHaJb4?~;#3j^WrKgCx}3YozM}uF#0{&QFMled>Mo$+hUe%lY}nvK|5GwA1fTy@ z(^KJxKj6OT*`H=XLgP=vBF+Dn0wO;EGz7>+V7(zo`X~r*4Zb>n+<&CFW^ zx;O-Yo^0{nqPJTC5S<;>8>L{^1C9Ql@|#RETigaBa*_pJOL-@W8p+w%^}Gv*)l3j& zWma|3USri z5Z(cKy3rMvzZlR?nR7E6wO%( zDf&3(AqN7_lQ~96t?KD<`i5K_pH$aIxYeiWm}ICd!1&&$NJHxywzKXt0v0W~ZuFwG z5rq7KRa$-&A|tYU(+b&T6VxMx2Qmg$O$VM!XY^ciTE+)P^vMMLl^U-ySP1P83$*2u zNcQ@)+ok4pN7x{9Z?XBZPr*Vr7wr91_FvBH=xc%RZ4TH$W+0R#VWB0Ua`8O;-2Pnqo5QG!{#(=RmvtM({fuA>4ai&IW$2`P<|D!v-qs^RSsZ z2+y{qc6(Io-Ywwf<$c?(7ay7Q&wZ)JAdk<#iTYCy`PaXy(4aeKd-6d}u}-UT9jad< zPB+QbuZWqQGTG)@?W;;TDUqxD9Q+ao``pz(B`&cPTFR3|P6fz8&WRjU<4 zKLyJI>Cm{uI!saN=y6~Pp0Yiw`YLo6*z$^aOS8b)G@I&C3g&BsS$8cSG8QK(iy>kZ`195!*f-ndgPIM}p9?J=GYwFDqRYmdSymmgW9=>uiSN z{#DAsx#ke6UQ;6!o#~HR_BN1VnmUn=c$;LY0ajlu+#0J~E8a8UlvxiJ7^)K-FrJE% z<2gebNA1Z==jc$B(7~TXXM6&Q)3pToSPkWWSOl$HC)oA zgNe5(5xkR+BQco*Qiy6ns0vv|LP>(bx@_3vrzwIU;zwexl)cvpL>(yu=LHEOokp5L zRA9~H_ysBBuJrkjur_&)92IMj*o{ClU=^%$`6*Q~>ISJTt7*aljn)-ljW+BK3w>s| zLN#{_x{$hhj7jvX2)Uy)P$0MUVAnPRgU&7jijQ%_?AODC$j+(yrkEJnuiw`IZ7!R2 zPB4GAo_x+e`MWBlrj}-+i-p zjlo(;u36|+c@du3o(ChHTb!CNG1uvA!k!ACwEt{gFz)!#yl79^=yNgIS(ucgbSZVj zR+{Nqx!hUAVk>-}*j$=WTI$Wgh61lQum5C;c&WKWY;gwydc@?bv+*)FqXm13fAnj~ z7*E%gV-~u|mTx|mAw-ZO`Bi*+jS3ZWr4V0~ zh0jG$(j(1RVT&D>u$wVNqIc}P&MlcPYg z_5|^fraxyhG$cMGT+&0SEe)_*oGW>KQZ~0~Rq(Ly?T1~r;_P(>cUwlKd0k}|K>BjD zPqf(ox&pVUNt_0FAu<5Ry?hfTydm-bPTF3CYZH!1pu(4}QAR&!8!uXdc*_CBC>{%1 zA#ZnKhO=T2`m_g!lt@+#fsRc8DFky1Glal5Y`)UPr+ffyzIo=U{^j>S8)Iva%|F%A zGycyWb;bAUPc@wa68+gwA19vu!9Z~EZ_QRl-&-LDp`8Ih-Pu$4|EZ)baFvDzZ+qHA zEC>in&_*!{DEABjn62&YhoepMyX%-^)Evr&KA*^%h@n}5{G)gq78)|*fHeX)qcQ9U*FEo?pAZ2&Lq&Gb-n;6#E_Xu)r30J;4{Oxf#|W(TISTm37EaLAz)5( zb1#?ZZ;q%NG(z8!JPil?M!oqa`W!eDy}m>{b|!``@2#VCMt(D7+2Uyh$(<&;@EQ{J z9;IF1P;>@bd{rIHJhxo+R-ifU(Mvyf==AfYG4+z6+4Q1Ar=nOHUA`Ok!e3Kj@w~@yTV|fh zG~45!>b!@cwCpXeD#8WQ?o1;`s8Gotuz$`fbvPoAP1e|d71`QPX&ZV+oBm-u;`HE@ zym&N?*)l!sMsiRqUCH=ki3ME&qFxMUJEEzrkRkAmSMOkwUCrLg(Ig%_Sr!ztKfZ&I&V|;hkBz1&x)60kft|N;0kXv~YbhB+EPM4N&!QS#}gP3tLBgQpm6pCr<>GQPu|KzFkk@ zOl|mn?>(D2)rZDbhsv1rnmK?{HP{lsAt^U^B+7vBxyOSavbz-KuGLmVO-nU=o z6S)#sswKHb>egmHw;{EM^SRV1M`pAk%gw4o7vPVDDKws)dfEG=5Opk4ayvRjWd%MK zXYcoEj?$jD=(Zg5!X+}wY2~0gxnC&q#zc-9wV0VW_PZP2tztcR_L@_n9AKCBu2fRHnbjeyv<*yJx~og`}k@A0HvO@R|K|$hBMLQ=WrVx>{$Ar3jVpsHmuC z$t3qeB>3$4EYSl>!zj&+H1r&FyDogkkYpysdb~}}mQ$u9=gVLTQ=Ns$4fWH&Gy=E_ z%CR%}(Hu1zm@)A~It;A3Re$W4q#uP;pyBCK6ta|7RTit)0mWh==&(r2UnTNDxk6om zmC>MJQS((G-uhP&ZPN^6Ry(Rrvz$XAhg$K8((*`87J)?Ujsv1THp9U~zMz*LJ2W|s(*ZTJ+2yv_eH*%dgVNuT(K!EpdvA^glL-!ujzY3Y z`KD{RAk{+dBc8b1NkgVVuh7c{#ta>ikwf9R&>BXBG@;6@!IJ8s!{^!TOSnoiXhJKq z?$^tc4t>w-N4X8((semr5<}q8VoD}!Pl|ZIk^JZ=leGyf(d(I2BU2>tl34u@7+jql z4N!&y&O_{Zbr!2bT8oPEH#c3eTM8Y6ab=2t-SM_`QpwW~PL!U-RtbW$9TA_Y9`}KQ zIm#;}*G*)&@z!0tS3P?A^WhYQLr zSy4ZZ5rI9~P9E!9?O~2mtyH;!ESE4k4@kzyhIRzCqRn~`#JT5k1Y*8$8zo4k?H~CF z=kwf&U*-m^wM5Lnx-bI|b%lcR0g5_8HsTc`$CD9QTdkZjx~{mG+?Fmpm=>yMB=5rp z!d|Ru`@?G2Kpu)ttD7#&4(`giOjCpi@DuC0ftdE2HAgVQY!X#HSTvYwSZIlvIXwJQ z8|!>2H#uIGlyv;@QWAKhAIV;3HzHTWzLYdyz@Rn3$xF(}6y`f2O2*-W=5m1`Ts3JXDuiYr z6d`uOh7w_AtN~-(cK;qFotu@Cr2}!C4)Mmfbmo~F$bUPd9bZU7p8bTd6>_dmBH53< z4^|H}aUq*qgxnNnJ?$CS$bK(GbLfnWmY8&GM)SB4&z#XOi3IpYi84+{|@ngymx$~Rj(n;X6$p3B%0|6q}h`vw| z5P-LTue1EUBRM<61|}yNC}WG^gs$1N7_|QquUfm;ERxkj(nHF?7$A@fr^X(L0Yd+JlyIbivAQ_WnVN+;*y|^d-o0gj@Sj0@Ll9H0=1@hE$Hta zR2PzZH0j!kKBea;ePh?Jrz9Ko7nOq28iGI}i($3?7&Jc!m;GLB*io;%#<2JUVUyNS z!x!dd5#uN<(@nza%(Q+QY+5y16l%qlK@t)s6jyvV^GzU}5{h^k#n=pC00#k<0GqHun4N7jH*p5NKxwY-`-poyrq98zAIn(Pqelhp@wBZS z;VPUpIZzh2>BSRb$Z?b~p?EPDjb#@KnB}){l5^=Naz&X^lrUaq`pipVbPx&kM1xpN z6F(xQqnZQL23bVMsk6$`?ca%u_*|N#<8zPrmThWVf6KSa&6A2d5O?dgv*@;Cgjp*B zq9km)rsQ-BmlK{>#^X~h*KOtJG(cw&oGPG2kQwhrr;VYA)J|^_Tgrrk@v%jYPrQtt zNfNI58EA5j9B%W{vgy!n`D;ueZJM60hba*peuxnK?;^EQuvlBbfq($AfL4p?fFBY4 zH0I_+=o&hQ&ljK|L&sGS&1sHDVe%tu)bbFl9j zT><}db*{&yjtx=~fNtE&hISi_2$bbgHKcne3!$?U8jyO9f`8uLE93M`HT*Vz6ZRT1~`1F?D!-$WNc;<&((Ib08Ag&yg|t zgjctZts}}?Z4*NkMIsVgJ|ZmJJcPXWHXI8k&Q;t;h5YLKm8n%R?^nsGhnP=8*y={8CBq{b z{Z1z2l0k`Rey6&pI09&?tw5cO;>4>RN@eM;5S9L+n!_|Sv1%ql{6v*EAj?yZ53f0e zGuz;q!pFarb_lP-92?X@yK2iBQ;9w_7OK&>_`#l?oq;sGg&;vunv(hKK&)jBGjxwu z@Kdut>cI;O;%x00?ndE2=bbq|pIxuF6kh^vxsjCt#~RjYlIH>zABUiYp4!%AA4{6OoRsk@aiB5-scca{ zgAc*xCz9H^EL)%*w$84D!Nm3-fZNkzve)G0*kYJ`?d zIpjut2dLm)=AZ34RwGb!v*GfMJf3||p%&~r!JRCSvmq2}EZT|TU?LW<#WEpSedEKH z9rtUHv@iE7LQ_c-f8H1-Znqi5p#pMe90Z!{VAf*dI)stltyRxJvofFk(yti0 zx|9WUkxLZkVJ0Wam1udF5}C2ce5Qug{)O+Ie*AF8Rv1#EQjKet91DYB#y(b#(fqxD z=vSK6#ca?)n&qt?EibeHleq-0r6&V>JLM+Sw|sprhxy8nA5LOrEOzx@et+=rHfShJ zXBp4>%&;4QGXd`*jU>amD8M9P-G!n1X*1*#@TeB03U;X2eat>Nze&YfGYg@L?*?Yu(P`DMIR42wH#Yo+>sAW0hA$p6f!s92m}jI%+zHV@~WpCT;m8=%^DqO zW|QW@yFWsIEu5wBkt~^=L1}fQ&MWCTUWZ%^n+FxEYE&eo_{k&hvMGy1Ca`awgh#=pynJdeU{rREf6`K z((@f%xEN&nCFyJP#M;K$;j{2-z>T|#ZvC_xM`?+X1vDf{lyKwxeBPPRdLkF-l{ z&(J5~U}ZMBvu8z(iVsZBPqjeE3+mAUt{@d`Hbpx#TlcruF$Zq(v+_Gz*1q%Cg0J$b zMWqv)I_|9_JwTh7s6NVxU@S6fZ5rP*(b;?P6W#M|Q{E%HF!*3aq8ZM8My=ByJRL_H zIB|FJLP+-G0rGRa%}pH--cJA`MaG=)el2nma18yxjp$ePRo^pqHhNFtN}b#Yu-G|j zWV6RBb9UZ16LPOPM<0hNk_U1n)~-O>v$k)+5iV1a3$HQSx&#Nahs319%u@A(zX5fD zSVdp$R9X)pb`6ayC_94ho$fEO{b`m?`*5v73IQ%*^kBH6Af!-`iXg>&@Ti`J!j!CN zqZ=tqJ5I;-t+5^@=@Nk)boU~N=edVvmmizr$_7cy*AqEy`naa4JCM)h0g`Batz z0j|PMD9#>RO=h(8sRzt1$QxCWuK5yEEk0YzBLc*B8CA_|tF=SP-u)Du$}6+$f{C~* zYylAlW#yhgHyzX7HR9N!Egb}*7{*O&+yw|Xt1d<%7LsW`dD@@74_EH5Kn7D(jhyKR ztLMrI5&Z5r*J_k>D73H^;gT!1`&99L?U`qv0JX&t)xEWFsTEV@i260l6x2!x_s>cx ziZADsDqDN*uO#2{u1torx59SQ8WH8~Hp^ryB8iiR!+Snt6CWS5B?UWNNYc|k>`BD{ zYp%%pIdp~ixk4jVw^H3+fmGirFLK>JfB9W`WprPYwrcV-Rp8qQaQ1=cGYL(V8K7uZ z?>ThBDUxb!^P3g3P@%`n16g9n@3O0J_ZHc|Sx$3=765keIKkMTW?fE`?l(j>Q(D}8 zQeP{s1fLD^F80G9W}~+%!&E+771NZeI!*9j#63ozC6Cq{T4Y>PkO61fyoOnrTT}-v zSoG#e@#Eu}MUm9d2MyH=&hpcJ%DzrGwM2r8sOqYyKfE#eabL&ktLQo`!@2;cd(xWh zT21{``ca`~=^|5c0}5Ee+#QZCT2T+zi`WXMPq1hKjYA9vn+#WnXU(^~L0GU&@Ke$; zuTt~8$=y3*MW{$X4^_dI9c3Z@s!?)NF4{|P7ITA@HNmcI8oHsVU7EylK>KEm78ma) zzv=g=vvQ9L2@^f9$dhf5kDAN))XgGt=_S~1uW`j{fa{a>hB?roaklqoO^aeS$|15X zLS2;v%Q5}uW{+H!rYDB1Wv=w3f7W!H_)^wjm%UP9D}{n?@+r64IwvOlE1ZG(sx8 zxP0lDg_&q3k5(_$>3AH4sMfaF!*3Qd9t0-HH}GiCxS9Ovett?pgkD5~Jr9ZE_b~^# z@@px>rOE}(h6WKV{1nvaZ8{*FHdl4yLh$n<_Wajh@-}ws^C?X0{-QP*|;bR&Co=D@zEYi&qyMo2H@C8da2rC z<@+vZn_uzIsT&C$g9%}5R|&KL7ArBuumo$#kTltOM#2?LO==v=9-(-pJiebc&}?(k z9t6WY7a?z(Lk{pcnht7Ix`EcCdu?XDw`B0#G12gftNye$S~LKY0hNgAlLarMO=Ehx z`1I;djAMh-67)+g@uy&|bh}bWe0Q0?Z&vUVv>>J8Yz=WqQlzPp1Fn8I%+*V4eBAE? zusO)vcoH|M(>vwgf~qA&;OuG&DyBc9Ipspa@;(A>ioPZpEy=tV2bq8mrVVHArq5^U z{R@**&ZwMh2Hq3aX}jDDEk$fg2@(l1*)Wd>qPW^Hj)T>0-Wvp`t7X#q2X@I8=19_N zDN}0Z_+Yi^6TDyldcxyD$l_tj=Vm5u7>$nZ z^<)jSSGVaVI!{W~yjC+okMRu{T;rFWkeYJgpw||gr{RuJ0;^l6C%Pt&voP(cJ#rer zN0`58?^on)hG`iEC+jch$#)#US-(T{S(W8AnPcEicN_$zI`%m7daOnY-xs&sY;}FC)Yyrd6u9s{NWom+mGt2+hV(rC8#Pz zcYNK#5?|CF-@ia`@=hIGOQ^U6KdAxRLAODx1`Awqja1}EbJiu&TRiP=4n-ZXe~43c z857Upg}*5HqFOb64SYa2*QwA4-&&6!-w3^fVC^IMs^&E{tKt%1$$rk>oVValmdxEY zLUgBo@R_j#n``I0Hm_N^>3Px-#P}GMsK!)hE+bh_!N*{{;r?U6WR%UQgCtYjOyUR-fm)Fz1#Q`O$cqA*CQrT4pC-M84+$g04 z$Z<%t#eKQ1(`*GDHvBjAim5>_l;j6PjDe`&FV`43)CWJzn`-jIG)QszRz7u0{hPy{df+b|8lfD)Sq!8;aufj=wu-HojGV53sOYStR| zGb+>GH29hTC&2uply=Fl<31%9N5lD|+wU&~m|sS}yTg)=aW`r=gpT{*9mUnB(&AywS|~%d z(l3)6kI6A#-P*IiYE$@9UHv#IPWEqXFN>S7PP}_G)SXp8r7*v0s=X0dm|B*wdiTXI z%-Tw)^LTL`-G^?m#~g;q8=p<}t0%rr&}x*;zg#GJ zqU~g9JQLJctDdT0VDZ!>q!Jll75s@26bpqw@MqXZQkB~or|urqc7dE6bz>lXRA86} zI~Y#-(bq8WD@NIc=f~QgiIbi%e*OTmtrBVQ4&m3lXp zi(BY@`7@P!13s^Uy1twfSI%{+sfIyBlBT*yeZ*xxTff{{`@IEPz)uB7e%>0oxT9DF z{qRQoI=@wt;QEmY<7?hp-x%rXBZOvN6``+)be&QS=UoA-6L5NnTCWL)q29gC% zd%M(1&m*zE0vYWt86O)s+tNJw+Ez=TVqSaIS78%`9xBw@;k+=;J~Owq#|dm-qw}sa zizvtY1~d<2nvST4eRX z7Oz!)7EL6Pf&bdPq*f2rwwoWet_^TNJx{~JT5%O_>T33*I#laoFmX?+L~9sEtGS?Htoj->OE7d51ez z?s43UVib0q_tavOp?pr3+FrX6LM<_U{S62Ck2kQp;*Z-evTy5;o6m7T=FNEkGQ0pZ zOpe{Y`4d2$Z{gas%pZ>e-5li~=l&mqpV1n{TNJn^_D_FdjrgAkY5mRm_cupko#`!d zTGxI%CLjYq>+8IK832f5L-?PZkPW)GsB**b?TEZ-{dRQQ{1YqS0zk)`f3hm@03eAi zfw$;_7ywG$5_*ePNC2RdE#6J#qRuhOJS80 zkhqHkRlo__pr-<{?fw~q>Mj*j9uH_^mjRT!`)3dvd;sLP*9HFm6b2T7)^|nUP>MY& zs3yU`X-<3iZ@{TA0F<|f1XVBm7i4{p06&7VUY%a#`ck*E~Nf~Py5twAo&3m6qDQ=Knco|gZo$P_6ASrfhhFp|AoH4 zLCa=u5G6>({6AM9XaxWX9wI^gwgkx>iocx^-3Ea2pFz!9gK7@{Ox?vH6;ZM6|9@@6 z>XV7Ny#<@Qn~go&|Bd8rsxbinr-Q(NI1!t-1!W!)ft-&1yndlz2LQz#Awi;pGLG12 z|MR{7b$UX+Jq?0}fMEMq4gpaZIPD0^@56nw4B~(koe)6e$8i58`yXrJ|Hyti|05&( zcjQ6GR8V3bf8o^=1W=X-!oQS)=iA~rMuMXD{FerL(*8@Y_yRzBCrD6DzW>q~et>`J zDIfs!^^GnA{zK!ujr2GX075xMf*MHtS3?fM`&Y990)Xt^=qAu#I{K9MP1A5n1=X4H z7eLSa&xNC%Q9%V{|Al4GaQ|!g|KsZUpW)l){7wIwgUTg9ZNmCL9O;d!f1Zy^)lttY-EmuCD*Ls0=TtpgKnWo-FO+&mW7kxx<=g>fwml$x0zy4h1{{yI$%}4+M diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 508322917..37aef8d3f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 65dcd68d6..aeb74cbb4 100755 --- a/gradlew +++ b/gradlew @@ -85,9 +85,6 @@ done APP_BASE_NAME=${0##*/} APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -144,7 +141,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -152,7 +149,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in diff --git a/worldedit-bukkit/adapters/adapter-1_17_1/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_17_1/build.gradle.kts index 977b4af10..940dfcb0b 100644 --- a/worldedit-bukkit/adapters/adapter-1_17_1/build.gradle.kts +++ b/worldedit-bukkit/adapters/adapter-1_17_1/build.gradle.kts @@ -1,3 +1,5 @@ +import io.papermc.paperweight.userdev.PaperweightUserDependenciesExtension + applyPaperweightAdapterConfiguration() plugins { @@ -19,6 +21,6 @@ configurations.all { dependencies { - paperDevBundle("1.17.1-R0.1-20220414.034903-210") + the().paperDevBundle("1.17.1-R0.1-20220414.034903-210") compileOnly("io.papermc:paperlib") } diff --git a/worldedit-bukkit/adapters/adapter-1_18_2/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_18_2/build.gradle.kts index 2f8b75130..aaa4643d2 100644 --- a/worldedit-bukkit/adapters/adapter-1_18_2/build.gradle.kts +++ b/worldedit-bukkit/adapters/adapter-1_18_2/build.gradle.kts @@ -1,3 +1,5 @@ +import io.papermc.paperweight.userdev.PaperweightUserDependenciesExtension + plugins { java } @@ -10,6 +12,6 @@ repositories { dependencies { // https://papermc.io/repo/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/ - paperDevBundle("1.18.2-R0.1-20220920.010157-167") + the().paperDevBundle("1.18.2-R0.1-20220920.010157-167") compileOnly("io.papermc:paperlib") } diff --git a/worldedit-bukkit/adapters/adapter-1_19/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_19/build.gradle.kts index b8c797ee4..cfb2cfe03 100644 --- a/worldedit-bukkit/adapters/adapter-1_19/build.gradle.kts +++ b/worldedit-bukkit/adapters/adapter-1_19/build.gradle.kts @@ -1,3 +1,5 @@ +import io.papermc.paperweight.userdev.PaperweightUserDependenciesExtension + plugins { java } @@ -9,6 +11,6 @@ repositories { } dependencies { - paperDevBundle("1.19.2-R0.1-20221206.184705-189") + the().paperDevBundle("1.19.2-R0.1-20221206.184705-189") compileOnly("io.papermc:paperlib") } diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_19_3/build.gradle.kts index fb422300e..4706a5752 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_3/build.gradle.kts +++ b/worldedit-bukkit/adapters/adapter-1_19_3/build.gradle.kts @@ -1,3 +1,5 @@ +import io.papermc.paperweight.userdev.PaperweightUserDependenciesExtension + plugins { java } @@ -10,6 +12,6 @@ repositories { dependencies { // https://papermc.io/repo/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/ - paperDevBundle("1.19.3-R0.1-20230312.180621-141") + the().paperDevBundle("1.19.3-R0.1-20230312.180621-141") compileOnly("io.papermc:paperlib") } diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts index cf00f80f2..0df6dc795 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts +++ b/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts @@ -1,3 +1,5 @@ +import io.papermc.paperweight.userdev.PaperweightUserDependenciesExtension + plugins { java } @@ -9,6 +11,6 @@ repositories { } dependencies { - paperDevBundle("1.19.4-R0.1-20230423.020222-72") + the().paperDevBundle("1.19.4-R0.1-20230601.025018-99") compileOnly("io.papermc:paperlib") } diff --git a/worldedit-core/doctools/build.gradle.kts b/worldedit-core/doctools/build.gradle.kts index 8f4555040..6f2123f20 100644 --- a/worldedit-core/doctools/build.gradle.kts +++ b/worldedit-core/doctools/build.gradle.kts @@ -1,14 +1,14 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("jvm") version "1.5.30" + kotlin("jvm") version "1.8.20" application } applyCommonConfiguration() tasks.withType { - kotlinOptions.jvmTarget = "11" + kotlinOptions.jvmTarget = "17" } application.mainClass.set("com.sk89q.worldedit.internal.util.DocumentationPrinter") From b7dc5f7ae51b49846f7844b5bccb52354524c6b1 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sun, 4 Jun 2023 13:29:07 +0200 Subject: [PATCH 053/161] [ci skip] Update Java tooling name --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8c6ece0eb..61000e9fb 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -7,7 +7,7 @@ pipeline { stage('Build') { steps { withEnv([ - "PATH+JAVA=${tool 'Temurin-17.0.6+10'}/bin" + "PATH+JAVA=${tool 'Temurin-17.0.7_7'}/bin" ]) { sh './gradlew clean build' } From 97d42441261a5226669f2ac774a41b9ec1b9029d Mon Sep 17 00:00:00 2001 From: EpicPlayerA10 <62206933+EpicPlayerA10@users.noreply.github.com> Date: Sun, 4 Jun 2023 15:14:50 +0200 Subject: [PATCH 054/161] Fix BlockEntity#remove spigot mapping (#2264) Fix spigot mapping --- .../adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java index 11dadaf1e..9f8938cec 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java @@ -184,7 +184,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { removeBlockEntityTicker.setAccessible(true); methodremoveTickingBlockEntity = lookup.unreflect(removeBlockEntityTicker); - fieldRemove = BlockEntity.class.getDeclaredField(Refraction.pickName("remove", "p")); + fieldRemove = BlockEntity.class.getDeclaredField(Refraction.pickName("remove", "q")); fieldRemove.setAccessible(true); CHUNKSECTION_BASE = unsafe.arrayBaseOffset(LevelChunkSection[].class); From 0e215e98d55fd2e8d588c88310503f9494414147 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sun, 4 Jun 2023 16:22:21 +0100 Subject: [PATCH 055/161] fix: minor changes to fix loading blocks outside stored range in ThreadUnsafeCharBlocks (#2260) - Fixes #2258 --- .../implementation/blocks/ThreadUnsafeCharBlocks.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java index 9f0aedc11..7d041155b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java @@ -98,12 +98,19 @@ public class ThreadUnsafeCharBlocks implements IChunkSet, IBlocks { public char[] load(int layer) { updateSectionIndexRange(layer); layer -= minSectionPosition; - return blocks[layer]; + char[] arr = blocks[layer]; + if (arr == null) { + arr = blocks[layer] = new char[FaweCache.INSTANCE.BLOCKS_PER_LAYER]; + } + return arr; } @Nullable @Override public char[] loadIfPresent(int layer) { + if (layer < minSectionPosition || layer > maxSectionPosition) { + return null; + } layer -= minSectionPosition; return blocks[layer]; } @@ -439,8 +446,8 @@ public class ThreadUnsafeCharBlocks implements IChunkSet, IBlocks { public IChunkSet createCopy() { char[][] blocksCopy = new char[sectionCount][]; for (int i = 0; i < sectionCount; i++) { + blocksCopy[i] = new char[FaweCache.INSTANCE.BLOCKS_PER_LAYER]; if (blocks[i] != null) { - blocksCopy[i] = new char[FaweCache.INSTANCE.BLOCKS_PER_LAYER]; System.arraycopy(blocks[i], 0, blocksCopy[i], 0, FaweCache.INSTANCE.BLOCKS_PER_LAYER); } } From e9fed5a066fceb3117a920e4c1985e2f2647e5cc Mon Sep 17 00:00:00 2001 From: Jordan Date: Sun, 4 Jun 2023 17:50:08 +0100 Subject: [PATCH 056/161] feat: improve error when loading biomes (#2241) --- .../v1_17_R1_2/PaperweightFaweAdapter.java | 16 ++++++++++---- .../fawe/v1_18_R2/PaperweightFaweAdapter.java | 15 +++++++++---- .../fawe/v1_19_R1/PaperweightFaweAdapter.java | 15 +++++++++---- .../fawe/v1_19_R2/PaperweightFaweAdapter.java | 15 +++++++++---- .../fawe/v1_19_R3/PaperweightFaweAdapter.java | 21 ++++++++++--------- 5 files changed, 56 insertions(+), 26 deletions(-) diff --git a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightFaweAdapter.java index d90fc50c8..64cf2c9d6 100644 --- a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightFaweAdapter.java @@ -103,6 +103,7 @@ import java.util.HashMap; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Objects; import java.util.OptionalInt; import java.util.Set; import java.util.function.Supplier; @@ -658,10 +659,17 @@ public final class PaperweightFaweAdapter extends CachedBukkitAdapter implements .registryAccess() .ownedRegistryOrThrow( Registry.BIOME_REGISTRY); - return biomeRegistry.stream() - .map(biomeRegistry::getKey) - .map(CraftNamespacedKey::fromMinecraft) - .collect(Collectors.toList()); + List keys = biomeRegistry.stream() + .map(biomeRegistry::getKey).filter(Objects::nonNull).toList(); + List namespacedKeys = new ArrayList<>(); + for (ResourceLocation key : keys) { + try { + namespacedKeys.add(CraftNamespacedKey.fromMinecraft(key)); + } catch (IllegalArgumentException e) { + LOGGER.error("Error converting biome key {}", key.toString(), e); + } + } + return namespacedKeys; } @Override diff --git a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightFaweAdapter.java index 25f93844a..e2481e72b 100644 --- a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightFaweAdapter.java @@ -656,10 +656,17 @@ public final class PaperweightFaweAdapter extends CachedBukkitAdapter implements .registryAccess() .ownedRegistryOrThrow( Registry.BIOME_REGISTRY); - return biomeRegistry.stream() - .map(biomeRegistry::getKey).filter(Objects::nonNull) - .map(CraftNamespacedKey::fromMinecraft) - .collect(Collectors.toList()); + List keys = biomeRegistry.stream() + .map(biomeRegistry::getKey).filter(Objects::nonNull).toList(); + List namespacedKeys = new ArrayList<>(); + for (ResourceLocation key : keys) { + try { + namespacedKeys.add(CraftNamespacedKey.fromMinecraft(key)); + } catch (IllegalArgumentException e) { + LOGGER.error("Error converting biome key {}", key.toString(), e); + } + } + return namespacedKeys; } @Override diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightFaweAdapter.java index a2a593b5e..b9aa9cf7f 100644 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightFaweAdapter.java @@ -645,10 +645,17 @@ public final class PaperweightFaweAdapter extends CachedBukkitAdapter implements .registryAccess() .ownedRegistryOrThrow( Registry.BIOME_REGISTRY); - return biomeRegistry.stream() - .map(biomeRegistry::getKey).filter(Objects::nonNull) - .map(CraftNamespacedKey::fromMinecraft) - .collect(Collectors.toList()); + List keys = biomeRegistry.stream() + .map(biomeRegistry::getKey).filter(Objects::nonNull).toList(); + List namespacedKeys = new ArrayList<>(); + for (ResourceLocation key : keys) { + try { + namespacedKeys.add(CraftNamespacedKey.fromMinecraft(key)); + } catch (IllegalArgumentException e) { + LOGGER.error("Error converting biome key {}", key.toString(), e); + } + } + return namespacedKeys; } @Override diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightFaweAdapter.java index af0bcfa32..7cfce755e 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightFaweAdapter.java @@ -650,10 +650,17 @@ public final class PaperweightFaweAdapter extends CachedBukkitAdapter implements .getServer() .registryAccess() .registryOrThrow(BIOME); - return biomeRegistry.stream() - .map(biomeRegistry::getKey).filter(Objects::nonNull) - .map(CraftNamespacedKey::fromMinecraft) - .collect(Collectors.toList()); + List keys = biomeRegistry.stream() + .map(biomeRegistry::getKey).filter(Objects::nonNull).toList(); + List namespacedKeys = new ArrayList<>(); + for (ResourceLocation key : keys) { + try { + namespacedKeys.add(CraftNamespacedKey.fromMinecraft(key)); + } catch (IllegalArgumentException e) { + LOGGER.error("Error converting biome key {}", key.toString(), e); + } + } + return namespacedKeys; } @Override diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweAdapter.java index e23e18a2e..7cc904e5c 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightFaweAdapter.java @@ -17,7 +17,6 @@ import com.google.common.collect.ImmutableMap; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.blocks.BaseItemStack; -import com.sk89q.worldedit.blocks.TileEntityBlock; import com.sk89q.worldedit.bukkit.BukkitAdapter; import com.sk89q.worldedit.bukkit.BukkitWorld; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; @@ -50,7 +49,6 @@ import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; -import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypesCache; import com.sk89q.worldedit.world.entity.EntityType; import com.sk89q.worldedit.world.item.ItemType; @@ -60,7 +58,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.Registry; import net.minecraft.core.WritableRegistry; import net.minecraft.core.registries.Registries; -import net.minecraft.nbt.IntTag; import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; import net.minecraft.resources.ResourceLocation; import net.minecraft.server.MinecraftServer; @@ -71,14 +68,12 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.StringRepresentable; import net.minecraft.world.entity.Entity; import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.DirectionProperty; import net.minecraft.world.level.chunk.LevelChunk; -import net.minecraft.world.level.chunk.LevelChunkSection; import org.apache.logging.log4j.Logger; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -86,7 +81,6 @@ import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.TreeType; import org.bukkit.block.data.BlockData; -import org.bukkit.craftbukkit.v1_19_R3.CraftChunk; import org.bukkit.craftbukkit.v1_19_R3.CraftServer; import org.bukkit.craftbukkit.v1_19_R3.CraftWorld; import org.bukkit.craftbukkit.v1_19_R3.block.CraftBlockState; @@ -602,10 +596,17 @@ public final class PaperweightFaweAdapter extends CachedBukkitAdapter implements .getServer() .registryAccess() .registryOrThrow(BIOME); - return biomeRegistry.stream() - .map(biomeRegistry::getKey).filter(Objects::nonNull) - .map(CraftNamespacedKey::fromMinecraft) - .collect(Collectors.toList()); + List keys = biomeRegistry.stream() + .map(biomeRegistry::getKey).filter(Objects::nonNull).toList(); + List namespacedKeys = new ArrayList<>(); + for (ResourceLocation key : keys) { + try { + namespacedKeys.add(CraftNamespacedKey.fromMinecraft(key)); + } catch (IllegalArgumentException e) { + LOGGER.error("Error converting biome key {}", key.toString(), e); + } + } + return namespacedKeys; } @Override From 46e8a37cf09fdbb3c0a9b87b598f3f8578bf6d4b Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sun, 4 Jun 2023 23:57:51 +0100 Subject: [PATCH 057/161] fix: improve test for polygonal region containment of cuboid - Possibly fixes #2265 --- .../worldedit/regions/Polygonal2DRegion.java | 32 ++++++++++--------- .../com/sk89q/worldedit/regions/Region.java | 2 -- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java index e02e72029..021e042be 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Polygonal2DRegion.java @@ -506,24 +506,26 @@ public class Polygonal2DRegion extends AbstractRegion implements FlatRegion { //FAWE start @Override public boolean containsEntireCuboid(int bx, int tx, int by, int ty, int bz, int tz) { - for (int x = bx; x <= tx; x++) { - if (!contains(x, 0, bz)) { - return false; + for (int y : new int[]{by, ty}) { + for (int x = bx; x <= tx; x++) { + if (!contains(x, y, bz)) { + return false; + } } - } - for (int x = bx; x <= tx; x++) { - if (!contains(x, 0, tz)) { - return false; + for (int x = bx; x <= tx; x++) { + if (!contains(x, y, tz)) { + return false; + } } - } - for (int z = bz; z <= tz; z++) { - if (!contains(bx, 0, z)) { - return false; + for (int z = bz; z <= tz; z++) { + if (!contains(bx, y, z)) { + return false; + } } - } - for (int z = bz; z <= tz; z++) { - if (!contains(tx, 0, z)) { - return false; + for (int z = bz; z <= tz; z++) { + if (!contains(tx, y, z)) { + return false; + } } } return true; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java index 8d718fb05..c18650560 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java @@ -42,8 +42,6 @@ import com.sk89q.worldedit.world.World; import javax.annotation.Nullable; import java.util.List; import java.util.Set; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Future; /** * Represents a physical shape. From e5d27c27bb1a4dbc98f70167dd5794cf7340761a Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Mon, 5 Jun 2023 00:17:13 +0100 Subject: [PATCH 058/161] chore: replace some hardcoded ordinals --- .../extent/clipboard/CPUOptimizedClipboard.java | 5 +++-- .../extent/clipboard/DiskOptimizedClipboard.java | 5 +++-- .../extent/clipboard/MemoryOptimizedClipboard.java | 5 +++-- .../extent/clipboard/io/FastSchematicWriter.java | 4 ++-- .../core/extent/filter/DistrFilter.java | 4 ++-- .../processor/heightmap/HeightmapProcessor.java | 4 ++-- .../core/history/change/MutableBiomeChange.java | 5 +++-- .../core/history/change/MutableFullBlockChange.java | 5 +++-- .../core/history/changeset/AbstractChangeSet.java | 2 +- .../core/queue/IBatchProcessor.java | 9 +++++---- .../com/sk89q/worldedit/regions/CuboidRegion.java | 13 +++++++------ .../java/com/sk89q/worldedit/regions/Region.java | 9 +++++---- 12 files changed, 39 insertions(+), 31 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/CPUOptimizedClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/CPUOptimizedClipboard.java index 6f566fcb9..1a30a0df8 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/CPUOptimizedClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/CPUOptimizedClipboard.java @@ -11,6 +11,7 @@ import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockTypesCache; import java.io.IOException; import java.util.Collection; @@ -191,8 +192,8 @@ public class CPUOptimizedClipboard extends LinearClipboard { @Override public > boolean setBlock(int index, B block) { char ordinal = block.getOrdinalChar(); - if (ordinal == 0) { - ordinal = 1; + if (ordinal == BlockTypesCache.ReservedIDs.__RESERVED__) { + ordinal = BlockTypesCache.ReservedIDs.AIR; } states[index] = ordinal; boolean hasNbt = block instanceof BaseBlock && block.hasNbtData(); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java index b54c075fc..08941d4a5 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java @@ -26,6 +26,7 @@ import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.block.BlockTypesCache; import org.apache.logging.log4j.Logger; import java.io.ByteArrayOutputStream; @@ -696,8 +697,8 @@ public class DiskOptimizedClipboard extends LinearClipboard { try { int index = headerSize + (getIndex(x, y, z) << 1); char ordinal = block.getOrdinalChar(); - if (ordinal == 0) { - ordinal = 1; + if (ordinal == BlockTypesCache.ReservedIDs.__RESERVED__) { + ordinal = BlockTypesCache.ReservedIDs.AIR; } byteBuffer.putChar(index, ordinal); boolean hasNbt = block instanceof BaseBlock && block.hasNbtData(); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/MemoryOptimizedClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/MemoryOptimizedClipboard.java index ed76a9d1f..449795e5d 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/MemoryOptimizedClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/MemoryOptimizedClipboard.java @@ -16,6 +16,7 @@ import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.block.BlockTypesCache; import java.io.IOException; import java.util.Collection; @@ -269,8 +270,8 @@ public class MemoryOptimizedClipboard extends LinearClipboard { @Override public > boolean setBlock(int index, B block) { int ordinal = block.getOrdinal(); - if (ordinal == 0) { - ordinal = 1; + if (ordinal == BlockTypesCache.ReservedIDs.__RESERVED__) { + ordinal = BlockTypesCache.ReservedIDs.AIR; } setOrdinal(index, ordinal); boolean hasNbt = block instanceof BaseBlock && block.hasNbtData(); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicWriter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicWriter.java index 696dd3ef5..db3452d29 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicWriter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/io/FastSchematicWriter.java @@ -172,8 +172,8 @@ public class FastSchematicWriter implements ClipboardWriter { } int ordinal = block.getOrdinal(); - if (ordinal == 0) { - ordinal = 1; + if (ordinal == BlockTypesCache.ReservedIDs.__RESERVED__) { + ordinal = BlockTypesCache.ReservedIDs.AIR; } char value = palette[ordinal]; if (value == Character.MAX_VALUE) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/DistrFilter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/DistrFilter.java index 78a7ea293..89b294279 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/DistrFilter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/DistrFilter.java @@ -41,8 +41,8 @@ public class DistrFilter extends ForkedFilter { @Override public final void applyBlock(FilterBlock block) { int ordinal = block.getOrdinal(); - if (ordinal == 0) { - ordinal = 1; + if (ordinal == BlockTypesCache.ReservedIDs.__RESERVED__) { + ordinal = BlockTypesCache.ReservedIDs.AIR; } counter[ordinal]++; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/HeightmapProcessor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/HeightmapProcessor.java index efa2447f7..3cdfeafb9 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/HeightmapProcessor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/heightmap/HeightmapProcessor.java @@ -73,11 +73,11 @@ public class HeightmapProcessor implements IBatchProcessor { for (int y = 15; y >= 0; y--) { // We don't need to actually iterate over x and z as we're both reading and writing an index for (int j = 0; j < BLOCKS_PER_Y; j++) { - char ordinal = 0; + char ordinal = BlockTypesCache.ReservedIDs.__RESERVED__; if (hasSectionSet) { ordinal = setSection[index(y, j)]; } - if (ordinal == 0) { + if (ordinal == BlockTypesCache.ReservedIDs.__RESERVED__) { if (!hasSectionGet) { if (!hasSectionSet) { continue layer; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableBiomeChange.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableBiomeChange.java index 46860c106..744a372e9 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableBiomeChange.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableBiomeChange.java @@ -5,6 +5,7 @@ import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.history.UndoContext; import com.sk89q.worldedit.history.change.Change; import com.sk89q.worldedit.world.biome.BiomeTypes; +import com.sk89q.worldedit.world.block.BlockTypesCache; public class MutableBiomeChange implements Change { @@ -13,8 +14,8 @@ public class MutableBiomeChange implements Change { private int to; public MutableBiomeChange() { - this.from = 0; - this.to = 0; + this.from = BlockTypesCache.ReservedIDs.__RESERVED__; + this.to = BlockTypesCache.ReservedIDs.__RESERVED__; } public void setBiome(int x, int y, int z, int from, int to) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableFullBlockChange.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableFullBlockChange.java index 81337afb3..2b99cb8a9 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableFullBlockChange.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/change/MutableFullBlockChange.java @@ -6,6 +6,7 @@ import com.sk89q.worldedit.extent.inventory.BlockBagException; import com.sk89q.worldedit.history.UndoContext; import com.sk89q.worldedit.history.change.Change; import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockTypesCache; public class MutableFullBlockChange implements Change { @@ -39,14 +40,14 @@ public class MutableFullBlockChange implements Change { if (blockBag != null) { BlockState toState = BlockState.getFromOrdinal(to); if (fromState != toState) { - if (allowFetch && from != 0) { + if (allowFetch && from != BlockTypesCache.ReservedIDs.__RESERVED__) { try { blockBag.fetchPlacedBlock(fromState); } catch (BlockBagException e) { return; } } - if (allowStore && to != 0) { + if (allowStore && to != BlockTypesCache.ReservedIDs.__RESERVED__) { try { blockBag.storeDroppedBlock(toState); } catch (BlockBagException ignored) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java index b06fc7926..bad1f96c6 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java @@ -186,7 +186,7 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor { } final int combinedFrom = from; final int combinedTo = blocksSet[index]; - if (combinedTo != 0) { + if (combinedTo != BlockTypesCache.ReservedIDs.__RESERVED__) { add(xx, yy, zz, combinedFrom, combinedTo); } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IBatchProcessor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IBatchProcessor.java index 4ee815292..807a90fb4 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IBatchProcessor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IBatchProcessor.java @@ -7,6 +7,7 @@ import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.world.block.BlockTypesCache; import javax.annotation.Nullable; import java.util.Map; @@ -71,7 +72,7 @@ public interface IBatchProcessor { if (arr != null) { int index = (minY & 15) << 8; for (int i = 0; i < index; i++) { - arr[i] = 0; + arr[i] = BlockTypesCache.ReservedIDs.__RESERVED__; } } else { arr = new char[4096]; @@ -89,7 +90,7 @@ public interface IBatchProcessor { if (arr != null) { int index = ((maxY + 1) & 15) << 8; for (int i = index; i < arr.length; i++) { - arr[i] = 0; + arr[i] = BlockTypesCache.ReservedIDs.__RESERVED__; } } else { arr = new char[4096]; @@ -130,7 +131,7 @@ public interface IBatchProcessor { if (arr != null) { int index = (minY & 15) << 8; for (int i = index; i < 4096; i++) { - arr[i] = 0; + arr[i] = BlockTypesCache.ReservedIDs.__RESERVED__; } } set.setBlocks(layer, arr); @@ -139,7 +140,7 @@ public interface IBatchProcessor { if (arr != null) { int index = ((maxY + 1) & 15) << 8; for (int i = 0; i < index; i++) { - arr[i] = 0; + arr[i] = BlockTypesCache.ReservedIDs.__RESERVED__; } } set.setBlocks(layer, arr); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java index 26f7636f4..213ee8473 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java @@ -31,6 +31,7 @@ import com.fastasyncworldedit.core.queue.IChunkSet; import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockTypesCache; import com.sk89q.worldedit.world.storage.ChunkStore; import javax.annotation.Nonnull; @@ -839,14 +840,14 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { for (int z = 0; z < lowerZ; z++) { // null the z values for (int x = 0; x < 16; x++, index++) { - arr[index] = 0; + arr[index] = BlockTypesCache.ReservedIDs.__RESERVED__; } } index = indexY + upperZi; for (int z = upperZ + 1; z < 16; z++) { // null the z values for (int x = 0; x < 16; x++, index++) { - arr[index] = 0; + arr[index] = BlockTypesCache.ReservedIDs.__RESERVED__; } } } @@ -855,11 +856,11 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { for (int z = lowerZ; z <= upperZ; z++, index += 16) { for (int x = 0; x < lowerX; x++) { // null the x values - arr[index + x] = 0; + arr[index + x] = BlockTypesCache.ReservedIDs.__RESERVED__; } for (int x = upperX + 1; x < 16; x++) { // null the x values - arr[index + x] = 0; + arr[index + x] = BlockTypesCache.ReservedIDs.__RESERVED__; } } } @@ -925,7 +926,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { for (int z = lowerZ; z <= upperZ; z++) { // null the z values for (int x = 0; x < 16; x++, index++) { - arr[index] = 0; + arr[index] = BlockTypesCache.ReservedIDs.__RESERVED__; } } } @@ -934,7 +935,7 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { for (int z = lowerZ; z <= upperZ; z++, index += 16) { for (int x = lowerX; x <= upperX; x++) { // null the x values - arr[index + x] = 0; + arr[index + x] = BlockTypesCache.ReservedIDs.__RESERVED__; } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java index c18650560..71227f2ba 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java @@ -38,6 +38,7 @@ import com.sk89q.worldedit.math.BlockVector2; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.world.World; +import com.sk89q.worldedit.world.block.BlockTypesCache; import javax.annotation.Nullable; import java.util.List; @@ -408,8 +409,8 @@ public interface Region extends Iterable, Cloneable, IBatchProcess for (int y = 0, index = 0; y < 16; y++) { for (int z = 0; z < 16; z++) { for (int x = 0; x < 16; x++, index++) { - if (arr[index] != 0 && !contains(x, y, z)) { - arr[index] = 0; + if (arr[index] != BlockTypesCache.ReservedIDs.__RESERVED__ && !contains(x, y, z)) { + arr[index] = BlockTypesCache.ReservedIDs.__RESERVED__; } } } @@ -458,8 +459,8 @@ public interface Region extends Iterable, Cloneable, IBatchProcess for (int y = 0, index = 0; y < 16; y++) { for (int z = 0; z < 16; z++) { for (int x = 0; x < 16; x++, index++) { - if (arr[index] != 0 && contains(x, y, z)) { - arr[index] = 0; + if (arr[index] != BlockTypesCache.ReservedIDs.__RESERVED__ && contains(x, y, z)) { + arr[index] = BlockTypesCache.ReservedIDs.__RESERVED__; processExtra = true; } } From 4b06796e7645fa1a2c8f0b064c5bf1114bd45133 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Mon, 5 Jun 2023 10:51:26 +0200 Subject: [PATCH 059/161] Archive PR artifacts (#2269) * Archive PR artifacts * Fix artifact path --- .github/workflows/build-pr.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 60c938e66..3959c8ad7 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -18,4 +18,9 @@ jobs: distribution: temurin java-version: 17 - name: Build on ${{ matrix.os }} - run: ./gradlew clean build + run: ./gradlew clean build --no-daemon + - name: Archive artifacts + uses: actions/upload-artifact@v3 + with: + name: FastAsyncWorldEdit-SNAPSHOT + path: worldedit-bukkit/build/libs/FastAsyncWorldEdit-Bukkit-*.jar From 5da5b216f3ce36bf79e417c47285b89e65b699ac Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Mon, 5 Jun 2023 22:26:41 +0100 Subject: [PATCH 060/161] fix #2268 -.- --- .../src/main/java/com/sk89q/worldedit/regions/Region.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java index 71227f2ba..ab9207ab4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java @@ -409,7 +409,7 @@ public interface Region extends Iterable, Cloneable, IBatchProcess for (int y = 0, index = 0; y < 16; y++) { for (int z = 0; z < 16; z++) { for (int x = 0; x < 16; x++, index++) { - if (arr[index] != BlockTypesCache.ReservedIDs.__RESERVED__ && !contains(x, y, z)) { + if (arr[index] != BlockTypesCache.ReservedIDs.__RESERVED__ && !contains(bx + x, by + y, bz + z)) { arr[index] = BlockTypesCache.ReservedIDs.__RESERVED__; } } From bdb170a5ca5b6209f3ce48cea6961730c6c20686 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Tue, 6 Jun 2023 19:18:01 +0200 Subject: [PATCH 061/161] Explicit call repository task --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 2879f6107..f56de9997 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -105,7 +105,7 @@ tasks { } nexusPublishing { - repositories { + this.repositories { sonatype { nexusUrl.set(URI.create("https://s01.oss.sonatype.org/service/local/")) snapshotRepositoryUrl.set(URI.create("https://s01.oss.sonatype.org/content/repositories/snapshots/")) From 5504811f115b420c87e3dd80307fb0994214f3b2 Mon Sep 17 00:00:00 2001 From: Jordan Date: Tue, 6 Jun 2023 18:21:02 +0100 Subject: [PATCH 062/161] chore: minor improvements to processing-related code (#2271) --- .../impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java | 5 +---- .../adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java | 4 +--- .../adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java | 4 +--- .../adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java | 4 +--- .../adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java | 4 +--- .../java/com/sk89q/worldedit/regions/CuboidRegion.java | 7 ++++--- .../src/main/java/com/sk89q/worldedit/regions/Region.java | 8 +++++++- 7 files changed, 16 insertions(+), 20 deletions(-) diff --git a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java index 5554fe25b..09fa8f7a5 100644 --- a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java @@ -445,10 +445,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc bitMask |= 1 << layer; - // Changes may still be written to chunk SET - char[] tmp = set.load(layerNo); - char[] setArr = new char[4096]; - System.arraycopy(tmp, 0, setArr, 0, 4096); + char[] setArr = set.load(layerNo); // synchronise on internal section to avoid circular locking with a continuing edit if the chunk was // submitted to keep loaded internal chunks to queue target size. diff --git a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java index f225bd441..06a74cfd1 100644 --- a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java @@ -491,9 +491,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc bitMask |= 1 << getSectionIndex; - char[] tmp = set.load(layerNo); - char[] setArr = new char[4096]; - System.arraycopy(tmp, 0, setArr, 0, 4096); + char[] setArr = set.load(layerNo); // synchronise on internal section to avoid circular locking with a continuing edit if the chunk was // submitted to keep loaded internal chunks to queue target size. diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java index 7a0b00f1f..e0a851c1b 100644 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java @@ -488,9 +488,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc bitMask |= 1 << getSectionIndex; - char[] tmp = set.load(layerNo); - char[] setArr = new char[4096]; - System.arraycopy(tmp, 0, setArr, 0, 4096); + char[] setArr = set.load(layerNo); // synchronise on internal section to avoid circular locking with a continuing edit if the chunk was // submitted to keep loaded internal chunks to queue target size. diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java index f3114fd1a..3ee8314fd 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java @@ -490,9 +490,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc bitMask |= 1 << getSectionIndex; - char[] tmp = set.load(layerNo); - char[] setArr = new char[4096]; - System.arraycopy(tmp, 0, setArr, 0, 4096); + char[] setArr = set.load(layerNo); // synchronise on internal section to avoid circular locking with a continuing edit if the chunk was // submitted to keep loaded internal chunks to queue target size. diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java index c12f57002..1b10ddd77 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java @@ -490,9 +490,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc bitMask |= 1 << getSectionIndex; - char[] tmp = set.load(layerNo); - char[] setArr = new char[4096]; - System.arraycopy(tmp, 0, setArr, 0, 4096); + char[] setArr = set.load(layerNo); // synchronise on internal section to avoid circular locking with a continuing edit if the chunk was // submitted to keep loaded internal chunks to queue target size. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java index 213ee8473..cc2f03aa2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/CuboidRegion.java @@ -824,14 +824,15 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion { boolean trimX = lowerX != 0 || upperX != 15; boolean trimZ = lowerZ != 0 || upperZ != 15; + if (!(trimX || trimZ)) { + return set; + } + for (int layer = get.getMinSectionPosition(); layer < get.getMaxSectionPosition(); layer++) { if (!set.hasSection(layer)) { continue; } char[] arr = Objects.requireNonNull(set.loadIfPresent(layer)); // This shouldn't be null if above is true - if (!(trimX || trimZ)) { - continue; - } int indexY = 0; for (int y = 0; y < 16; y++, indexY += 256) { // For each y layer within a chunk section int index; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java index ab9207ab4..b89536520 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/regions/Region.java @@ -401,11 +401,17 @@ public interface Region extends Iterable, Cloneable, IBatchProcess // contains some boolean processExtra = false; for (int layer = getMinimumY() >> 4; layer <= getMaximumY() >> 4; layer++) { + if (!set.hasSection(layer)) { + continue; + } int by = layer << 4; int ty = by + 15; if (!containsEntireCuboid(bx, tx, by, ty, bz, tz)) { processExtra = true; - char[] arr = set.load(layer); + char[] arr = set.loadIfPresent(layer); + if (arr == null) { + continue; + } for (int y = 0, index = 0; y < 16; y++) { for (int z = 0; z < 16; z++) { for (int x = 0; x < 16; x++, index++) { From b7719d17bd276c4c7dbc3d169c0dbc4ab236c471 Mon Sep 17 00:00:00 2001 From: Jordan Date: Tue, 6 Jun 2023 18:21:18 +0100 Subject: [PATCH 063/161] fix: correctly processSet with blacklist when required (#2270) * fix: correctly processSet with blacklist when required * Fix incorrect region --- .../com/fastasyncworldedit/core/extent/MultiRegionExtent.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/MultiRegionExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/MultiRegionExtent.java index e7f88c7c5..c13c5965b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/MultiRegionExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/MultiRegionExtent.java @@ -172,7 +172,7 @@ public class MultiRegionExtent extends FaweRegionExtent { set = intersection.processSet(chunk, get, set); } if (disallowedIntersection != null) { - intersection.processSet(chunk, get, set); + set = disallowedIntersection.processSet(chunk, get, set, true); } return set; } From 84872cf9a26cc2b90119239fd1617b644936aa05 Mon Sep 17 00:00:00 2001 From: Jordan Date: Tue, 6 Jun 2023 18:22:25 +0100 Subject: [PATCH 064/161] chore: improve queue documentation and submit history to better queue (#2266) --- .../bukkit/adapter/BukkitQueueHandler.java | 6 +- .../history/changeset/AbstractChangeSet.java | 2 +- .../queue/implementation/QueueHandler.java | 219 +++++++++++++++++- .../core/util/TaskManager.java | 4 +- .../core/util/task/AsyncNotifyQueue.java | 13 +- .../task/FaweForkJoinWorkerThreadFactory.java | 21 ++ 6 files changed, 245 insertions(+), 20 deletions(-) create mode 100644 worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/FaweForkJoinWorkerThreadFactory.java diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/BukkitQueueHandler.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/BukkitQueueHandler.java index 6e1bb1f9e..eec38e7ac 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/BukkitQueueHandler.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/BukkitQueueHandler.java @@ -3,8 +3,6 @@ package com.fastasyncworldedit.bukkit.adapter; import co.aikar.timings.Timings; import com.fastasyncworldedit.bukkit.listener.ChunkListener; import com.fastasyncworldedit.core.queue.implementation.QueueHandler; -import com.sk89q.worldedit.internal.util.LogManagerCompat; -import org.apache.logging.log4j.Logger; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -31,7 +29,7 @@ public class BukkitQueueHandler extends QueueHandler { } @Override - public void startSet(boolean parallel) { + public void startUnsafe(boolean parallel) { ChunkListener.physicsFreeze = true; if (parallel) { try { @@ -51,7 +49,7 @@ public class BukkitQueueHandler extends QueueHandler { } @Override - public void endSet(boolean parallel) { + public void endUnsafe(boolean parallel) { ChunkListener.physicsFreeze = false; if (parallel) { try { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java index bad1f96c6..b3493c896 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/AbstractChangeSet.java @@ -389,7 +389,7 @@ public abstract class AbstractChangeSet implements ChangeSet, IBatchProcessor { return; // fast path to avoid additional tasks: a worker is already draining the queue } // create a new worker to drain the current queue - Fawe.instance().getQueueHandler().submit(() -> drainQueue(false)); + Fawe.instance().getQueueHandler().async(() -> drainQueue(false)); } private void drainQueue(boolean ignoreRunningState) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java index 2091a0bb9..ae3ba4043 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java @@ -14,6 +14,7 @@ import com.fastasyncworldedit.core.queue.implementation.chunk.ChunkCache; import com.fastasyncworldedit.core.util.MemUtil; import com.fastasyncworldedit.core.util.TaskManager; import com.fastasyncworldedit.core.util.collection.CleanableThreadLocal; +import com.fastasyncworldedit.core.util.task.FaweForkJoinWorkerThreadFactory; import com.fastasyncworldedit.core.wrappers.WorldWrapper; import com.google.common.util.concurrent.Futures; import com.sk89q.worldedit.world.World; @@ -39,10 +40,41 @@ import java.util.function.Supplier; @SuppressWarnings({"unchecked", "rawtypes"}) public abstract class QueueHandler implements Trimable, Runnable { - private final ForkJoinPool forkJoinPoolPrimary = new ForkJoinPool(); - private final ForkJoinPool forkJoinPoolSecondary = new ForkJoinPool(); + private static final int PROCESSORS = Runtime.getRuntime().availableProcessors(); + + /** + * Primary queue should be used for tasks that are unlikely to wait on other tasks, IO, etc. (i.e. spend most of their + * time utilising CPU. + */ + private final ForkJoinPool forkJoinPoolPrimary = new ForkJoinPool( + PROCESSORS, + new FaweForkJoinWorkerThreadFactory("FAWE Fork Join Pool Primary - %s"), + null, + false + ); + /** + * Secondary queue should be used for "cleanup" tasks that are likely to be shorter in life than those submitted to the + * primary queue. They may be IO-bound tasks. + */ + private final ForkJoinPool forkJoinPoolSecondary = new ForkJoinPool( + PROCESSORS, + new FaweForkJoinWorkerThreadFactory("FAWE Fork Join Pool Secondary - %s"), + null, + false + ); + /** + * Main "work-horse" queue for FAWE. Handles chunk submission (and chunk submission alone). Blocking in order to forcibly + * prevent overworking/over-submission of chunk process tasks. + */ private final ThreadPoolExecutor blockingExecutor = FaweCache.INSTANCE.newBlockingExecutor(); + /** + * Queue for tasks to be completed on the main thread. These take priority of tasks submitted to syncWhenFree queue + */ private final ConcurrentLinkedQueue syncTasks = new ConcurrentLinkedQueue<>(); + /** + * Queue for tasks to be completed on the main thread. These are completed only if and when there is time left in a tick + * after completing all tasks in the syncTasks queue + */ private final ConcurrentLinkedQueue syncWhenFree = new ConcurrentLinkedQueue<>(); private final Map>> chunkGetCache = new HashMap<>(); @@ -54,7 +86,7 @@ public abstract class QueueHandler implements Trimable, Runnable { private long last; private long allocate = 50; - public QueueHandler() { + protected QueueHandler() { TaskManager.taskManager().repeat(this, 1); } @@ -80,6 +112,12 @@ public abstract class QueueHandler implements Trimable, Runnable { } } + /** + * Get if the {@code blockingExecutor} is saturated with tasks or not. Under-utilisation implies the queue has space for + * more submissions. + * + * @return true if {@code blockingExecutor} is not saturated with tasks + */ public boolean isUnderutilized() { return blockingExecutor.getActiveCount() < blockingExecutor.getMaximumPoolSize(); } @@ -125,6 +163,10 @@ public abstract class QueueHandler implements Trimable, Runnable { } while (System.currentTimeMillis() - start < currentAllocate); } + /** + * @deprecated For removal without replacement. + */ + @Deprecated(forRemoval = true, since = "TODO") public > void complete(Future task) { try { while (task != null) { @@ -135,49 +177,140 @@ public abstract class QueueHandler implements Trimable, Runnable { } } + /** + * Complete a task in the {@code forkJoinPoolSecondary} queue. Secondary queue should be used for "cleanup" tasks that are + * likely to be shorter in life than those submitted to the primary queue. They may be IO-bound tasks. + * + * @param run Runnable to run + * @param value Value to return when done + * @param Value type + * @return Future for submitted task + */ public Future async(Runnable run, T value) { return forkJoinPoolSecondary.submit(run, value); } + /** + * Complete a task in the {@code forkJoinPoolSecondary} queue. Secondary queue should be used for "cleanup" tasks that are + * likely to be shorter in life than those submitted to the primary queue. They may be IO-bound tasks. + * + * @param run Runnable to run + * @return Future for submitted task + */ public Future async(Runnable run) { return forkJoinPoolSecondary.submit(run); } + /** + * Complete a task in the {@code forkJoinPoolSecondary} queue. Secondary queue should be used for "cleanup" tasks that are + * likely to be shorter in life than those submitted to the primary queue. They may be IO-bound tasks. + * + * @param call Callable to run + * @param Return value type + * @return Future for submitted task + */ public Future async(Callable call) { return forkJoinPoolSecondary.submit(call); } - public ForkJoinTask submit(Runnable call) { - return forkJoinPoolPrimary.submit(call); + /** + * Complete a task in the {@code forkJoinPoolPrimary} queue. Primary queue should be used for tasks that are unlikely to + * wait on other tasks, IO, etc. (i.e. spend most of their time utilising CPU. + * + * @param run Task to run + * @return {@link ForkJoinTask} representing task being run + */ + public ForkJoinTask submit(Runnable run) { + return forkJoinPoolPrimary.submit(run); } + /** + * Submit a task to be run on the main thread. Does not guarantee to be run on the next tick as FAWE will only operate to + * maintain approx. 18 tps. + * + * @param run Task to run + * @param Value type + * @return Future representing task + */ public Future sync(Runnable run) { return sync(run, syncTasks); } + /** + * Submit a task to be run on the main thread. Does not guarantee to be run on the next tick as FAWE will only operate to + * maintain approx. 18 tps. + * + * @param call Task to run + * @param Value type + * @return Future representing task + */ public Future sync(Callable call) throws Exception { return sync(call, syncTasks); } - public Future sync(Supplier call) { - return sync(call, syncTasks); + /** + * Submit a task to be run on the main thread. Does not guarantee to be run on the next tick as FAWE will only operate to + * maintain approx. 18 tps. + * + * @param supplier Task to run + * @param Value type + * @return Future representing task + */ + public Future sync(Supplier supplier) { + return sync(supplier, syncTasks); } - // Lower priority sync task (runs only when there are no other tasks) + /** + * Submit a task to be run on the main thread. Does not guarantee to be run on the next tick as FAWE will only operate to + * maintain approx. 18 tps. Takes lower priority than tasks submitted via any {@code QueueHandler#sync} method. Completed + * only if and when there is time left in a tick after completing all sync tasks submitted using the aforementioned methods. + * + * @param run Task to run + * @param value Value to return when done + * @param Value type + * @return Future representing task + */ public Future syncWhenFree(Runnable run, T value) { return sync(run, value, syncWhenFree); } + /** + * Submit a task to be run on the main thread. Does not guarantee to be run on the next tick as FAWE will only operate to + * maintain approx. 18 tps. Takes lower priority than tasks submitted via any {@code QueueHandler#sync} method. Completed + * only if and when there is time left in a tick after completing all sync tasks submitted using the aforementioned methods. + * + * @param run Task to run + * @param Value type + * @return Future representing task + */ public Future syncWhenFree(Runnable run) { return sync(run, syncWhenFree); } + /** + * Submit a task to be run on the main thread. Does not guarantee to be run on the next tick as FAWE will only operate to + * maintain approx. 18 tps. Takes lower priority than tasks submitted via any {@code QueueHandler#sync} method. Completed + * only if and when there is time left in a tick after completing all sync tasks submitted using the aforementioned methods. + * + * @param call Task to run + * @param Value type + * @return Future representing task + */ public Future syncWhenFree(Callable call) throws Exception { return sync(call, syncWhenFree); } - public Future syncWhenFree(Supplier call) { - return sync(call, syncWhenFree); + /** + * Submit a task to be run on the main thread. Does not guarantee to be run on the next tick as FAWE will only operate to + * maintain approx. 18 tps. Takes lower priority than tasks submitted via any {@code QueueHandler#sync} method. Completed + * only if and when there is time left in a tick after completing all sync tasks submitted using the aforementioned methods. + * + * @param supplier Task to run + * @param Value type + * @return Future representing task + */ + public Future syncWhenFree(Supplier supplier) { + return sync(supplier, syncWhenFree); } private Future sync(Runnable run, T value, Queue queue) { @@ -228,6 +361,15 @@ public abstract class QueueHandler implements Trimable, Runnable { } } + /** + * Internal use only. Specifically for submitting {@link IQueueChunk} for "processing" an edit. Submits to the blocking + * executor, the main "work-horse" queue for FAWE. Handles chunk submission (and chunk submission alone). Blocking in order + * to forcibly prevent overworking/over-submission of chunk process tasks. + * + * @param chunk chunk + * @param + * @return Future representing task + */ public > T submit(IQueueChunk chunk) { // if (MemUtil.isMemoryFree()) { TODO NOT IMPLEMENTED - optimize this // return (T) forkJoinPoolSecondary.submit(chunk); @@ -259,6 +401,9 @@ public abstract class QueueHandler implements Trimable, Runnable { return new SingleThreadQueueExtent(); } + /** + * Sets the current thread's {@link IQueueExtent} instance in the queue pool to null. + */ public void unCache() { queuePool.set(null); } @@ -271,14 +416,58 @@ public abstract class QueueHandler implements Trimable, Runnable { return queue; } - public abstract void startSet(boolean parallel); + /** + * Indicate a "set" task is being started. + * + * @param parallel if the "set" being started is parallel/async + * @deprecated To be replaced by better-named {@link QueueHandler#startUnsafe(boolean)} )} + */ + @Deprecated(forRemoval = true, since = "TODO") + public void startSet(boolean parallel) { + startUnsafe(parallel); + } - public abstract void endSet(boolean parallel); + /** + * Indicate a "set" task is ending. + * + * @param parallel if the "set" being started is parallel/async + * @deprecated To be replaced by better-named {@link QueueHandler#endUnsafe(boolean)} )} + */ + @Deprecated(forRemoval = true, since = "TODO") + public void endSet(boolean parallel) { + startUnsafe(parallel); + } + + /** + * Indicate an unsafe task is starting. Physics are frozen, async catchers disabled, etc. for the duration of the task + * + * @param parallel If the task is being run async and/or in parallel + */ + public abstract void startUnsafe(boolean parallel); + + /** + * Indicate a/the unsafe task submitted after a {@link QueueHandler#startUnsafe(boolean)} call has ended. + * + * @param parallel If the task was being run async and/or in parallel + */ + public abstract void endUnsafe(boolean parallel); + + /** + * Create a new queue for a given world. + */ public IQueueExtent getQueue(World world) { return getQueue(world, null, null); } + /** + * Create a new queue for a given world. + * + * @param world World to create queue for + * @param processor existing processor to set to queue or null + * @param postProcessor existing post-processor to set to queue or null + * @return New queue for given world + */ public IQueueExtent getQueue(World world, IBatchProcessor processor, IBatchProcessor postProcessor) { final IQueueExtent queue = pool(); IChunkCache cacheGet = getOrCreateWorldCache(world); @@ -293,6 +482,12 @@ public abstract class QueueHandler implements Trimable, Runnable { return queue; } + /** + * Trims each chunk GET cache + * + * @param aggressive if each chunk GET cache should be trimmed aggressively + * @return true if all chunk GET caches could be trimmed + */ @Override public boolean trim(boolean aggressive) { boolean result = true; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TaskManager.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TaskManager.java index ad69c87d6..f3abf0ac3 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TaskManager.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TaskManager.java @@ -157,13 +157,13 @@ public abstract class TaskManager { */ public void runUnsafe(Runnable run) { QueueHandler queue = Fawe.instance().getQueueHandler(); - queue.startSet(true); + queue.startUnsafe(Fawe.isMainThread()); try { run.run(); } catch (Throwable e) { e.printStackTrace(); } - queue.endSet(true); + queue.endUnsafe(Fawe.isMainThread()); } /** diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/AsyncNotifyQueue.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/AsyncNotifyQueue.java index 10f910928..7cd91f87a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/AsyncNotifyQueue.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/AsyncNotifyQueue.java @@ -1,9 +1,13 @@ package com.fastasyncworldedit.core.util.task; import com.fastasyncworldedit.core.Fawe; +import com.fastasyncworldedit.core.configuration.Settings; +import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.io.Closeable; import java.util.concurrent.Callable; +import java.util.concurrent.Executors; +import java.util.concurrent.ForkJoinPool; import java.util.concurrent.Future; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -11,6 +15,13 @@ import java.util.function.Supplier; public class AsyncNotifyQueue implements Closeable { + private static final ForkJoinPool QUEUE_SUBMISSIONS = new ForkJoinPool( + Settings.settings().QUEUE.PARALLEL_THREADS, + new FaweForkJoinWorkerThreadFactory("AsyncNotifyQueue - %s"), + null, + false + ); + private final Lock lock = new ReentrantLock(true); private final Thread.UncaughtExceptionHandler handler; private boolean closed; @@ -59,7 +70,7 @@ public class AsyncNotifyQueue implements Closeable { } return null; }; - self[0] = Fawe.instance().getQueueHandler().async(wrapped); + self[0] = QUEUE_SUBMISSIONS.submit(wrapped); return self[0]; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/FaweForkJoinWorkerThreadFactory.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/FaweForkJoinWorkerThreadFactory.java new file mode 100644 index 000000000..589b5b863 --- /dev/null +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/FaweForkJoinWorkerThreadFactory.java @@ -0,0 +1,21 @@ +package com.fastasyncworldedit.core.util.task; + +import java.util.concurrent.ForkJoinPool; +import java.util.concurrent.ForkJoinWorkerThread; + +public class FaweForkJoinWorkerThreadFactory implements ForkJoinPool.ForkJoinWorkerThreadFactory { + + private final String nameFormat; + + public FaweForkJoinWorkerThreadFactory(String nameFormat) { + this.nameFormat = nameFormat; + } + + @Override + public ForkJoinWorkerThread newThread(ForkJoinPool pool) { + final ForkJoinWorkerThread worker = ForkJoinPool.defaultForkJoinWorkerThreadFactory.newThread(pool); + worker.setName(String.format(nameFormat, worker.getPoolIndex())); + return worker; + } + +} From 1356cd5caa5659f2615eef9d12f33f34a75fa7b6 Mon Sep 17 00:00:00 2001 From: Jordan Date: Tue, 6 Jun 2023 23:35:37 +0100 Subject: [PATCH 065/161] feat: implement a player-specific queue for clipboard IO tasks (#2267) * feat: implement a player-specific queue for clipboard IO tasks - Addresses #2222 (hopefully fixes) * Address comments * Add since --------- Co-authored-by: Alexander Brandes --- .../com/fastasyncworldedit/core/Fawe.java | 26 +++ .../clipboard/DiskOptimizedClipboard.java | 4 + .../util/task/KeyQueuedExecutorService.java | 172 ++++++++++++++++++ .../com/sk89q/worldedit/entity/Player.java | 13 +- 4 files changed, 211 insertions(+), 4 deletions(-) create mode 100644 worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/KeyQueuedExecutorService.java diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java index 8b8e6c530..7f31c6519 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java @@ -12,7 +12,9 @@ import com.fastasyncworldedit.core.util.RandomTextureUtil; import com.fastasyncworldedit.core.util.TaskManager; import com.fastasyncworldedit.core.util.TextureUtil; import com.fastasyncworldedit.core.util.WEManager; +import com.fastasyncworldedit.core.util.task.KeyQueuedExecutorService; import com.github.luben.zstd.Zstd; +import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.internal.util.LogManagerCompat; import net.jpountz.lz4.LZ4Factory; @@ -33,6 +35,9 @@ import java.lang.management.MemoryPoolMXBean; import java.lang.management.MemoryUsage; import java.util.Date; import java.util.List; +import java.util.UUID; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; /** @@ -86,6 +91,7 @@ public class Fawe { * The platform specific implementation. */ private final IFawe implementation; + private final KeyQueuedExecutorService clipboardExecutor; private FaweVersion version; private TextureUtil textures; private QueueHandler queueHandler; @@ -131,6 +137,15 @@ public class Fawe { }, 0); TaskManager.taskManager().repeat(timer, 1); + + clipboardExecutor = new KeyQueuedExecutorService<>(new ThreadPoolExecutor( + 1, + Settings.settings().QUEUE.PARALLEL_THREADS, + 0L, + TimeUnit.MILLISECONDS, + new LinkedBlockingQueue<>(), + new ThreadFactoryBuilder().setNameFormat("fawe-clipboard-%d").build() + )); } /** @@ -428,4 +443,15 @@ public class Fawe { return this.thread = Thread.currentThread(); } + /** + * Gets the executor used for clipboard IO if clipboard on disk is enabled or null + * + * @return Executor used for clipboard IO if clipboard on disk is enabled or null + * @since TODO + */ + @Nullable + public KeyQueuedExecutorService getClipboardExecutor() { + return this.clipboardExecutor; + } + } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java index 08941d4a5..28dc52333 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java @@ -156,7 +156,9 @@ public class DiskOptimizedClipboard extends LinearClipboard { /** * Load an existing file as a DiskOptimizedClipboard. The file MUST exist and MUST be created as a DiskOptimizedClipboard * with data written to it. + * @deprecated Will be made private, use {@link DiskOptimizedClipboard#loadFromFile(File)} */ + @Deprecated(forRemoval = true, since = "TODO") public DiskOptimizedClipboard(File file) { this(file, VERSION); } @@ -167,7 +169,9 @@ public class DiskOptimizedClipboard extends LinearClipboard { * * @param file File to read from * @param versionOverride An override version to allow loading of older clipboards if required + * @deprecated Will be made private, use {@link DiskOptimizedClipboard#loadFromFile(File)} */ + @Deprecated(forRemoval = true, since = "TODO") public DiskOptimizedClipboard(File file, int versionOverride) { super(readSize(file, versionOverride), BlockVector3.ZERO); headerSize = getHeaderSizeOverrideFromVersion(versionOverride); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/KeyQueuedExecutorService.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/KeyQueuedExecutorService.java new file mode 100644 index 000000000..bfaafb071 --- /dev/null +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/KeyQueuedExecutorService.java @@ -0,0 +1,172 @@ +package com.fastasyncworldedit.core.util.task; + +import javax.annotation.Nonnull; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Queue; +import java.util.concurrent.Callable; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.concurrent.FutureTask; +import java.util.concurrent.RejectedExecutionException; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; + +/** + * Executor service that queues tasks based on keys, executing tasks on a configurable {@link ThreadPoolExecutor} + * + * @param Key type + * @since TODO + */ +public class KeyQueuedExecutorService { + + private final ExecutorService parent; + private final Map keyQueue = new HashMap<>(); + + /** + * Create a new {@link KeyQueuedExecutorService} instance + * + * @param parent Parent {@link ExecutorService} to use for actual task completion + */ + public KeyQueuedExecutorService(ExecutorService parent) { + this.parent = parent; + } + + /** + * Delegates to {@link ThreadPoolExecutor#shutdown()} + */ + public void shutdown() { + parent.shutdown(); + } + + /** + * Delegates to {@link ThreadPoolExecutor#shutdownNow()} + */ + @Nonnull + public List shutdownNow() { + return parent.shutdownNow(); + } + + /** + * Delegates to {@link ThreadPoolExecutor#isShutdown()} + */ + public boolean isShutdown() { + return parent.isShutdown(); + } + + /** + * Delegates to {@link ThreadPoolExecutor#isTerminated()} + */ + public boolean isTerminated() { + return parent.isTerminated(); + } + + /** + * Delegates to {@link ThreadPoolExecutor#awaitTermination(long, TimeUnit)} + */ + public boolean awaitTermination(long timeout, @Nonnull TimeUnit unit) throws InterruptedException { + return parent.awaitTermination(timeout, unit); + } + + protected FutureTask newTaskFor(Runnable runnable, T value) { + return new FutureTask<>(runnable, value); + } + + protected FutureTask newTaskFor(Callable callable) { + return new FutureTask<>(callable); + } + + @Nonnull + public Future submit(@Nonnull K key, @Nonnull Callable task) { + FutureTask ftask = newTaskFor(task); + execute(key, ftask); + return ftask; + } + + @Nonnull + public Future submit(@Nonnull K key, @Nonnull Runnable task, T result) { + FutureTask ftask = newTaskFor(task, result); + execute(key, ftask); + return ftask; + } + + @Nonnull + public Future submit(@Nonnull K key, @Nonnull Runnable task) { + FutureTask ftask = newTaskFor(task, null); + execute(key, ftask); + return ftask; + } + + public void execute(@Nonnull K key, @Nonnull FutureTask command) { + synchronized (keyQueue) { + boolean triggerRun = false; + KeyRunner runner = keyQueue.get(key); + if (runner == null) { + runner = new KeyRunner(key); + keyQueue.put(key, runner); + triggerRun = true; + } + runner.add(command); + if (triggerRun) { + runner.triggerRun(); + } + } + } + + private final class KeyRunner { + + private final Queue> tasks = new ConcurrentLinkedQueue<>(); + private final K key; + + private KeyRunner(K key) { + this.key = key; + } + + void add(FutureTask task) { + if (!tasks.add(task)) { + throw new RejectedExecutionException(rejection()); + } + } + + void triggerRun() { + Runnable task = tasks.poll(); + if (task == null) { + throw new RejectedExecutionException(rejection()); + } + try { + run(task); + } catch (RejectedExecutionException e) { + synchronized (keyQueue) { + keyQueue.remove(key); + } + throw new RejectedExecutionException(rejection(), e); + } + } + + private void run(Runnable task) { + parent.execute(() -> { + task.run(); + Runnable next = tasks.poll(); + if (next == null) { + synchronized (keyQueue) { + next = tasks.poll(); + if (next == null) { + keyQueue.remove(key); + } + } + } + if (next != null) { + run(next); + } + }); + } + + private String rejection() { + return "Task for the key '" + key + "' rejected"; + } + + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java index 781b02ae2..8f5b5cb53 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java @@ -437,14 +437,16 @@ public interface Player extends Entity, Actor { } else { continue; } - WorldEdit.getInstance().getExecutorService().submit(() -> { + Fawe.instance().getClipboardExecutor().submit(getUniqueId(), () -> { doc.close(); // Ensure closed before deletion doc.getFile().delete(); }); } } - } else if (Settings.settings().CLIPBOARD.DELETE_ON_LOGOUT || Settings.settings().CLIPBOARD.USE_DISK) { - WorldEdit.getInstance().getExecutorService().submit(() -> session.setClipboard(null)); + } else if (Settings.settings().CLIPBOARD.USE_DISK) { + Fawe.instance().getClipboardExecutor().submit(getUniqueId(), () -> session.setClipboard(null)); + } else if (Settings.settings().CLIPBOARD.DELETE_ON_LOGOUT) { + session.setClipboard(null); } if (Settings.settings().HISTORY.DELETE_ON_LOGOUT) { session.clearHistory(); @@ -470,7 +472,10 @@ public interface Player extends Entity, Actor { } } catch (EmptyClipboardException ignored) { } - DiskOptimizedClipboard doc = DiskOptimizedClipboard.loadFromFile(file); + DiskOptimizedClipboard doc = Fawe.instance().getClipboardExecutor().submit( + getUniqueId(), + () -> DiskOptimizedClipboard.loadFromFile(file) + ).get(); Clipboard clip = doc.toClipboard(); ClipboardHolder holder = new ClipboardHolder(clip); session.setClipboard(holder); From c5f66c342b433e735b1d3f659cb12c8b6e5eef07 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 7 Jun 2023 00:35:50 +0200 Subject: [PATCH 066/161] Update dependency com.palmergames.bukkit.towny:towny to v0.99.1.2 (#2272) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index d3b4ba434..892d1c7cf 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,7 +11,7 @@ mapmanager = "1.8.0-SNAPSHOT" griefprevention = "16.18.1" griefdefender = "2.1.0-SNAPSHOT" residence = "4.5._13.1" -towny = "0.99.1.0" +towny = "0.99.1.2" # Third party bstats = "3.0.2" From 832f93c0f34816b45467cccc4327404d9139c8cd Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Wed, 7 Jun 2023 00:51:56 +0200 Subject: [PATCH 067/161] Optimize PR builds (#2273) * Optimize PR build * Update codeql.yml --- .github/workflows/build-pr.yml | 3 ++- .github/workflows/codeql.yml | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 3959c8ad7..11f0d1d5d 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -16,9 +16,10 @@ jobs: uses: actions/setup-java@v3 with: distribution: temurin + cache: gradle java-version: 17 - name: Build on ${{ matrix.os }} - run: ./gradlew clean build --no-daemon + run: ./gradlew build -s - name: Archive artifacts uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 3b21f975b..f4287607f 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,5 +1,7 @@ name: "CodeQL" on: + push: + branches: [main] pull_request: # The branches below must be a subset of the branches above branches: [main] From 3b7d1267185939381212f8b370367b1772922e94 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Wed, 7 Jun 2023 11:11:54 +0200 Subject: [PATCH 068/161] Release 2.6.2 --- build.gradle.kts | 2 +- .../java/com/fastasyncworldedit/core/Fawe.java | 2 +- .../core/command/SuggestInputParseException.java | 14 +++++++------- .../extent/clipboard/DiskOptimizedClipboard.java | 4 ++-- .../core/queue/implementation/QueueHandler.java | 6 +++--- .../blocks/ThreadUnsafeCharBlocks.java | 4 ++-- .../core/util/task/KeyQueuedExecutorService.java | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index f56de9997..a990b2904 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -52,7 +52,7 @@ ext { } } -version = String.format("%s-%s", rootVersion, buildNumber) +version = String.format("%s", rootVersion) if (!project.hasProperty("gitCommitHash")) { apply(plugin = "org.ajoberstar.grgit") diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java index 7f31c6519..8f4818f2f 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java @@ -447,7 +447,7 @@ public class Fawe { * Gets the executor used for clipboard IO if clipboard on disk is enabled or null * * @return Executor used for clipboard IO if clipboard on disk is enabled or null - * @since TODO + * @since 2.6.2 */ @Nullable public KeyQueuedExecutorService getClipboardExecutor() { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/SuggestInputParseException.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/SuggestInputParseException.java index bd10e6d20..fc50bf1a3 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/SuggestInputParseException.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/SuggestInputParseException.java @@ -19,7 +19,7 @@ public class SuggestInputParseException extends InputParseException { /** * @deprecated Use {@link SuggestInputParseException#SuggestInputParseException(Component, Supplier)} */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "2.6.2") public SuggestInputParseException(String msg, String prefix, Supplier> getSuggestions) { this(new InputParseException(msg), getSuggestions); } @@ -27,7 +27,7 @@ public class SuggestInputParseException extends InputParseException { /** * @deprecated Use {@link SuggestInputParseException#of(Throwable, Supplier)} */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "2.6.2") public static SuggestInputParseException of(Throwable other, String prefix, Supplier> getSuggestions) { if (other instanceof InputParseException) { return of((InputParseException) other, getSuggestions); @@ -38,7 +38,7 @@ public class SuggestInputParseException extends InputParseException { /** * @deprecated Use {@link SuggestInputParseException#of(InputParseException, Supplier)} */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "2.6.2") public static SuggestInputParseException of(InputParseException other, String prefix, Supplier> getSuggestions) { if (other instanceof SuggestInputParseException) { return (SuggestInputParseException) other; @@ -49,7 +49,7 @@ public class SuggestInputParseException extends InputParseException { /** * @deprecated Use {@link SuggestInputParseException#SuggestInputParseException(InputParseException, Supplier)} */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "2.6.2") public SuggestInputParseException(InputParseException other, String prefix, Supplier> getSuggestions) { super(other.getRichMessage()); checkNotNull(getSuggestions); @@ -62,8 +62,8 @@ public class SuggestInputParseException extends InputParseException { * Create a new SuggestInputParseException instance * * @param message Message to send - * @param getSuggestions Supplier of list of sugegstions to give to user - * @since TODO + * @param getSuggestions Supplier of list of suggestions to give to user + * @since 2.6.2 */ public SuggestInputParseException(Component message, Supplier> getSuggestions) { this(new InputParseException(message), getSuggestions); @@ -129,7 +129,7 @@ public class SuggestInputParseException extends InputParseException { /** * @deprecated Unused */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "2.6.2") public SuggestInputParseException prepend(String input) { // Do nothing return this; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java index 28dc52333..a9704e36b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java @@ -158,7 +158,7 @@ public class DiskOptimizedClipboard extends LinearClipboard { * with data written to it. * @deprecated Will be made private, use {@link DiskOptimizedClipboard#loadFromFile(File)} */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "2.6.2") public DiskOptimizedClipboard(File file) { this(file, VERSION); } @@ -171,7 +171,7 @@ public class DiskOptimizedClipboard extends LinearClipboard { * @param versionOverride An override version to allow loading of older clipboards if required * @deprecated Will be made private, use {@link DiskOptimizedClipboard#loadFromFile(File)} */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "2.6.2") public DiskOptimizedClipboard(File file, int versionOverride) { super(readSize(file, versionOverride), BlockVector3.ZERO); headerSize = getHeaderSizeOverrideFromVersion(versionOverride); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java index ae3ba4043..7f604a277 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java @@ -166,7 +166,7 @@ public abstract class QueueHandler implements Trimable, Runnable { /** * @deprecated For removal without replacement. */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "2.6.2") public > void complete(Future task) { try { while (task != null) { @@ -422,7 +422,7 @@ public abstract class QueueHandler implements Trimable, Runnable { * @param parallel if the "set" being started is parallel/async * @deprecated To be replaced by better-named {@link QueueHandler#startUnsafe(boolean)} )} */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "2.6.2") public void startSet(boolean parallel) { startUnsafe(parallel); } @@ -434,7 +434,7 @@ public abstract class QueueHandler implements Trimable, Runnable { * @param parallel if the "set" being started is parallel/async * @deprecated To be replaced by better-named {@link QueueHandler#endUnsafe(boolean)} )} */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "2.6.2") public void endSet(boolean parallel) { startUnsafe(parallel); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java index 7d041155b..f3dda058f 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java @@ -30,7 +30,7 @@ import java.util.UUID; * This is currently only used as a "copy" of {@link CharSetBlocks} to provide to * {@link com.fastasyncworldedit.core.queue.IBatchProcessor} instances for processing without overlapping the continuing edit. * - * @since TODO + * @since 2.6.2 */ public class ThreadUnsafeCharBlocks implements IChunkSet, IBlocks { @@ -54,7 +54,7 @@ public class ThreadUnsafeCharBlocks implements IChunkSet, IBlocks { /** * New instance given the data stored in a {@link CharSetBlocks} instance. * - * @since TODO + * @since 2.6.2 */ ThreadUnsafeCharBlocks( char[][] blocks, diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/KeyQueuedExecutorService.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/KeyQueuedExecutorService.java index bfaafb071..d9db5c888 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/KeyQueuedExecutorService.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/KeyQueuedExecutorService.java @@ -18,7 +18,7 @@ import java.util.concurrent.TimeUnit; * Executor service that queues tasks based on keys, executing tasks on a configurable {@link ThreadPoolExecutor} * * @param Key type - * @since TODO + * @since 2.6.2 */ public class KeyQueuedExecutorService { From 9be1a58bf343c1a62c8e676f55f8e88d6c8e3bdc Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Wed, 7 Jun 2023 11:30:06 +0200 Subject: [PATCH 069/161] Back to snapshot for development --- build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index a990b2904..f79edd650 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,7 +34,7 @@ logger.lifecycle(""" ******************************************* """) -var rootVersion by extra("2.6.2") +var rootVersion by extra("2.6.3") var snapshot by extra("SNAPSHOT") var revision: String by extra("") var buildNumber by extra("") @@ -52,7 +52,7 @@ ext { } } -version = String.format("%s", rootVersion) +version = String.format("%s-%s", rootVersion, buildNumber) if (!project.hasProperty("gitCommitHash")) { apply(plugin = "org.ajoberstar.grgit") From 152d870cdbb5ad7e3ad019e301083c298cee1aaf Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Thu, 8 Jun 2023 10:24:44 +0200 Subject: [PATCH 070/161] Improve exception handling on adapter loading (#2277) --- .../impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java index 9f8938cec..cb4ab2f2a 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java @@ -215,14 +215,13 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { } catch (NoSuchFieldException ignored) { } POST_CHUNK_REWRITE = chunkRewrite; - } catch (RuntimeException e) { + } catch (RuntimeException | Error e) { throw e; - } catch (Throwable rethrow) { - rethrow.printStackTrace(); - throw new RuntimeException(rethrow); + } catch (Exception e) { + throw new RuntimeException(e); } MethodHandle craftChunkGetHandle; - final MethodType type = methodType(ChunkAccess.class); + final MethodType type = methodType(LevelChunk.class); try { craftChunkGetHandle = lookup.findVirtual(CraftChunk.class, "getHandle", type); } catch (NoSuchMethodException | IllegalAccessException e) { From e7876c4eba73252deed1c5cbfd9ca5c737135390 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Fri, 9 Jun 2023 12:53:42 +0200 Subject: [PATCH 071/161] Update to 1.20 (#2276) * Towards 1.20 * Init bukkit * Update YAML to 2.0 * Fixes for 1.20 adapters * Update obfuscated field names * Remove getHandle workaround * entityManager is obfuscated * Update paperweight * [ci-skip] Add 1.20 to modrinth task --------- Co-authored-by: Phillipp Glanz Co-authored-by: SirYwell --- .github/ISSUE_TEMPLATE/bug_report.yml | 1 + .github/workflows/build.yml | 15 - build.gradle.kts | 2 +- settings.gradle.kts | 2 +- .../adapters/adapter-1_19_4/build.gradle.kts | 2 +- .../v1_19_R3/PaperweightPlatformAdapter.java | 22 +- .../adapters/adapter-1_20/build.gradle.kts | 17 + .../ext/fawe/v1_20_R1/PaperweightAdapter.java | 1079 +++++++ .../v1_20_R1/PaperweightDataConverters.java | 2800 +++++++++++++++++ .../fawe/v1_20_R1/PaperweightFakePlayer.java | 93 + .../PaperweightWorldNativeAccess.java | 181 ++ .../v1_20_R1/PaperweightBlockMaterial.java | 185 ++ .../fawe/v1_20_R1/PaperweightFaweAdapter.java | 652 ++++ .../PaperweightFaweWorldNativeAccess.java | 287 ++ .../fawe/v1_20_R1/PaperweightGetBlocks.java | 1142 +++++++ .../v1_20_R1/PaperweightGetBlocks_Copy.java | 248 ++ .../v1_20_R1/PaperweightMapChunkUtil.java | 34 + .../v1_20_R1/PaperweightPlatformAdapter.java | 720 +++++ .../v1_20_R1/PaperweightPostProcessor.java | 175 ++ .../PaperweightStarlightRelighter.java | 205 ++ .../PaperweightStarlightRelighterFactory.java | 28 + .../nbt/PaperweightLazyCompoundTag.java | 161 + .../fawe/v1_20_R1/regen/PaperweightRegen.java | 594 ++++ worldedit-bukkit/build.gradle.kts | 4 +- worldedit-core/build.gradle.kts | 5 +- .../configuration/file/YamlConstructor.java | 2 + .../configuration/file/YamlRepresenter.java | 2 + .../com/sk89q/util/yaml/YAMLProcessor.java | 3 +- .../sk89q/worldedit/internal/Constants.java | 5 + .../worldedit/world/biome/BiomeTypes.java | 5 + .../world/block/BlockCategories.java | 23 +- .../worldedit/world/block/BlockTypes.java | 143 + .../worldedit/world/entity/EntityTypes.java | 12 + .../worldedit/world/item/ItemCategories.java | 25 +- .../sk89q/worldedit/world/item/ItemTypes.java | 208 ++ .../world/registry/BundledRegistries.java | 1 + .../worldedit/world/registry/blocks.120.json | 1 + .../worldedit/world/registry/items.120.json | 1 + 38 files changed, 9038 insertions(+), 47 deletions(-) create mode 100644 worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts create mode 100644 worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightAdapter.java create mode 100644 worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightDataConverters.java create mode 100644 worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightFakePlayer.java create mode 100644 worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightWorldNativeAccess.java create mode 100644 worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightBlockMaterial.java create mode 100644 worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightFaweAdapter.java create mode 100644 worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightFaweWorldNativeAccess.java create mode 100644 worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java create mode 100644 worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks_Copy.java create mode 100644 worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightMapChunkUtil.java create mode 100644 worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPlatformAdapter.java create mode 100644 worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPostProcessor.java create mode 100644 worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightStarlightRelighter.java create mode 100644 worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightStarlightRelighterFactory.java create mode 100644 worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/nbt/PaperweightLazyCompoundTag.java create mode 100644 worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/regen/PaperweightRegen.java create mode 100644 worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/blocks.120.json create mode 100644 worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/items.120.json diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 12b4cf2fc..5fef8cc10 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -27,6 +27,7 @@ body: description: Which server version version you using? If your server version is not listed, it is not supported. Update to a supported version first. multiple: false options: + - '1.20' - '1.19.4' - '1.19.3' - '1.19.2' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 832a1ba6b..65555631f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,18 +76,3 @@ jobs: run: ./gradlew modrinth env: MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} - - name: Publish to CurseForge - if: ${{ runner.os == 'Linux' && env.STATUS == 'release' && github.event_name == 'push' && github.ref == 'refs/heads/main'}} - uses: itsmeow/curseforge-upload@v3 - with: - file_path: worldedit-bukkit/build/libs/FastAsyncWorldEdit-Bukkit-${{ github.event.release.tag_name }}.jar - # https://minecraft.curseforge.com/api/game/versions?token=redacted - # gameVersionTypeID: 1 - game_versions: "8503,9016,9190,9261,9560,9561" - project_id: 103525 - game_endpoint: minecraft - token: ${{ secrets.CURSEFORGE_TOKEN }} - display_name: FastAsyncWorldEdit ${{ github.event.release.tag_name }} - release_type: release - changelog: "Click here to view changelog: https://github.com/IntellectualSites/FastAsyncWorldEdit/releases/tag/${{ github.event.release.tag_name }}" - changelog_type: markdown diff --git a/build.gradle.kts b/build.gradle.kts index f79edd650..82caafa3f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -83,7 +83,7 @@ allprojects { } applyCommonConfiguration() -val supportedVersions = listOf("1.16.5", "1.17", "1.17.1", "1.18.2", "1.19", "1.19.1", "1.19.2", "1.19.3", "1.19.4") +val supportedVersions = listOf("1.16.5", "1.17", "1.17.1", "1.18.2", "1.19", "1.19.1", "1.19.2", "1.19.3", "1.19.4", "1.20") tasks { supportedVersions.forEach { diff --git a/settings.gradle.kts b/settings.gradle.kts index 9121dc6ac..8e8ebe625 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,7 +2,7 @@ rootProject.name = "FastAsyncWorldEdit" include("worldedit-libs") -listOf("legacy", "1_17_1", "1_18_2", "1_19", "1_19_3","1_19_4").forEach { +listOf("legacy", "1_17_1", "1_18_2", "1_19", "1_19_3","1_19_4", "1_20").forEach { include("worldedit-bukkit:adapters:adapter-$it") } diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts index 0df6dc795..5e1f312bc 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts +++ b/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts @@ -11,6 +11,6 @@ repositories { } dependencies { - the().paperDevBundle("1.19.4-R0.1-20230601.025018-99") + the().paperDevBundle("1.19.4-R0.1-20230608.201059-104") compileOnly("io.papermc:paperlib") } diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java index cb4ab2f2a..887d7a3d3 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java @@ -109,12 +109,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { private static final MethodHandle methodRemoveGameEventListener; private static final MethodHandle methodremoveTickingBlockEntity; - /* - * This is a workaround for the changes from https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/1fddefce1cdce44010927b888432bf70c0e88cde#src/main/java/org/bukkit/craftbukkit/CraftChunk.java - * and is only needed to support 1.19.4 versions before *and* after this change. - */ - private static final MethodHandle CRAFT_CHUNK_GET_HANDLE; - private static final Field fieldRemove; static final boolean POST_CHUNK_REWRITE; @@ -220,20 +214,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { } catch (Exception e) { throw new RuntimeException(e); } - MethodHandle craftChunkGetHandle; - final MethodType type = methodType(LevelChunk.class); - try { - craftChunkGetHandle = lookup.findVirtual(CraftChunk.class, "getHandle", type); - } catch (NoSuchMethodException | IllegalAccessException e) { - try { - final MethodType newType = methodType(ChunkAccess.class, ChunkStatus.class); - craftChunkGetHandle = lookup.findVirtual(CraftChunk.class, "getHandle", newType); - craftChunkGetHandle = MethodHandles.insertArguments(craftChunkGetHandle, 1, ChunkStatus.FULL); - } catch (NoSuchMethodException | IllegalAccessException ex) { - throw new RuntimeException(ex); - } - } - CRAFT_CHUNK_GET_HANDLE = craftChunkGetHandle; } static boolean setSectionAtomic( @@ -309,7 +289,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { try { CraftChunk chunk = (CraftChunk) future.get(); addTicket(serverLevel, chunkX, chunkZ); - return (LevelChunk) CRAFT_CHUNK_GET_HANDLE.invoke(chunk); + return (LevelChunk) chunk.getHandle(ChunkStatus.FULL); } catch (Throwable e) { e.printStackTrace(); } diff --git a/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts new file mode 100644 index 000000000..c9a239ebf --- /dev/null +++ b/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts @@ -0,0 +1,17 @@ +import io.papermc.paperweight.userdev.PaperweightUserDependenciesExtension + +plugins { + java +} + +applyPaperweightAdapterConfiguration() + +repositories { + gradlePluginPortal() +} + +dependencies { + // https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/ + the().paperDevBundle("1.20-R0.1-20230609.070122-4") + compileOnly("io.papermc:paperlib") +} diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightAdapter.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightAdapter.java new file mode 100644 index 000000000..f39fe98f4 --- /dev/null +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightAdapter.java @@ -0,0 +1,1079 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_20_R1; + +import com.google.common.cache.CacheBuilder; +import com.google.common.cache.CacheLoader; +import com.google.common.cache.LoadingCache; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Sets; +import com.google.common.util.concurrent.Futures; +import com.mojang.datafixers.util.Either; +import com.mojang.serialization.Lifecycle; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.NBTConstants; +import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.blocks.BaseItem; +import com.sk89q.worldedit.blocks.BaseItemStack; +import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; +import com.sk89q.worldedit.bukkit.adapter.Refraction; +import com.sk89q.worldedit.entity.BaseEntity; +import com.sk89q.worldedit.extension.platform.Watchdog; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.internal.Constants; +import com.sk89q.worldedit.internal.block.BlockStateIdAccess; +import com.sk89q.worldedit.internal.wna.WorldNativeAccess; +import com.sk89q.worldedit.math.BlockVector2; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.registry.state.BooleanProperty; +import com.sk89q.worldedit.registry.state.DirectionalProperty; +import com.sk89q.worldedit.registry.state.EnumProperty; +import com.sk89q.worldedit.registry.state.IntegerProperty; +import com.sk89q.worldedit.registry.state.Property; +import com.sk89q.worldedit.util.Direction; +import com.sk89q.worldedit.util.SideEffect; +import com.sk89q.worldedit.util.concurrency.LazyReference; +import com.sk89q.worldedit.util.formatting.text.Component; +import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; +import com.sk89q.worldedit.util.io.file.SafeFiles; +import com.sk89q.worldedit.util.nbt.BinaryTag; +import com.sk89q.worldedit.util.nbt.ByteArrayBinaryTag; +import com.sk89q.worldedit.util.nbt.ByteBinaryTag; +import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; +import com.sk89q.worldedit.util.nbt.DoubleBinaryTag; +import com.sk89q.worldedit.util.nbt.EndBinaryTag; +import com.sk89q.worldedit.util.nbt.FloatBinaryTag; +import com.sk89q.worldedit.util.nbt.IntArrayBinaryTag; +import com.sk89q.worldedit.util.nbt.IntBinaryTag; +import com.sk89q.worldedit.util.nbt.ListBinaryTag; +import com.sk89q.worldedit.util.nbt.LongArrayBinaryTag; +import com.sk89q.worldedit.util.nbt.LongBinaryTag; +import com.sk89q.worldedit.util.nbt.ShortBinaryTag; +import com.sk89q.worldedit.util.nbt.StringBinaryTag; +import com.sk89q.worldedit.world.DataFixer; +import com.sk89q.worldedit.world.RegenOptions; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.biome.BiomeTypes; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.item.ItemType; +import net.minecraft.Util; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; +import net.minecraft.network.protocol.game.ClientboundEntityEventPacket; +import net.minecraft.resources.ResourceKey; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.dedicated.DedicatedServer; +import net.minecraft.server.level.ChunkHolder; +import net.minecraft.server.level.ServerChunkCache; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.progress.ChunkProgressListener; +import net.minecraft.util.StringRepresentable; +import net.minecraft.util.thread.BlockableEventLoop; +import net.minecraft.world.Clearable; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.InteractionResult; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.context.UseOnContext; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.LevelSettings; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.StructureBlockEntity; +import net.minecraft.world.level.block.state.StateDefinition; +import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraft.world.level.chunk.ChunkStatus; +import net.minecraft.world.level.chunk.LevelChunk; +import net.minecraft.world.level.dimension.LevelStem; +import net.minecraft.world.level.levelgen.WorldOptions; +import net.minecraft.world.level.storage.LevelStorageSource; +import net.minecraft.world.level.storage.PrimaryLevelData; +import net.minecraft.world.phys.BlockHitResult; +import net.minecraft.world.phys.Vec3; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.World.Environment; +import org.bukkit.block.data.BlockData; +import org.bukkit.craftbukkit.v1_20_R1.CraftServer; +import org.bukkit.craftbukkit.v1_20_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData; +import org.bukkit.craftbukkit.v1_20_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_20_R1.util.CraftMagicNumbers; +import org.bukkit.entity.Player; +import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; +import org.bukkit.generator.ChunkGenerator; +import org.spigotmc.SpigotConfig; +import org.spigotmc.WatchdogThread; + +import java.lang.ref.WeakReference; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.OptionalInt; +import java.util.OptionalLong; +import java.util.Set; +import java.util.TreeMap; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.stream.Collectors; +import javax.annotation.Nullable; + +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Preconditions.checkState; + +public final class PaperweightAdapter implements BukkitImplAdapter { + + private final Logger LOGGER = Logger.getLogger(getClass().getCanonicalName()); + + private final Field serverWorldsField; + private final Method getChunkFutureMethod; + private final Field chunkProviderExecutorField; + private final Watchdog watchdog; + + // ------------------------------------------------------------------------ + // Code that may break between versions of Minecraft + // ------------------------------------------------------------------------ + + public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException { + // A simple test + CraftServer.class.cast(Bukkit.getServer()); + + int dataVersion = CraftMagicNumbers.INSTANCE.getDataVersion(); + if (dataVersion != 3463) { + throw new UnsupportedClassVersionError("Not 1.20!"); + } + + serverWorldsField = CraftServer.class.getDeclaredField("worlds"); + serverWorldsField.setAccessible(true); + + getChunkFutureMethod = ServerChunkCache.class.getDeclaredMethod( + Refraction.pickName("getChunkFutureMainThread", "c"), + int.class, int.class, ChunkStatus.class, boolean.class + ); + getChunkFutureMethod.setAccessible(true); + + chunkProviderExecutorField = ServerChunkCache.class.getDeclaredField( + Refraction.pickName("mainThreadProcessor", "g") + ); + chunkProviderExecutorField.setAccessible(true); + + new PaperweightDataConverters(CraftMagicNumbers.INSTANCE.getDataVersion(), this).buildUnoptimized(); + + Watchdog watchdog; + try { + Class.forName("org.spigotmc.WatchdogThread"); + watchdog = new SpigotWatchdog(); + } catch (ClassNotFoundException | NoSuchFieldException e) { + try { + watchdog = new MojangWatchdog(((CraftServer) Bukkit.getServer()).getServer()); + } catch (NoSuchFieldException ex) { + watchdog = null; + } + } + this.watchdog = watchdog; + + try { + Class.forName("org.spigotmc.SpigotConfig"); + SpigotConfig.config.set("world-settings.faweregentempworld.verbose", false); + } catch (ClassNotFoundException ignored) { + } + } + + @Override + public DataFixer getDataFixer() { + return PaperweightDataConverters.INSTANCE; + } + + /** + * Read the given NBT data into the given tile entity. + * + * @param tileEntity the tile entity + * @param tag the tag + */ + static void readTagIntoTileEntity(net.minecraft.nbt.CompoundTag tag, BlockEntity tileEntity) { + tileEntity.load(tag); + tileEntity.setChanged(); + } + + /** + * Get the ID string of the given entity. + * + * @param entity the entity + * @return the entity ID + */ + private static String getEntityId(Entity entity) { + return EntityType.getKey(entity.getType()).toString(); + } + + /** + * Create an entity using the given entity ID. + * + * @param id the entity ID + * @param world the world + * @return an entity or null + */ + @Nullable + private static Entity createEntityFromId(String id, net.minecraft.world.level.Level world) { + return EntityType.byString(id).map(t -> t.create(world)).orElse(null); + } + + /** + * Write the given NBT data into the given entity. + * + * @param entity the entity + * @param tag the tag + */ + private static void readTagIntoEntity(net.minecraft.nbt.CompoundTag tag, Entity entity) { + entity.load(tag); + } + + /** + * Write the entity's NBT data to the given tag. + * + * @param entity the entity + * @param tag the tag + */ + private static void readEntityIntoTag(Entity entity, net.minecraft.nbt.CompoundTag tag) { + entity.save(tag); + } + + private static Block getBlockFromType(BlockType blockType) { + + return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.BLOCK).get(ResourceLocation.tryParse(blockType.getId())); + } + + private static Item getItemFromType(ItemType itemType) { + return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(itemType.getId())); + } + + @Override + public OptionalInt getInternalBlockStateId(BlockData data) { + net.minecraft.world.level.block.state.BlockState state = ((CraftBlockData) data).getState(); + int combinedId = Block.getId(state); + return combinedId == 0 && state.getBlock() != Blocks.AIR ? OptionalInt.empty() : OptionalInt.of(combinedId); + } + + @Override + public OptionalInt getInternalBlockStateId(BlockState state) { + Block mcBlock = getBlockFromType(state.getBlockType()); + net.minecraft.world.level.block.state.BlockState newState = mcBlock.defaultBlockState(); + Map, Object> states = state.getStates(); + newState = applyProperties(mcBlock.getStateDefinition(), newState, states); + final int combinedId = Block.getId(newState); + return combinedId == 0 && state.getBlockType() != BlockTypes.AIR ? OptionalInt.empty() : OptionalInt.of(combinedId); + } + + @Override + public BlockState getBlock(Location location) { + checkNotNull(location); + + CraftWorld craftWorld = ((CraftWorld) location.getWorld()); + int x = location.getBlockX(); + int y = location.getBlockY(); + int z = location.getBlockZ(); + + final ServerLevel handle = craftWorld.getHandle(); + LevelChunk chunk = handle.getChunk(x >> 4, z >> 4); + final BlockPos blockPos = new BlockPos(x, y, z); + final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(blockPos); + int internalId = Block.getId(blockData); + BlockState state = BlockStateIdAccess.getBlockStateById(internalId); + if (state == null) { + org.bukkit.block.Block bukkitBlock = location.getBlock(); + state = BukkitAdapter.adapt(bukkitBlock.getBlockData()); + } + + return state; + } + + @Override + public BaseBlock getFullBlock(Location location) { + BlockState state = getBlock(location); + + CraftWorld craftWorld = ((CraftWorld) location.getWorld()); + int x = location.getBlockX(); + int y = location.getBlockY(); + int z = location.getBlockZ(); + + final ServerLevel handle = craftWorld.getHandle(); + LevelChunk chunk = handle.getChunk(x >> 4, z >> 4); + final BlockPos blockPos = new BlockPos(x, y, z); + + // Read the NBT data + BlockEntity te = chunk.getBlockEntity(blockPos); + if (te != null) { + net.minecraft.nbt.CompoundTag tag = te.saveWithId(); + return state.toBaseBlock((CompoundBinaryTag) toNativeBinary(tag)); + } + + return state.toBaseBlock(); + } +/* + @Override + public boolean hasCustomBiomeSupport() { + return true; + } +*/ + private static final HashMap> biomeTypeToNMSCache = new HashMap<>(); + private static final HashMap, BiomeType> biomeTypeFromNMSCache = new HashMap<>(); + + /* @Override + public BiomeType getBiome(Location location) { + checkNotNull(location); + + CraftWorld craftWorld = ((CraftWorld) location.getWorld()); + int x = location.getBlockX(); + int y = location.getBlockY(); + int z = location.getBlockZ(); + + final ServerLevel handle = craftWorld.getHandle(); + LevelChunk chunk = handle.getChunk(x >> 4, z >> 4); + + return biomeTypeFromNMSCache.computeIfAbsent(chunk.getNoiseBiome(x >> 2, y >> 2, z >> 2), b -> BiomeType.REGISTRY.get(b.unwrapKey().get().location().toString())); + } + + @Override + public void setBiome(Location location, BiomeType biome) { + checkNotNull(location); + checkNotNull(biome); + + CraftWorld craftWorld = ((CraftWorld) location.getWorld()); + int x = location.getBlockX(); + int y = location.getBlockY(); + int z = location.getBlockZ(); + + final ServerLevel handle = craftWorld.getHandle(); + LevelChunk chunk = handle.getChunk(x >> 4, z >> 4); + chunk.setBiome(x >> 2, y >> 2, z >> 2, biomeTypeToNMSCache.computeIfAbsent(biome, b -> ((CraftServer) Bukkit.getServer()).getServer().registryAccess().registryOrThrow(Registries.BIOME).getHolderOrThrow(ResourceKey.create(Registries.BIOME, new ResourceLocation(b.getId()))))); + chunk.setUnsaved(true); + }*/ + + @Override + public WorldNativeAccess createWorldNativeAccess(org.bukkit.World world) { + return new com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_20_R1.PaperweightWorldNativeAccess(this, + new WeakReference<>(((CraftWorld) world).getHandle())); + } + + private static net.minecraft.core.Direction adapt(Direction face) { + switch (face) { + case NORTH: + return net.minecraft.core.Direction.NORTH; + case SOUTH: + return net.minecraft.core.Direction.SOUTH; + case WEST: + return net.minecraft.core.Direction.WEST; + case EAST: + return net.minecraft.core.Direction.EAST; + case DOWN: + return net.minecraft.core.Direction.DOWN; + case UP: + default: + return net.minecraft.core.Direction.UP; + } + } + + @SuppressWarnings({"rawtypes", "unchecked"}) + private net.minecraft.world.level.block.state.BlockState applyProperties( + StateDefinition stateContainer, + net.minecraft.world.level.block.state.BlockState newState, + Map, Object> states + ) { + for (Map.Entry, Object> state : states.entrySet()) { + net.minecraft.world.level.block.state.properties.Property property = + stateContainer.getProperty(state.getKey().getName()); + Comparable value = (Comparable) state.getValue(); + // we may need to adapt this value, depending on the source prop + if (property instanceof DirectionProperty) { + Direction dir = (Direction) value; + value = adapt(dir); + } else if (property instanceof net.minecraft.world.level.block.state.properties.EnumProperty) { + String enumName = (String) value; + value = ((net.minecraft.world.level.block.state.properties.EnumProperty) property) + .getValue(enumName).orElseThrow(() -> + new IllegalStateException( + "Enum property " + property.getName() + " does not contain " + enumName + ) + ); + } + + newState = newState.setValue( + (net.minecraft.world.level.block.state.properties.Property) property, + (Comparable) value + ); + } + return newState; + } + + @Override + public BaseEntity getEntity(org.bukkit.entity.Entity entity) { + checkNotNull(entity); + + CraftEntity craftEntity = ((CraftEntity) entity); + Entity mcEntity = craftEntity.getHandle(); + + // Do not allow creating of passenger entity snapshots, passengers are included in the vehicle entity + if (mcEntity.isPassenger()) { + return null; + } + + String id = getEntityId(mcEntity); + + net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag(); + readEntityIntoTag(mcEntity, tag); + return new BaseEntity( + com.sk89q.worldedit.world.entity.EntityTypes.get(id), + LazyReference.from(() -> (CompoundBinaryTag) toNativeBinary(tag)) + ); + } + + @Nullable + @Override + public org.bukkit.entity.Entity createEntity(Location location, BaseEntity state) { + checkNotNull(location); + checkNotNull(state); + + CraftWorld craftWorld = ((CraftWorld) location.getWorld()); + ServerLevel worldServer = craftWorld.getHandle(); + + Entity createdEntity = createEntityFromId(state.getType().getId(), craftWorld.getHandle()); + + if (createdEntity != null) { + CompoundBinaryTag nativeTag = state.getNbt(); + if (nativeTag != null) { + net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) fromNativeBinary(nativeTag); + for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) { + tag.remove(name); + } + readTagIntoEntity(tag, createdEntity); + } + + createdEntity.absMoveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + + worldServer.addFreshEntity(createdEntity, SpawnReason.CUSTOM); + return createdEntity.getBukkitEntity(); + } else { + return null; + } + } + + // This removes all unwanted tags from the main entity and all its passengers + private void removeUnwantedEntityTagsRecursively(net.minecraft.nbt.CompoundTag tag) { + for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) { + tag.remove(name); + } + + // Adapted from net.minecraft.world.entity.EntityType#loadEntityRecursive + if (tag.contains("Passengers", NBTConstants.TYPE_LIST)) { + net.minecraft.nbt.ListTag nbttaglist = tag.getList("Passengers", NBTConstants.TYPE_COMPOUND); + + for (int i = 0; i < nbttaglist.size(); ++i) { + removeUnwantedEntityTagsRecursively(nbttaglist.getCompound(i)); + } + } + } + + @Override + public Component getRichBlockName(BlockType blockType) { + return TranslatableComponent.of(getBlockFromType(blockType).getDescriptionId()); + } + + @Override + public Component getRichItemName(ItemType itemType) { + return TranslatableComponent.of(getItemFromType(itemType).getDescriptionId()); + } + + @Override + public Component getRichItemName(BaseItemStack itemStack) { + return TranslatableComponent.of(CraftItemStack.asNMSCopy(BukkitAdapter.adapt(itemStack)).getDescriptionId()); + } + + @SuppressWarnings({ "unchecked", "rawtypes" }) + private static final LoadingCache> PROPERTY_CACHE = CacheBuilder.newBuilder().build(new CacheLoader>() { + @Override + public Property load(net.minecraft.world.level.block.state.properties.Property state) throws Exception { + if (state instanceof net.minecraft.world.level.block.state.properties.BooleanProperty) { + return new BooleanProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues())); + } else if (state instanceof DirectionProperty) { + return new DirectionalProperty(state.getName(), + (List) state.getPossibleValues().stream().map(e -> Direction.valueOf(((StringRepresentable) e).getSerializedName().toUpperCase(Locale.ROOT))).collect(Collectors.toList())); + } else if (state instanceof net.minecraft.world.level.block.state.properties.EnumProperty) { + return new EnumProperty(state.getName(), + (List) state.getPossibleValues().stream().map(e -> ((StringRepresentable) e).getSerializedName()).collect(Collectors.toList())); + } else if (state instanceof net.minecraft.world.level.block.state.properties.IntegerProperty) { + return new IntegerProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues())); + } else { + throw new IllegalArgumentException("WorldEdit needs an update to support " + state.getClass().getSimpleName()); + } + } + }); + + @SuppressWarnings({ "rawtypes" }) + @Override + public Map> getProperties(BlockType blockType) { + Map> properties = new TreeMap<>(); + Block block = getBlockFromType(blockType); + StateDefinition blockStateList = + block.getStateDefinition(); + for (net.minecraft.world.level.block.state.properties.Property state : blockStateList.getProperties()) { + Property property = PROPERTY_CACHE.getUnchecked(state); + properties.put(property.getName(), property); + } + return properties; + } + + @Override + public void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData) { + ((CraftPlayer) player).getHandle().connection.send(ClientboundBlockEntityDataPacket.create( + new StructureBlockEntity( + new BlockPos(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()), + Blocks.STRUCTURE_BLOCK.defaultBlockState() + ), + __ -> (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData) + )); + } + + /*@Override + public void sendFakeNBT(Player player, BlockVector3 pos, CompoundTag nbtData) { + ((CraftPlayer) player).getHandle().connection.send(ClientboundBlockEntityDataPacket.create( + new StructureBlockEntity( + new BlockPos(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()), + Blocks.STRUCTURE_BLOCK.defaultBlockState() + ), + __ -> (net.minecraft.nbt.CompoundTag) fromNative(nbtData) + )); + }*/ + + @Override + public void sendFakeOP(Player player) { + ((CraftPlayer) player).getHandle().connection.send(new ClientboundEntityEventPacket( + ((CraftPlayer) player).getHandle(), (byte) 28 + )); + } + + @Override + public org.bukkit.inventory.ItemStack adapt(BaseItemStack item) { + ItemStack stack = new ItemStack( + DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(item.getType().getId())), + item.getAmount() + ); + stack.setTag(((net.minecraft.nbt.CompoundTag) fromNative(item.getNbtData()))); + return CraftItemStack.asCraftMirror(stack); + } + + @Override + public BaseItemStack adapt(org.bukkit.inventory.ItemStack itemStack) { + final ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); + final BaseItemStack weStack = new BaseItemStack(BukkitAdapter.asItemType(itemStack.getType()), itemStack.getAmount()); + weStack.setNbt(((CompoundBinaryTag) toNativeBinary(nmsStack.getTag()))); + return weStack; + } + + private final LoadingCache fakePlayers + = CacheBuilder.newBuilder().weakKeys().softValues().build(CacheLoader.from(PaperweightFakePlayer::new)); + + @Override + public boolean simulateItemUse(org.bukkit.World world, BlockVector3 position, BaseItem item, Direction face) { + CraftWorld craftWorld = (CraftWorld) world; + ServerLevel worldServer = craftWorld.getHandle(); + ItemStack stack = CraftItemStack.asNMSCopy(BukkitAdapter.adapt(item instanceof BaseItemStack + ? ((BaseItemStack) item) : new BaseItemStack(item.getType(), item.getNbtData(), 1))); + stack.setTag((net.minecraft.nbt.CompoundTag) fromNative(item.getNbtData())); + + PaperweightFakePlayer fakePlayer; + try { + fakePlayer = fakePlayers.get(worldServer); + } catch (ExecutionException ignored) { + return false; + } + fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, stack); + fakePlayer.absMoveTo(position.getBlockX(), position.getBlockY(), position.getBlockZ(), + (float) face.toVector().toYaw(), (float) face.toVector().toPitch()); + + final BlockPos blockPos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); + final Vec3 blockVec = Vec3.atLowerCornerOf(blockPos); + final net.minecraft.core.Direction enumFacing = adapt(face); + BlockHitResult rayTrace = new BlockHitResult(blockVec, enumFacing, blockPos, false); + UseOnContext context = new UseOnContext(fakePlayer, InteractionHand.MAIN_HAND, rayTrace); + InteractionResult result = stack.useOn(context, InteractionHand.MAIN_HAND); + if (result != InteractionResult.SUCCESS) { + if (worldServer.getBlockState(blockPos).use(worldServer, fakePlayer, InteractionHand.MAIN_HAND, rayTrace).consumesAction()) { + result = InteractionResult.SUCCESS; + } else { + result = stack.getItem().use(worldServer, fakePlayer, InteractionHand.MAIN_HAND).getResult(); + } + } + + return result == InteractionResult.SUCCESS; + } + + @Override + public boolean canPlaceAt(org.bukkit.World world, BlockVector3 position, BlockState blockState) { + int internalId = BlockStateIdAccess.getBlockStateId(blockState); + net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId); + return blockData.canSurvive(((CraftWorld) world).getHandle(), new BlockPos(position.getX(), position.getY(), position.getZ())); + } + + @Override + public boolean regenerate(org.bukkit.World bukkitWorld, Region region, Extent extent, RegenOptions options) { + try { + doRegen(bukkitWorld, region, extent, options); + } catch (Exception e) { + throw new IllegalStateException("Regen failed.", e); + } + + return true; + } + + private void doRegen(org.bukkit.World bukkitWorld, Region region, Extent extent, RegenOptions options) throws Exception { + Environment env = bukkitWorld.getEnvironment(); + ChunkGenerator gen = bukkitWorld.getGenerator(); + + Path tempDir = Files.createTempDirectory("WorldEditWorldGen"); + LevelStorageSource levelStorage = LevelStorageSource.createDefault(tempDir); + ResourceKey worldDimKey = getWorldDimKey(env); + try (LevelStorageSource.LevelStorageAccess session = levelStorage.createAccess("faweregentempworld", worldDimKey)) { + ServerLevel originalWorld = ((CraftWorld) bukkitWorld).getHandle(); + PrimaryLevelData levelProperties = (PrimaryLevelData) originalWorld.getServer() + .getWorldData().overworldData(); + WorldOptions originalOpts = levelProperties.worldGenOptions(); + + long seed = options.getSeed().orElse(originalWorld.getSeed()); + WorldOptions newOpts = options.getSeed().isPresent() + ? originalOpts.withSeed(OptionalLong.of(seed)) + : originalOpts; + + LevelSettings newWorldSettings = new LevelSettings( + "faweregentempworld", + levelProperties.settings.gameType(), + levelProperties.settings.hardcore(), + levelProperties.settings.difficulty(), + levelProperties.settings.allowCommands(), + levelProperties.settings.gameRules(), + levelProperties.settings.getDataConfiguration() + ); + + PrimaryLevelData.SpecialWorldProperty specialWorldProperty = + levelProperties.isFlatWorld() + ? PrimaryLevelData.SpecialWorldProperty.FLAT + : levelProperties.isDebugWorld() + ? PrimaryLevelData.SpecialWorldProperty.DEBUG + : PrimaryLevelData.SpecialWorldProperty.NONE; + + PrimaryLevelData newWorldData = new PrimaryLevelData(newWorldSettings, newOpts, specialWorldProperty, Lifecycle.stable()); + + ServerLevel freshWorld = new ServerLevel( + originalWorld.getServer(), + originalWorld.getServer().executor, + session, newWorldData, + originalWorld.dimension(), + new LevelStem( + originalWorld.dimensionTypeRegistration(), + originalWorld.getChunkSource().getGenerator() + ), + new NoOpWorldLoadListener(), + originalWorld.isDebug(), + seed, + ImmutableList.of(), + false, + originalWorld.getRandomSequences(), + env, + gen, + bukkitWorld.getBiomeProvider() + ); + try { + regenForWorld(region, extent, freshWorld, options); + } finally { + freshWorld.getChunkSource().close(false); + } + } finally { + try { + @SuppressWarnings("unchecked") + Map map = (Map) serverWorldsField.get(Bukkit.getServer()); + map.remove("faweregentempworld"); + } catch (IllegalAccessException ignored) { + } + SafeFiles.tryHardToDeleteDir(tempDir); + } + } + + private BiomeType adapt(ServerLevel serverWorld, Biome origBiome) { + ResourceLocation key = serverWorld.registryAccess().registryOrThrow(Registries.BIOME).getKey(origBiome); + if (key == null) { + return null; + } + return BiomeTypes.get(key.toString()); + } + + @SuppressWarnings("unchecked") + private void regenForWorld(Region region, Extent extent, ServerLevel serverWorld, RegenOptions options) throws WorldEditException { + List> chunkLoadings = submitChunkLoadTasks(region, serverWorld); + BlockableEventLoop executor; + try { + executor = (BlockableEventLoop) chunkProviderExecutorField.get(serverWorld.getChunkSource()); + } catch (IllegalAccessException e) { + throw new IllegalStateException("Couldn't get executor for chunk loading.", e); + } + executor.managedBlock(() -> { + // bail out early if a future fails + if (chunkLoadings.stream().anyMatch(ftr -> + ftr.isDone() && Futures.getUnchecked(ftr) == null + )) { + return false; + } + return chunkLoadings.stream().allMatch(CompletableFuture::isDone); + }); + Map chunks = new HashMap<>(); + for (CompletableFuture future : chunkLoadings) { + @Nullable + ChunkAccess chunk = future.getNow(null); + checkState(chunk != null, "Failed to generate a chunk, regen failed."); + chunks.put(chunk.getPos(), chunk); + } + + for (BlockVector3 vec : region) { + BlockPos pos = new BlockPos(vec.getBlockX(), vec.getBlockY(), vec.getBlockZ()); + ChunkAccess chunk = chunks.get(new ChunkPos(pos)); + final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(pos); + int internalId = Block.getId(blockData); + BlockStateHolder state = BlockStateIdAccess.getBlockStateById(internalId); + Objects.requireNonNull(state); + BlockEntity blockEntity = chunk.getBlockEntity(pos); + if (blockEntity != null) { + net.minecraft.nbt.CompoundTag tag = blockEntity.saveWithId(); + state = state.toBaseBlock(((CompoundBinaryTag) toNativeBinary(tag))); + } + extent.setBlock(vec, state.toBaseBlock()); + if (options.shouldRegenBiomes()) { + Biome origBiome = chunk.getNoiseBiome(vec.getX(), vec.getY(), vec.getZ()).value(); + BiomeType adaptedBiome = adapt(serverWorld, origBiome); + if (adaptedBiome != null) { + extent.setBiome(vec, adaptedBiome); + } + } + } + } + + @SuppressWarnings("unchecked") + private List> submitChunkLoadTasks(Region region, ServerLevel serverWorld) { + ServerChunkCache chunkManager = serverWorld.getChunkSource(); + List> chunkLoadings = new ArrayList<>(); + // Pre-gen all the chunks + for (BlockVector2 chunk : region.getChunks()) { + try { + //noinspection unchecked + chunkLoadings.add( + ((CompletableFuture>) + getChunkFutureMethod.invoke(chunkManager, chunk.getX(), chunk.getZ(), ChunkStatus.FEATURES, true)) + .thenApply(either -> either.left().orElse(null)) + ); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new IllegalStateException("Couldn't load chunk for regen.", e); + } + } + return chunkLoadings; + } + + private ResourceKey getWorldDimKey(Environment env) { + switch (env) { + case NETHER: + return LevelStem.NETHER; + case THE_END: + return LevelStem.END; + case NORMAL: + default: + return LevelStem.OVERWORLD; + } + } + + private static final Set SUPPORTED_SIDE_EFFECTS = Sets.immutableEnumSet( + SideEffect.NEIGHBORS, + SideEffect.LIGHTING, + SideEffect.VALIDATION, + SideEffect.ENTITY_AI, + SideEffect.EVENTS, + SideEffect.UPDATE + ); + + @Override + public Set getSupportedSideEffects() { + return SUPPORTED_SIDE_EFFECTS; + } + + @Override + public boolean clearContainerBlockContents(org.bukkit.World world, BlockVector3 pt) { + ServerLevel originalWorld = ((CraftWorld) world).getHandle(); + + BlockEntity entity = originalWorld.getBlockEntity(new BlockPos(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ())); + if (entity instanceof Clearable) { + ((Clearable) entity).clearContent(); + return true; + } + return false; + } + + /*@Override + public void initializeRegistries() { + DedicatedServer server = ((CraftServer) Bukkit.getServer()).getServer(); + // Biomes + for (ResourceLocation name : server.registryAccess().registryOrThrow(Registries.BIOME).keySet()) { + if (BiomeType.REGISTRY.get(name.toString()) == null) { + BiomeType.REGISTRY.register(name.toString(), new BiomeType(name.toString())); + } + } + }* + + // ------------------------------------------------------------------------ + // Code that is less likely to break + // ------------------------------------------------------------------------ + + /** + * Converts from a non-native NMS NBT structure to a native WorldEdit NBT + * structure. + * + * @param foreign non-native NMS NBT structure + * @return native WorldEdit NBT structure + */ + @Override + public BinaryTag toNativeBinary(net.minecraft.nbt.Tag foreign) { + if (foreign == null) { + return null; + } + if (foreign instanceof net.minecraft.nbt.CompoundTag) { + Map values = new HashMap<>(); + Set foreignKeys = ((net.minecraft.nbt.CompoundTag) foreign).getAllKeys(); + + for (String str : foreignKeys) { + net.minecraft.nbt.Tag base = ((net.minecraft.nbt.CompoundTag) foreign).get(str); + values.put(str, toNativeBinary(base)); + } + return CompoundBinaryTag.from(values); + } else if (foreign instanceof net.minecraft.nbt.ByteTag) { + return ByteBinaryTag.of(((net.minecraft.nbt.ByteTag) foreign).getAsByte()); + } else if (foreign instanceof net.minecraft.nbt.ByteArrayTag) { + return ByteArrayBinaryTag.of(((net.minecraft.nbt.ByteArrayTag) foreign).getAsByteArray()); + } else if (foreign instanceof net.minecraft.nbt.DoubleTag) { + return DoubleBinaryTag.of(((net.minecraft.nbt.DoubleTag) foreign).getAsDouble()); + } else if (foreign instanceof net.minecraft.nbt.FloatTag) { + return FloatBinaryTag.of(((net.minecraft.nbt.FloatTag) foreign).getAsFloat()); + } else if (foreign instanceof net.minecraft.nbt.IntTag) { + return IntBinaryTag.of(((net.minecraft.nbt.IntTag) foreign).getAsInt()); + } else if (foreign instanceof net.minecraft.nbt.IntArrayTag) { + return IntArrayBinaryTag.of(((net.minecraft.nbt.IntArrayTag) foreign).getAsIntArray()); + } else if (foreign instanceof net.minecraft.nbt.LongArrayTag) { + return LongArrayBinaryTag.of(((net.minecraft.nbt.LongArrayTag) foreign).getAsLongArray()); + } else if (foreign instanceof net.minecraft.nbt.ListTag) { + try { + return toNativeList((net.minecraft.nbt.ListTag) foreign); + } catch (Throwable e) { + LOGGER.log(Level.WARNING, "Failed to convert net.minecraft.nbt.ListTag", e); + return ListBinaryTag.empty(); + } + } else if (foreign instanceof net.minecraft.nbt.LongTag) { + return LongBinaryTag.of(((net.minecraft.nbt.LongTag) foreign).getAsLong()); + } else if (foreign instanceof net.minecraft.nbt.ShortTag) { + return ShortBinaryTag.of(((net.minecraft.nbt.ShortTag) foreign).getAsShort()); + } else if (foreign instanceof net.minecraft.nbt.StringTag) { + return StringBinaryTag.of(foreign.getAsString()); + } else if (foreign instanceof net.minecraft.nbt.EndTag) { + return EndBinaryTag.get(); + } else { + throw new IllegalArgumentException("Don't know how to make native " + foreign.getClass().getCanonicalName()); + } + } + + /** + * Convert a foreign NBT list tag into a native WorldEdit one. + * + * @param foreign the foreign tag + * @return the converted tag + * @throws SecurityException on error + * @throws IllegalArgumentException on error + */ + private ListBinaryTag toNativeList(net.minecraft.nbt.ListTag foreign) throws SecurityException, IllegalArgumentException { + ListBinaryTag.Builder values = ListBinaryTag.builder(); + + for (net.minecraft.nbt.Tag tag : foreign) { + values.add(toNativeBinary(tag)); + } + + return values.build(); + } + + /** + * Converts a WorldEdit-native NBT structure to a NMS structure. + * + * @param foreign structure to convert + * @return non-native structure + */ + @Override + public net.minecraft.nbt.Tag fromNativeBinary(BinaryTag foreign) { + if (foreign == null) { + return null; + } + if (foreign instanceof CompoundBinaryTag) { + net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag(); + for (String key : ((CompoundBinaryTag) foreign).keySet()) { + tag.put(key, fromNativeBinary(((CompoundBinaryTag) foreign).get(key))); + } + return tag; + } else if (foreign instanceof ByteBinaryTag) { + return net.minecraft.nbt.ByteTag.valueOf(((ByteBinaryTag) foreign).value()); + } else if (foreign instanceof ByteArrayBinaryTag) { + return new net.minecraft.nbt.ByteArrayTag(((ByteArrayBinaryTag) foreign).value()); + } else if (foreign instanceof DoubleBinaryTag) { + return net.minecraft.nbt.DoubleTag.valueOf(((DoubleBinaryTag) foreign).value()); + } else if (foreign instanceof FloatBinaryTag) { + return net.minecraft.nbt.FloatTag.valueOf(((FloatBinaryTag) foreign).value()); + } else if (foreign instanceof IntBinaryTag) { + return net.minecraft.nbt.IntTag.valueOf(((IntBinaryTag) foreign).value()); + } else if (foreign instanceof IntArrayBinaryTag) { + return new net.minecraft.nbt.IntArrayTag(((IntArrayBinaryTag) foreign).value()); + } else if (foreign instanceof LongArrayBinaryTag) { + return new net.minecraft.nbt.LongArrayTag(((LongArrayBinaryTag) foreign).value()); + } else if (foreign instanceof ListBinaryTag) { + net.minecraft.nbt.ListTag tag = new net.minecraft.nbt.ListTag(); + ListBinaryTag foreignList = (ListBinaryTag) foreign; + for (BinaryTag t : foreignList) { + tag.add(fromNativeBinary(t)); + } + return tag; + } else if (foreign instanceof LongBinaryTag) { + return net.minecraft.nbt.LongTag.valueOf(((LongBinaryTag) foreign).value()); + } else if (foreign instanceof ShortBinaryTag) { + return net.minecraft.nbt.ShortTag.valueOf(((ShortBinaryTag) foreign).value()); + } else if (foreign instanceof StringBinaryTag) { + return net.minecraft.nbt.StringTag.valueOf(((StringBinaryTag) foreign).value()); + } else if (foreign instanceof EndBinaryTag) { + return net.minecraft.nbt.EndTag.INSTANCE; + } else { + throw new IllegalArgumentException("Don't know how to make NMS " + foreign.getClass().getCanonicalName()); + } + } + + @Override + public boolean supportsWatchdog() { + return watchdog != null; + } + + @Override + public void tickWatchdog() { + watchdog.tick(); + } + + private class SpigotWatchdog implements Watchdog { + private final Field instanceField; + private final Field lastTickField; + + SpigotWatchdog() throws NoSuchFieldException { + Field instanceField = WatchdogThread.class.getDeclaredField("instance"); + instanceField.setAccessible(true); + this.instanceField = instanceField; + + Field lastTickField = WatchdogThread.class.getDeclaredField("lastTick"); + lastTickField.setAccessible(true); + this.lastTickField = lastTickField; + } + + @Override + public void tick() { + try { + WatchdogThread instance = (WatchdogThread) this.instanceField.get(null); + if ((long) lastTickField.get(instance) != 0) { + WatchdogThread.tick(); + } + } catch (IllegalAccessException e) { + LOGGER.log(Level.WARNING, "Failed to tick watchdog", e); + } + } + } + + private static class MojangWatchdog implements Watchdog { + private final DedicatedServer server; + private final Field tickField; + + MojangWatchdog(DedicatedServer server) throws NoSuchFieldException { + this.server = server; + Field tickField = MinecraftServer.class.getDeclaredField( + Refraction.pickName("nextTickTime", "ah") + ); + if (tickField.getType() != long.class) { + throw new IllegalStateException("nextTickTime is not a long field, mapping is likely incorrect"); + } + tickField.setAccessible(true); + this.tickField = tickField; + } + + @Override + public void tick() { + try { + tickField.set(server, Util.getMillis()); + } catch (IllegalAccessException ignored) { + } + } + } + + private static class NoOpWorldLoadListener implements ChunkProgressListener { + @Override + public void updateSpawnPos(ChunkPos spawnPos) { + } + + @Override + public void onStatusChange(ChunkPos pos, @org.jetbrains.annotations.Nullable ChunkStatus status) { + } + + @Override + public void start() { + } + + @Override + public void stop() { + } + + @Override + public void setChunkRadius(int radius) { + } + } +} diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightDataConverters.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightDataConverters.java new file mode 100644 index 000000000..1b56d2956 --- /dev/null +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightDataConverters.java @@ -0,0 +1,2800 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_20_R1; + +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonParseException; +import com.mojang.datafixers.DSL; +import com.mojang.datafixers.DSL.TypeReference; +import com.mojang.datafixers.DataFixer; +import com.mojang.datafixers.DataFixerBuilder; +import com.mojang.datafixers.schemas.Schema; +import com.mojang.serialization.Dynamic; +import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; +import net.minecraft.core.Direction; +import net.minecraft.nbt.NbtOps; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.GsonHelper; +import net.minecraft.util.StringUtil; +import net.minecraft.util.datafix.DataFixers; +import net.minecraft.util.datafix.fixes.References; +import net.minecraft.world.item.DyeColor; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.Executor; +import java.util.stream.Collectors; +import javax.annotation.Nullable; + +/** + * Handles converting all Pre 1.13.2 data using the Legacy DataFix System (ported to 1.13.2) + * + * We register a DFU Fixer per Legacy Data Version and apply the fixes using legacy strategy + * which is safer, faster and cleaner code. + * + * The pre DFU code did not fail when the Source version was unknown. + * + * This class also provides util methods for converting compounds to wrap the update call to + * receive the source version in the compound + */ +@SuppressWarnings({ "rawtypes", "unchecked" }) +class PaperweightDataConverters extends DataFixerBuilder implements com.sk89q.worldedit.world.DataFixer { + + //FAWE start - BinaryTag + @SuppressWarnings("unchecked") + @Override + public T fixUp(FixType type, T original, int srcVer) { + if (type == FixTypes.CHUNK) { + return (T) fixChunk((CompoundBinaryTag) original, srcVer); + } else if (type == FixTypes.BLOCK_ENTITY) { + return (T) fixBlockEntity((CompoundBinaryTag) original, srcVer); + } else if (type == FixTypes.ENTITY) { + return (T) fixEntity((CompoundBinaryTag) original, srcVer); + } else if (type == FixTypes.BLOCK_STATE) { + return (T) fixBlockState((String) original, srcVer); + } else if (type == FixTypes.ITEM_TYPE) { + return (T) fixItemType((String) original, srcVer); + } else if (type == FixTypes.BIOME) { + return (T) fixBiome((String) original, srcVer); + } + return original; + } + + private CompoundBinaryTag fixChunk(CompoundBinaryTag originalChunk, int srcVer) { + net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNativeBinary(originalChunk); + net.minecraft.nbt.CompoundTag fixed = convert(LegacyType.CHUNK, tag, srcVer); + return (CompoundBinaryTag) adapter.toNativeBinary(fixed); + } + + private CompoundBinaryTag fixBlockEntity(CompoundBinaryTag origTileEnt, int srcVer) { + net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNativeBinary(origTileEnt); + net.minecraft.nbt.CompoundTag fixed = convert(LegacyType.BLOCK_ENTITY, tag, srcVer); + return (CompoundBinaryTag) adapter.toNativeBinary(fixed); + } + + private CompoundBinaryTag fixEntity(CompoundBinaryTag origEnt, int srcVer) { + net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNativeBinary(origEnt); + net.minecraft.nbt.CompoundTag fixed = convert(LegacyType.ENTITY, tag, srcVer); + return (CompoundBinaryTag) adapter.toNativeBinary(fixed); + } + //FAWE end + + private String fixBlockState(String blockState, int srcVer) { + net.minecraft.nbt.CompoundTag stateNBT = stateToNBT(blockState); + Dynamic dynamic = new Dynamic<>(OPS_NBT, stateNBT); + net.minecraft.nbt.CompoundTag fixed = (net.minecraft.nbt.CompoundTag) INSTANCE.fixer.update(References.BLOCK_STATE, dynamic, srcVer, DATA_VERSION).getValue(); + return nbtToState(fixed); + } + + private String nbtToState(net.minecraft.nbt.CompoundTag tagCompound) { + StringBuilder sb = new StringBuilder(); + sb.append(tagCompound.getString("Name")); + if (tagCompound.contains("Properties", 10)) { + sb.append('['); + net.minecraft.nbt.CompoundTag props = tagCompound.getCompound("Properties"); + sb.append(props.getAllKeys().stream().map(k -> k + "=" + props.getString(k).replace("\"", "")).collect(Collectors.joining(","))); + sb.append(']'); + } + return sb.toString(); + } + + private static net.minecraft.nbt.CompoundTag stateToNBT(String blockState) { + int propIdx = blockState.indexOf('['); + net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag(); + if (propIdx < 0) { + tag.putString("Name", blockState); + } else { + tag.putString("Name", blockState.substring(0, propIdx)); + net.minecraft.nbt.CompoundTag propTag = new net.minecraft.nbt.CompoundTag(); + String props = blockState.substring(propIdx + 1, blockState.length() - 1); + String[] propArr = props.split(","); + for (String pair : propArr) { + final String[] split = pair.split("="); + propTag.putString(split[0], split[1]); + } + tag.put("Properties", propTag); + } + return tag; + } + + private String fixBiome(String key, int srcVer) { + return fixName(key, srcVer, References.BIOME); + } + + private String fixItemType(String key, int srcVer) { + return fixName(key, srcVer, References.ITEM_NAME); + } + + private static String fixName(String key, int srcVer, TypeReference type) { + return INSTANCE.fixer.update(type, new Dynamic<>(OPS_NBT, net.minecraft.nbt.StringTag.valueOf(key)), srcVer, DATA_VERSION) + .getValue().getAsString(); + } + + private final PaperweightAdapter adapter; + + private static final NbtOps OPS_NBT = NbtOps.INSTANCE; + private static final int LEGACY_VERSION = 1343; + private static int DATA_VERSION; + static PaperweightDataConverters INSTANCE; + + private final Map> converters = new EnumMap<>(LegacyType.class); + private final Map> inspectors = new EnumMap<>(LegacyType.class); + + // Set on build + private DataFixer fixer; + private static final Map DFU_TO_LEGACY = new HashMap<>(); + + public enum LegacyType { + LEVEL(References.LEVEL), + PLAYER(References.PLAYER), + CHUNK(References.CHUNK), + BLOCK_ENTITY(References.BLOCK_ENTITY), + ENTITY(References.ENTITY), + ITEM_INSTANCE(References.ITEM_STACK), + OPTIONS(References.OPTIONS), + STRUCTURE(References.STRUCTURE); + + private final TypeReference type; + + LegacyType(TypeReference type) { + this.type = type; + DFU_TO_LEGACY.put(type.typeName(), this); + } + + public TypeReference getDFUType() { + return type; + } + } + + PaperweightDataConverters(int dataVersion, PaperweightAdapter adapter) { + super(dataVersion); + DATA_VERSION = dataVersion; + INSTANCE = this; + this.adapter = adapter; + registerConverters(); + registerInspectors(); + } + + + // Called after fixers are built and ready for FIXING + @Override + public DataFixer buildUnoptimized() { + return this.fixer = new WrappedDataFixer(DataFixers.getDataFixer()); + } + + @Override + public DataFixer buildOptimized(final Set requiredTypes, Executor executor) { + return buildUnoptimized(); + } + + @SuppressWarnings("unchecked") + private class WrappedDataFixer implements DataFixer { + private final DataFixer realFixer; + + WrappedDataFixer(DataFixer realFixer) { + this.realFixer = realFixer; + } + + @Override + public Dynamic update(TypeReference type, Dynamic dynamic, int sourceVer, int targetVer) { + LegacyType legacyType = DFU_TO_LEGACY.get(type.typeName()); + if (sourceVer < LEGACY_VERSION && legacyType != null) { + net.minecraft.nbt.CompoundTag cmp = (net.minecraft.nbt.CompoundTag) dynamic.getValue(); + int desiredVersion = Math.min(targetVer, LEGACY_VERSION); + + cmp = convert(legacyType, cmp, sourceVer, desiredVersion); + sourceVer = desiredVersion; + dynamic = new Dynamic(OPS_NBT, cmp); + } + return realFixer.update(type, dynamic, sourceVer, targetVer); + } + + private net.minecraft.nbt.CompoundTag convert(LegacyType type, net.minecraft.nbt.CompoundTag cmp, int sourceVer, int desiredVersion) { + List converters = PaperweightDataConverters.this.converters.get(type); + if (converters != null && !converters.isEmpty()) { + for (DataConverter converter : converters) { + int dataVersion = converter.getDataVersion(); + if (dataVersion > sourceVer && dataVersion <= desiredVersion) { + cmp = converter.convert(cmp); + } + } + } + + List inspectors = PaperweightDataConverters.this.inspectors.get(type); + if (inspectors != null && !inspectors.isEmpty()) { + for (DataInspector inspector : inspectors) { + cmp = inspector.inspect(cmp, sourceVer, desiredVersion); + } + } + + return cmp; + } + + @Override + public Schema getSchema(int i) { + return realFixer.getSchema(i); + } + } + + public static net.minecraft.nbt.CompoundTag convert(LegacyType type, net.minecraft.nbt.CompoundTag cmp) { + return convert(type.getDFUType(), cmp); + } + + public static net.minecraft.nbt.CompoundTag convert(LegacyType type, net.minecraft.nbt.CompoundTag cmp, int sourceVer) { + return convert(type.getDFUType(), cmp, sourceVer); + } + + public static net.minecraft.nbt.CompoundTag convert(LegacyType type, net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { + return convert(type.getDFUType(), cmp, sourceVer, targetVer); + } + + public static net.minecraft.nbt.CompoundTag convert(TypeReference type, net.minecraft.nbt.CompoundTag cmp) { + int i = cmp.contains("DataVersion", 99) ? cmp.getInt("DataVersion") : -1; + return convert(type, cmp, i); + } + + public static net.minecraft.nbt.CompoundTag convert(TypeReference type, net.minecraft.nbt.CompoundTag cmp, int sourceVer) { + return convert(type, cmp, sourceVer, DATA_VERSION); + } + + public static net.minecraft.nbt.CompoundTag convert(TypeReference type, net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { + if (sourceVer >= targetVer) { + return cmp; + } + return (net.minecraft.nbt.CompoundTag) INSTANCE.fixer.update(type, new Dynamic<>(OPS_NBT, cmp), sourceVer, targetVer).getValue(); + } + + + public interface DataInspector { + net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer); + } + + public interface DataConverter { + + int getDataVersion(); + + net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp); + } + + + private void registerInspector(LegacyType type, DataInspector inspector) { + this.inspectors.computeIfAbsent(type, k -> new ArrayList<>()).add(inspector); + } + + private void registerConverter(LegacyType type, DataConverter converter) { + int version = converter.getDataVersion(); + + List list = this.converters.computeIfAbsent(type, k -> new ArrayList<>()); + if (!list.isEmpty() && list.get(list.size() - 1).getDataVersion() > version) { + for (int j = 0; j < list.size(); ++j) { + if (list.get(j).getDataVersion() > version) { + list.add(j, converter); + break; + } + } + } else { + list.add(converter); + } + } + + private void registerInspectors() { + registerEntityItemList("EntityHorseDonkey", "SaddleItem", "Items"); + registerEntityItemList("EntityHorseMule", "Items"); + registerEntityItemList("EntityMinecartChest", "Items"); + registerEntityItemList("EntityMinecartHopper", "Items"); + registerEntityItemList("EntityVillager", "Inventory"); + registerEntityItemListEquipment("EntityArmorStand"); + registerEntityItemListEquipment("EntityBat"); + registerEntityItemListEquipment("EntityBlaze"); + registerEntityItemListEquipment("EntityCaveSpider"); + registerEntityItemListEquipment("EntityChicken"); + registerEntityItemListEquipment("EntityCow"); + registerEntityItemListEquipment("EntityCreeper"); + registerEntityItemListEquipment("EntityEnderDragon"); + registerEntityItemListEquipment("EntityEnderman"); + registerEntityItemListEquipment("EntityEndermite"); + registerEntityItemListEquipment("EntityEvoker"); + registerEntityItemListEquipment("EntityGhast"); + registerEntityItemListEquipment("EntityGiantZombie"); + registerEntityItemListEquipment("EntityGuardian"); + registerEntityItemListEquipment("EntityGuardianElder"); + registerEntityItemListEquipment("EntityHorse"); + registerEntityItemListEquipment("EntityHorseDonkey"); + registerEntityItemListEquipment("EntityHorseMule"); + registerEntityItemListEquipment("EntityHorseSkeleton"); + registerEntityItemListEquipment("EntityHorseZombie"); + registerEntityItemListEquipment("EntityIronGolem"); + registerEntityItemListEquipment("EntityMagmaCube"); + registerEntityItemListEquipment("EntityMushroomCow"); + registerEntityItemListEquipment("EntityOcelot"); + registerEntityItemListEquipment("EntityPig"); + registerEntityItemListEquipment("EntityPigZombie"); + registerEntityItemListEquipment("EntityRabbit"); + registerEntityItemListEquipment("EntitySheep"); + registerEntityItemListEquipment("EntityShulker"); + registerEntityItemListEquipment("EntitySilverfish"); + registerEntityItemListEquipment("EntitySkeleton"); + registerEntityItemListEquipment("EntitySkeletonStray"); + registerEntityItemListEquipment("EntitySkeletonWither"); + registerEntityItemListEquipment("EntitySlime"); + registerEntityItemListEquipment("EntitySnowman"); + registerEntityItemListEquipment("EntitySpider"); + registerEntityItemListEquipment("EntitySquid"); + registerEntityItemListEquipment("EntityVex"); + registerEntityItemListEquipment("EntityVillager"); + registerEntityItemListEquipment("EntityVindicator"); + registerEntityItemListEquipment("EntityWitch"); + registerEntityItemListEquipment("EntityWither"); + registerEntityItemListEquipment("EntityWolf"); + registerEntityItemListEquipment("EntityZombie"); + registerEntityItemListEquipment("EntityZombieHusk"); + registerEntityItemListEquipment("EntityZombieVillager"); + registerEntityItemSingle("EntityFireworks", "FireworksItem"); + registerEntityItemSingle("EntityHorse", "ArmorItem"); + registerEntityItemSingle("EntityHorse", "SaddleItem"); + registerEntityItemSingle("EntityHorseMule", "SaddleItem"); + registerEntityItemSingle("EntityHorseSkeleton", "SaddleItem"); + registerEntityItemSingle("EntityHorseZombie", "SaddleItem"); + registerEntityItemSingle("EntityItem", "Item"); + registerEntityItemSingle("EntityItemFrame", "Item"); + registerEntityItemSingle("EntityPotion", "Potion"); + + registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItem("TileEntityRecordPlayer", "RecordItem")); + registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityBrewingStand", "Items")); + registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityChest", "Items")); + registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityDispenser", "Items")); + registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityDropper", "Items")); + registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityFurnace", "Items")); + registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityHopper", "Items")); + registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityShulkerBox", "Items")); + registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorMobSpawnerMobs()); + registerInspector(LegacyType.CHUNK, new DataInspectorChunks()); + registerInspector(LegacyType.ENTITY, new DataInspectorCommandBlock()); + registerInspector(LegacyType.ENTITY, new DataInspectorEntityPassengers()); + registerInspector(LegacyType.ENTITY, new DataInspectorMobSpawnerMinecart()); + registerInspector(LegacyType.ENTITY, new DataInspectorVillagers()); + registerInspector(LegacyType.ITEM_INSTANCE, new DataInspectorBlockEntity()); + registerInspector(LegacyType.ITEM_INSTANCE, new DataInspectorEntity()); + registerInspector(LegacyType.LEVEL, new DataInspectorLevelPlayer()); + registerInspector(LegacyType.PLAYER, new DataInspectorPlayer()); + registerInspector(LegacyType.PLAYER, new DataInspectorPlayerVehicle()); + registerInspector(LegacyType.STRUCTURE, new DataInspectorStructure()); + } + + private void registerConverters() { + registerConverter(LegacyType.ENTITY, new DataConverterEquipment()); + registerConverter(LegacyType.BLOCK_ENTITY, new DataConverterSignText()); + registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterMaterialId()); + registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterPotionId()); + registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterSpawnEgg()); + registerConverter(LegacyType.ENTITY, new DataConverterMinecart()); + registerConverter(LegacyType.BLOCK_ENTITY, new DataConverterMobSpawner()); + registerConverter(LegacyType.ENTITY, new DataConverterUUID()); + registerConverter(LegacyType.ENTITY, new DataConverterHealth()); + registerConverter(LegacyType.ENTITY, new DataConverterSaddle()); + registerConverter(LegacyType.ENTITY, new DataConverterHanging()); + registerConverter(LegacyType.ENTITY, new DataConverterDropChances()); + registerConverter(LegacyType.ENTITY, new DataConverterRiding()); + registerConverter(LegacyType.ENTITY, new DataConverterArmorStand()); + registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterBook()); + registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterCookedFish()); + registerConverter(LegacyType.ENTITY, new DataConverterZombie()); + registerConverter(LegacyType.OPTIONS, new DataConverterVBO()); + registerConverter(LegacyType.ENTITY, new DataConverterGuardian()); + registerConverter(LegacyType.ENTITY, new DataConverterSkeleton()); + registerConverter(LegacyType.ENTITY, new DataConverterZombieType()); + registerConverter(LegacyType.ENTITY, new DataConverterHorse()); + registerConverter(LegacyType.BLOCK_ENTITY, new DataConverterTileEntity()); + registerConverter(LegacyType.ENTITY, new DataConverterEntity()); + registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterBanner()); + registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterPotionWater()); + registerConverter(LegacyType.ENTITY, new DataConverterShulker()); + registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterShulkerBoxItem()); + registerConverter(LegacyType.BLOCK_ENTITY, new DataConverterShulkerBoxBlock()); + registerConverter(LegacyType.OPTIONS, new DataConverterLang()); + registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterTotem()); + registerConverter(LegacyType.CHUNK, new DataConverterBedBlock()); + registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterBedItem()); + } + + private void registerEntityItemList(String type, String... keys) { + registerInspector(LegacyType.ENTITY, new DataInspectorItemList(type, keys)); + } + + private void registerEntityItemSingle(String type, String key) { + registerInspector(LegacyType.ENTITY, new DataInspectorItem(type, key)); + } + + private void registerEntityItemListEquipment(String type) { + registerEntityItemList(type, "ArmorItems", "HandItems"); + } + + private static final Map OLD_ID_TO_KEY_MAP = new HashMap<>(); + + static { + final Map map = OLD_ID_TO_KEY_MAP; + map.put("EntityItem", new ResourceLocation("item")); + map.put("EntityExperienceOrb", new ResourceLocation("xp_orb")); + map.put("EntityAreaEffectCloud", new ResourceLocation("area_effect_cloud")); + map.put("EntityGuardianElder", new ResourceLocation("elder_guardian")); + map.put("EntitySkeletonWither", new ResourceLocation("wither_skeleton")); + map.put("EntitySkeletonStray", new ResourceLocation("stray")); + map.put("EntityEgg", new ResourceLocation("egg")); + map.put("EntityLeash", new ResourceLocation("leash_knot")); + map.put("EntityPainting", new ResourceLocation("painting")); + map.put("EntityTippedArrow", new ResourceLocation("arrow")); + map.put("EntitySnowball", new ResourceLocation("snowball")); + map.put("EntityLargeFireball", new ResourceLocation("fireball")); + map.put("EntitySmallFireball", new ResourceLocation("small_fireball")); + map.put("EntityEnderPearl", new ResourceLocation("ender_pearl")); + map.put("EntityEnderSignal", new ResourceLocation("eye_of_ender_signal")); + map.put("EntityPotion", new ResourceLocation("potion")); + map.put("EntityThrownExpBottle", new ResourceLocation("xp_bottle")); + map.put("EntityItemFrame", new ResourceLocation("item_frame")); + map.put("EntityWitherSkull", new ResourceLocation("wither_skull")); + map.put("EntityTNTPrimed", new ResourceLocation("tnt")); + map.put("EntityFallingBlock", new ResourceLocation("falling_block")); + map.put("EntityFireworks", new ResourceLocation("fireworks_rocket")); + map.put("EntityZombieHusk", new ResourceLocation("husk")); + map.put("EntitySpectralArrow", new ResourceLocation("spectral_arrow")); + map.put("EntityShulkerBullet", new ResourceLocation("shulker_bullet")); + map.put("EntityDragonFireball", new ResourceLocation("dragon_fireball")); + map.put("EntityZombieVillager", new ResourceLocation("zombie_villager")); + map.put("EntityHorseSkeleton", new ResourceLocation("skeleton_horse")); + map.put("EntityHorseZombie", new ResourceLocation("zombie_horse")); + map.put("EntityArmorStand", new ResourceLocation("armor_stand")); + map.put("EntityHorseDonkey", new ResourceLocation("donkey")); + map.put("EntityHorseMule", new ResourceLocation("mule")); + map.put("EntityEvokerFangs", new ResourceLocation("evocation_fangs")); + map.put("EntityEvoker", new ResourceLocation("evocation_illager")); + map.put("EntityVex", new ResourceLocation("vex")); + map.put("EntityVindicator", new ResourceLocation("vindication_illager")); + map.put("EntityIllagerIllusioner", new ResourceLocation("illusion_illager")); + map.put("EntityMinecartCommandBlock", new ResourceLocation("commandblock_minecart")); + map.put("EntityBoat", new ResourceLocation("boat")); + map.put("EntityMinecartRideable", new ResourceLocation("minecart")); + map.put("EntityMinecartChest", new ResourceLocation("chest_minecart")); + map.put("EntityMinecartFurnace", new ResourceLocation("furnace_minecart")); + map.put("EntityMinecartTNT", new ResourceLocation("tnt_minecart")); + map.put("EntityMinecartHopper", new ResourceLocation("hopper_minecart")); + map.put("EntityMinecartMobSpawner", new ResourceLocation("spawner_minecart")); + map.put("EntityCreeper", new ResourceLocation("creeper")); + map.put("EntitySkeleton", new ResourceLocation("skeleton")); + map.put("EntitySpider", new ResourceLocation("spider")); + map.put("EntityGiantZombie", new ResourceLocation("giant")); + map.put("EntityZombie", new ResourceLocation("zombie")); + map.put("EntitySlime", new ResourceLocation("slime")); + map.put("EntityGhast", new ResourceLocation("ghast")); + map.put("EntityPigZombie", new ResourceLocation("zombie_pigman")); + map.put("EntityEnderman", new ResourceLocation("enderman")); + map.put("EntityCaveSpider", new ResourceLocation("cave_spider")); + map.put("EntitySilverfish", new ResourceLocation("silverfish")); + map.put("EntityBlaze", new ResourceLocation("blaze")); + map.put("EntityMagmaCube", new ResourceLocation("magma_cube")); + map.put("EntityEnderDragon", new ResourceLocation("ender_dragon")); + map.put("EntityWither", new ResourceLocation("wither")); + map.put("EntityBat", new ResourceLocation("bat")); + map.put("EntityWitch", new ResourceLocation("witch")); + map.put("EntityEndermite", new ResourceLocation("endermite")); + map.put("EntityGuardian", new ResourceLocation("guardian")); + map.put("EntityShulker", new ResourceLocation("shulker")); + map.put("EntityPig", new ResourceLocation("pig")); + map.put("EntitySheep", new ResourceLocation("sheep")); + map.put("EntityCow", new ResourceLocation("cow")); + map.put("EntityChicken", new ResourceLocation("chicken")); + map.put("EntitySquid", new ResourceLocation("squid")); + map.put("EntityWolf", new ResourceLocation("wolf")); + map.put("EntityMushroomCow", new ResourceLocation("mooshroom")); + map.put("EntitySnowman", new ResourceLocation("snowman")); + map.put("EntityOcelot", new ResourceLocation("ocelot")); + map.put("EntityIronGolem", new ResourceLocation("villager_golem")); + map.put("EntityHorse", new ResourceLocation("horse")); + map.put("EntityRabbit", new ResourceLocation("rabbit")); + map.put("EntityPolarBear", new ResourceLocation("polar_bear")); + map.put("EntityLlama", new ResourceLocation("llama")); + map.put("EntityLlamaSpit", new ResourceLocation("llama_spit")); + map.put("EntityParrot", new ResourceLocation("parrot")); + map.put("EntityVillager", new ResourceLocation("villager")); + map.put("EntityEnderCrystal", new ResourceLocation("ender_crystal")); + map.put("TileEntityFurnace", new ResourceLocation("furnace")); + map.put("TileEntityChest", new ResourceLocation("chest")); + map.put("TileEntityEnderChest", new ResourceLocation("ender_chest")); + map.put("TileEntityRecordPlayer", new ResourceLocation("jukebox")); + map.put("TileEntityDispenser", new ResourceLocation("dispenser")); + map.put("TileEntityDropper", new ResourceLocation("dropper")); + map.put("TileEntitySign", new ResourceLocation("sign")); + map.put("TileEntityMobSpawner", new ResourceLocation("mob_spawner")); + map.put("TileEntityNote", new ResourceLocation("noteblock")); + map.put("TileEntityPiston", new ResourceLocation("piston")); + map.put("TileEntityBrewingStand", new ResourceLocation("brewing_stand")); + map.put("TileEntityEnchantTable", new ResourceLocation("enchanting_table")); + map.put("TileEntityEnderPortal", new ResourceLocation("end_portal")); + map.put("TileEntityBeacon", new ResourceLocation("beacon")); + map.put("TileEntitySkull", new ResourceLocation("skull")); + map.put("TileEntityLightDetector", new ResourceLocation("daylight_detector")); + map.put("TileEntityHopper", new ResourceLocation("hopper")); + map.put("TileEntityComparator", new ResourceLocation("comparator")); + map.put("TileEntityFlowerPot", new ResourceLocation("flower_pot")); + map.put("TileEntityBanner", new ResourceLocation("banner")); + map.put("TileEntityStructure", new ResourceLocation("structure_block")); + map.put("TileEntityEndGateway", new ResourceLocation("end_gateway")); + map.put("TileEntityCommand", new ResourceLocation("command_block")); + map.put("TileEntityShulkerBox", new ResourceLocation("shulker_box")); + map.put("TileEntityBed", new ResourceLocation("bed")); + } + + private static ResourceLocation getKey(String type) { + final ResourceLocation key = OLD_ID_TO_KEY_MAP.get(type); + if (key == null) { + throw new IllegalArgumentException("Unknown mapping for " + type); + } + return key; + } + + private static void convertCompound(LegacyType type, net.minecraft.nbt.CompoundTag cmp, String key, int sourceVer, int targetVer) { + cmp.put(key, convert(type, cmp.getCompound(key), sourceVer, targetVer)); + } + + private static void convertItem(net.minecraft.nbt.CompoundTag nbttagcompound, String key, int sourceVer, int targetVer) { + if (nbttagcompound.contains(key, 10)) { + convertCompound(LegacyType.ITEM_INSTANCE, nbttagcompound, key, sourceVer, targetVer); + } + } + + private static void convertItems(net.minecraft.nbt.CompoundTag nbttagcompound, String key, int sourceVer, int targetVer) { + if (nbttagcompound.contains(key, 9)) { + net.minecraft.nbt.ListTag nbttaglist = nbttagcompound.getList(key, 10); + + for (int j = 0; j < nbttaglist.size(); ++j) { + nbttaglist.set(j, convert(LegacyType.ITEM_INSTANCE, nbttaglist.getCompound(j), sourceVer, targetVer)); + } + } + + } + + private static class DataConverterEquipment implements DataConverter { + + DataConverterEquipment() { + } + + public int getDataVersion() { + return 100; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + net.minecraft.nbt.ListTag nbttaglist = cmp.getList("Equipment", 10); + net.minecraft.nbt.ListTag nbttaglist1; + + if (!nbttaglist.isEmpty() && !cmp.contains("HandItems", 10)) { + nbttaglist1 = new net.minecraft.nbt.ListTag(); + nbttaglist1.add(nbttaglist.get(0)); + nbttaglist1.add(new net.minecraft.nbt.CompoundTag()); + cmp.put("HandItems", nbttaglist1); + } + + if (nbttaglist.size() > 1 && !cmp.contains("ArmorItem", 10)) { + nbttaglist1 = new net.minecraft.nbt.ListTag(); + nbttaglist1.add(nbttaglist.get(1)); + nbttaglist1.add(nbttaglist.get(2)); + nbttaglist1.add(nbttaglist.get(3)); + nbttaglist1.add(nbttaglist.get(4)); + cmp.put("ArmorItems", nbttaglist1); + } + + cmp.remove("Equipment"); + if (cmp.contains("DropChances", 9)) { + nbttaglist1 = cmp.getList("DropChances", 5); + net.minecraft.nbt.ListTag nbttaglist2; + + if (!cmp.contains("HandDropChances", 10)) { + nbttaglist2 = new net.minecraft.nbt.ListTag(); + nbttaglist2.add(net.minecraft.nbt.FloatTag.valueOf(nbttaglist1.getFloat(0))); + nbttaglist2.add(net.minecraft.nbt.FloatTag.valueOf(0.0F)); + cmp.put("HandDropChances", nbttaglist2); + } + + if (!cmp.contains("ArmorDropChances", 10)) { + nbttaglist2 = new net.minecraft.nbt.ListTag(); + nbttaglist2.add(net.minecraft.nbt.FloatTag.valueOf(nbttaglist1.getFloat(1))); + nbttaglist2.add(net.minecraft.nbt.FloatTag.valueOf(nbttaglist1.getFloat(2))); + nbttaglist2.add(net.minecraft.nbt.FloatTag.valueOf(nbttaglist1.getFloat(3))); + nbttaglist2.add(net.minecraft.nbt.FloatTag.valueOf(nbttaglist1.getFloat(4))); + cmp.put("ArmorDropChances", nbttaglist2); + } + + cmp.remove("DropChances"); + } + + return cmp; + } + } + + private static class DataInspectorBlockEntity implements DataInspector { + + private static final Map b = Maps.newHashMap(); + private static final Map c = Maps.newHashMap(); + + DataInspectorBlockEntity() { + } + + @Nullable + private static String convertEntityId(int i, String s) { + String key = new ResourceLocation(s).toString(); + if (i < 515 && DataInspectorBlockEntity.b.containsKey(key)) { + return DataInspectorBlockEntity.b.get(key); + } else { + return DataInspectorBlockEntity.c.get(key); + } + } + + public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { + if (!cmp.contains("tag", 10)) { + return cmp; + } else { + net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); + + if (nbttagcompound1.contains("BlockEntityTag", 10)) { + net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag"); + String s = cmp.getString("id"); + String s1 = convertEntityId(sourceVer, s); + boolean flag; + + if (s1 == null) { + // CraftBukkit - Remove unnecessary warning (occurs when deserializing a Shulker Box item) + // DataInspectorBlockEntity.a.warn("Unable to resolve BlockEntity for ItemInstance: {}", s); + flag = false; + } else { + flag = !nbttagcompound2.contains("id"); + nbttagcompound2.putString("id", s1); + } + + convert(LegacyType.BLOCK_ENTITY, nbttagcompound2, sourceVer, targetVer); + if (flag) { + nbttagcompound2.remove("id"); + } + } + + return cmp; + } + } + + static { + Map map = DataInspectorBlockEntity.b; + + map.put("minecraft:furnace", "Furnace"); + map.put("minecraft:lit_furnace", "Furnace"); + map.put("minecraft:chest", "Chest"); + map.put("minecraft:trapped_chest", "Chest"); + map.put("minecraft:ender_chest", "EnderChest"); + map.put("minecraft:jukebox", "RecordPlayer"); + map.put("minecraft:dispenser", "Trap"); + map.put("minecraft:dropper", "Dropper"); + map.put("minecraft:sign", "Sign"); + map.put("minecraft:mob_spawner", "MobSpawner"); + map.put("minecraft:noteblock", "Music"); + map.put("minecraft:brewing_stand", "Cauldron"); + map.put("minecraft:enhanting_table", "EnchantTable"); + map.put("minecraft:command_block", "CommandBlock"); + map.put("minecraft:beacon", "Beacon"); + map.put("minecraft:skull", "Skull"); + map.put("minecraft:daylight_detector", "DLDetector"); + map.put("minecraft:hopper", "Hopper"); + map.put("minecraft:banner", "Banner"); + map.put("minecraft:flower_pot", "FlowerPot"); + map.put("minecraft:repeating_command_block", "CommandBlock"); + map.put("minecraft:chain_command_block", "CommandBlock"); + map.put("minecraft:standing_sign", "Sign"); + map.put("minecraft:wall_sign", "Sign"); + map.put("minecraft:piston_head", "Piston"); + map.put("minecraft:daylight_detector_inverted", "DLDetector"); + map.put("minecraft:unpowered_comparator", "Comparator"); + map.put("minecraft:powered_comparator", "Comparator"); + map.put("minecraft:wall_banner", "Banner"); + map.put("minecraft:standing_banner", "Banner"); + map.put("minecraft:structure_block", "Structure"); + map.put("minecraft:end_portal", "Airportal"); + map.put("minecraft:end_gateway", "EndGateway"); + map.put("minecraft:shield", "Shield"); + map = DataInspectorBlockEntity.c; + map.put("minecraft:furnace", "minecraft:furnace"); + map.put("minecraft:lit_furnace", "minecraft:furnace"); + map.put("minecraft:chest", "minecraft:chest"); + map.put("minecraft:trapped_chest", "minecraft:chest"); + map.put("minecraft:ender_chest", "minecraft:enderchest"); + map.put("minecraft:jukebox", "minecraft:jukebox"); + map.put("minecraft:dispenser", "minecraft:dispenser"); + map.put("minecraft:dropper", "minecraft:dropper"); + map.put("minecraft:sign", "minecraft:sign"); + map.put("minecraft:mob_spawner", "minecraft:mob_spawner"); + map.put("minecraft:noteblock", "minecraft:noteblock"); + map.put("minecraft:brewing_stand", "minecraft:brewing_stand"); + map.put("minecraft:enhanting_table", "minecraft:enchanting_table"); + map.put("minecraft:command_block", "minecraft:command_block"); + map.put("minecraft:beacon", "minecraft:beacon"); + map.put("minecraft:skull", "minecraft:skull"); + map.put("minecraft:daylight_detector", "minecraft:daylight_detector"); + map.put("minecraft:hopper", "minecraft:hopper"); + map.put("minecraft:banner", "minecraft:banner"); + map.put("minecraft:flower_pot", "minecraft:flower_pot"); + map.put("minecraft:repeating_command_block", "minecraft:command_block"); + map.put("minecraft:chain_command_block", "minecraft:command_block"); + map.put("minecraft:shulker_box", "minecraft:shulker_box"); + map.put("minecraft:white_shulker_box", "minecraft:shulker_box"); + map.put("minecraft:orange_shulker_box", "minecraft:shulker_box"); + map.put("minecraft:magenta_shulker_box", "minecraft:shulker_box"); + map.put("minecraft:light_blue_shulker_box", "minecraft:shulker_box"); + map.put("minecraft:yellow_shulker_box", "minecraft:shulker_box"); + map.put("minecraft:lime_shulker_box", "minecraft:shulker_box"); + map.put("minecraft:pink_shulker_box", "minecraft:shulker_box"); + map.put("minecraft:gray_shulker_box", "minecraft:shulker_box"); + map.put("minecraft:silver_shulker_box", "minecraft:shulker_box"); + map.put("minecraft:cyan_shulker_box", "minecraft:shulker_box"); + map.put("minecraft:purple_shulker_box", "minecraft:shulker_box"); + map.put("minecraft:blue_shulker_box", "minecraft:shulker_box"); + map.put("minecraft:brown_shulker_box", "minecraft:shulker_box"); + map.put("minecraft:green_shulker_box", "minecraft:shulker_box"); + map.put("minecraft:red_shulker_box", "minecraft:shulker_box"); + map.put("minecraft:black_shulker_box", "minecraft:shulker_box"); + map.put("minecraft:bed", "minecraft:bed"); + map.put("minecraft:standing_sign", "minecraft:sign"); + map.put("minecraft:wall_sign", "minecraft:sign"); + map.put("minecraft:piston_head", "minecraft:piston"); + map.put("minecraft:daylight_detector_inverted", "minecraft:daylight_detector"); + map.put("minecraft:unpowered_comparator", "minecraft:comparator"); + map.put("minecraft:powered_comparator", "minecraft:comparator"); + map.put("minecraft:wall_banner", "minecraft:banner"); + map.put("minecraft:standing_banner", "minecraft:banner"); + map.put("minecraft:structure_block", "minecraft:structure_block"); + map.put("minecraft:end_portal", "minecraft:end_portal"); + map.put("minecraft:end_gateway", "minecraft:end_gateway"); + map.put("minecraft:shield", "minecraft:shield"); + } + } + + private static class DataInspectorEntity implements DataInspector { + + DataInspectorEntity() { + } + + public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { + net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); + + if (nbttagcompound1.contains("EntityTag", 10)) { + net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("EntityTag"); + String s = cmp.getString("id"); + String s1; + + if ("minecraft:armor_stand".equals(s)) { + s1 = sourceVer < 515 ? "ArmorStand" : "minecraft:armor_stand"; + } else { + if (!"minecraft:spawn_egg".equals(s)) { + return cmp; + } + + s1 = nbttagcompound2.getString("id"); + } + + boolean flag; + + flag = !nbttagcompound2.contains("id", 8); + nbttagcompound2.putString("id", s1); + + convert(LegacyType.ENTITY, nbttagcompound2, sourceVer, targetVer); + if (flag) { + nbttagcompound2.remove("id"); + } + } + + return cmp; + } + } + + + private abstract static class DataInspectorTagged implements DataInspector { + + private final ResourceLocation key; + + DataInspectorTagged(String type) { + this.key = getKey(type); + } + + public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { + if (this.key.equals(new ResourceLocation(cmp.getString("id")))) { + cmp = this.inspectChecked(cmp, sourceVer, targetVer); + } + + return cmp; + } + + abstract net.minecraft.nbt.CompoundTag inspectChecked(net.minecraft.nbt.CompoundTag nbttagcompound, int sourceVer, int targetVer); + } + + private static class DataInspectorItemList extends DataInspectorTagged { + + private final String[] keys; + + DataInspectorItemList(String oclass, String... astring) { + super(oclass); + this.keys = astring; + } + + net.minecraft.nbt.CompoundTag inspectChecked(net.minecraft.nbt.CompoundTag nbttagcompound, int sourceVer, int targetVer) { + for (String s : this.keys) { + PaperweightDataConverters.convertItems(nbttagcompound, s, sourceVer, targetVer); + } + + return nbttagcompound; + } + } + + private static class DataInspectorItem extends DataInspectorTagged { + + private final String[] keys; + + DataInspectorItem(String oclass, String... astring) { + super(oclass); + this.keys = astring; + } + + net.minecraft.nbt.CompoundTag inspectChecked(net.minecraft.nbt.CompoundTag nbttagcompound, int sourceVer, int targetVer) { + for (String key : this.keys) { + PaperweightDataConverters.convertItem(nbttagcompound, key, sourceVer, targetVer); + } + + return nbttagcompound; + } + } + + private static class DataConverterMaterialId implements DataConverter { + + private static final String[] materials = new String[2268]; + + DataConverterMaterialId() { + } + + public int getDataVersion() { + return 102; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if (cmp.contains("id", 99)) { + short short0 = cmp.getShort("id"); + + if (short0 > 0 && short0 < materials.length && materials[short0] != null) { + cmp.putString("id", materials[short0]); + } + } + + return cmp; + } + + static { + materials[1] = "minecraft:stone"; + materials[2] = "minecraft:grass"; + materials[3] = "minecraft:dirt"; + materials[4] = "minecraft:cobblestone"; + materials[5] = "minecraft:planks"; + materials[6] = "minecraft:sapling"; + materials[7] = "minecraft:bedrock"; + materials[8] = "minecraft:flowing_water"; + materials[9] = "minecraft:water"; + materials[10] = "minecraft:flowing_lava"; + materials[11] = "minecraft:lava"; + materials[12] = "minecraft:sand"; + materials[13] = "minecraft:gravel"; + materials[14] = "minecraft:gold_ore"; + materials[15] = "minecraft:iron_ore"; + materials[16] = "minecraft:coal_ore"; + materials[17] = "minecraft:log"; + materials[18] = "minecraft:leaves"; + materials[19] = "minecraft:sponge"; + materials[20] = "minecraft:glass"; + materials[21] = "minecraft:lapis_ore"; + materials[22] = "minecraft:lapis_block"; + materials[23] = "minecraft:dispenser"; + materials[24] = "minecraft:sandstone"; + materials[25] = "minecraft:noteblock"; + materials[27] = "minecraft:golden_rail"; + materials[28] = "minecraft:detector_rail"; + materials[29] = "minecraft:sticky_piston"; + materials[30] = "minecraft:web"; + materials[31] = "minecraft:tallgrass"; + materials[32] = "minecraft:deadbush"; + materials[33] = "minecraft:piston"; + materials[35] = "minecraft:wool"; + materials[37] = "minecraft:yellow_flower"; + materials[38] = "minecraft:red_flower"; + materials[39] = "minecraft:brown_mushroom"; + materials[40] = "minecraft:red_mushroom"; + materials[41] = "minecraft:gold_block"; + materials[42] = "minecraft:iron_block"; + materials[43] = "minecraft:double_stone_slab"; + materials[44] = "minecraft:stone_slab"; + materials[45] = "minecraft:brick_block"; + materials[46] = "minecraft:tnt"; + materials[47] = "minecraft:bookshelf"; + materials[48] = "minecraft:mossy_cobblestone"; + materials[49] = "minecraft:obsidian"; + materials[50] = "minecraft:torch"; + materials[51] = "minecraft:fire"; + materials[52] = "minecraft:mob_spawner"; + materials[53] = "minecraft:oak_stairs"; + materials[54] = "minecraft:chest"; + materials[56] = "minecraft:diamond_ore"; + materials[57] = "minecraft:diamond_block"; + materials[58] = "minecraft:crafting_table"; + materials[60] = "minecraft:farmland"; + materials[61] = "minecraft:furnace"; + materials[62] = "minecraft:lit_furnace"; + materials[65] = "minecraft:ladder"; + materials[66] = "minecraft:rail"; + materials[67] = "minecraft:stone_stairs"; + materials[69] = "minecraft:lever"; + materials[70] = "minecraft:stone_pressure_plate"; + materials[72] = "minecraft:wooden_pressure_plate"; + materials[73] = "minecraft:redstone_ore"; + materials[76] = "minecraft:redstone_torch"; + materials[77] = "minecraft:stone_button"; + materials[78] = "minecraft:snow_layer"; + materials[79] = "minecraft:ice"; + materials[80] = "minecraft:snow"; + materials[81] = "minecraft:cactus"; + materials[82] = "minecraft:clay"; + materials[84] = "minecraft:jukebox"; + materials[85] = "minecraft:fence"; + materials[86] = "minecraft:pumpkin"; + materials[87] = "minecraft:netherrack"; + materials[88] = "minecraft:soul_sand"; + materials[89] = "minecraft:glowstone"; + materials[90] = "minecraft:portal"; + materials[91] = "minecraft:lit_pumpkin"; + materials[95] = "minecraft:stained_glass"; + materials[96] = "minecraft:trapdoor"; + materials[97] = "minecraft:monster_egg"; + materials[98] = "minecraft:stonebrick"; + materials[99] = "minecraft:brown_mushroom_block"; + materials[100] = "minecraft:red_mushroom_block"; + materials[101] = "minecraft:iron_bars"; + materials[102] = "minecraft:glass_pane"; + materials[103] = "minecraft:melon_block"; + materials[106] = "minecraft:vine"; + materials[107] = "minecraft:fence_gate"; + materials[108] = "minecraft:brick_stairs"; + materials[109] = "minecraft:stone_brick_stairs"; + materials[110] = "minecraft:mycelium"; + materials[111] = "minecraft:waterlily"; + materials[112] = "minecraft:nether_brick"; + materials[113] = "minecraft:nether_brick_fence"; + materials[114] = "minecraft:nether_brick_stairs"; + materials[116] = "minecraft:enchanting_table"; + materials[119] = "minecraft:end_portal"; + materials[120] = "minecraft:end_portal_frame"; + materials[121] = "minecraft:end_stone"; + materials[122] = "minecraft:dragon_egg"; + materials[123] = "minecraft:redstone_lamp"; + materials[125] = "minecraft:double_wooden_slab"; + materials[126] = "minecraft:wooden_slab"; + materials[127] = "minecraft:cocoa"; + materials[128] = "minecraft:sandstone_stairs"; + materials[129] = "minecraft:emerald_ore"; + materials[130] = "minecraft:ender_chest"; + materials[131] = "minecraft:tripwire_hook"; + materials[133] = "minecraft:emerald_block"; + materials[134] = "minecraft:spruce_stairs"; + materials[135] = "minecraft:birch_stairs"; + materials[136] = "minecraft:jungle_stairs"; + materials[137] = "minecraft:command_block"; + materials[138] = "minecraft:beacon"; + materials[139] = "minecraft:cobblestone_wall"; + materials[141] = "minecraft:carrots"; + materials[142] = "minecraft:potatoes"; + materials[143] = "minecraft:wooden_button"; + materials[145] = "minecraft:anvil"; + materials[146] = "minecraft:trapped_chest"; + materials[147] = "minecraft:light_weighted_pressure_plate"; + materials[148] = "minecraft:heavy_weighted_pressure_plate"; + materials[151] = "minecraft:daylight_detector"; + materials[152] = "minecraft:redstone_block"; + materials[153] = "minecraft:quartz_ore"; + materials[154] = "minecraft:hopper"; + materials[155] = "minecraft:quartz_block"; + materials[156] = "minecraft:quartz_stairs"; + materials[157] = "minecraft:activator_rail"; + materials[158] = "minecraft:dropper"; + materials[159] = "minecraft:stained_hardened_clay"; + materials[160] = "minecraft:stained_glass_pane"; + materials[161] = "minecraft:leaves2"; + materials[162] = "minecraft:log2"; + materials[163] = "minecraft:acacia_stairs"; + materials[164] = "minecraft:dark_oak_stairs"; + materials[170] = "minecraft:hay_block"; + materials[171] = "minecraft:carpet"; + materials[172] = "minecraft:hardened_clay"; + materials[173] = "minecraft:coal_block"; + materials[174] = "minecraft:packed_ice"; + materials[175] = "minecraft:double_plant"; + materials[256] = "minecraft:iron_shovel"; + materials[257] = "minecraft:iron_pickaxe"; + materials[258] = "minecraft:iron_axe"; + materials[259] = "minecraft:flint_and_steel"; + materials[260] = "minecraft:apple"; + materials[261] = "minecraft:bow"; + materials[262] = "minecraft:arrow"; + materials[263] = "minecraft:coal"; + materials[264] = "minecraft:diamond"; + materials[265] = "minecraft:iron_ingot"; + materials[266] = "minecraft:gold_ingot"; + materials[267] = "minecraft:iron_sword"; + materials[268] = "minecraft:wooden_sword"; + materials[269] = "minecraft:wooden_shovel"; + materials[270] = "minecraft:wooden_pickaxe"; + materials[271] = "minecraft:wooden_axe"; + materials[272] = "minecraft:stone_sword"; + materials[273] = "minecraft:stone_shovel"; + materials[274] = "minecraft:stone_pickaxe"; + materials[275] = "minecraft:stone_axe"; + materials[276] = "minecraft:diamond_sword"; + materials[277] = "minecraft:diamond_shovel"; + materials[278] = "minecraft:diamond_pickaxe"; + materials[279] = "minecraft:diamond_axe"; + materials[280] = "minecraft:stick"; + materials[281] = "minecraft:bowl"; + materials[282] = "minecraft:mushroom_stew"; + materials[283] = "minecraft:golden_sword"; + materials[284] = "minecraft:golden_shovel"; + materials[285] = "minecraft:golden_pickaxe"; + materials[286] = "minecraft:golden_axe"; + materials[287] = "minecraft:string"; + materials[288] = "minecraft:feather"; + materials[289] = "minecraft:gunpowder"; + materials[290] = "minecraft:wooden_hoe"; + materials[291] = "minecraft:stone_hoe"; + materials[292] = "minecraft:iron_hoe"; + materials[293] = "minecraft:diamond_hoe"; + materials[294] = "minecraft:golden_hoe"; + materials[295] = "minecraft:wheat_seeds"; + materials[296] = "minecraft:wheat"; + materials[297] = "minecraft:bread"; + materials[298] = "minecraft:leather_helmet"; + materials[299] = "minecraft:leather_chestplate"; + materials[300] = "minecraft:leather_leggings"; + materials[301] = "minecraft:leather_boots"; + materials[302] = "minecraft:chainmail_helmet"; + materials[303] = "minecraft:chainmail_chestplate"; + materials[304] = "minecraft:chainmail_leggings"; + materials[305] = "minecraft:chainmail_boots"; + materials[306] = "minecraft:iron_helmet"; + materials[307] = "minecraft:iron_chestplate"; + materials[308] = "minecraft:iron_leggings"; + materials[309] = "minecraft:iron_boots"; + materials[310] = "minecraft:diamond_helmet"; + materials[311] = "minecraft:diamond_chestplate"; + materials[312] = "minecraft:diamond_leggings"; + materials[313] = "minecraft:diamond_boots"; + materials[314] = "minecraft:golden_helmet"; + materials[315] = "minecraft:golden_chestplate"; + materials[316] = "minecraft:golden_leggings"; + materials[317] = "minecraft:golden_boots"; + materials[318] = "minecraft:flint"; + materials[319] = "minecraft:porkchop"; + materials[320] = "minecraft:cooked_porkchop"; + materials[321] = "minecraft:painting"; + materials[322] = "minecraft:golden_apple"; + materials[323] = "minecraft:sign"; + materials[324] = "minecraft:wooden_door"; + materials[325] = "minecraft:bucket"; + materials[326] = "minecraft:water_bucket"; + materials[327] = "minecraft:lava_bucket"; + materials[328] = "minecraft:minecart"; + materials[329] = "minecraft:saddle"; + materials[330] = "minecraft:iron_door"; + materials[331] = "minecraft:redstone"; + materials[332] = "minecraft:snowball"; + materials[333] = "minecraft:boat"; + materials[334] = "minecraft:leather"; + materials[335] = "minecraft:milk_bucket"; + materials[336] = "minecraft:brick"; + materials[337] = "minecraft:clay_ball"; + materials[338] = "minecraft:reeds"; + materials[339] = "minecraft:paper"; + materials[340] = "minecraft:book"; + materials[341] = "minecraft:slime_ball"; + materials[342] = "minecraft:chest_minecart"; + materials[343] = "minecraft:furnace_minecart"; + materials[344] = "minecraft:egg"; + materials[345] = "minecraft:compass"; + materials[346] = "minecraft:fishing_rod"; + materials[347] = "minecraft:clock"; + materials[348] = "minecraft:glowstone_dust"; + materials[349] = "minecraft:fish"; + materials[350] = "minecraft:cooked_fish"; // Paper - cooked_fished -> cooked_fish + materials[351] = "minecraft:dye"; + materials[352] = "minecraft:bone"; + materials[353] = "minecraft:sugar"; + materials[354] = "minecraft:cake"; + materials[355] = "minecraft:bed"; + materials[356] = "minecraft:repeater"; + materials[357] = "minecraft:cookie"; + materials[358] = "minecraft:filled_map"; + materials[359] = "minecraft:shears"; + materials[360] = "minecraft:melon"; + materials[361] = "minecraft:pumpkin_seeds"; + materials[362] = "minecraft:melon_seeds"; + materials[363] = "minecraft:beef"; + materials[364] = "minecraft:cooked_beef"; + materials[365] = "minecraft:chicken"; + materials[366] = "minecraft:cooked_chicken"; + materials[367] = "minecraft:rotten_flesh"; + materials[368] = "minecraft:ender_pearl"; + materials[369] = "minecraft:blaze_rod"; + materials[370] = "minecraft:ghast_tear"; + materials[371] = "minecraft:gold_nugget"; + materials[372] = "minecraft:nether_wart"; + materials[373] = "minecraft:potion"; + materials[374] = "minecraft:glass_bottle"; + materials[375] = "minecraft:spider_eye"; + materials[376] = "minecraft:fermented_spider_eye"; + materials[377] = "minecraft:blaze_powder"; + materials[378] = "minecraft:magma_cream"; + materials[379] = "minecraft:brewing_stand"; + materials[380] = "minecraft:cauldron"; + materials[381] = "minecraft:ender_eye"; + materials[382] = "minecraft:speckled_melon"; + materials[383] = "minecraft:spawn_egg"; + materials[384] = "minecraft:experience_bottle"; + materials[385] = "minecraft:fire_charge"; + materials[386] = "minecraft:writable_book"; + materials[387] = "minecraft:written_book"; + materials[388] = "minecraft:emerald"; + materials[389] = "minecraft:item_frame"; + materials[390] = "minecraft:flower_pot"; + materials[391] = "minecraft:carrot"; + materials[392] = "minecraft:potato"; + materials[393] = "minecraft:baked_potato"; + materials[394] = "minecraft:poisonous_potato"; + materials[395] = "minecraft:map"; + materials[396] = "minecraft:golden_carrot"; + materials[397] = "minecraft:skull"; + materials[398] = "minecraft:carrot_on_a_stick"; + materials[399] = "minecraft:nether_star"; + materials[400] = "minecraft:pumpkin_pie"; + materials[401] = "minecraft:fireworks"; + materials[402] = "minecraft:firework_charge"; + materials[403] = "minecraft:enchanted_book"; + materials[404] = "minecraft:comparator"; + materials[405] = "minecraft:netherbrick"; + materials[406] = "minecraft:quartz"; + materials[407] = "minecraft:tnt_minecart"; + materials[408] = "minecraft:hopper_minecart"; + materials[417] = "minecraft:iron_horse_armor"; + materials[418] = "minecraft:golden_horse_armor"; + materials[419] = "minecraft:diamond_horse_armor"; + materials[420] = "minecraft:lead"; + materials[421] = "minecraft:name_tag"; + materials[422] = "minecraft:command_block_minecart"; + materials[2256] = "minecraft:record_13"; + materials[2257] = "minecraft:record_cat"; + materials[2258] = "minecraft:record_blocks"; + materials[2259] = "minecraft:record_chirp"; + materials[2260] = "minecraft:record_far"; + materials[2261] = "minecraft:record_mall"; + materials[2262] = "minecraft:record_mellohi"; + materials[2263] = "minecraft:record_stal"; + materials[2264] = "minecraft:record_strad"; + materials[2265] = "minecraft:record_ward"; + materials[2266] = "minecraft:record_11"; + materials[2267] = "minecraft:record_wait"; + // Paper start + materials[409] = "minecraft:prismarine_shard"; + materials[410] = "minecraft:prismarine_crystals"; + materials[411] = "minecraft:rabbit"; + materials[412] = "minecraft:cooked_rabbit"; + materials[413] = "minecraft:rabbit_stew"; + materials[414] = "minecraft:rabbit_foot"; + materials[415] = "minecraft:rabbit_hide"; + materials[416] = "minecraft:armor_stand"; + materials[423] = "minecraft:mutton"; + materials[424] = "minecraft:cooked_mutton"; + materials[425] = "minecraft:banner"; + materials[426] = "minecraft:end_crystal"; + materials[427] = "minecraft:spruce_door"; + materials[428] = "minecraft:birch_door"; + materials[429] = "minecraft:jungle_door"; + materials[430] = "minecraft:acacia_door"; + materials[431] = "minecraft:dark_oak_door"; + materials[432] = "minecraft:chorus_fruit"; + materials[433] = "minecraft:chorus_fruit_popped"; + materials[434] = "minecraft:beetroot"; + materials[435] = "minecraft:beetroot_seeds"; + materials[436] = "minecraft:beetroot_soup"; + materials[437] = "minecraft:dragon_breath"; + materials[438] = "minecraft:splash_potion"; + materials[439] = "minecraft:spectral_arrow"; + materials[440] = "minecraft:tipped_arrow"; + materials[441] = "minecraft:lingering_potion"; + materials[442] = "minecraft:shield"; + materials[443] = "minecraft:elytra"; + materials[444] = "minecraft:spruce_boat"; + materials[445] = "minecraft:birch_boat"; + materials[446] = "minecraft:jungle_boat"; + materials[447] = "minecraft:acacia_boat"; + materials[448] = "minecraft:dark_oak_boat"; + materials[449] = "minecraft:totem_of_undying"; + materials[450] = "minecraft:shulker_shell"; + materials[452] = "minecraft:iron_nugget"; + materials[453] = "minecraft:knowledge_book"; + // Paper end + } + } + + private static class DataConverterArmorStand implements DataConverter { + + DataConverterArmorStand() { + } + + public int getDataVersion() { + return 147; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if ("ArmorStand".equals(cmp.getString("id")) && cmp.getBoolean("Silent") && !cmp.getBoolean("Marker")) { + cmp.remove("Silent"); + } + + return cmp; + } + } + + private static class DataConverterBanner implements DataConverter { + + DataConverterBanner() { + } + + public int getDataVersion() { + return 804; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if ("minecraft:banner".equals(cmp.getString("id")) && cmp.contains("tag", 10)) { + net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); + + if (nbttagcompound1.contains("BlockEntityTag", 10)) { + net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag"); + + if (nbttagcompound2.contains("Base", 99)) { + cmp.putShort("Damage", (short) (nbttagcompound2.getShort("Base") & 15)); + if (nbttagcompound1.contains("display", 10)) { + net.minecraft.nbt.CompoundTag nbttagcompound3 = nbttagcompound1.getCompound("display"); + + if (nbttagcompound3.contains("Lore", 9)) { + net.minecraft.nbt.ListTag nbttaglist = nbttagcompound3.getList("Lore", 8); + + if (nbttaglist.size() == 1 && "(+NBT)".equals(nbttaglist.getString(0))) { + return cmp; + } + } + } + + nbttagcompound2.remove("Base"); + if (nbttagcompound2.isEmpty()) { + nbttagcompound1.remove("BlockEntityTag"); + } + + if (nbttagcompound1.isEmpty()) { + cmp.remove("tag"); + } + } + } + } + + return cmp; + } + } + + private static class DataConverterPotionId implements DataConverter { + + private static final String[] potions = new String[128]; + + DataConverterPotionId() { + } + + public int getDataVersion() { + return 102; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if ("minecraft:potion".equals(cmp.getString("id"))) { + net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); + short short0 = cmp.getShort("Damage"); + + if (!nbttagcompound1.contains("Potion", 8)) { + String s = DataConverterPotionId.potions[short0 & 127]; + + nbttagcompound1.putString("Potion", s == null ? "minecraft:water" : s); + cmp.put("tag", nbttagcompound1); + if ((short0 & 16384) == 16384) { + cmp.putString("id", "minecraft:splash_potion"); + } + } + + if (short0 != 0) { + cmp.putShort("Damage", (short) 0); + } + } + + return cmp; + } + + static { + DataConverterPotionId.potions[0] = "minecraft:water"; + DataConverterPotionId.potions[1] = "minecraft:regeneration"; + DataConverterPotionId.potions[2] = "minecraft:swiftness"; + DataConverterPotionId.potions[3] = "minecraft:fire_resistance"; + DataConverterPotionId.potions[4] = "minecraft:poison"; + DataConverterPotionId.potions[5] = "minecraft:healing"; + DataConverterPotionId.potions[6] = "minecraft:night_vision"; + DataConverterPotionId.potions[7] = null; + DataConverterPotionId.potions[8] = "minecraft:weakness"; + DataConverterPotionId.potions[9] = "minecraft:strength"; + DataConverterPotionId.potions[10] = "minecraft:slowness"; + DataConverterPotionId.potions[11] = "minecraft:leaping"; + DataConverterPotionId.potions[12] = "minecraft:harming"; + DataConverterPotionId.potions[13] = "minecraft:water_breathing"; + DataConverterPotionId.potions[14] = "minecraft:invisibility"; + DataConverterPotionId.potions[15] = null; + DataConverterPotionId.potions[16] = "minecraft:awkward"; + DataConverterPotionId.potions[17] = "minecraft:regeneration"; + DataConverterPotionId.potions[18] = "minecraft:swiftness"; + DataConverterPotionId.potions[19] = "minecraft:fire_resistance"; + DataConverterPotionId.potions[20] = "minecraft:poison"; + DataConverterPotionId.potions[21] = "minecraft:healing"; + DataConverterPotionId.potions[22] = "minecraft:night_vision"; + DataConverterPotionId.potions[23] = null; + DataConverterPotionId.potions[24] = "minecraft:weakness"; + DataConverterPotionId.potions[25] = "minecraft:strength"; + DataConverterPotionId.potions[26] = "minecraft:slowness"; + DataConverterPotionId.potions[27] = "minecraft:leaping"; + DataConverterPotionId.potions[28] = "minecraft:harming"; + DataConverterPotionId.potions[29] = "minecraft:water_breathing"; + DataConverterPotionId.potions[30] = "minecraft:invisibility"; + DataConverterPotionId.potions[31] = null; + DataConverterPotionId.potions[32] = "minecraft:thick"; + DataConverterPotionId.potions[33] = "minecraft:strong_regeneration"; + DataConverterPotionId.potions[34] = "minecraft:strong_swiftness"; + DataConverterPotionId.potions[35] = "minecraft:fire_resistance"; + DataConverterPotionId.potions[36] = "minecraft:strong_poison"; + DataConverterPotionId.potions[37] = "minecraft:strong_healing"; + DataConverterPotionId.potions[38] = "minecraft:night_vision"; + DataConverterPotionId.potions[39] = null; + DataConverterPotionId.potions[40] = "minecraft:weakness"; + DataConverterPotionId.potions[41] = "minecraft:strong_strength"; + DataConverterPotionId.potions[42] = "minecraft:slowness"; + DataConverterPotionId.potions[43] = "minecraft:strong_leaping"; + DataConverterPotionId.potions[44] = "minecraft:strong_harming"; + DataConverterPotionId.potions[45] = "minecraft:water_breathing"; + DataConverterPotionId.potions[46] = "minecraft:invisibility"; + DataConverterPotionId.potions[47] = null; + DataConverterPotionId.potions[48] = null; + DataConverterPotionId.potions[49] = "minecraft:strong_regeneration"; + DataConverterPotionId.potions[50] = "minecraft:strong_swiftness"; + DataConverterPotionId.potions[51] = "minecraft:fire_resistance"; + DataConverterPotionId.potions[52] = "minecraft:strong_poison"; + DataConverterPotionId.potions[53] = "minecraft:strong_healing"; + DataConverterPotionId.potions[54] = "minecraft:night_vision"; + DataConverterPotionId.potions[55] = null; + DataConverterPotionId.potions[56] = "minecraft:weakness"; + DataConverterPotionId.potions[57] = "minecraft:strong_strength"; + DataConverterPotionId.potions[58] = "minecraft:slowness"; + DataConverterPotionId.potions[59] = "minecraft:strong_leaping"; + DataConverterPotionId.potions[60] = "minecraft:strong_harming"; + DataConverterPotionId.potions[61] = "minecraft:water_breathing"; + DataConverterPotionId.potions[62] = "minecraft:invisibility"; + DataConverterPotionId.potions[63] = null; + DataConverterPotionId.potions[64] = "minecraft:mundane"; + DataConverterPotionId.potions[65] = "minecraft:long_regeneration"; + DataConverterPotionId.potions[66] = "minecraft:long_swiftness"; + DataConverterPotionId.potions[67] = "minecraft:long_fire_resistance"; + DataConverterPotionId.potions[68] = "minecraft:long_poison"; + DataConverterPotionId.potions[69] = "minecraft:healing"; + DataConverterPotionId.potions[70] = "minecraft:long_night_vision"; + DataConverterPotionId.potions[71] = null; + DataConverterPotionId.potions[72] = "minecraft:long_weakness"; + DataConverterPotionId.potions[73] = "minecraft:long_strength"; + DataConverterPotionId.potions[74] = "minecraft:long_slowness"; + DataConverterPotionId.potions[75] = "minecraft:long_leaping"; + DataConverterPotionId.potions[76] = "minecraft:harming"; + DataConverterPotionId.potions[77] = "minecraft:long_water_breathing"; + DataConverterPotionId.potions[78] = "minecraft:long_invisibility"; + DataConverterPotionId.potions[79] = null; + DataConverterPotionId.potions[80] = "minecraft:awkward"; + DataConverterPotionId.potions[81] = "minecraft:long_regeneration"; + DataConverterPotionId.potions[82] = "minecraft:long_swiftness"; + DataConverterPotionId.potions[83] = "minecraft:long_fire_resistance"; + DataConverterPotionId.potions[84] = "minecraft:long_poison"; + DataConverterPotionId.potions[85] = "minecraft:healing"; + DataConverterPotionId.potions[86] = "minecraft:long_night_vision"; + DataConverterPotionId.potions[87] = null; + DataConverterPotionId.potions[88] = "minecraft:long_weakness"; + DataConverterPotionId.potions[89] = "minecraft:long_strength"; + DataConverterPotionId.potions[90] = "minecraft:long_slowness"; + DataConverterPotionId.potions[91] = "minecraft:long_leaping"; + DataConverterPotionId.potions[92] = "minecraft:harming"; + DataConverterPotionId.potions[93] = "minecraft:long_water_breathing"; + DataConverterPotionId.potions[94] = "minecraft:long_invisibility"; + DataConverterPotionId.potions[95] = null; + DataConverterPotionId.potions[96] = "minecraft:thick"; + DataConverterPotionId.potions[97] = "minecraft:regeneration"; + DataConverterPotionId.potions[98] = "minecraft:swiftness"; + DataConverterPotionId.potions[99] = "minecraft:long_fire_resistance"; + DataConverterPotionId.potions[100] = "minecraft:poison"; + DataConverterPotionId.potions[101] = "minecraft:strong_healing"; + DataConverterPotionId.potions[102] = "minecraft:long_night_vision"; + DataConverterPotionId.potions[103] = null; + DataConverterPotionId.potions[104] = "minecraft:long_weakness"; + DataConverterPotionId.potions[105] = "minecraft:strength"; + DataConverterPotionId.potions[106] = "minecraft:long_slowness"; + DataConverterPotionId.potions[107] = "minecraft:leaping"; + DataConverterPotionId.potions[108] = "minecraft:strong_harming"; + DataConverterPotionId.potions[109] = "minecraft:long_water_breathing"; + DataConverterPotionId.potions[110] = "minecraft:long_invisibility"; + DataConverterPotionId.potions[111] = null; + DataConverterPotionId.potions[112] = null; + DataConverterPotionId.potions[113] = "minecraft:regeneration"; + DataConverterPotionId.potions[114] = "minecraft:swiftness"; + DataConverterPotionId.potions[115] = "minecraft:long_fire_resistance"; + DataConverterPotionId.potions[116] = "minecraft:poison"; + DataConverterPotionId.potions[117] = "minecraft:strong_healing"; + DataConverterPotionId.potions[118] = "minecraft:long_night_vision"; + DataConverterPotionId.potions[119] = null; + DataConverterPotionId.potions[120] = "minecraft:long_weakness"; + DataConverterPotionId.potions[121] = "minecraft:strength"; + DataConverterPotionId.potions[122] = "minecraft:long_slowness"; + DataConverterPotionId.potions[123] = "minecraft:leaping"; + DataConverterPotionId.potions[124] = "minecraft:strong_harming"; + DataConverterPotionId.potions[125] = "minecraft:long_water_breathing"; + DataConverterPotionId.potions[126] = "minecraft:long_invisibility"; + DataConverterPotionId.potions[127] = null; + } + } + + private static class DataConverterSpawnEgg implements DataConverter { + + private static final String[] eggs = new String[256]; + + DataConverterSpawnEgg() { + } + + public int getDataVersion() { + return 105; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if ("minecraft:spawn_egg".equals(cmp.getString("id"))) { + net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); + net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("EntityTag"); + short short0 = cmp.getShort("Damage"); + + if (!nbttagcompound2.contains("id", 8)) { + String s = DataConverterSpawnEgg.eggs[short0 & 255]; + + if (s != null) { + nbttagcompound2.putString("id", s); + nbttagcompound1.put("EntityTag", nbttagcompound2); + cmp.put("tag", nbttagcompound1); + } + } + + if (short0 != 0) { + cmp.putShort("Damage", (short) 0); + } + } + + return cmp; + } + + static { + + DataConverterSpawnEgg.eggs[1] = "Item"; + DataConverterSpawnEgg.eggs[2] = "XPOrb"; + DataConverterSpawnEgg.eggs[7] = "ThrownEgg"; + DataConverterSpawnEgg.eggs[8] = "LeashKnot"; + DataConverterSpawnEgg.eggs[9] = "Painting"; + DataConverterSpawnEgg.eggs[10] = "Arrow"; + DataConverterSpawnEgg.eggs[11] = "Snowball"; + DataConverterSpawnEgg.eggs[12] = "Fireball"; + DataConverterSpawnEgg.eggs[13] = "SmallFireball"; + DataConverterSpawnEgg.eggs[14] = "ThrownEnderpearl"; + DataConverterSpawnEgg.eggs[15] = "EyeOfEnderSignal"; + DataConverterSpawnEgg.eggs[16] = "ThrownPotion"; + DataConverterSpawnEgg.eggs[17] = "ThrownExpBottle"; + DataConverterSpawnEgg.eggs[18] = "ItemFrame"; + DataConverterSpawnEgg.eggs[19] = "WitherSkull"; + DataConverterSpawnEgg.eggs[20] = "PrimedTnt"; + DataConverterSpawnEgg.eggs[21] = "FallingSand"; + DataConverterSpawnEgg.eggs[22] = "FireworksRocketEntity"; + DataConverterSpawnEgg.eggs[23] = "TippedArrow"; + DataConverterSpawnEgg.eggs[24] = "SpectralArrow"; + DataConverterSpawnEgg.eggs[25] = "ShulkerBullet"; + DataConverterSpawnEgg.eggs[26] = "DragonFireball"; + DataConverterSpawnEgg.eggs[30] = "ArmorStand"; + DataConverterSpawnEgg.eggs[41] = "Boat"; + DataConverterSpawnEgg.eggs[42] = "MinecartRideable"; + DataConverterSpawnEgg.eggs[43] = "MinecartChest"; + DataConverterSpawnEgg.eggs[44] = "MinecartFurnace"; + DataConverterSpawnEgg.eggs[45] = "MinecartTNT"; + DataConverterSpawnEgg.eggs[46] = "MinecartHopper"; + DataConverterSpawnEgg.eggs[47] = "MinecartSpawner"; + DataConverterSpawnEgg.eggs[40] = "MinecartCommandBlock"; + DataConverterSpawnEgg.eggs[48] = "Mob"; + DataConverterSpawnEgg.eggs[49] = "Monster"; + DataConverterSpawnEgg.eggs[50] = "Creeper"; + DataConverterSpawnEgg.eggs[51] = "Skeleton"; + DataConverterSpawnEgg.eggs[52] = "Spider"; + DataConverterSpawnEgg.eggs[53] = "Giant"; + DataConverterSpawnEgg.eggs[54] = "Zombie"; + DataConverterSpawnEgg.eggs[55] = "Slime"; + DataConverterSpawnEgg.eggs[56] = "Ghast"; + DataConverterSpawnEgg.eggs[57] = "PigZombie"; + DataConverterSpawnEgg.eggs[58] = "Enderman"; + DataConverterSpawnEgg.eggs[59] = "CaveSpider"; + DataConverterSpawnEgg.eggs[60] = "Silverfish"; + DataConverterSpawnEgg.eggs[61] = "Blaze"; + DataConverterSpawnEgg.eggs[62] = "LavaSlime"; + DataConverterSpawnEgg.eggs[63] = "EnderDragon"; + DataConverterSpawnEgg.eggs[64] = "WitherBoss"; + DataConverterSpawnEgg.eggs[65] = "Bat"; + DataConverterSpawnEgg.eggs[66] = "Witch"; + DataConverterSpawnEgg.eggs[67] = "Endermite"; + DataConverterSpawnEgg.eggs[68] = "Guardian"; + DataConverterSpawnEgg.eggs[69] = "Shulker"; + DataConverterSpawnEgg.eggs[90] = "Pig"; + DataConverterSpawnEgg.eggs[91] = "Sheep"; + DataConverterSpawnEgg.eggs[92] = "Cow"; + DataConverterSpawnEgg.eggs[93] = "Chicken"; + DataConverterSpawnEgg.eggs[94] = "Squid"; + DataConverterSpawnEgg.eggs[95] = "Wolf"; + DataConverterSpawnEgg.eggs[96] = "MushroomCow"; + DataConverterSpawnEgg.eggs[97] = "SnowMan"; + DataConverterSpawnEgg.eggs[98] = "Ozelot"; + DataConverterSpawnEgg.eggs[99] = "VillagerGolem"; + DataConverterSpawnEgg.eggs[100] = "EntityHorse"; + DataConverterSpawnEgg.eggs[101] = "Rabbit"; + DataConverterSpawnEgg.eggs[120] = "Villager"; + DataConverterSpawnEgg.eggs[200] = "EnderCrystal"; + } + } + + private static class DataConverterMinecart implements DataConverter { + + private static final List a = Lists.newArrayList("MinecartRideable", "MinecartChest", "MinecartFurnace", "MinecartTNT", "MinecartSpawner", "MinecartHopper", "MinecartCommandBlock"); + + DataConverterMinecart() { + } + + public int getDataVersion() { + return 106; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if ("Minecart".equals(cmp.getString("id"))) { + String s = "MinecartRideable"; + int i = cmp.getInt("Type"); + + if (i > 0 && i < DataConverterMinecart.a.size()) { + s = DataConverterMinecart.a.get(i); + } + + cmp.putString("id", s); + cmp.remove("Type"); + } + + return cmp; + } + } + + private static class DataConverterMobSpawner implements DataConverter { + + DataConverterMobSpawner() { + } + + public int getDataVersion() { + return 107; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if (!"MobSpawner".equals(cmp.getString("id"))) { + return cmp; + } else { + if (cmp.contains("EntityId", 8)) { + String s = cmp.getString("EntityId"); + net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("SpawnData"); + + nbttagcompound1.putString("id", s.isEmpty() ? "Pig" : s); + cmp.put("SpawnData", nbttagcompound1); + cmp.remove("EntityId"); + } + + if (cmp.contains("SpawnPotentials", 9)) { + net.minecraft.nbt.ListTag nbttaglist = cmp.getList("SpawnPotentials", 10); + + for (int i = 0; i < nbttaglist.size(); ++i) { + net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttaglist.getCompound(i); + + if (nbttagcompound2.contains("Type", 8)) { + net.minecraft.nbt.CompoundTag nbttagcompound3 = nbttagcompound2.getCompound("Properties"); + + nbttagcompound3.putString("id", nbttagcompound2.getString("Type")); + nbttagcompound2.put("Entity", nbttagcompound3); + nbttagcompound2.remove("Type"); + nbttagcompound2.remove("Properties"); + } + } + } + + return cmp; + } + } + } + + private static class DataConverterUUID implements DataConverter { + + DataConverterUUID() { + } + + public int getDataVersion() { + return 108; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if (cmp.contains("UUID", 8)) { + cmp.putUUID("UUID", UUID.fromString(cmp.getString("UUID"))); + } + + return cmp; + } + } + + private static class DataConverterHealth implements DataConverter { + + private static final Set a = Sets.newHashSet("ArmorStand", "Bat", "Blaze", "CaveSpider", "Chicken", "Cow", "Creeper", "EnderDragon", "Enderman", "Endermite", "EntityHorse", "Ghast", "Giant", "Guardian", "LavaSlime", "MushroomCow", "Ozelot", "Pig", "PigZombie", "Rabbit", "Sheep", "Shulker", "Silverfish", "Skeleton", "Slime", "SnowMan", "Spider", "Squid", "Villager", "VillagerGolem", "Witch", "WitherBoss", "Wolf", "Zombie"); + + DataConverterHealth() { + } + + public int getDataVersion() { + return 109; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if (DataConverterHealth.a.contains(cmp.getString("id"))) { + float f; + + if (cmp.contains("HealF", 99)) { + f = cmp.getFloat("HealF"); + cmp.remove("HealF"); + } else { + if (!cmp.contains("Health", 99)) { + return cmp; + } + + f = cmp.getFloat("Health"); + } + + cmp.putFloat("Health", f); + } + + return cmp; + } + } + + private static class DataConverterSaddle implements DataConverter { + + DataConverterSaddle() { + } + + public int getDataVersion() { + return 110; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if ("EntityHorse".equals(cmp.getString("id")) && !cmp.contains("SaddleItem", 10) && cmp.getBoolean("Saddle")) { + net.minecraft.nbt.CompoundTag nbttagcompound1 = new net.minecraft.nbt.CompoundTag(); + + nbttagcompound1.putString("id", "minecraft:saddle"); + nbttagcompound1.putByte("Count", (byte) 1); + nbttagcompound1.putShort("Damage", (short) 0); + cmp.put("SaddleItem", nbttagcompound1); + cmp.remove("Saddle"); + } + + return cmp; + } + } + + private static class DataConverterHanging implements DataConverter { + + DataConverterHanging() { + } + + public int getDataVersion() { + return 111; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + String s = cmp.getString("id"); + boolean flag = "Painting".equals(s); + boolean flag1 = "ItemFrame".equals(s); + + if ((flag || flag1) && !cmp.contains("Facing", 99)) { + Direction enumdirection; + + if (cmp.contains("Direction", 99)) { + enumdirection = Direction.from2DDataValue(cmp.getByte("Direction")); + cmp.putInt("TileX", cmp.getInt("TileX") + enumdirection.getStepX()); + cmp.putInt("TileY", cmp.getInt("TileY") + enumdirection.getStepY()); + cmp.putInt("TileZ", cmp.getInt("TileZ") + enumdirection.getStepZ()); + cmp.remove("Direction"); + if (flag1 && cmp.contains("ItemRotation", 99)) { + cmp.putByte("ItemRotation", (byte) (cmp.getByte("ItemRotation") * 2)); + } + } else { + enumdirection = Direction.from2DDataValue(cmp.getByte("Dir")); + cmp.remove("Dir"); + } + + cmp.putByte("Facing", (byte) enumdirection.get2DDataValue()); + } + + return cmp; + } + } + + private static class DataConverterDropChances implements DataConverter { + + DataConverterDropChances() { + } + + public int getDataVersion() { + return 113; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + net.minecraft.nbt.ListTag nbttaglist; + + if (cmp.contains("HandDropChances", 9)) { + nbttaglist = cmp.getList("HandDropChances", 5); + if (nbttaglist.size() == 2 && nbttaglist.getFloat(0) == 0.0F && nbttaglist.getFloat(1) == 0.0F) { + cmp.remove("HandDropChances"); + } + } + + if (cmp.contains("ArmorDropChances", 9)) { + nbttaglist = cmp.getList("ArmorDropChances", 5); + if (nbttaglist.size() == 4 && nbttaglist.getFloat(0) == 0.0F && nbttaglist.getFloat(1) == 0.0F && nbttaglist.getFloat(2) == 0.0F && nbttaglist.getFloat(3) == 0.0F) { + cmp.remove("ArmorDropChances"); + } + } + + return cmp; + } + } + + private static class DataConverterRiding implements DataConverter { + + DataConverterRiding() { + } + + public int getDataVersion() { + return 135; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + while (cmp.contains("Riding", 10)) { + net.minecraft.nbt.CompoundTag nbttagcompound1 = this.b(cmp); + + this.convert(cmp, nbttagcompound1); + cmp = nbttagcompound1; + } + + return cmp; + } + + protected void convert(net.minecraft.nbt.CompoundTag nbttagcompound, net.minecraft.nbt.CompoundTag nbttagcompound1) { + net.minecraft.nbt.ListTag nbttaglist = new net.minecraft.nbt.ListTag(); + + nbttaglist.add(nbttagcompound); + nbttagcompound1.put("Passengers", nbttaglist); + } + + protected net.minecraft.nbt.CompoundTag b(net.minecraft.nbt.CompoundTag nbttagcompound) { + net.minecraft.nbt.CompoundTag nbttagcompound1 = nbttagcompound.getCompound("Riding"); + + nbttagcompound.remove("Riding"); + return nbttagcompound1; + } + } + + private static class DataConverterBook implements DataConverter { + + DataConverterBook() { + } + + public int getDataVersion() { + return 165; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if ("minecraft:written_book".equals(cmp.getString("id"))) { + net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); + + if (nbttagcompound1.contains("pages", 9)) { + net.minecraft.nbt.ListTag nbttaglist = nbttagcompound1.getList("pages", 8); + + for (int i = 0; i < nbttaglist.size(); ++i) { + String s = nbttaglist.getString(i); + Component object = null; + + if (!"null".equals(s) && !StringUtil.isNullOrEmpty(s)) { + if ((s.charAt(0) != 34 || s.charAt(s.length() - 1) != 34) && (s.charAt(0) != 123 || s.charAt(s.length() - 1) != 125)) { + object = Component.literal(s); + } else { + try { + object = GsonHelper.fromJson(DataConverterSignText.a, s, Component.class, true); + if (object == null) { + object = Component.literal(""); + } + } catch (JsonParseException jsonparseexception) { + ; + } + + if (object == null) { + try { + object = Component.Serializer.fromJson(s); + } catch (JsonParseException jsonparseexception1) { + ; + } + } + + if (object == null) { + try { + object = Component.Serializer.fromJsonLenient(s); + } catch (JsonParseException jsonparseexception2) { + ; + } + } + + if (object == null) { + object = Component.literal(s); + } + } + } else { + object = Component.literal(""); + } + + nbttaglist.set(i, net.minecraft.nbt.StringTag.valueOf(Component.Serializer.toJson(object))); + } + + nbttagcompound1.put("pages", nbttaglist); + } + } + + return cmp; + } + } + + private static class DataConverterCookedFish implements DataConverter { + + private static final ResourceLocation a = new ResourceLocation("cooked_fished"); + + DataConverterCookedFish() { + } + + public int getDataVersion() { + return 502; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if (cmp.contains("id", 8) && DataConverterCookedFish.a.equals(new ResourceLocation(cmp.getString("id")))) { + cmp.putString("id", "minecraft:cooked_fish"); + } + + return cmp; + } + } + + private static class DataConverterZombie implements DataConverter { + + private static final Random a = new Random(); + + DataConverterZombie() { + } + + public int getDataVersion() { + return 502; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if ("Zombie".equals(cmp.getString("id")) && cmp.getBoolean("IsVillager")) { + if (!cmp.contains("ZombieType", 99)) { + int i = -1; + + if (cmp.contains("VillagerProfession", 99)) { + try { + i = this.convert(cmp.getInt("VillagerProfession")); + } catch (RuntimeException runtimeexception) { + ; + } + } + + if (i == -1) { + i = this.convert(DataConverterZombie.a.nextInt(6)); + } + + cmp.putInt("ZombieType", i); + } + + cmp.remove("IsVillager"); + } + + return cmp; + } + + private int convert(int i) { + return i >= 0 && i < 6 ? i : -1; + } + } + + private static class DataConverterVBO implements DataConverter { + + DataConverterVBO() { + } + + public int getDataVersion() { + return 505; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + cmp.putString("useVbo", "true"); + return cmp; + } + } + + private static class DataConverterGuardian implements DataConverter { + + DataConverterGuardian() { + } + + public int getDataVersion() { + return 700; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if ("Guardian".equals(cmp.getString("id"))) { + if (cmp.getBoolean("Elder")) { + cmp.putString("id", "ElderGuardian"); + } + + cmp.remove("Elder"); + } + + return cmp; + } + } + + private static class DataConverterSkeleton implements DataConverter { + + DataConverterSkeleton() { + } + + public int getDataVersion() { + return 701; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + String s = cmp.getString("id"); + + if ("Skeleton".equals(s)) { + int i = cmp.getInt("SkeletonType"); + + if (i == 1) { + cmp.putString("id", "WitherSkeleton"); + } else if (i == 2) { + cmp.putString("id", "Stray"); + } + + cmp.remove("SkeletonType"); + } + + return cmp; + } + } + + private static class DataConverterZombieType implements DataConverter { + + DataConverterZombieType() { + } + + public int getDataVersion() { + return 702; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if ("Zombie".equals(cmp.getString("id"))) { + int i = cmp.getInt("ZombieType"); + + switch (i) { + case 0: + default: + break; + + case 1: + case 2: + case 3: + case 4: + case 5: + cmp.putString("id", "ZombieVillager"); + cmp.putInt("Profession", i - 1); + break; + + case 6: + cmp.putString("id", "Husk"); + } + + cmp.remove("ZombieType"); + } + + return cmp; + } + } + + private static class DataConverterHorse implements DataConverter { + + DataConverterHorse() { + } + + public int getDataVersion() { + return 703; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if ("EntityHorse".equals(cmp.getString("id"))) { + int i = cmp.getInt("Type"); + + switch (i) { + case 0: + default: + cmp.putString("id", "Horse"); + break; + + case 1: + cmp.putString("id", "Donkey"); + break; + + case 2: + cmp.putString("id", "Mule"); + break; + + case 3: + cmp.putString("id", "ZombieHorse"); + break; + + case 4: + cmp.putString("id", "SkeletonHorse"); + } + + cmp.remove("Type"); + } + + return cmp; + } + } + + private static class DataConverterTileEntity implements DataConverter { + + private static final Map a = Maps.newHashMap(); + + DataConverterTileEntity() { + } + + public int getDataVersion() { + return 704; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + String s = DataConverterTileEntity.a.get(cmp.getString("id")); + + if (s != null) { + cmp.putString("id", s); + } + + return cmp; + } + + static { + DataConverterTileEntity.a.put("Airportal", "minecraft:end_portal"); + DataConverterTileEntity.a.put("Banner", "minecraft:banner"); + DataConverterTileEntity.a.put("Beacon", "minecraft:beacon"); + DataConverterTileEntity.a.put("Cauldron", "minecraft:brewing_stand"); + DataConverterTileEntity.a.put("Chest", "minecraft:chest"); + DataConverterTileEntity.a.put("Comparator", "minecraft:comparator"); + DataConverterTileEntity.a.put("Control", "minecraft:command_block"); + DataConverterTileEntity.a.put("DLDetector", "minecraft:daylight_detector"); + DataConverterTileEntity.a.put("Dropper", "minecraft:dropper"); + DataConverterTileEntity.a.put("EnchantTable", "minecraft:enchanting_table"); + DataConverterTileEntity.a.put("EndGateway", "minecraft:end_gateway"); + DataConverterTileEntity.a.put("EnderChest", "minecraft:ender_chest"); + DataConverterTileEntity.a.put("FlowerPot", "minecraft:flower_pot"); + DataConverterTileEntity.a.put("Furnace", "minecraft:furnace"); + DataConverterTileEntity.a.put("Hopper", "minecraft:hopper"); + DataConverterTileEntity.a.put("MobSpawner", "minecraft:mob_spawner"); + DataConverterTileEntity.a.put("Music", "minecraft:noteblock"); + DataConverterTileEntity.a.put("Piston", "minecraft:piston"); + DataConverterTileEntity.a.put("RecordPlayer", "minecraft:jukebox"); + DataConverterTileEntity.a.put("Sign", "minecraft:sign"); + DataConverterTileEntity.a.put("Skull", "minecraft:skull"); + DataConverterTileEntity.a.put("Structure", "minecraft:structure_block"); + DataConverterTileEntity.a.put("Trap", "minecraft:dispenser"); + } + } + + private static class DataConverterEntity implements DataConverter { + + private static final Map a = Maps.newHashMap(); + + DataConverterEntity() { + } + + public int getDataVersion() { + return 704; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + String s = DataConverterEntity.a.get(cmp.getString("id")); + + if (s != null) { + cmp.putString("id", s); + } + + return cmp; + } + + static { + DataConverterEntity.a.put("AreaEffectCloud", "minecraft:area_effect_cloud"); + DataConverterEntity.a.put("ArmorStand", "minecraft:armor_stand"); + DataConverterEntity.a.put("Arrow", "minecraft:arrow"); + DataConverterEntity.a.put("Bat", "minecraft:bat"); + DataConverterEntity.a.put("Blaze", "minecraft:blaze"); + DataConverterEntity.a.put("Boat", "minecraft:boat"); + DataConverterEntity.a.put("CaveSpider", "minecraft:cave_spider"); + DataConverterEntity.a.put("Chicken", "minecraft:chicken"); + DataConverterEntity.a.put("Cow", "minecraft:cow"); + DataConverterEntity.a.put("Creeper", "minecraft:creeper"); + DataConverterEntity.a.put("Donkey", "minecraft:donkey"); + DataConverterEntity.a.put("DragonFireball", "minecraft:dragon_fireball"); + DataConverterEntity.a.put("ElderGuardian", "minecraft:elder_guardian"); + DataConverterEntity.a.put("EnderCrystal", "minecraft:ender_crystal"); + DataConverterEntity.a.put("EnderDragon", "minecraft:ender_dragon"); + DataConverterEntity.a.put("Enderman", "minecraft:enderman"); + DataConverterEntity.a.put("Endermite", "minecraft:endermite"); + DataConverterEntity.a.put("EyeOfEnderSignal", "minecraft:eye_of_ender_signal"); + DataConverterEntity.a.put("FallingSand", "minecraft:falling_block"); + DataConverterEntity.a.put("Fireball", "minecraft:fireball"); + DataConverterEntity.a.put("FireworksRocketEntity", "minecraft:fireworks_rocket"); + DataConverterEntity.a.put("Ghast", "minecraft:ghast"); + DataConverterEntity.a.put("Giant", "minecraft:giant"); + DataConverterEntity.a.put("Guardian", "minecraft:guardian"); + DataConverterEntity.a.put("Horse", "minecraft:horse"); + DataConverterEntity.a.put("Husk", "minecraft:husk"); + DataConverterEntity.a.put("Item", "minecraft:item"); + DataConverterEntity.a.put("ItemFrame", "minecraft:item_frame"); + DataConverterEntity.a.put("LavaSlime", "minecraft:magma_cube"); + DataConverterEntity.a.put("LeashKnot", "minecraft:leash_knot"); + DataConverterEntity.a.put("MinecartChest", "minecraft:chest_minecart"); + DataConverterEntity.a.put("MinecartCommandBlock", "minecraft:commandblock_minecart"); + DataConverterEntity.a.put("MinecartFurnace", "minecraft:furnace_minecart"); + DataConverterEntity.a.put("MinecartHopper", "minecraft:hopper_minecart"); + DataConverterEntity.a.put("MinecartRideable", "minecraft:minecart"); + DataConverterEntity.a.put("MinecartSpawner", "minecraft:spawner_minecart"); + DataConverterEntity.a.put("MinecartTNT", "minecraft:tnt_minecart"); + DataConverterEntity.a.put("Mule", "minecraft:mule"); + DataConverterEntity.a.put("MushroomCow", "minecraft:mooshroom"); + DataConverterEntity.a.put("Ozelot", "minecraft:ocelot"); + DataConverterEntity.a.put("Painting", "minecraft:painting"); + DataConverterEntity.a.put("Pig", "minecraft:pig"); + DataConverterEntity.a.put("PigZombie", "minecraft:zombie_pigman"); + DataConverterEntity.a.put("PolarBear", "minecraft:polar_bear"); + DataConverterEntity.a.put("PrimedTnt", "minecraft:tnt"); + DataConverterEntity.a.put("Rabbit", "minecraft:rabbit"); + DataConverterEntity.a.put("Sheep", "minecraft:sheep"); + DataConverterEntity.a.put("Shulker", "minecraft:shulker"); + DataConverterEntity.a.put("ShulkerBullet", "minecraft:shulker_bullet"); + DataConverterEntity.a.put("Silverfish", "minecraft:silverfish"); + DataConverterEntity.a.put("Skeleton", "minecraft:skeleton"); + DataConverterEntity.a.put("SkeletonHorse", "minecraft:skeleton_horse"); + DataConverterEntity.a.put("Slime", "minecraft:slime"); + DataConverterEntity.a.put("SmallFireball", "minecraft:small_fireball"); + DataConverterEntity.a.put("SnowMan", "minecraft:snowman"); + DataConverterEntity.a.put("Snowball", "minecraft:snowball"); + DataConverterEntity.a.put("SpectralArrow", "minecraft:spectral_arrow"); + DataConverterEntity.a.put("Spider", "minecraft:spider"); + DataConverterEntity.a.put("Squid", "minecraft:squid"); + DataConverterEntity.a.put("Stray", "minecraft:stray"); + DataConverterEntity.a.put("ThrownEgg", "minecraft:egg"); + DataConverterEntity.a.put("ThrownEnderpearl", "minecraft:ender_pearl"); + DataConverterEntity.a.put("ThrownExpBottle", "minecraft:xp_bottle"); + DataConverterEntity.a.put("ThrownPotion", "minecraft:potion"); + DataConverterEntity.a.put("Villager", "minecraft:villager"); + DataConverterEntity.a.put("VillagerGolem", "minecraft:villager_golem"); + DataConverterEntity.a.put("Witch", "minecraft:witch"); + DataConverterEntity.a.put("WitherBoss", "minecraft:wither"); + DataConverterEntity.a.put("WitherSkeleton", "minecraft:wither_skeleton"); + DataConverterEntity.a.put("WitherSkull", "minecraft:wither_skull"); + DataConverterEntity.a.put("Wolf", "minecraft:wolf"); + DataConverterEntity.a.put("XPOrb", "minecraft:xp_orb"); + DataConverterEntity.a.put("Zombie", "minecraft:zombie"); + DataConverterEntity.a.put("ZombieHorse", "minecraft:zombie_horse"); + DataConverterEntity.a.put("ZombieVillager", "minecraft:zombie_villager"); + } + } + + private static class DataConverterPotionWater implements DataConverter { + + DataConverterPotionWater() { + } + + public int getDataVersion() { + return 806; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + String s = cmp.getString("id"); + + if ("minecraft:potion".equals(s) || "minecraft:splash_potion".equals(s) || "minecraft:lingering_potion".equals(s) || "minecraft:tipped_arrow".equals(s)) { + net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); + + if (!nbttagcompound1.contains("Potion", 8)) { + nbttagcompound1.putString("Potion", "minecraft:water"); + } + + if (!cmp.contains("tag", 10)) { + cmp.put("tag", nbttagcompound1); + } + } + + return cmp; + } + } + + private static class DataConverterShulker implements DataConverter { + + DataConverterShulker() { + } + + public int getDataVersion() { + return 808; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if ("minecraft:shulker".equals(cmp.getString("id")) && !cmp.contains("Color", 99)) { + cmp.putByte("Color", (byte) 10); + } + + return cmp; + } + } + + private static class DataConverterShulkerBoxItem implements DataConverter { + + public static final String[] a = new String[] { "minecraft:white_shulker_box", "minecraft:orange_shulker_box", "minecraft:magenta_shulker_box", "minecraft:light_blue_shulker_box", "minecraft:yellow_shulker_box", "minecraft:lime_shulker_box", "minecraft:pink_shulker_box", "minecraft:gray_shulker_box", "minecraft:silver_shulker_box", "minecraft:cyan_shulker_box", "minecraft:purple_shulker_box", "minecraft:blue_shulker_box", "minecraft:brown_shulker_box", "minecraft:green_shulker_box", "minecraft:red_shulker_box", "minecraft:black_shulker_box" }; + + DataConverterShulkerBoxItem() { + } + + public int getDataVersion() { + return 813; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if ("minecraft:shulker_box".equals(cmp.getString("id")) && cmp.contains("tag", 10)) { + net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); + + if (nbttagcompound1.contains("BlockEntityTag", 10)) { + net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag"); + + if (nbttagcompound2.getList("Items", 10).isEmpty()) { + nbttagcompound2.remove("Items"); + } + + int i = nbttagcompound2.getInt("Color"); + + nbttagcompound2.remove("Color"); + if (nbttagcompound2.isEmpty()) { + nbttagcompound1.remove("BlockEntityTag"); + } + + if (nbttagcompound1.isEmpty()) { + cmp.remove("tag"); + } + + cmp.putString("id", DataConverterShulkerBoxItem.a[i % 16]); + } + } + + return cmp; + } + } + + private static class DataConverterShulkerBoxBlock implements DataConverter { + + DataConverterShulkerBoxBlock() { + } + + public int getDataVersion() { + return 813; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if ("minecraft:shulker".equals(cmp.getString("id"))) { + cmp.remove("Color"); + } + + return cmp; + } + } + + private static class DataConverterLang implements DataConverter { + + DataConverterLang() { + } + + public int getDataVersion() { + return 816; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if (cmp.contains("lang", 8)) { + cmp.putString("lang", cmp.getString("lang").toLowerCase(Locale.ROOT)); + } + + return cmp; + } + } + + private static class DataConverterTotem implements DataConverter { + + DataConverterTotem() { + } + + public int getDataVersion() { + return 820; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if ("minecraft:totem".equals(cmp.getString("id"))) { + cmp.putString("id", "minecraft:totem_of_undying"); + } + + return cmp; + } + } + + private static class DataConverterBedBlock implements DataConverter { + + private static final Logger a = LogManager.getLogger(PaperweightDataConverters.class); + + DataConverterBedBlock() { + } + + public int getDataVersion() { + return 1125; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + try { + net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("Level"); + int i = nbttagcompound1.getInt("xPos"); + int j = nbttagcompound1.getInt("zPos"); + net.minecraft.nbt.ListTag nbttaglist = nbttagcompound1.getList("TileEntities", 10); + net.minecraft.nbt.ListTag nbttaglist1 = nbttagcompound1.getList("Sections", 10); + + for (int k = 0; k < nbttaglist1.size(); ++k) { + net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttaglist1.getCompound(k); + byte b0 = nbttagcompound2.getByte("Y"); + byte[] abyte = nbttagcompound2.getByteArray("Blocks"); + + for (int l = 0; l < abyte.length; ++l) { + if (416 == (abyte[l] & 255) << 4) { + int i1 = l & 15; + int j1 = l >> 8 & 15; + int k1 = l >> 4 & 15; + net.minecraft.nbt.CompoundTag nbttagcompound3 = new net.minecraft.nbt.CompoundTag(); + + nbttagcompound3.putString("id", "bed"); + nbttagcompound3.putInt("x", i1 + (i << 4)); + nbttagcompound3.putInt("y", j1 + (b0 << 4)); + nbttagcompound3.putInt("z", k1 + (j << 4)); + nbttaglist.add(nbttagcompound3); + } + } + } + } catch (Exception exception) { + DataConverterBedBlock.a.warn("Unable to datafix Bed blocks, level format may be missing tags."); + } + + return cmp; + } + } + + private static class DataConverterBedItem implements DataConverter { + + DataConverterBedItem() { + } + + public int getDataVersion() { + return 1125; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if ("minecraft:bed".equals(cmp.getString("id")) && cmp.getShort("Damage") == 0) { + cmp.putShort("Damage", (short) DyeColor.RED.getId()); + } + + return cmp; + } + } + + private static class DataConverterSignText implements DataConverter { + + public static final Gson a = new GsonBuilder().registerTypeAdapter(Component.class, new JsonDeserializer() { + MutableComponent a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { + if (jsonelement.isJsonPrimitive()) { + return Component.literal(jsonelement.getAsString()); + } else if (jsonelement.isJsonArray()) { + JsonArray jsonarray = jsonelement.getAsJsonArray(); + MutableComponent ichatbasecomponent = null; + Iterator iterator = jsonarray.iterator(); + + while (iterator.hasNext()) { + JsonElement jsonelement1 = (JsonElement) iterator.next(); + MutableComponent ichatbasecomponent1 = this.a(jsonelement1, jsonelement1.getClass(), jsondeserializationcontext); + + if (ichatbasecomponent == null) { + ichatbasecomponent = ichatbasecomponent1; + } else { + ichatbasecomponent.append(ichatbasecomponent1); + } + } + + return ichatbasecomponent; + } else { + throw new JsonParseException("Don't know how to turn " + jsonelement + " into a Component"); + } + } + + public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { + return this.a(jsonelement, type, jsondeserializationcontext); + } + }).create(); + + DataConverterSignText() { + } + + public int getDataVersion() { + return 101; + } + + public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { + if ("Sign".equals(cmp.getString("id"))) { + this.convert(cmp, "Text1"); + this.convert(cmp, "Text2"); + this.convert(cmp, "Text3"); + this.convert(cmp, "Text4"); + } + + return cmp; + } + + private void convert(net.minecraft.nbt.CompoundTag nbttagcompound, String s) { + String s1 = nbttagcompound.getString(s); + Component object = null; + + if (!"null".equals(s1) && !StringUtil.isNullOrEmpty(s1)) { + if ((s1.charAt(0) != 34 || s1.charAt(s1.length() - 1) != 34) && (s1.charAt(0) != 123 || s1.charAt(s1.length() - 1) != 125)) { + object = Component.literal(s1); + } else { + try { + object = GsonHelper.fromJson(DataConverterSignText.a, s1, Component.class, true); + if (object == null) { + object = Component.literal(""); + } + } catch (JsonParseException jsonparseexception) { + ; + } + + if (object == null) { + try { + object = Component.Serializer.fromJson(s1); + } catch (JsonParseException jsonparseexception1) { + ; + } + } + + if (object == null) { + try { + object = Component.Serializer.fromJsonLenient(s1); + } catch (JsonParseException jsonparseexception2) { + ; + } + } + + if (object == null) { + object = Component.literal(s1); + } + } + } else { + object = Component.literal(""); + } + + nbttagcompound.putString(s, Component.Serializer.toJson(object)); + } + } + + private static class DataInspectorPlayerVehicle implements DataInspector { + @Override + public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { + if (cmp.contains("RootVehicle", 10)) { + net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("RootVehicle"); + + if (nbttagcompound1.contains("Entity", 10)) { + convertCompound(LegacyType.ENTITY, nbttagcompound1, "Entity", sourceVer, targetVer); + } + } + + return cmp; + } + } + + private static class DataInspectorLevelPlayer implements DataInspector { + @Override + public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { + if (cmp.contains("Player", 10)) { + convertCompound(LegacyType.PLAYER, cmp, "Player", sourceVer, targetVer); + } + + return cmp; + } + } + + private static class DataInspectorStructure implements DataInspector { + @Override + public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { + net.minecraft.nbt.ListTag nbttaglist; + int j; + net.minecraft.nbt.CompoundTag nbttagcompound1; + + if (cmp.contains("entities", 9)) { + nbttaglist = cmp.getList("entities", 10); + + for (j = 0; j < nbttaglist.size(); ++j) { + nbttagcompound1 = (net.minecraft.nbt.CompoundTag) nbttaglist.get(j); + if (nbttagcompound1.contains("nbt", 10)) { + convertCompound(LegacyType.ENTITY, nbttagcompound1, "nbt", sourceVer, targetVer); + } + } + } + + if (cmp.contains("blocks", 9)) { + nbttaglist = cmp.getList("blocks", 10); + + for (j = 0; j < nbttaglist.size(); ++j) { + nbttagcompound1 = (net.minecraft.nbt.CompoundTag) nbttaglist.get(j); + if (nbttagcompound1.contains("nbt", 10)) { + convertCompound(LegacyType.BLOCK_ENTITY, nbttagcompound1, "nbt", sourceVer, targetVer); + } + } + } + + return cmp; + } + } + + private static class DataInspectorChunks implements DataInspector { + @Override + public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { + if (cmp.contains("Level", 10)) { + net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("Level"); + net.minecraft.nbt.ListTag nbttaglist; + int j; + + if (nbttagcompound1.contains("Entities", 9)) { + nbttaglist = nbttagcompound1.getList("Entities", 10); + + for (j = 0; j < nbttaglist.size(); ++j) { + nbttaglist.set(j, convert(LegacyType.ENTITY, (net.minecraft.nbt.CompoundTag) nbttaglist.get(j), sourceVer, targetVer)); + } + } + + if (nbttagcompound1.contains("TileEntities", 9)) { + nbttaglist = nbttagcompound1.getList("TileEntities", 10); + + for (j = 0; j < nbttaglist.size(); ++j) { + nbttaglist.set(j, convert(LegacyType.BLOCK_ENTITY, (net.minecraft.nbt.CompoundTag) nbttaglist.get(j), sourceVer, targetVer)); + } + } + } + + return cmp; + } + } + + private static class DataInspectorEntityPassengers implements DataInspector { + @Override + public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { + if (cmp.contains("Passengers", 9)) { + net.minecraft.nbt.ListTag nbttaglist = cmp.getList("Passengers", 10); + + for (int j = 0; j < nbttaglist.size(); ++j) { + nbttaglist.set(j, convert(LegacyType.ENTITY, nbttaglist.getCompound(j), sourceVer, targetVer)); + } + } + + return cmp; + } + } + + private static class DataInspectorPlayer implements DataInspector { + @Override + public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { + convertItems(cmp, "Inventory", sourceVer, targetVer); + convertItems(cmp, "EnderItems", sourceVer, targetVer); + if (cmp.contains("ShoulderEntityLeft", 10)) { + convertCompound(LegacyType.ENTITY, cmp, "ShoulderEntityLeft", sourceVer, targetVer); + } + + if (cmp.contains("ShoulderEntityRight", 10)) { + convertCompound(LegacyType.ENTITY, cmp, "ShoulderEntityRight", sourceVer, targetVer); + } + + return cmp; + } + } + + private static class DataInspectorVillagers implements DataInspector { + ResourceLocation entityVillager = getKey("EntityVillager"); + + @Override + public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { + if (entityVillager.equals(new ResourceLocation(cmp.getString("id"))) && cmp.contains("Offers", 10)) { + net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("Offers"); + + if (nbttagcompound1.contains("Recipes", 9)) { + net.minecraft.nbt.ListTag nbttaglist = nbttagcompound1.getList("Recipes", 10); + + for (int j = 0; j < nbttaglist.size(); ++j) { + net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttaglist.getCompound(j); + + convertItem(nbttagcompound2, "buy", sourceVer, targetVer); + convertItem(nbttagcompound2, "buyB", sourceVer, targetVer); + convertItem(nbttagcompound2, "sell", sourceVer, targetVer); + nbttaglist.set(j, nbttagcompound2); + } + } + } + + return cmp; + } + } + + private static class DataInspectorMobSpawnerMinecart implements DataInspector { + ResourceLocation entityMinecartMobSpawner = getKey("EntityMinecartMobSpawner"); + ResourceLocation tileEntityMobSpawner = getKey("TileEntityMobSpawner"); + + @Override + public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { + String s = cmp.getString("id"); + if (entityMinecartMobSpawner.equals(new ResourceLocation(s))) { + cmp.putString("id", tileEntityMobSpawner.toString()); + convert(LegacyType.BLOCK_ENTITY, cmp, sourceVer, targetVer); + cmp.putString("id", s); + } + + return cmp; + } + } + + private static class DataInspectorMobSpawnerMobs implements DataInspector { + ResourceLocation tileEntityMobSpawner = getKey("TileEntityMobSpawner"); + + @Override + public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { + if (tileEntityMobSpawner.equals(new ResourceLocation(cmp.getString("id")))) { + if (cmp.contains("SpawnPotentials", 9)) { + net.minecraft.nbt.ListTag nbttaglist = cmp.getList("SpawnPotentials", 10); + + for (int j = 0; j < nbttaglist.size(); ++j) { + net.minecraft.nbt.CompoundTag nbttagcompound1 = nbttaglist.getCompound(j); + + convertCompound(LegacyType.ENTITY, nbttagcompound1, "Entity", sourceVer, targetVer); + } + } + + convertCompound(LegacyType.ENTITY, cmp, "SpawnData", sourceVer, targetVer); + } + + return cmp; + } + } + + private static class DataInspectorCommandBlock implements DataInspector { + ResourceLocation tileEntityCommand = getKey("TileEntityCommand"); + + @Override + public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { + if (tileEntityCommand.equals(new ResourceLocation(cmp.getString("id")))) { + cmp.putString("id", "Control"); + convert(LegacyType.BLOCK_ENTITY, cmp, sourceVer, targetVer); + cmp.putString("id", "MinecartCommandBlock"); + } + + return cmp; + } + } +} diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightFakePlayer.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightFakePlayer.java new file mode 100644 index 000000000..87dca94f2 --- /dev/null +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightFakePlayer.java @@ -0,0 +1,93 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_20_R1; + +import com.mojang.authlib.GameProfile; +import net.minecraft.network.chat.Component; +import net.minecraft.network.protocol.game.ServerboundClientInformationPacket; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.stats.Stat; +import net.minecraft.world.MenuProvider; +import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.block.entity.SignBlockEntity; +import net.minecraft.world.phys.Vec3; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; + +import java.util.OptionalInt; +import java.util.UUID; + +class PaperweightFakePlayer extends ServerPlayer { + private static final GameProfile FAKE_WORLDEDIT_PROFILE = new GameProfile(UUID.nameUUIDFromBytes("worldedit".getBytes()), "[WorldEdit]"); + private static final Vec3 ORIGIN = new Vec3(0.0D, 0.0D, 0.0D); + + PaperweightFakePlayer(ServerLevel world) { + super(world.getServer(), world, FAKE_WORLDEDIT_PROFILE); + } + + @Override + public Vec3 position() { + return ORIGIN; + } + + @Override + public void tick() { + } + + @Override + public void die(DamageSource damagesource) { + } + + @Override + public Entity changeDimension(ServerLevel worldserver, TeleportCause cause) { + return this; + } + + @Override + public OptionalInt openMenu(MenuProvider factory) { + return OptionalInt.empty(); + } + + @Override + public void updateOptions(ServerboundClientInformationPacket packet) { + } + + @Override + public void displayClientMessage(Component message, boolean actionBar) { + } + + @Override + public void awardStat(Stat stat, int amount) { + } + + @Override + public void awardStat(Stat stat) { + } + + @Override + public boolean isInvulnerableTo(DamageSource damageSource) { + return true; + } + + @Override + public void openTextEdit(SignBlockEntity sign, boolean front) { + } +} diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightWorldNativeAccess.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightWorldNativeAccess.java new file mode 100644 index 000000000..dc44a165a --- /dev/null +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightWorldNativeAccess.java @@ -0,0 +1,181 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_20_R1; + +import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; +import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.internal.block.BlockStateIdAccess; +import com.sk89q.worldedit.internal.wna.WorldNativeAccess; +import com.sk89q.worldedit.util.SideEffect; +import com.sk89q.worldedit.util.SideEffectSet; +import com.sk89q.worldedit.world.block.BlockState; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.FullChunkStatus; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.chunk.LevelChunk; +import org.bukkit.craftbukkit.v1_20_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData; +import org.bukkit.event.block.BlockPhysicsEvent; + +import java.lang.ref.WeakReference; +import java.util.Objects; +import javax.annotation.Nullable; + +public class PaperweightWorldNativeAccess implements WorldNativeAccess { + private static final int UPDATE = 1; + private static final int NOTIFY = 2; + + private final PaperweightAdapter adapter; + private final WeakReference world; + private SideEffectSet sideEffectSet; + + public PaperweightWorldNativeAccess(PaperweightAdapter adapter, WeakReference world) { + this.adapter = adapter; + this.world = world; + } + + private ServerLevel getWorld() { + return Objects.requireNonNull(world.get(), "The reference to the world was lost"); + } + + @Override + public void setCurrentSideEffectSet(SideEffectSet sideEffectSet) { + this.sideEffectSet = sideEffectSet; + } + + @Override + public LevelChunk getChunk(int x, int z) { + return getWorld().getChunk(x, z); + } + + @Override + public net.minecraft.world.level.block.state.BlockState toNative(BlockState state) { + int stateId = BlockStateIdAccess.getBlockStateId(state); + return BlockStateIdAccess.isValidInternalId(stateId) + ? Block.stateById(stateId) + : ((CraftBlockData) BukkitAdapter.adapt(state)).getState(); + } + + @Override + public net.minecraft.world.level.block.state.BlockState getBlockState(LevelChunk chunk, BlockPos position) { + return chunk.getBlockState(position); + } + + @Nullable + @Override + public net.minecraft.world.level.block.state.BlockState setBlockState(LevelChunk chunk, BlockPos position, net.minecraft.world.level.block.state.BlockState state) { + return chunk.setBlockState(position, state, false, this.sideEffectSet.shouldApply(SideEffect.UPDATE)); + } + + @Override + public net.minecraft.world.level.block.state.BlockState getValidBlockForPosition(net.minecraft.world.level.block.state.BlockState block, BlockPos position) { + return Block.updateFromNeighbourShapes(block, getWorld(), position); + } + + @Override + public BlockPos getPosition(int x, int y, int z) { + return new BlockPos(x, y, z); + } + + @Override + public void updateLightingForBlock(BlockPos position) { + getWorld().getChunkSource().getLightEngine().checkBlock(position); + } + + @Override + public boolean updateTileEntity(BlockPos position, CompoundBinaryTag tag) { + return false; + } + + @Override + public void notifyBlockUpdate(LevelChunk chunk, BlockPos position, net.minecraft.world.level.block.state.BlockState oldState, net.minecraft.world.level.block.state.BlockState newState) { + if (chunk.getSections()[getWorld().getSectionIndex(position.getY())] != null) { + getWorld().sendBlockUpdated(position, oldState, newState, UPDATE | NOTIFY); + } + } + + @Override + public boolean isChunkTicking(LevelChunk chunk) { + return chunk.getFullStatus().isOrAfter(FullChunkStatus.BLOCK_TICKING); + } + + @Override + public void markBlockChanged(LevelChunk chunk, BlockPos position) { + if (chunk.getSections()[getWorld().getSectionIndex(position.getY())] != null) { + getWorld().getChunkSource().blockChanged(position); + } + } + + @Override + public void notifyNeighbors(BlockPos pos, net.minecraft.world.level.block.state.BlockState oldState, net.minecraft.world.level.block.state.BlockState newState) { + ServerLevel world = getWorld(); + if (sideEffectSet.shouldApply(SideEffect.EVENTS)) { + world.updateNeighborsAt(pos, oldState.getBlock()); + } else { + // When we don't want events, manually run the physics without them. + Block block = oldState.getBlock(); + fireNeighborChanged(pos, world, block, pos.west()); + fireNeighborChanged(pos, world, block, pos.east()); + fireNeighborChanged(pos, world, block, pos.below()); + fireNeighborChanged(pos, world, block, pos.above()); + fireNeighborChanged(pos, world, block, pos.north()); + fireNeighborChanged(pos, world, block, pos.south()); + } + if (newState.hasAnalogOutputSignal()) { + world.updateNeighbourForOutputSignal(pos, newState.getBlock()); + } + } + + // Not sure why neighborChanged is deprecated + @SuppressWarnings("deprecation") + private void fireNeighborChanged(BlockPos pos, ServerLevel world, Block block, BlockPos neighborPos) { + world.getBlockState(neighborPos).neighborChanged(world, neighborPos, block, pos, false); + } + + @Override + public void updateNeighbors(BlockPos pos, net.minecraft.world.level.block.state.BlockState oldState, net.minecraft.world.level.block.state.BlockState newState, int recursionLimit) { + ServerLevel world = getWorld(); + // a == updateNeighbors + // b == updateDiagonalNeighbors + oldState.updateIndirectNeighbourShapes(world, pos, NOTIFY, recursionLimit); + if (sideEffectSet.shouldApply(SideEffect.EVENTS)) { + CraftWorld craftWorld = world.getWorld(); + BlockPhysicsEvent event = new BlockPhysicsEvent(craftWorld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()), CraftBlockData.fromData(newState)); + world.getCraftServer().getPluginManager().callEvent(event); + if (event.isCancelled()) { + return; + } + } + newState.updateNeighbourShapes(world, pos, NOTIFY, recursionLimit); + newState.updateIndirectNeighbourShapes(world, pos, NOTIFY, recursionLimit); + } + + @Override + public void onBlockStateChange(BlockPos pos, net.minecraft.world.level.block.state.BlockState oldState, net.minecraft.world.level.block.state.BlockState newState) { + getWorld().onBlockStateChange(pos, oldState, newState); + } + + @Override + public void flush() { + + } + +} diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightBlockMaterial.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightBlockMaterial.java new file mode 100644 index 000000000..826874f57 --- /dev/null +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightBlockMaterial.java @@ -0,0 +1,185 @@ +package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1; + +import com.google.common.base.Suppliers; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.util.ReflectionUtil; +import com.sk89q.worldedit.bukkit.adapter.Refraction; +import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1.nbt.PaperweightLazyCompoundTag; +import com.sk89q.worldedit.world.registry.BlockMaterial; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.EmptyBlockGetter; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.EntityBlock; +import net.minecraft.world.level.block.LiquidBlock; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockBehaviour; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.material.PushReaction; +import org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData; + +public class PaperweightBlockMaterial implements BlockMaterial { + + private final Block block; + private final BlockState blockState; + private final boolean isTranslucent; + private final CraftBlockData craftBlockData; + private final org.bukkit.Material craftMaterial; + private final int opacity; + private final CompoundTag tile; + + public PaperweightBlockMaterial(Block block) { + this(block, block.defaultBlockState()); + } + + public PaperweightBlockMaterial(Block block, BlockState blockState) { + this.block = block; + this.blockState = blockState; + this.craftBlockData = CraftBlockData.fromData(blockState); + this.craftMaterial = craftBlockData.getMaterial(); + BlockBehaviour.Properties blockInfo = ReflectionUtil.getField(BlockBehaviour.class, block, + Refraction.pickName("properties", "aN")); + this.isTranslucent = !(boolean) ReflectionUtil.getField(BlockBehaviour.Properties.class, blockInfo, + Refraction.pickName("canOcclude", "m") + ); + opacity = blockState.getLightBlock(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); + BlockEntity tileEntity = !(block instanceof EntityBlock) ? null : ((EntityBlock) block).newBlockEntity( + BlockPos.ZERO, + blockState + ); + tile = tileEntity == null + ? null + : new PaperweightLazyCompoundTag(Suppliers.memoize(tileEntity::saveWithId)); + } + + public Block getBlock() { + return block; + } + + public BlockState getState() { + return blockState; + } + + public CraftBlockData getCraftBlockData() { + return craftBlockData; + } + + @Override + public boolean isAir() { + return blockState.isAir(); + } + + @Override + public boolean isFullCube() { + return craftMaterial.isOccluding(); + } + + @Override + public boolean isOpaque() { + return blockState.isOpaque(); + } + + @Override + public boolean isPowerSource() { + return blockState.isSignalSource(); + } + + @Override + public boolean isLiquid() { + // TODO: Better check ? + return block instanceof LiquidBlock; + } + + @Override + public boolean isSolid() { + // TODO: Replace + return blockState.isSolid(); + } + + @Override + public float getHardness() { + return craftBlockData.getState().destroySpeed; + } + + @Override + public float getResistance() { + return block.getExplosionResistance(); + } + + @Override + public float getSlipperiness() { + return block.getFriction(); + } + + @Override + public int getLightValue() { + return blockState.getLightEmission(); + } + + @Override + public int getLightOpacity() { + return opacity; + } + + @Override + public boolean isFragileWhenPushed() { + return blockState.getPistonPushReaction() == PushReaction.DESTROY; + } + + @Override + public boolean isUnpushable() { + return blockState.getPistonPushReaction() == PushReaction.BLOCK; + } + + @Override + public boolean isTicksRandomly() { + return block.isRandomlyTicking(blockState); + } + + @Override + public boolean isMovementBlocker() { + return craftMaterial.isSolid(); + } + + @Override + public boolean isBurnable() { + return craftMaterial.isBurnable(); + } + + @Override + public boolean isToolRequired() { + // Removed in 1.16.1, this is not present in higher versions + return false; + } + + @Override + public boolean isReplacedDuringPlacement() { + return blockState.canBeReplaced(); + } + + @Override + public boolean isTranslucent() { + return isTranslucent; + } + + @Override + public boolean hasContainer() { + return block instanceof EntityBlock; + } + + @Override + public boolean isTile() { + return block instanceof EntityBlock; + } + + @Override + public CompoundTag getDefaultTile() { + return tile; + } + + @Override + public int getMapColor() { + // rgb field + return block.defaultMapColor().col; + } + +} diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightFaweAdapter.java new file mode 100644 index 000000000..33c209632 --- /dev/null +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightFaweAdapter.java @@ -0,0 +1,652 @@ +package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1; + +import com.fastasyncworldedit.bukkit.adapter.CachedBukkitAdapter; +import com.fastasyncworldedit.bukkit.adapter.IDelegateBukkitImplAdapter; +import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory; +import com.fastasyncworldedit.core.FaweCache; +import com.fastasyncworldedit.core.entity.LazyBaseEntity; +import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory; +import com.fastasyncworldedit.core.queue.IBatchProcessor; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.implementation.packet.ChunkPacket; +import com.fastasyncworldedit.core.util.NbtUtils; +import com.fastasyncworldedit.core.util.TaskManager; +import com.google.common.base.Preconditions; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; +import com.sk89q.jnbt.Tag; +import com.sk89q.worldedit.EditSession; +import com.sk89q.worldedit.blocks.BaseItemStack; +import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.bukkit.BukkitWorld; +import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; +import com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_20_R1.PaperweightAdapter; +import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1.nbt.PaperweightLazyCompoundTag; +import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1.regen.PaperweightRegen; +import com.sk89q.worldedit.entity.BaseEntity; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.internal.block.BlockStateIdAccess; +import com.sk89q.worldedit.internal.util.LogManagerCompat; +import com.sk89q.worldedit.internal.wna.WorldNativeAccess; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.registry.state.BooleanProperty; +import com.sk89q.worldedit.registry.state.DirectionalProperty; +import com.sk89q.worldedit.registry.state.EnumProperty; +import com.sk89q.worldedit.registry.state.IntegerProperty; +import com.sk89q.worldedit.registry.state.Property; +import com.sk89q.worldedit.util.Direction; +import com.sk89q.worldedit.util.SideEffect; +import com.sk89q.worldedit.util.SideEffectSet; +import com.sk89q.worldedit.util.TreeGenerator; +import com.sk89q.worldedit.util.formatting.text.Component; +import com.sk89q.worldedit.util.nbt.BinaryTag; +import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; +import com.sk89q.worldedit.util.nbt.StringBinaryTag; +import com.sk89q.worldedit.world.RegenOptions; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockStateHolder; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypesCache; +import com.sk89q.worldedit.world.entity.EntityType; +import com.sk89q.worldedit.world.item.ItemType; +import com.sk89q.worldedit.world.registry.BlockMaterial; +import io.papermc.lib.PaperLib; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Registry; +import net.minecraft.core.WritableRegistry; +import net.minecraft.core.registries.Registries; +import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.dedicated.DedicatedServer; +import net.minecraft.server.level.ChunkHolder; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.util.StringRepresentable; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.properties.BlockStateProperties; +import net.minecraft.world.level.block.state.properties.DirectionProperty; +import net.minecraft.world.level.chunk.LevelChunk; +import org.apache.logging.log4j.Logger; +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.NamespacedKey; +import org.bukkit.TreeType; +import org.bukkit.block.data.BlockData; +import org.bukkit.craftbukkit.v1_20_R1.CraftServer; +import org.bukkit.craftbukkit.v1_20_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_20_R1.block.CraftBlockState; +import org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData; +import org.bukkit.craftbukkit.v1_20_R1.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_20_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_20_R1.inventory.CraftItemStack; +import org.bukkit.craftbukkit.v1_20_R1.util.CraftNamespacedKey; +import org.bukkit.entity.Player; + +import javax.annotation.Nullable; +import java.lang.ref.WeakReference; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.OptionalInt; +import java.util.Set; +import java.util.function.Supplier; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static net.minecraft.core.registries.Registries.BIOME; + +public final class PaperweightFaweAdapter extends CachedBukkitAdapter implements + IDelegateBukkitImplAdapter { + + private static final Logger LOGGER = LogManagerCompat.getLogger(); + private static Method CHUNK_HOLDER_WAS_ACCESSIBLE_SINCE_LAST_SAVE; + + static { + try { + CHUNK_HOLDER_WAS_ACCESSIBLE_SINCE_LAST_SAVE = ChunkHolder.class.getDeclaredMethod("wasAccessibleSinceLastSave"); + } catch (NoSuchMethodException ignored) { // may not be present in newer paper versions + } + } + + private final PaperweightAdapter parent; + // ------------------------------------------------------------------------ + // Code that may break between versions of Minecraft + // ------------------------------------------------------------------------ + private final PaperweightMapChunkUtil mapUtil = new PaperweightMapChunkUtil(); + private char[] ibdToStateOrdinal = null; + private int[] ordinalToIbdID = null; + private boolean initialised = false; + private Map>> allBlockProperties = null; + + public PaperweightFaweAdapter() throws NoSuchFieldException, NoSuchMethodException { + this.parent = new PaperweightAdapter(); + } + + @Nullable + private static String getEntityId(Entity entity) { + ResourceLocation resourceLocation = net.minecraft.world.entity.EntityType.getKey(entity.getType()); + return resourceLocation == null ? null : resourceLocation.toString(); + } + + private static void readEntityIntoTag(Entity entity, net.minecraft.nbt.CompoundTag compoundTag) { + entity.save(compoundTag); + } + + @Override + public BukkitImplAdapter getParent() { + return parent; + } + + private synchronized boolean init() { + if (ibdToStateOrdinal != null && ibdToStateOrdinal[1] != 0) { + return false; + } + ibdToStateOrdinal = new char[BlockTypesCache.states.length]; // size + ordinalToIbdID = new int[ibdToStateOrdinal.length]; // size + for (int i = 0; i < ibdToStateOrdinal.length; i++) { + BlockState blockState = BlockTypesCache.states[i]; + PaperweightBlockMaterial material = (PaperweightBlockMaterial) blockState.getMaterial(); + int id = Block.BLOCK_STATE_REGISTRY.getId(material.getState()); + char ordinal = blockState.getOrdinalChar(); + ibdToStateOrdinal[id] = ordinal; + ordinalToIbdID[ordinal] = id; + } + Map>> properties = new HashMap<>(); + try { + for (Field field : BlockStateProperties.class.getDeclaredFields()) { + Object obj = field.get(null); + if (!(obj instanceof net.minecraft.world.level.block.state.properties.Property state)) { + continue; + } + Property property; + if (state instanceof net.minecraft.world.level.block.state.properties.BooleanProperty) { + property = new BooleanProperty( + state.getName(), + (List) ImmutableList.copyOf(state.getPossibleValues()) + ); + } else if (state instanceof DirectionProperty) { + property = new DirectionalProperty( + state.getName(), + state + .getPossibleValues() + .stream() + .map(e -> Direction.valueOf(((StringRepresentable) e).getSerializedName().toUpperCase())) + .collect(Collectors.toList()) + ); + } else if (state instanceof net.minecraft.world.level.block.state.properties.EnumProperty) { + property = new EnumProperty( + state.getName(), + state + .getPossibleValues() + .stream() + .map(e -> ((StringRepresentable) e).getSerializedName()) + .collect(Collectors.toList()) + ); + } else if (state instanceof net.minecraft.world.level.block.state.properties.IntegerProperty) { + property = new IntegerProperty( + state.getName(), + (List) ImmutableList.copyOf(state.getPossibleValues()) + ); + } else { + throw new IllegalArgumentException("FastAsyncWorldEdit needs an update to support " + state + .getClass() + .getSimpleName()); + } + properties.compute(property.getName().toLowerCase(Locale.ROOT), (k, v) -> { + if (v == null) { + v = new ArrayList<>(Collections.singletonList(property)); + } else { + v.add(property); + } + return v; + }); + } + } catch (IllegalAccessException e) { + e.printStackTrace(); + } finally { + allBlockProperties = ImmutableMap.copyOf(properties); + } + initialised = true; + return true; + } + + @Override + public BlockMaterial getMaterial(BlockType blockType) { + Block block = getBlock(blockType); + return new PaperweightBlockMaterial(block); + } + + @Override + public synchronized BlockMaterial getMaterial(BlockState state) { + net.minecraft.world.level.block.state.BlockState blockState = ((CraftBlockData) Bukkit.createBlockData(state.getAsString())).getState(); + return new PaperweightBlockMaterial(blockState.getBlock(), blockState); + } + + public Block getBlock(BlockType blockType) { + return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.BLOCK) + .get(new ResourceLocation(blockType.getNamespace(), blockType.getResource())); + } + + @Deprecated + @Override + public BlockState getBlock(Location location) { + Preconditions.checkNotNull(location); + + CraftWorld craftWorld = ((CraftWorld) location.getWorld()); + int x = location.getBlockX(); + int y = location.getBlockY(); + int z = location.getBlockZ(); + final ServerLevel handle = craftWorld.getHandle(); + LevelChunk chunk = handle.getChunk(x >> 4, z >> 4); + final BlockPos blockPos = new BlockPos(x, y, z); + final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(blockPos); + BlockState state = adapt(blockData); + if (state == null) { + org.bukkit.block.Block bukkitBlock = location.getBlock(); + state = BukkitAdapter.adapt(bukkitBlock.getBlockData()); + } + return state; + } + + @Override + public BaseBlock getFullBlock(final Location location) { + Preconditions.checkNotNull(location); + + CraftWorld craftWorld = ((CraftWorld) location.getWorld()); + int x = location.getBlockX(); + int y = location.getBlockY(); + int z = location.getBlockZ(); + + final ServerLevel handle = craftWorld.getHandle(); + LevelChunk chunk = handle.getChunk(x >> 4, z >> 4); + final BlockPos blockPos = new BlockPos(x, y, z); + final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(blockPos); + BlockState state = adapt(blockData); + if (state == null) { + org.bukkit.block.Block bukkitBlock = location.getBlock(); + state = BukkitAdapter.adapt(bukkitBlock.getBlockData()); + } + if (state.getBlockType().getMaterial().hasContainer()) { + + // Read the NBT data + BlockEntity blockEntity = chunk.getBlockEntity(blockPos, LevelChunk.EntityCreationType.CHECK); + if (blockEntity != null) { + net.minecraft.nbt.CompoundTag tag = blockEntity.saveWithId(); + return state.toBaseBlock((CompoundBinaryTag) toNativeBinary(tag)); + } + } + + return state.toBaseBlock(); + } + + @Override + public Set getSupportedSideEffects() { + return SideEffectSet.defaults().getSideEffectsToApply(); + } + + @Override + public WorldNativeAccess createWorldNativeAccess(org.bukkit.World world) { + return new PaperweightFaweWorldNativeAccess( + this, + new WeakReference<>(((CraftWorld) world).getHandle()) + ); + } + + @Override + public BaseEntity getEntity(org.bukkit.entity.Entity entity) { + Preconditions.checkNotNull(entity); + + CraftEntity craftEntity = ((CraftEntity) entity); + Entity mcEntity = craftEntity.getHandle(); + + String id = getEntityId(mcEntity); + + if (id != null) { + EntityType type = com.sk89q.worldedit.world.entity.EntityTypes.get(id); + Supplier saveTag = () -> { + final net.minecraft.nbt.CompoundTag minecraftTag = new net.minecraft.nbt.CompoundTag(); + readEntityIntoTag(mcEntity, minecraftTag); + //add Id for AbstractChangeSet to work + final CompoundBinaryTag tag = (CompoundBinaryTag) toNativeBinary(minecraftTag); + final Map tags = NbtUtils.getCompoundBinaryTagValues(tag); + tags.put("Id", StringBinaryTag.of(id)); + return CompoundBinaryTag.from(tags); + }; + return new LazyBaseEntity(type, saveTag); + } else { + return null; + } + } + + @Override + public Component getRichBlockName(BlockType blockType) { + return parent.getRichBlockName(blockType); + } + + @Override + public Component getRichItemName(ItemType itemType) { + return parent.getRichItemName(itemType); + } + + @Override + public Component getRichItemName(BaseItemStack itemStack) { + return parent.getRichItemName(itemStack); + } + + @Override + public OptionalInt getInternalBlockStateId(BlockState state) { + PaperweightBlockMaterial material = (PaperweightBlockMaterial) state.getMaterial(); + net.minecraft.world.level.block.state.BlockState mcState = material.getCraftBlockData().getState(); + return OptionalInt.of(Block.BLOCK_STATE_REGISTRY.getId(mcState)); + } + + @Override + public BlockState adapt(BlockData blockData) { + CraftBlockData cbd = ((CraftBlockData) blockData); + net.minecraft.world.level.block.state.BlockState ibd = cbd.getState(); + return adapt(ibd); + } + + public BlockState adapt(net.minecraft.world.level.block.state.BlockState blockState) { + return BlockTypesCache.states[adaptToChar(blockState)]; + } + + public char adaptToChar(net.minecraft.world.level.block.state.BlockState blockState) { + int id = Block.BLOCK_STATE_REGISTRY.getId(blockState); + if (initialised) { + return ibdToStateOrdinal[id]; + } + synchronized (this) { + if (initialised) { + return ibdToStateOrdinal[id]; + } + try { + init(); + return ibdToStateOrdinal[id]; + } catch (ArrayIndexOutOfBoundsException e1) { + LOGGER.error("Attempted to convert {} with ID {} to char. ibdToStateOrdinal length: {}. Defaulting to air!", + blockState.getBlock(), Block.BLOCK_STATE_REGISTRY.getId(blockState), ibdToStateOrdinal.length, e1 + ); + return BlockTypesCache.ReservedIDs.AIR; + } + } + } + + public char ibdIDToOrdinal(int id) { + if (initialised) { + return ibdToStateOrdinal[id]; + } + synchronized (this) { + if (initialised) { + return ibdToStateOrdinal[id]; + } + init(); + return ibdToStateOrdinal[id]; + } + } + + @Override + public char[] getIbdToStateOrdinal() { + if (initialised) { + return ibdToStateOrdinal; + } + synchronized (this) { + if (initialised) { + return ibdToStateOrdinal; + } + init(); + return ibdToStateOrdinal; + } + } + + public int ordinalToIbdID(char ordinal) { + if (initialised) { + return ordinalToIbdID[ordinal]; + } + synchronized (this) { + if (initialised) { + return ordinalToIbdID[ordinal]; + } + init(); + return ordinalToIbdID[ordinal]; + } + } + + @Override + public int[] getOrdinalToIbdID() { + if (initialised) { + return ordinalToIbdID; + } + synchronized (this) { + if (initialised) { + return ordinalToIbdID; + } + init(); + return ordinalToIbdID; + } + } + + @Override + public > BlockData adapt(B state) { + PaperweightBlockMaterial material = (PaperweightBlockMaterial) state.getMaterial(); + return material.getCraftBlockData(); + } + + @Override + public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket chunkPacket) { + ServerLevel nmsWorld = ((CraftWorld) world).getHandle(); + ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ()); + if (map != null && wasAccessibleSinceLastSave(map)) { + boolean flag = false; + // PlayerChunk.d players = map.players; + Stream stream = /*players.a(new ChunkCoordIntPair(packet.getChunkX(), packet.getChunkZ()), flag) + */ Stream.empty(); + + ServerPlayer checkPlayer = player == null ? null : ((CraftPlayer) player).getHandle(); + stream.filter(entityPlayer -> checkPlayer == null || entityPlayer == checkPlayer) + .forEach(entityPlayer -> { + synchronized (chunkPacket) { + ClientboundLevelChunkWithLightPacket nmsPacket = (ClientboundLevelChunkWithLightPacket) chunkPacket.getNativePacket(); + if (nmsPacket == null) { + nmsPacket = mapUtil.create(this, chunkPacket); + chunkPacket.setNativePacket(nmsPacket); + } + try { + FaweCache.INSTANCE.CHUNK_FLAG.get().set(true); + entityPlayer.connection.send(nmsPacket); + } finally { + FaweCache.INSTANCE.CHUNK_FLAG.get().set(false); + } + } + }); + } + } + + @Override + public Map> getProperties(BlockType blockType) { + return getParent().getProperties(blockType); + } + + @Override + public boolean canPlaceAt(org.bukkit.World world, BlockVector3 blockVector3, BlockState blockState) { + int internalId = BlockStateIdAccess.getBlockStateId(blockState); + net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId); + return blockState1.hasPostProcess( + ((CraftWorld) world).getHandle(), + new BlockPos(blockVector3.getX(), blockVector3.getY(), blockVector3.getZ()) + ); + } + + @Override + public org.bukkit.inventory.ItemStack adapt(BaseItemStack baseItemStack) { + ItemStack stack = new ItemStack( + DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM) + .get(ResourceLocation.tryParse(baseItemStack.getType().getId())), + baseItemStack.getAmount() + ); + stack.setTag(((net.minecraft.nbt.CompoundTag) fromNative(baseItemStack.getNbtData()))); + return CraftItemStack.asCraftMirror(stack); + } + + @Override + public boolean generateTree( + TreeGenerator.TreeType treeType, EditSession editSession, BlockVector3 blockVector3, + org.bukkit.World bukkitWorld + ) { + TreeType bukkitType = BukkitWorld.toBukkitTreeType(treeType); + if (bukkitType == TreeType.CHORUS_PLANT) { + blockVector3 = blockVector3.add( + 0, + 1, + 0 + ); // bukkit skips the feature gen which does this offset normally, so we have to add it back + } + ServerLevel serverLevel = ((CraftWorld) bukkitWorld).getHandle(); + final BlockVector3 finalBlockVector = blockVector3; + // Sync to main thread to ensure no clashes occur + Map placed = TaskManager.taskManager().sync(() -> { + serverLevel.captureTreeGeneration = true; + serverLevel.captureBlockStates = true; + try { + if (!bukkitWorld.generateTree(BukkitAdapter.adapt(bukkitWorld, finalBlockVector), bukkitType)) { + return null; + } + return ImmutableMap.copyOf(serverLevel.capturedBlockStates); + } finally { + serverLevel.captureBlockStates = false; + serverLevel.captureTreeGeneration = false; + serverLevel.capturedBlockStates.clear(); + } + }); + if (placed == null || placed.isEmpty()) { + return false; + } + for (CraftBlockState craftBlockState : placed.values()) { + if (craftBlockState == null || craftBlockState.getType() == Material.AIR) { + continue; + } + editSession.setBlock(craftBlockState.getX(), craftBlockState.getY(), craftBlockState.getZ(), + BukkitAdapter.adapt(((org.bukkit.block.BlockState) craftBlockState).getBlockData()) + ); + } + return true; + } + + @Override + public BaseItemStack adapt(org.bukkit.inventory.ItemStack itemStack) { + final ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); + final BaseItemStack weStack = new BaseItemStack(BukkitAdapter.asItemType(itemStack.getType()), itemStack.getAmount()); + weStack.setNbt(((CompoundBinaryTag) toNativeBinary(nmsStack.getTag()))); + return weStack; + } + + @Override + public Tag toNative(net.minecraft.nbt.Tag foreign) { + return parent.toNative(foreign); + } + + @Override + public net.minecraft.nbt.Tag fromNative(Tag foreign) { + if (foreign instanceof PaperweightLazyCompoundTag) { + return ((PaperweightLazyCompoundTag) foreign).get(); + } + return parent.fromNative(foreign); + } + + @Override + public boolean regenerate(org.bukkit.World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception { + return new PaperweightRegen(bukkitWorld, region, target, options).regenerate(); + } + + @Override + public IChunkGet get(org.bukkit.World world, int chunkX, int chunkZ) { + return new PaperweightGetBlocks(world, chunkX, chunkZ); + } + + @Override + public int getInternalBiomeId(BiomeType biomeType) { + final Registry registry = MinecraftServer + .getServer() + .registryAccess() + .registryOrThrow(BIOME); + ResourceLocation resourceLocation = ResourceLocation.tryParse(biomeType.getId()); + Biome biome = registry.get(resourceLocation); + return registry.getId(biome); + } + + @Override + public Iterable getRegisteredBiomes() { + WritableRegistry biomeRegistry = (WritableRegistry) ((CraftServer) Bukkit.getServer()) + .getServer() + .registryAccess() + .registryOrThrow(BIOME); + List keys = biomeRegistry.stream() + .map(biomeRegistry::getKey).filter(Objects::nonNull).toList(); + List namespacedKeys = new ArrayList<>(); + for (ResourceLocation key : keys) { + try { + namespacedKeys.add(CraftNamespacedKey.fromMinecraft(key)); + } catch (IllegalArgumentException e) { + LOGGER.error("Error converting biome key {}", key.toString(), e); + } + } + return namespacedKeys; + } + + @Override + public RelighterFactory getRelighterFactory() { + if (PaperLib.isPaper()) { + return new PaperweightStarlightRelighterFactory(); + } else { + return new NMSRelighterFactory(); + } + } + + @Override + public Map>> getAllProperties() { + if (initialised) { + return allBlockProperties; + } + synchronized (this) { + if (initialised) { + return allBlockProperties; + } + init(); + return allBlockProperties; + } + } + + @Override + public IBatchProcessor getTickingPostProcessor() { + return new PaperweightPostProcessor(); + } + + private boolean wasAccessibleSinceLastSave(ChunkHolder holder) { + if (!PaperLib.isPaper() || !PaperweightPlatformAdapter.POST_CHUNK_REWRITE) { + try { + return (boolean) CHUNK_HOLDER_WAS_ACCESSIBLE_SINCE_LAST_SAVE.invoke(holder); + } catch (IllegalAccessException | InvocationTargetException ignored) { + // fall-through + } + } + // Papers new chunk system has no related replacement - therefor we assume true. + return true; + } + +} diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightFaweWorldNativeAccess.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightFaweWorldNativeAccess.java new file mode 100644 index 000000000..e1230b20e --- /dev/null +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightFaweWorldNativeAccess.java @@ -0,0 +1,287 @@ +package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1; + +import com.fastasyncworldedit.core.Fawe; +import com.fastasyncworldedit.core.math.IntPair; +import com.fastasyncworldedit.core.util.TaskManager; +import com.fastasyncworldedit.core.util.task.RunnableVal; +import com.sk89q.worldedit.bukkit.BukkitAdapter; +import com.sk89q.worldedit.internal.block.BlockStateIdAccess; +import com.sk89q.worldedit.internal.wna.WorldNativeAccess; +import com.sk89q.worldedit.util.SideEffect; +import com.sk89q.worldedit.util.SideEffectSet; +import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; +import com.sk89q.worldedit.world.block.BlockState; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.level.ChunkHolder; +import net.minecraft.server.level.ServerChunkCache; +import net.minecraft.server.level.FullChunkStatus; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.chunk.LevelChunk; +import org.bukkit.craftbukkit.v1_20_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_20_R1.block.data.CraftBlockData; +import org.bukkit.event.block.BlockPhysicsEvent; + +import javax.annotation.Nullable; +import java.lang.ref.WeakReference; +import java.util.Collections; +import java.util.HashSet; +import java.util.Objects; +import java.util.Set; +import java.util.concurrent.atomic.AtomicInteger; + +public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess { + + private static final int UPDATE = 1; + private static final int NOTIFY = 2; + private static final Direction[] NEIGHBOUR_ORDER = { + Direction.EAST, + Direction.WEST, + Direction.DOWN, + Direction.UP, + Direction.NORTH, + Direction.SOUTH + }; + private final PaperweightFaweAdapter paperweightFaweAdapter; + private final WeakReference level; + private final AtomicInteger lastTick; + private final Set cachedChanges = new HashSet<>(); + private final Set cachedChunksToSend = new HashSet<>(); + private SideEffectSet sideEffectSet; + + public PaperweightFaweWorldNativeAccess(PaperweightFaweAdapter paperweightFaweAdapter, WeakReference level) { + this.paperweightFaweAdapter = paperweightFaweAdapter; + this.level = level; + // Use the actual tick as minecraft-defined so we don't try to force blocks into the world when the server's already lagging. + // - With the caveat that we don't want to have too many cached changed (1024) so we'd flush those at 1024 anyway. + this.lastTick = new AtomicInteger(MinecraftServer.currentTick); + } + + private Level getLevel() { + return Objects.requireNonNull(level.get(), "The reference to the world was lost"); + } + + @Override + public void setCurrentSideEffectSet(SideEffectSet sideEffectSet) { + this.sideEffectSet = sideEffectSet; + } + + @Override + public LevelChunk getChunk(int x, int z) { + return getLevel().getChunk(x, z); + } + + @Override + public net.minecraft.world.level.block.state.BlockState toNative(BlockState blockState) { + int stateId = paperweightFaweAdapter.ordinalToIbdID(blockState.getOrdinalChar()); + return BlockStateIdAccess.isValidInternalId(stateId) + ? Block.stateById(stateId) + : ((CraftBlockData) BukkitAdapter.adapt(blockState)).getState(); + } + + @Override + public net.minecraft.world.level.block.state.BlockState getBlockState(LevelChunk levelChunk, BlockPos blockPos) { + return levelChunk.getBlockState(blockPos); + } + + @Nullable + @Override + public synchronized net.minecraft.world.level.block.state.BlockState setBlockState( + LevelChunk levelChunk, BlockPos blockPos, + net.minecraft.world.level.block.state.BlockState blockState + ) { + int currentTick = MinecraftServer.currentTick; + if (Fawe.isMainThread()) { + return levelChunk.setBlockState(blockPos, blockState, + this.sideEffectSet != null && this.sideEffectSet.shouldApply(SideEffect.UPDATE) + ); + } + // Since FAWE is.. Async we need to do it on the main thread (wooooo.. :( ) + cachedChanges.add(new CachedChange(levelChunk, blockPos, blockState)); + cachedChunksToSend.add(new IntPair(levelChunk.locX, levelChunk.locZ)); + boolean nextTick = lastTick.get() > currentTick; + if (nextTick || cachedChanges.size() >= 1024) { + if (nextTick) { + lastTick.set(currentTick); + } + flushAsync(nextTick); + } + return blockState; + } + + @Override + public net.minecraft.world.level.block.state.BlockState getValidBlockForPosition( + net.minecraft.world.level.block.state.BlockState blockState, + BlockPos blockPos + ) { + return Block.updateFromNeighbourShapes(blockState, getLevel(), blockPos); + } + + @Override + public BlockPos getPosition(int x, int y, int z) { + return new BlockPos(x, y, z); + } + + @Override + public void updateLightingForBlock(BlockPos blockPos) { + getLevel().getChunkSource().getLightEngine().checkBlock(blockPos); + } + + @Override + public boolean updateTileEntity(BlockPos blockPos, CompoundBinaryTag tag) { + // We will assume that the tile entity was created for us, + // though we do not do this on the other versions + BlockEntity blockEntity = getLevel().getBlockEntity(blockPos); + if (blockEntity == null) { + return false; + } + net.minecraft.nbt.Tag nativeTag = paperweightFaweAdapter.fromNativeBinary(tag); + blockEntity.load((CompoundTag) nativeTag); + return true; + } + + @Override + public void notifyBlockUpdate( + LevelChunk levelChunk, BlockPos blockPos, + net.minecraft.world.level.block.state.BlockState oldState, + net.minecraft.world.level.block.state.BlockState newState + ) { + if (levelChunk.getSections()[level.get().getSectionIndex(blockPos.getY())] != null) { + getLevel().sendBlockUpdated(blockPos, oldState, newState, UPDATE | NOTIFY); + } + } + + @Override + public boolean isChunkTicking(LevelChunk levelChunk) { + return levelChunk.getFullStatus().isOrAfter(FullChunkStatus.BLOCK_TICKING); + } + + @Override + public void markBlockChanged(LevelChunk levelChunk, BlockPos blockPos) { + if (levelChunk.getSections()[level.get().getSectionIndex(blockPos.getY())] != null) { + ((ServerChunkCache) getLevel().getChunkSource()).blockChanged(blockPos); + } + } + + @Override + public void notifyNeighbors( + BlockPos blockPos, + net.minecraft.world.level.block.state.BlockState oldState, + net.minecraft.world.level.block.state.BlockState newState + ) { + Level level = getLevel(); + if (sideEffectSet.shouldApply(SideEffect.EVENTS)) { + level.blockUpdated(blockPos, oldState.getBlock()); + } else { + // When we don't want events, manually run the physics without them. + // Un-nest neighbour updating + for (Direction direction : NEIGHBOUR_ORDER) { + BlockPos shifted = blockPos.relative(direction); + level.getBlockState(shifted).neighborChanged(level, shifted, oldState.getBlock(), blockPos, false); + } + } + if (newState.hasAnalogOutputSignal()) { + level.updateNeighbourForOutputSignal(blockPos, newState.getBlock()); + } + } + + @Override + public void updateNeighbors( + BlockPos blockPos, + net.minecraft.world.level.block.state.BlockState oldState, + net.minecraft.world.level.block.state.BlockState newState, + int recursionLimit + ) { + Level level = getLevel(); + // a == updateNeighbors + // b == updateDiagonalNeighbors + oldState.updateIndirectNeighbourShapes(level, blockPos, NOTIFY, recursionLimit); + if (sideEffectSet.shouldApply(SideEffect.EVENTS)) { + CraftWorld craftWorld = level.getWorld(); + if (craftWorld != null) { + BlockPhysicsEvent event = new BlockPhysicsEvent( + craftWorld.getBlockAt(blockPos.getX(), blockPos.getY(), blockPos.getZ()), + CraftBlockData.fromData(newState) + ); + level.getCraftServer().getPluginManager().callEvent(event); + if (event.isCancelled()) { + return; + } + } + } + newState.triggerEvent(level, blockPos, NOTIFY, recursionLimit); + newState.updateIndirectNeighbourShapes(level, blockPos, NOTIFY, recursionLimit); + } + + @Override + public void onBlockStateChange( + BlockPos blockPos, + net.minecraft.world.level.block.state.BlockState oldState, + net.minecraft.world.level.block.state.BlockState newState + ) { + getLevel().onBlockStateChange(blockPos, oldState, newState); + } + + private synchronized void flushAsync(final boolean sendChunks) { + final Set changes = Set.copyOf(cachedChanges); + cachedChanges.clear(); + final Set toSend; + if (sendChunks) { + toSend = Set.copyOf(cachedChunksToSend); + cachedChunksToSend.clear(); + } else { + toSend = Collections.emptySet(); + } + RunnableVal runnableVal = new RunnableVal<>() { + @Override + public void run(Object value) { + changes.forEach(cc -> cc.levelChunk.setBlockState(cc.blockPos, cc.blockState, + sideEffectSet != null && sideEffectSet.shouldApply(SideEffect.UPDATE) + )); + if (!sendChunks) { + return; + } + for (IntPair chunk : toSend) { + PaperweightPlatformAdapter.sendChunk(getLevel().getWorld().getHandle(), chunk.x(), chunk.z(), false); + } + } + }; + TaskManager.taskManager().async(() -> TaskManager.taskManager().sync(runnableVal)); + } + + @Override + public synchronized void flush() { + RunnableVal runnableVal = new RunnableVal<>() { + @Override + public void run(Object value) { + cachedChanges.forEach(cc -> cc.levelChunk.setBlockState(cc.blockPos, cc.blockState, + sideEffectSet != null && sideEffectSet.shouldApply(SideEffect.UPDATE) + )); + for (IntPair chunk : cachedChunksToSend) { + PaperweightPlatformAdapter.sendChunk(getLevel().getWorld().getHandle(), chunk.x(), chunk.z(), false); + } + } + }; + if (Fawe.isMainThread()) { + runnableVal.run(); + } else { + TaskManager.taskManager().sync(runnableVal); + } + cachedChanges.clear(); + cachedChunksToSend.clear(); + } + + private record CachedChange( + LevelChunk levelChunk, + BlockPos blockPos, + net.minecraft.world.level.block.state.BlockState blockState + ) { + + } + +} diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java new file mode 100644 index 000000000..38c871ea8 --- /dev/null +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java @@ -0,0 +1,1142 @@ +package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1; + +import com.fastasyncworldedit.bukkit.adapter.BukkitGetBlocks; +import com.fastasyncworldedit.bukkit.adapter.DelegateSemaphore; +import com.fastasyncworldedit.core.Fawe; +import com.fastasyncworldedit.core.FaweCache; +import com.fastasyncworldedit.core.configuration.Settings; +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; +import com.fastasyncworldedit.core.math.BitArrayUnstretched; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.queue.implementation.QueueHandler; +import com.fastasyncworldedit.core.queue.implementation.blocks.CharGetBlocks; +import com.fastasyncworldedit.core.util.MathMan; +import com.fastasyncworldedit.core.util.collection.AdaptedMap; +import com.google.common.base.Suppliers; +import com.sk89q.jnbt.CompoundTag; +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.WorldEditPlugin; +import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1.nbt.PaperweightLazyCompoundTag; +import com.sk89q.worldedit.internal.Constants; +import com.sk89q.worldedit.internal.util.LogManagerCompat; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.biome.BiomeTypes; +import com.sk89q.worldedit.world.block.BlockTypesCache; +import io.papermc.lib.PaperLib; +import io.papermc.paper.event.block.BeaconDeactivatedEvent; +import net.minecraft.core.*; +import net.minecraft.nbt.IntTag; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.sounds.SoundEvents; +import net.minecraft.util.BitStorage; +import net.minecraft.util.ZeroBitStorage; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.level.LightLayer; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.block.entity.BeaconBlockEntity; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.level.chunk.*; +import net.minecraft.world.level.levelgen.Heightmap; +import net.minecraft.world.level.lighting.LevelLightEngine; +import org.apache.logging.log4j.Logger; +import org.bukkit.World; +import org.bukkit.craftbukkit.v1_20_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_20_R1.block.CraftBlock; +import org.bukkit.event.entity.CreatureSpawnEvent; + +import javax.annotation.Nonnull; +import java.util.*; +import java.util.concurrent.Callable; +import java.util.concurrent.Future; +import java.util.concurrent.Semaphore; +import java.util.concurrent.locks.ReadWriteLock; +import java.util.concurrent.locks.ReentrantReadWriteLock; +import java.util.function.Function; +import java.util.stream.Collectors; + +import static net.minecraft.core.registries.Registries.BIOME; + +public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBlocks { + + private static final Logger LOGGER = LogManagerCompat.getLogger(); + + private static final Function posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ()); + private static final Function nmsTile2We = + tileEntity -> new PaperweightLazyCompoundTag(Suppliers.memoize(tileEntity::saveWithId)); + private final PaperweightFaweAdapter adapter = ((PaperweightFaweAdapter) WorldEditPlugin + .getInstance() + .getBukkitImplAdapter()); + private final ReadWriteLock sectionLock = new ReentrantReadWriteLock(); + private final ServerLevel serverLevel; + private final int chunkX; + private final int chunkZ; + private final int minHeight; + private final int maxHeight; + private final int minSectionPosition; + private final int maxSectionPosition; + private final Registry biomeRegistry; + private final IdMap> biomeHolderIdMap; + private LevelChunkSection[] sections; + private LevelChunk levelChunk; + private DataLayer[] blockLight; + private DataLayer[] skyLight; + private boolean createCopy = false; + private PaperweightGetBlocks_Copy copy = null; + private boolean forceLoadSections = true; + private boolean lightUpdate = false; + + public PaperweightGetBlocks(World world, int chunkX, int chunkZ) { + this(((CraftWorld) world).getHandle(), chunkX, chunkZ); + } + + public PaperweightGetBlocks(ServerLevel serverLevel, int chunkX, int chunkZ) { + super(serverLevel.getMinBuildHeight() >> 4, (serverLevel.getMaxBuildHeight() - 1) >> 4); + this.serverLevel = serverLevel; + this.chunkX = chunkX; + this.chunkZ = chunkZ; + this.minHeight = serverLevel.getMinBuildHeight(); + this.maxHeight = serverLevel.getMaxBuildHeight() - 1; // Minecraft max limit is exclusive. + this.minSectionPosition = minHeight >> 4; + this.maxSectionPosition = maxHeight >> 4; + this.skyLight = new DataLayer[getSectionCount()]; + this.blockLight = new DataLayer[getSectionCount()]; + this.biomeRegistry = serverLevel.registryAccess().registryOrThrow(BIOME); + this.biomeHolderIdMap = biomeRegistry.asHolderIdMap(); + } + + public int getChunkX() { + return chunkX; + } + + public int getChunkZ() { + return chunkZ; + } + + @Override + public boolean isCreateCopy() { + return createCopy; + } + + @Override + public void setCreateCopy(boolean createCopy) { + this.createCopy = createCopy; + } + + @Override + public IChunkGet getCopy() { + return copy; + } + + @Override + public void setLightingToGet(char[][] light, int minSectionPosition, int maxSectionPosition) { + if (light != null) { + lightUpdate = true; + try { + fillLightNibble(light, LightLayer.BLOCK, minSectionPosition, maxSectionPosition); + } catch (Throwable e) { + e.printStackTrace(); + } + } + } + + @Override + public void setSkyLightingToGet(char[][] light, int minSectionPosition, int maxSectionPosition) { + if (light != null) { + lightUpdate = true; + try { + fillLightNibble(light, LightLayer.SKY, minSectionPosition, maxSectionPosition); + } catch (Throwable e) { + e.printStackTrace(); + } + } + } + + @Override + public void setHeightmapToGet(HeightMapType type, int[] data) { + // height + 1 to match server internal + BitArrayUnstretched bitArray = new BitArrayUnstretched(MathMan.log2nlz(getChunk().getHeight() + 1), 256); + bitArray.fromRaw(data); + Heightmap.Types nativeType = Heightmap.Types.valueOf(type.name()); + Heightmap heightMap = getChunk().heightmaps.get(nativeType); + heightMap.setRawData(getChunk(), nativeType, bitArray.getData()); + } + + @Override + public int getMaxY() { + return maxHeight; + } + + @Override + public int getMinY() { + return minHeight; + } + + @Override + public BiomeType getBiomeType(int x, int y, int z) { + LevelChunkSection section = getSections(false)[(y >> 4) - getMinSectionPosition()]; + Holder biomes = section.getNoiseBiome(x >> 2, (y & 15) >> 2, z >> 2); + return PaperweightPlatformAdapter.adapt(biomes, serverLevel); + } + + @Override + public void removeSectionLighting(int layer, boolean sky) { + SectionPos sectionPos = SectionPos.of(getChunk().getPos(), layer); + DataLayer dataLayer = serverLevel.getChunkSource().getLightEngine().getLayerListener(LightLayer.BLOCK).getDataLayerData( + sectionPos); + if (dataLayer != null) { + lightUpdate = true; + synchronized (dataLayer) { + byte[] bytes = dataLayer.getData(); + Arrays.fill(bytes, (byte) 0); + } + } + if (sky) { + SectionPos sectionPos1 = SectionPos.of(getChunk().getPos(), layer); + DataLayer dataLayer1 = serverLevel + .getChunkSource() + .getLightEngine() + .getLayerListener(LightLayer.SKY) + .getDataLayerData(sectionPos1); + if (dataLayer1 != null) { + lightUpdate = true; + synchronized (dataLayer1) { + byte[] bytes = dataLayer1.getData(); + Arrays.fill(bytes, (byte) 0); + } + } + } + } + + @Override + public CompoundTag getTile(int x, int y, int z) { + BlockEntity blockEntity = getChunk().getBlockEntity(new BlockPos((x & 15) + ( + chunkX << 4), y, (z & 15) + ( + chunkZ << 4))); + if (blockEntity == null) { + return null; + } + return new PaperweightLazyCompoundTag(Suppliers.memoize(blockEntity::saveWithId)); + } + + @Override + public Map getTiles() { + Map nmsTiles = getChunk().getBlockEntities(); + if (nmsTiles.isEmpty()) { + return Collections.emptyMap(); + } + return AdaptedMap.immutable(nmsTiles, posNms2We, nmsTile2We); + } + + @Override + public int getSkyLight(int x, int y, int z) { + int layer = y >> 4; + int alayer = layer - getMinSectionPosition(); + if (skyLight[alayer] == null) { + SectionPos sectionPos = SectionPos.of(getChunk().getPos(), layer); + DataLayer dataLayer = + serverLevel.getChunkSource().getLightEngine().getLayerListener(LightLayer.SKY).getDataLayerData(sectionPos); + // If the server hasn't generated the section's NibbleArray yet, it will be null + if (dataLayer == null) { + byte[] LAYER_COUNT = new byte[2048]; + // Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway. + Arrays.fill(LAYER_COUNT, (byte) 15); + dataLayer = new DataLayer(LAYER_COUNT); + ((LevelLightEngine) serverLevel.getChunkSource().getLightEngine()).queueSectionData( + LightLayer.BLOCK, + sectionPos, + dataLayer + ); + } + skyLight[alayer] = dataLayer; + } + return skyLight[alayer].get(x & 15, y & 15, z & 15); + } + + @Override + public int getEmittedLight(int x, int y, int z) { + int layer = y >> 4; + int alayer = layer - getMinSectionPosition(); + if (blockLight[alayer] == null) { + serverLevel.getRawBrightness(new BlockPos(1, 1, 1), 5); + SectionPos sectionPos = SectionPos.of(getChunk().getPos(), layer); + DataLayer dataLayer = serverLevel + .getChunkSource() + .getLightEngine() + .getLayerListener(LightLayer.BLOCK) + .getDataLayerData(sectionPos); + // If the server hasn't generated the section's DataLayer yet, it will be null + if (dataLayer == null) { + byte[] LAYER_COUNT = new byte[2048]; + // Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway. + Arrays.fill(LAYER_COUNT, (byte) 15); + dataLayer = new DataLayer(LAYER_COUNT); + ((LevelLightEngine) serverLevel.getChunkSource().getLightEngine()).queueSectionData(LightLayer.BLOCK, sectionPos, + dataLayer + ); + } + blockLight[alayer] = dataLayer; + } + return blockLight[alayer].get(x & 15, y & 15, z & 15); + } + + @Override + public int[] getHeightMap(HeightMapType type) { + long[] longArray = getChunk().heightmaps.get(Heightmap.Types.valueOf(type.name())).getRawData(); + BitArrayUnstretched bitArray = new BitArrayUnstretched(9, 256, longArray); + return bitArray.toRaw(new int[256]); + } + + @Override + public CompoundTag getEntity(UUID uuid) { + Entity entity = serverLevel.getEntity(uuid); + if (entity != null) { + org.bukkit.entity.Entity bukkitEnt = entity.getBukkitEntity(); + return BukkitAdapter.adapt(bukkitEnt).getState().getNbtData(); + } + for (CompoundTag tag : getEntities()) { + if (uuid.equals(tag.getUUID())) { + return tag; + } + } + return null; + } + + @Override + public Set getEntities() { + List entities = PaperweightPlatformAdapter.getEntities(getChunk()); + 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 CompoundTag getTag)) { + return false; + } + UUID getUUID = getTag.getUUID(); + for (Entity entity : entities) { + UUID uuid = entity.getUUID(); + if (uuid.equals(getUUID)) { + return true; + } + } + return false; + } + + @Nonnull + @Override + public Iterator iterator() { + Iterable result = entities.stream().map(input -> { + net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag(); + input.save(tag); + return (CompoundTag) adapter.toNative(tag); + }).collect(Collectors.toList()); + return result.iterator(); + } + }; + } + + private void removeEntity(Entity entity) { + entity.discard(); + } + + public LevelChunk ensureLoaded(ServerLevel nmsWorld, int chunkX, int chunkZ) { + return PaperweightPlatformAdapter.ensureLoaded(nmsWorld, chunkX, chunkZ); + } + + @Override + @SuppressWarnings("rawtypes") + public synchronized > T call(IChunkSet set, Runnable finalizer) { + forceLoadSections = false; + copy = createCopy ? new PaperweightGetBlocks_Copy(levelChunk) : null; + try { + ServerLevel nmsWorld = serverLevel; + LevelChunk nmsChunk = ensureLoaded(nmsWorld, chunkX, chunkZ); + + // Remove existing tiles. Create a copy so that we can remove blocks + Map chunkTiles = new HashMap<>(nmsChunk.getBlockEntities()); + List beacons = null; + if (!chunkTiles.isEmpty()) { + for (Map.Entry entry : chunkTiles.entrySet()) { + final BlockPos pos = entry.getKey(); + final int lx = pos.getX() & 15; + final int ly = pos.getY(); + final int lz = pos.getZ() & 15; + final int layer = ly >> 4; + if (!set.hasSection(layer)) { + continue; + } + + int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); + if (ordinal != 0) { + BlockEntity tile = entry.getValue(); + if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { + if (beacons == null) { + beacons = new ArrayList<>(); + } + beacons.add(tile); + PaperweightPlatformAdapter.removeBeacon(tile, nmsChunk); + continue; + } + nmsChunk.removeBlockEntity(tile.getBlockPos()); + if (createCopy) { + copy.storeTile(tile); + } + } + } + } + final BiomeType[][] biomes = set.getBiomes(); + + int bitMask = 0; + synchronized (nmsChunk) { + LevelChunkSection[] levelChunkSections = nmsChunk.getSections(); + + for (int layerNo = getMinSectionPosition(); layerNo <= getMaxSectionPosition(); layerNo++) { + + int getSectionIndex = layerNo - getMinSectionPosition(); + int setSectionIndex = layerNo - set.getMinSectionPosition(); + + if (!set.hasSection(layerNo)) { + // No blocks, but might be biomes present. Handle this lazily. + if (biomes == null) { + continue; + } + if (layerNo < set.getMinSectionPosition() || layerNo > set.getMaxSectionPosition()) { + continue; + } + if (biomes[setSectionIndex] != null) { + synchronized (super.sectionLocks[getSectionIndex]) { + LevelChunkSection existingSection = levelChunkSections[getSectionIndex]; + if (createCopy && existingSection != null) { + copy.storeBiomes(getSectionIndex, existingSection.getBiomes()); + } + + if (existingSection == null) { + PalettedContainer> biomeData = PaperweightPlatformAdapter.getBiomePalettedContainer( + biomes[setSectionIndex], + biomeHolderIdMap + ); + LevelChunkSection newSection = PaperweightPlatformAdapter.newChunkSection( + layerNo, + new char[4096], + adapter, + biomeRegistry, + biomeData + ); + if (PaperweightPlatformAdapter.setSectionAtomic( + levelChunkSections, + null, + newSection, + getSectionIndex + )) { + updateGet(nmsChunk, levelChunkSections, newSection, new char[4096], getSectionIndex); + continue; + } else { + existingSection = levelChunkSections[getSectionIndex]; + if (existingSection == null) { + LOGGER.error("Skipping invalid null section. chunk: {}, {} layer: {}", chunkX, chunkZ, + getSectionIndex + ); + continue; + } + } + } else { + setBiomesToPalettedContainer(biomes, setSectionIndex, existingSection.getBiomes()); + } + } + } + continue; + } + + bitMask |= 1 << getSectionIndex; + + char[] setArr = set.load(layerNo); + + // synchronise on internal section to avoid circular locking with a continuing edit if the chunk was + // submitted to keep loaded internal chunks to queue target size. + synchronized (super.sectionLocks[getSectionIndex]) { + + LevelChunkSection newSection; + LevelChunkSection existingSection = levelChunkSections[getSectionIndex]; + // Don't attempt to tick section whilst we're editing + if (existingSection != null) { + PaperweightPlatformAdapter.clearCounts(existingSection); + if (PaperLib.isPaper()) { + existingSection.tickingList.clear(); + } + } + + if (createCopy) { + char[] tmpLoad = loadPrivately(layerNo); + char[] copyArr = new char[4096]; + System.arraycopy(tmpLoad, 0, copyArr, 0, 4096); + copy.storeSection(getSectionIndex, copyArr); + if (biomes != null && existingSection != null) { + copy.storeBiomes(getSectionIndex, existingSection.getBiomes()); + } + } + + if (existingSection == null) { + PalettedContainer> biomeData = biomes == null ? new PalettedContainer<>( + biomeHolderIdMap, + biomeHolderIdMap.byIdOrThrow(WorldEditPlugin + .getInstance() + .getBukkitImplAdapter() + .getInternalBiomeId( + BiomeTypes.PLAINS)), + PalettedContainer.Strategy.SECTION_BIOMES + ) : PaperweightPlatformAdapter.getBiomePalettedContainer(biomes[setSectionIndex], biomeHolderIdMap); + newSection = PaperweightPlatformAdapter.newChunkSection( + layerNo, + setArr, + adapter, + biomeRegistry, + biomeData + ); + if (PaperweightPlatformAdapter.setSectionAtomic( + levelChunkSections, + null, + newSection, + getSectionIndex + )) { + updateGet(nmsChunk, levelChunkSections, newSection, setArr, getSectionIndex); + continue; + } else { + existingSection = levelChunkSections[getSectionIndex]; + if (existingSection == null) { + LOGGER.error("Skipping invalid null section. chunk: {}, {} layer: {}", chunkX, chunkZ, + getSectionIndex + ); + continue; + } + } + } + + //ensure that the server doesn't try to tick the chunksection while we're editing it. (Again) + PaperweightPlatformAdapter.clearCounts(existingSection); + if (PaperLib.isPaper()) { + existingSection.tickingList.clear(); + } + DelegateSemaphore lock = PaperweightPlatformAdapter.applyLock(existingSection); + + // Synchronize to prevent further acquisitions + synchronized (lock) { + lock.acquire(); // Wait until we have the lock + lock.release(); + try { + sectionLock.writeLock().lock(); + if (this.getChunk() != nmsChunk) { + this.levelChunk = nmsChunk; + this.sections = null; + this.reset(); + } else if (existingSection != getSections(false)[getSectionIndex]) { + this.sections[getSectionIndex] = existingSection; + this.reset(); + } else if (!Arrays.equals( + update(getSectionIndex, new char[4096], true), + loadPrivately(layerNo) + )) { + this.reset(layerNo); + /*} else if (lock.isModified()) { + this.reset(layerNo);*/ + } + } finally { + sectionLock.writeLock().unlock(); + } + + PalettedContainer> biomeData = setBiomesToPalettedContainer( + biomes, + setSectionIndex, + existingSection.getBiomes() + ); + + newSection = + PaperweightPlatformAdapter.newChunkSection( + layerNo, + this::loadPrivately, + setArr, + adapter, + biomeRegistry, + biomeData + ); + if (!PaperweightPlatformAdapter.setSectionAtomic( + levelChunkSections, + existingSection, + newSection, + getSectionIndex + )) { + LOGGER.error("Skipping invalid null section. chunk: {}, {} layer: {}", chunkX, chunkZ, + getSectionIndex + ); + } else { + updateGet(nmsChunk, levelChunkSections, newSection, setArr, getSectionIndex); + } + } + } + } + + Map heightMaps = set.getHeightMaps(); + for (Map.Entry entry : heightMaps.entrySet()) { + PaperweightGetBlocks.this.setHeightmapToGet(entry.getKey(), entry.getValue()); + } + PaperweightGetBlocks.this.setLightingToGet( + set.getLight(), + set.getMinSectionPosition(), + set.getMaxSectionPosition() + ); + PaperweightGetBlocks.this.setSkyLightingToGet( + set.getSkyLight(), + set.getMinSectionPosition(), + set.getMaxSectionPosition() + ); + + Runnable[] syncTasks = null; + + int bx = chunkX << 4; + int bz = chunkZ << 4; + + // Call beacon deactivate events here synchronously + // list will be null on spigot, so this is an implicit isPaper check + if (beacons != null && !beacons.isEmpty()) { + final List finalBeacons = beacons; + + syncTasks = new Runnable[4]; + + syncTasks[3] = () -> { + for (BlockEntity beacon : finalBeacons) { + BeaconBlockEntity.playSound(beacon.getLevel(), beacon.getBlockPos(), SoundEvents.BEACON_DEACTIVATE); + new BeaconDeactivatedEvent(CraftBlock.at(beacon.getLevel(), beacon.getBlockPos())).callEvent(); + } + }; + } + + Set entityRemoves = set.getEntityRemoves(); + if (entityRemoves != null && !entityRemoves.isEmpty()) { + if (syncTasks == null) { + syncTasks = new Runnable[3]; + } + + syncTasks[2] = () -> { + Set entitiesRemoved = new HashSet<>(); + final List entities = PaperweightPlatformAdapter.getEntities(nmsChunk); + + for (Entity entity : entities) { + UUID uuid = entity.getUUID(); + if (entityRemoves.contains(uuid)) { + if (createCopy) { + copy.storeEntity(entity); + } + removeEntity(entity); + entitiesRemoved.add(uuid); + entityRemoves.remove(uuid); + } + } + if (Settings.settings().EXPERIMENTAL.REMOVE_ENTITY_FROM_WORLD_ON_CHUNK_FAIL) { + for (UUID uuid : entityRemoves) { + Entity entity = nmsWorld.getEntities().get(uuid); + if (entity != null) { + removeEntity(entity); + } + } + } + // Only save entities that were actually removed to history + set.getEntityRemoves().clear(); + set.getEntityRemoves().addAll(entitiesRemoved); + }; + } + + Set entities = set.getEntities(); + if (entities != null && !entities.isEmpty()) { + if (syncTasks == null) { + syncTasks = new Runnable[2]; + } + + syncTasks[1] = () -> { + Iterator iterator = entities.iterator(); + while (iterator.hasNext()) { + final CompoundTag nativeTag = iterator.next(); + final Map entityTagMap = nativeTag.getValue(); + final StringTag idTag = (StringTag) entityTagMap.get("Id"); + final ListTag posTag = (ListTag) entityTagMap.get("Pos"); + final ListTag rotTag = (ListTag) entityTagMap.get("Rotation"); + if (idTag == null || posTag == null || rotTag == null) { + LOGGER.error("Unknown entity tag: {}", nativeTag); + continue; + } + final double x = posTag.getDouble(0); + final double y = posTag.getDouble(1); + final double z = posTag.getDouble(2); + final float yaw = rotTag.getFloat(0); + final float pitch = rotTag.getFloat(1); + final String id = idTag.getValue(); + + EntityType type = EntityType.byString(id).orElse(null); + if (type != null) { + Entity entity = type.create(nmsWorld); + if (entity != null) { + final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative( + nativeTag); + for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) { + tag.remove(name); + } + entity.load(tag); + entity.absMoveTo(x, y, z, yaw, pitch); + entity.setUUID(nativeTag.getUUID()); + if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) { + LOGGER.warn( + "Error creating entity of type `{}` in world `{}` at location `{},{},{}`", + id, + nmsWorld.getWorld().getName(), + x, + y, + z + ); + // Unsuccessful create should not be saved to history + iterator.remove(); + } + } + } + } + }; + } + + // set tiles + Map tiles = set.getTiles(); + if (tiles != null && !tiles.isEmpty()) { + if (syncTasks == null) { + syncTasks = new Runnable[1]; + } + + syncTasks[0] = () -> { + for (final Map.Entry entry : tiles.entrySet()) { + final CompoundTag nativeTag = entry.getValue(); + final BlockVector3 blockHash = entry.getKey(); + final int x = blockHash.getX() + bx; + final int y = blockHash.getY(); + final int z = blockHash.getZ() + bz; + final BlockPos pos = new BlockPos(x, y, z); + + synchronized (nmsWorld) { + BlockEntity tileEntity = nmsWorld.getBlockEntity(pos); + if (tileEntity == null || tileEntity.isRemoved()) { + nmsWorld.removeBlockEntity(pos); + tileEntity = nmsWorld.getBlockEntity(pos); + } + if (tileEntity != null) { + final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative( + nativeTag); + tag.put("x", IntTag.valueOf(x)); + tag.put("y", IntTag.valueOf(y)); + tag.put("z", IntTag.valueOf(z)); + tileEntity.load(tag); + } + } + } + }; + } + + Runnable callback; + if (bitMask == 0 && biomes == null && !lightUpdate) { + callback = null; + } else { + int finalMask = bitMask != 0 ? bitMask : lightUpdate ? set.getBitMask() : 0; + boolean finalLightUpdate = lightUpdate; + callback = () -> { + // Set Modified + nmsChunk.setLightCorrect(true); // Set Modified + nmsChunk.mustNotSave = false; + nmsChunk.setUnsaved(true); + // send to player + if (Settings.settings().LIGHTING.MODE == 0 || !Settings.settings().LIGHTING.DELAY_PACKET_SENDING) { + this.send(finalMask, finalLightUpdate); + } + if (finalizer != null) { + finalizer.run(); + } + }; + } + if (syncTasks != null) { + QueueHandler queueHandler = Fawe.instance().getQueueHandler(); + Runnable[] finalSyncTasks = syncTasks; + + // Chain the sync tasks and the callback + Callable chain = () -> { + try { + // Run the sync tasks + for (Runnable task : finalSyncTasks) { + if (task != null) { + task.run(); + } + } + if (callback == null) { + if (finalizer != null) { + finalizer.run(); + } + return null; + } else { + return queueHandler.async(callback, null); + } + } catch (Throwable e) { + e.printStackTrace(); + throw e; + } + }; + //noinspection unchecked - required at compile time + return (T) (Future) queueHandler.sync(chain); + } else { + if (callback == null) { + if (finalizer != null) { + finalizer.run(); + } + } else { + callback.run(); + } + } + } + return null; + } catch (Throwable e) { + e.printStackTrace(); + return null; + } finally { + forceLoadSections = true; + } + } + + private void updateGet( + LevelChunk nmsChunk, + LevelChunkSection[] chunkSections, + LevelChunkSection section, + char[] arr, + int layer + ) { + try { + sectionLock.writeLock().lock(); + if (this.getChunk() != nmsChunk) { + this.levelChunk = nmsChunk; + this.sections = new LevelChunkSection[chunkSections.length]; + System.arraycopy(chunkSections, 0, this.sections, 0, chunkSections.length); + this.reset(); + } + if (this.sections == null) { + this.sections = new LevelChunkSection[chunkSections.length]; + System.arraycopy(chunkSections, 0, this.sections, 0, chunkSections.length); + } + if (this.sections[layer] != section) { + // Not sure why it's funky, but it's what I did in commit fda7d00747abe97d7891b80ed8bb88d97e1c70d1 and I don't want to touch it >dords + this.sections[layer] = new LevelChunkSection[]{section}.clone()[0]; + } + } finally { + sectionLock.writeLock().unlock(); + } + this.blocks[layer] = arr; + } + + private char[] loadPrivately(int layer) { + layer -= getMinSectionPosition(); + if (super.sections[layer] != null) { + synchronized (super.sectionLocks[layer]) { + if (super.sections[layer].isFull() && super.blocks[layer] != null) { + char[] blocks = new char[4096]; + System.arraycopy(super.blocks[layer], 0, blocks, 0, 4096); + return blocks; + } + } + } + return PaperweightGetBlocks.this.update(layer, null, true); + } + + @Override + public synchronized void send(int mask, boolean lighting) { + PaperweightPlatformAdapter.sendChunk(serverLevel, chunkX, chunkZ, lighting); + } + + /** + * Update a given (nullable) data array to the current data stored in the server's chunk, associated with this + * {@link PaperweightPlatformAdapter} instance. Not synchronised to the {@link PaperweightPlatformAdapter} instance as synchronisation + * is handled where necessary in the method, and should otherwise be handled correctly by this method's caller. + * + * @param layer layer index (0 may denote a negative layer in the world, e.g. at y=-32) + * @param data array to be updated/filled with data or null + * @param aggressive if the cached section array should be re-acquired. + * @return the given array to be filled with data, or a new array if null is given. + */ + @Override + @SuppressWarnings("unchecked") + public char[] update(int layer, char[] data, boolean aggressive) { + LevelChunkSection section = getSections(aggressive)[layer]; + // Section is null, return empty array + if (section == null) { + data = new char[4096]; + Arrays.fill(data, (char) BlockTypesCache.ReservedIDs.AIR); + return data; + } + if (data != null && data.length != 4096) { + data = new char[4096]; + Arrays.fill(data, (char) BlockTypesCache.ReservedIDs.AIR); + } + if (data == null || data == FaweCache.INSTANCE.EMPTY_CHAR_4096) { + data = new char[4096]; + Arrays.fill(data, (char) BlockTypesCache.ReservedIDs.AIR); + } + Semaphore lock = PaperweightPlatformAdapter.applyLock(section); + synchronized (lock) { + // Efficiently convert ChunkSection to raw data + try { + lock.acquire(); + + final PalettedContainer blocks = section.getStates(); + final Object dataObject = PaperweightPlatformAdapter.fieldData.get(blocks); + final BitStorage bits = (BitStorage) PaperweightPlatformAdapter.fieldStorage.get(dataObject); + + if (bits instanceof ZeroBitStorage) { + Arrays.fill(data, adapter.adaptToChar(blocks.get(0, 0, 0))); // get(int) is only public on paper + return data; + } + + final Palette palette = (Palette) PaperweightPlatformAdapter.fieldPalette.get(dataObject); + + final int bitsPerEntry = bits.getBits(); + final long[] blockStates = bits.getRaw(); + + new BitArrayUnstretched(bitsPerEntry, 4096, blockStates).toRaw(data); + + int num_palette; + if (palette instanceof LinearPalette || palette instanceof HashMapPalette) { + num_palette = palette.getSize(); + } else { + // The section's palette is the global block palette. + for (int i = 0; i < 4096; i++) { + char paletteVal = data[i]; + char ordinal = adapter.ibdIDToOrdinal(paletteVal); + data[i] = ordinal; + } + return data; + } + + char[] paletteToOrdinal = FaweCache.INSTANCE.PALETTE_TO_BLOCK_CHAR.get(); + try { + if (num_palette != 1) { + for (int i = 0; i < num_palette; i++) { + char ordinal = ordinal(palette.valueFor(i), adapter); + paletteToOrdinal[i] = ordinal; + } + for (int i = 0; i < 4096; i++) { + char paletteVal = data[i]; + char val = paletteToOrdinal[paletteVal]; + if (val == Character.MAX_VALUE) { + val = ordinal(palette.valueFor(i), adapter); + paletteToOrdinal[i] = val; + } + data[i] = val; + } + } else { + char ordinal = ordinal(palette.valueFor(0), adapter); + Arrays.fill(data, ordinal); + } + } finally { + for (int i = 0; i < num_palette; i++) { + paletteToOrdinal[i] = Character.MAX_VALUE; + } + } + return data; + } catch (IllegalAccessException | InterruptedException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } finally { + lock.release(); + } + } + } + + private char ordinal(BlockState ibd, PaperweightFaweAdapter adapter) { + if (ibd == null) { + return BlockTypesCache.ReservedIDs.AIR; + } else { + return adapter.adaptToChar(ibd); + } + } + + public LevelChunkSection[] getSections(boolean force) { + force &= forceLoadSections; + sectionLock.readLock().lock(); + LevelChunkSection[] tmp = sections; + sectionLock.readLock().unlock(); + if (tmp == null || force) { + try { + sectionLock.writeLock().lock(); + tmp = sections; + if (tmp == null || force) { + LevelChunkSection[] chunkSections = getChunk().getSections(); + tmp = new LevelChunkSection[chunkSections.length]; + System.arraycopy(chunkSections, 0, tmp, 0, chunkSections.length); + sections = tmp; + } + } finally { + sectionLock.writeLock().unlock(); + } + } + return tmp; + } + + public LevelChunk getChunk() { + LevelChunk levelChunk = this.levelChunk; + if (levelChunk == null) { + synchronized (this) { + levelChunk = this.levelChunk; + if (levelChunk == null) { + this.levelChunk = levelChunk = ensureLoaded(this.serverLevel, chunkX, chunkZ); + } + } + } + return levelChunk; + } + + private void fillLightNibble(char[][] light, LightLayer lightLayer, int minSectionPosition, int maxSectionPosition) { + for (int Y = 0; Y <= maxSectionPosition - minSectionPosition; Y++) { + if (light[Y] == null) { + continue; + } + SectionPos sectionPos = SectionPos.of(levelChunk.getPos(), Y + minSectionPosition); + DataLayer dataLayer = serverLevel.getChunkSource().getLightEngine().getLayerListener(lightLayer).getDataLayerData( + sectionPos); + if (dataLayer == null) { + byte[] LAYER_COUNT = new byte[2048]; + Arrays.fill(LAYER_COUNT, lightLayer == LightLayer.SKY ? (byte) 15 : (byte) 0); + dataLayer = new DataLayer(LAYER_COUNT); + ((LevelLightEngine) serverLevel.getChunkSource().getLightEngine()).queueSectionData( + lightLayer, + sectionPos, + dataLayer + ); + } + synchronized (dataLayer) { + for (int x = 0; x < 16; x++) { + for (int y = 0; y < 16; y++) { + for (int z = 0; z < 16; z++) { + int i = y << 8 | z << 4 | x; + if (light[Y][i] < 16) { + dataLayer.set(x, y, z, light[Y][i]); + } + } + } + } + } + } + } + + private PalettedContainer> setBiomesToPalettedContainer( + final BiomeType[][] biomes, + final int sectionIndex, + final PalettedContainerRO> data + ) { + PalettedContainer> biomeData; + if (data instanceof PalettedContainer> palettedContainer) { + biomeData = palettedContainer; + } else { + LOGGER.warn( + "Cannot correctly set biomes to world, existing biomes may be lost. Expected class " + + "type {} but got {}", + PalettedContainer.class.getSimpleName(), + data.getClass().getSimpleName() + ); + biomeData = data.recreate(); + } + BiomeType[] sectionBiomes; + if (biomes == null || (sectionBiomes = biomes[sectionIndex]) == null) { + return biomeData; + } + for (int y = 0, index = 0; y < 4; y++) { + for (int z = 0; z < 4; z++) { + for (int x = 0; x < 4; x++, index++) { + BiomeType biomeType = sectionBiomes[index]; + if (biomeType == null) { + continue; + } + biomeData.set( + x, + y, + z, + biomeHolderIdMap.byIdOrThrow(WorldEditPlugin + .getInstance() + .getBukkitImplAdapter() + .getInternalBiomeId(biomeType)) + ); + } + } + } + return biomeData; + } + + @Override + public boolean hasSection(int layer) { + layer -= getMinSectionPosition(); + return getSections(false)[layer] != null; + } + + @Override + @SuppressWarnings("unchecked") + public synchronized boolean trim(boolean aggressive) { + skyLight = new DataLayer[getSectionCount()]; + blockLight = new DataLayer[getSectionCount()]; + if (aggressive) { + sectionLock.writeLock().lock(); + sections = null; + levelChunk = null; + sectionLock.writeLock().unlock(); + return super.trim(true); + } else if (sections == null) { + // don't bother trimming if there are no sections stored. + return true; + } else { + for (int i = getMinSectionPosition(); i <= getMaxSectionPosition(); i++) { + int layer = i - getMinSectionPosition(); + if (!hasSection(i) || !super.sections[layer].isFull()) { + continue; + } + LevelChunkSection existing = getSections(true)[layer]; + try { + final PalettedContainer blocksExisting = existing.getStates(); + + final Object dataObject = PaperweightPlatformAdapter.fieldData.get(blocksExisting); + final Palette palette = (Palette) PaperweightPlatformAdapter.fieldPalette.get( + dataObject); + int paletteSize; + + if (palette instanceof LinearPalette || palette instanceof HashMapPalette) { + paletteSize = palette.getSize(); + } else { + super.trim(false, i); + continue; + } + if (paletteSize == 1) { + //If the cached palette size is 1 then no blocks can have been changed i.e. do not need to update these chunks. + continue; + } + super.trim(false, i); + } catch (IllegalAccessException ignored) { + super.trim(false, i); + } + } + return true; + } + } + +} diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks_Copy.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks_Copy.java new file mode 100644 index 000000000..7a387a887 --- /dev/null +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks_Copy.java @@ -0,0 +1,248 @@ +package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1; + +import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; +import com.fastasyncworldedit.core.queue.IBlocks; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.google.common.base.Suppliers; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.bukkit.WorldEditPlugin; +import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; +import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1.nbt.PaperweightLazyCompoundTag; +import com.sk89q.worldedit.internal.util.LogManagerCompat; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockTypesCache; +import net.minecraft.core.Holder; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.chunk.LevelChunk; +import net.minecraft.world.level.chunk.PalettedContainer; +import net.minecraft.world.level.chunk.PalettedContainerRO; +import org.apache.logging.log4j.Logger; + +import javax.annotation.Nullable; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.UUID; +import java.util.concurrent.Future; + +public class PaperweightGetBlocks_Copy implements IChunkGet { + + private static final Logger LOGGER = LogManagerCompat.getLogger(); + + private final Map tiles = new HashMap<>(); + private final Set entities = new HashSet<>(); + private final char[][] blocks; + private final int minHeight; + private final int maxHeight; + final ServerLevel serverLevel; + final LevelChunk levelChunk; + private PalettedContainer>[] biomes = null; + + protected PaperweightGetBlocks_Copy(LevelChunk levelChunk) { + this.levelChunk = levelChunk; + this.serverLevel = levelChunk.level; + this.minHeight = serverLevel.getMinBuildHeight(); + this.maxHeight = serverLevel.getMaxBuildHeight() - 1; // Minecraft max limit is exclusive. + this.blocks = new char[getSectionCount()][]; + } + + protected void storeTile(BlockEntity blockEntity) { + tiles.put( + BlockVector3.at( + blockEntity.getBlockPos().getX(), + blockEntity.getBlockPos().getY(), + blockEntity.getBlockPos().getZ() + ), + new PaperweightLazyCompoundTag(Suppliers.memoize(blockEntity::saveWithId)) + ); + } + + @Override + public Map getTiles() { + return tiles; + } + + @Override + @Nullable + public CompoundTag getTile(int x, int y, int z) { + return tiles.get(BlockVector3.at(x, y, z)); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + protected void storeEntity(Entity entity) { + BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); + net.minecraft.nbt.CompoundTag compoundTag = new net.minecraft.nbt.CompoundTag(); + entity.save(compoundTag); + entities.add((CompoundTag) adapter.toNative(compoundTag)); + } + + @Override + public Set getEntities() { + return this.entities; + } + + @Override + public CompoundTag getEntity(UUID uuid) { + for (CompoundTag tag : entities) { + if (uuid.equals(tag.getUUID())) { + return tag; + } + } + return null; + } + + @Override + public boolean isCreateCopy() { + return false; + } + + @Override + public void setCreateCopy(boolean createCopy) { + } + + @Override + public void setLightingToGet(char[][] lighting, int minSectionPosition, int maxSectionPosition) { + } + + @Override + public void setSkyLightingToGet(char[][] lighting, int minSectionPosition, int maxSectionPosition) { + } + + @Override + public void setHeightmapToGet(HeightMapType type, int[] data) { + } + + @Override + public int getMaxY() { + return maxHeight; + } + + @Override + public int getMinY() { + return minHeight; + } + + @Override + public int getMaxSectionPosition() { + return maxHeight >> 4; + } + + @Override + public int getMinSectionPosition() { + return minHeight >> 4; + } + + @Override + public BiomeType getBiomeType(int x, int y, int z) { + Holder biome = biomes[(y >> 4) - getMinSectionPosition()].get(x >> 2, (y & 15) >> 2, z >> 2); + return PaperweightPlatformAdapter.adapt(biome, serverLevel); + } + + @Override + public void removeSectionLighting(int layer, boolean sky) { + } + + @Override + public boolean trim(boolean aggressive, int layer) { + return false; + } + + @Override + public IBlocks reset() { + return null; + } + + @Override + public int getSectionCount() { + return serverLevel.getSectionsCount(); + } + + protected void storeSection(int layer, char[] data) { + blocks[layer] = data; + } + + protected void storeBiomes(int layer, PalettedContainerRO> biomeData) { + if (biomes == null) { + biomes = new PalettedContainer[getSectionCount()]; + } + if (biomeData instanceof PalettedContainer> palettedContainer) { + biomes[layer] = palettedContainer.copy(); + } else { + LOGGER.error( + "Cannot correctly save biomes to history. Expected class type {} but got {}", + PalettedContainer.class.getSimpleName(), + biomeData.getClass().getSimpleName() + ); + } + } + + @Override + public BaseBlock getFullBlock(int x, int y, int z) { + BlockState state = BlockTypesCache.states[get(x, y, z)]; + return state.toBaseBlock(this, x, y, z); + } + + @Override + public boolean hasSection(int layer) { + layer -= getMinSectionPosition(); + return blocks[layer] != null; + } + + @Override + public char[] load(int layer) { + layer -= getMinSectionPosition(); + return blocks[layer]; + } + + @Override + public char[] loadIfPresent(int layer) { + layer -= getMinSectionPosition(); + return blocks[layer]; + } + + @Override + public BlockState getBlock(int x, int y, int z) { + return BlockTypesCache.states[get(x, y, z)]; + } + + @Override + public int getSkyLight(int x, int y, int z) { + return 0; + } + + @Override + public int getEmittedLight(int x, int y, int z) { + return 0; + } + + @Override + public int[] getHeightMap(HeightMapType type) { + return new int[0]; + } + + @Override + public > T call(IChunkSet set, Runnable finalize) { + return null; + } + + public char get(int x, int y, int z) { + final int layer = (y >> 4) - getMinSectionPosition(); + final int index = (y & 15) << 8 | z << 4 | x; + return blocks[layer][index]; + } + + + @Override + public boolean trim(boolean aggressive) { + return false; + } + +} diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightMapChunkUtil.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightMapChunkUtil.java new file mode 100644 index 000000000..62f5d4e03 --- /dev/null +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightMapChunkUtil.java @@ -0,0 +1,34 @@ +package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1; + +import com.fastasyncworldedit.bukkit.adapter.MapChunkUtil; +import com.sk89q.worldedit.bukkit.adapter.Refraction; +import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; +import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; + +//TODO un-very-break-this +public class PaperweightMapChunkUtil extends MapChunkUtil { + + public PaperweightMapChunkUtil() throws NoSuchFieldException { + fieldX = ClientboundLevelChunkPacketData.class.getDeclaredField(Refraction.pickName("TWO_MEGABYTES", "a")); + fieldZ = ClientboundLevelChunkWithLightPacket.class.getDeclaredField(Refraction.pickName("x", "a")); + fieldBitMask = ClientboundLevelChunkWithLightPacket.class.getDeclaredField(Refraction.pickName("z", "b")); + fieldHeightMap = ClientboundLevelChunkPacketData.class.getDeclaredField(Refraction.pickName("heightmaps", "b")); + fieldChunkData = ClientboundLevelChunkWithLightPacket.class.getDeclaredField(Refraction.pickName("chunkData", "c")); + fieldBlockEntities = ClientboundLevelChunkPacketData.class.getDeclaredField(Refraction.pickName("buffer", "c")); + fieldFull = ClientboundLevelChunkPacketData.class.getDeclaredField(Refraction.pickName("blockEntitiesData", "d")); + fieldX.setAccessible(true); + fieldZ.setAccessible(true); + fieldBitMask.setAccessible(true); + fieldHeightMap.setAccessible(true); + fieldChunkData.setAccessible(true); + fieldBlockEntities.setAccessible(true); + fieldFull.setAccessible(true); + } + + @Override + public ClientboundLevelChunkWithLightPacket createPacket() { + // TODO ??? return new ClientboundLevelChunkPacket(); + throw new UnsupportedOperationException(); + } + +} diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPlatformAdapter.java new file mode 100644 index 000000000..4d8498dce --- /dev/null +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPlatformAdapter.java @@ -0,0 +1,720 @@ +package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1; + +import com.destroystokyo.paper.util.maplist.EntityList; +import com.fastasyncworldedit.bukkit.adapter.CachedBukkitAdapter; +import com.fastasyncworldedit.bukkit.adapter.DelegateSemaphore; +import com.fastasyncworldedit.bukkit.adapter.NMSAdapter; +import com.fastasyncworldedit.core.Fawe; +import com.fastasyncworldedit.core.FaweCache; +import com.fastasyncworldedit.core.math.BitArrayUnstretched; +import com.fastasyncworldedit.core.util.MathMan; +import com.fastasyncworldedit.core.util.ReflectionUtils; +import com.fastasyncworldedit.core.util.TaskManager; +import com.mojang.datafixers.util.Either; +import com.sk89q.worldedit.bukkit.WorldEditPlugin; +import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; +import com.sk89q.worldedit.bukkit.adapter.Refraction; +import com.sk89q.worldedit.world.biome.BiomeType; +import com.sk89q.worldedit.world.biome.BiomeTypes; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockTypesCache; +import io.papermc.lib.PaperLib; +import io.papermc.paper.world.ChunkEntitySlices; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.core.IdMap; +import net.minecraft.core.Registry; +import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; +import net.minecraft.server.level.ChunkHolder; +import net.minecraft.server.level.ChunkMap; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.server.level.TicketType; +import net.minecraft.util.BitStorage; +import net.minecraft.util.ExceptionCollector; +import net.minecraft.util.SimpleBitStorage; +import net.minecraft.util.ThreadingDetector; +import net.minecraft.util.Unit; +import net.minecraft.util.ZeroBitStorage; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraft.world.level.chunk.ChunkStatus; +import net.minecraft.world.level.chunk.GlobalPalette; +import net.minecraft.world.level.chunk.HashMapPalette; +import net.minecraft.world.level.chunk.LevelChunk; +import net.minecraft.world.level.chunk.LevelChunkSection; +import net.minecraft.world.level.chunk.LinearPalette; +import net.minecraft.world.level.chunk.Palette; +import net.minecraft.world.level.chunk.PalettedContainer; +import net.minecraft.world.level.chunk.SingleValuePalette; +import net.minecraft.world.level.entity.PersistentEntitySectionManager; +import org.bukkit.craftbukkit.v1_20_R1.CraftChunk; +import sun.misc.Unsafe; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodType; +import java.lang.reflect.Constructor; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.Semaphore; +import java.util.function.Function; + +import static java.lang.invoke.MethodType.methodType; +import static net.minecraft.core.registries.Registries.BIOME; + +public final class PaperweightPlatformAdapter extends NMSAdapter { + + public static final Field fieldData; + + public static final Constructor dataConstructor; + + public static final Field fieldStorage; + public static final Field fieldPalette; + + private static final Field fieldTickingFluidCount; + private static final Field fieldTickingBlockCount; + private static final Field fieldNonEmptyBlockCount; + + private static final MethodHandle methodGetVisibleChunk; + + private static final int CHUNKSECTION_BASE; + private static final int CHUNKSECTION_SHIFT; + + private static final Field fieldThreadingDetector; + private static final long fieldThreadingDetectorOffset; + + private static final Field fieldLock; + private static final long fieldLockOffset; + + private static final MethodHandle methodRemoveGameEventListener; + private static final MethodHandle methodremoveTickingBlockEntity; + + /* + * This is a workaround for the changes from https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/1fddefce1cdce44010927b888432bf70c0e88cde#src/main/java/org/bukkit/craftbukkit/CraftChunk.java + * and is only needed to support 1.19.4 versions before *and* after this change. + */ + private static final MethodHandle CRAFT_CHUNK_GET_HANDLE; + + private static final Field fieldRemove; + + static final boolean POST_CHUNK_REWRITE; + private static Method PAPER_CHUNK_GEN_ALL_ENTITIES; + private static Field LEVEL_CHUNK_ENTITIES; + private static Field SERVER_LEVEL_ENTITY_MANAGER; + + static { + final MethodHandles.Lookup lookup = MethodHandles.lookup(); + try { + fieldData = PalettedContainer.class.getDeclaredField(Refraction.pickName("data", "d")); + fieldData.setAccessible(true); + + Class dataClazz = fieldData.getType(); + dataConstructor = dataClazz.getDeclaredConstructors()[0]; + dataConstructor.setAccessible(true); + + fieldStorage = dataClazz.getDeclaredField(Refraction.pickName("storage", "b")); + fieldStorage.setAccessible(true); + fieldPalette = dataClazz.getDeclaredField(Refraction.pickName("palette", "c")); + fieldPalette.setAccessible(true); + + fieldTickingFluidCount = LevelChunkSection.class.getDeclaredField(Refraction.pickName("tickingFluidCount", "g")); + fieldTickingFluidCount.setAccessible(true); + fieldTickingBlockCount = LevelChunkSection.class.getDeclaredField(Refraction.pickName("tickingBlockCount", "f")); + fieldTickingBlockCount.setAccessible(true); + fieldNonEmptyBlockCount = LevelChunkSection.class.getDeclaredField(Refraction.pickName("nonEmptyBlockCount", "e")); + fieldNonEmptyBlockCount.setAccessible(true); + + Method getVisibleChunkIfPresent = ChunkMap.class.getDeclaredMethod(Refraction.pickName( + "getVisibleChunkIfPresent", + "b" + ), long.class); + getVisibleChunkIfPresent.setAccessible(true); + methodGetVisibleChunk = lookup.unreflect(getVisibleChunkIfPresent); + + Unsafe unsafe = ReflectionUtils.getUnsafe(); + if (!PaperLib.isPaper()) { + fieldThreadingDetector = PalettedContainer.class.getDeclaredField(Refraction.pickName("threadingDetector", "f")); + fieldThreadingDetectorOffset = unsafe.objectFieldOffset(fieldThreadingDetector); + + fieldLock = ThreadingDetector.class.getDeclaredField(Refraction.pickName("lock", "c")); + fieldLockOffset = unsafe.objectFieldOffset(fieldLock); + } else { + // in paper, the used methods are synchronized properly + fieldThreadingDetector = null; + fieldThreadingDetectorOffset = -1; + + fieldLock = null; + fieldLockOffset = -1; + } + + Method removeGameEventListener = LevelChunk.class.getDeclaredMethod( + Refraction.pickName("removeGameEventListener", "a"), + BlockEntity.class, + ServerLevel.class + ); + removeGameEventListener.setAccessible(true); + methodRemoveGameEventListener = lookup.unreflect(removeGameEventListener); + + Method removeBlockEntityTicker = LevelChunk.class.getDeclaredMethod( + Refraction.pickName( + "removeBlockEntityTicker", + "l" + ), BlockPos.class + ); + removeBlockEntityTicker.setAccessible(true); + methodremoveTickingBlockEntity = lookup.unreflect(removeBlockEntityTicker); + + fieldRemove = BlockEntity.class.getDeclaredField(Refraction.pickName("remove", "q")); + fieldRemove.setAccessible(true); + + CHUNKSECTION_BASE = unsafe.arrayBaseOffset(LevelChunkSection[].class); + int scale = unsafe.arrayIndexScale(LevelChunkSection[].class); + if ((scale & (scale - 1)) != 0) { + throw new Error("data type scale not a power of two"); + } + CHUNKSECTION_SHIFT = 31 - Integer.numberOfLeadingZeros(scale); + boolean chunkRewrite; + try { + ServerLevel.class.getDeclaredMethod("getEntityLookup"); + chunkRewrite = true; + PAPER_CHUNK_GEN_ALL_ENTITIES = ChunkEntitySlices.class.getDeclaredMethod("getAllEntities"); + PAPER_CHUNK_GEN_ALL_ENTITIES.setAccessible(true); + } catch (NoSuchMethodException ignored) { + chunkRewrite = false; + } + try { + // Paper - Pre-Chunk-Update + LEVEL_CHUNK_ENTITIES = LevelChunk.class.getDeclaredField("entities"); + LEVEL_CHUNK_ENTITIES.setAccessible(true); + } catch (NoSuchFieldException ignored) { + } + try { + // Non-Paper + SERVER_LEVEL_ENTITY_MANAGER = ServerLevel.class.getDeclaredField(Refraction.pickName("entityManager", "M")); + LEVEL_CHUNK_ENTITIES.setAccessible(true); + } catch (NoSuchFieldException ignored) { + } + POST_CHUNK_REWRITE = chunkRewrite; + } catch (RuntimeException | Error e) { + throw e; + } catch (Exception e) { + throw new RuntimeException(e); + } + MethodHandle craftChunkGetHandle; + final MethodType type = methodType(LevelChunk.class); + try { + craftChunkGetHandle = lookup.findVirtual(CraftChunk.class, "getHandle", type); + } catch (NoSuchMethodException | IllegalAccessException e) { + try { + final MethodType newType = methodType(ChunkAccess.class, ChunkStatus.class); + craftChunkGetHandle = lookup.findVirtual(CraftChunk.class, "getHandle", newType); + craftChunkGetHandle = MethodHandles.insertArguments(craftChunkGetHandle, 1, ChunkStatus.FULL); + } catch (NoSuchMethodException | IllegalAccessException ex) { + throw new RuntimeException(ex); + } + } + CRAFT_CHUNK_GET_HANDLE = craftChunkGetHandle; + } + + static boolean setSectionAtomic( + LevelChunkSection[] sections, + LevelChunkSection expected, + LevelChunkSection value, + int layer + ) { + long offset = ((long) layer << CHUNKSECTION_SHIFT) + CHUNKSECTION_BASE; + if (layer >= 0 && layer < sections.length) { + return ReflectionUtils.getUnsafe().compareAndSwapObject(sections, offset, expected, value); + } + return false; + } + + // There is no point in having a functional semaphore for paper servers. + private static final ThreadLocal SEMAPHORE_THREAD_LOCAL = + ThreadLocal.withInitial(() -> new DelegateSemaphore(1, null)); + + static DelegateSemaphore applyLock(LevelChunkSection section) { + if (PaperLib.isPaper()) { + return SEMAPHORE_THREAD_LOCAL.get(); + } + try { + synchronized (section) { + Unsafe unsafe = ReflectionUtils.getUnsafe(); + PalettedContainer blocks = section.getStates(); + ThreadingDetector currentThreadingDetector = (ThreadingDetector) unsafe.getObject( + blocks, + fieldThreadingDetectorOffset + ); + synchronized (currentThreadingDetector) { + Semaphore currentLock = (Semaphore) unsafe.getObject(currentThreadingDetector, fieldLockOffset); + if (currentLock instanceof DelegateSemaphore delegateSemaphore) { + return delegateSemaphore; + } + DelegateSemaphore newLock = new DelegateSemaphore(1, currentLock); + unsafe.putObject(currentThreadingDetector, fieldLockOffset, newLock); + return newLock; + } + } + } catch (Throwable e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } + + public static LevelChunk ensureLoaded(ServerLevel serverLevel, int chunkX, int chunkZ) { + if (!PaperLib.isPaper()) { + LevelChunk nmsChunk = serverLevel.getChunkSource().getChunk(chunkX, chunkZ, false); + if (nmsChunk != null) { + return nmsChunk; + } + if (Fawe.isMainThread()) { + return serverLevel.getChunk(chunkX, chunkZ); + } + } else { + LevelChunk nmsChunk = serverLevel.getChunkSource().getChunkAtIfCachedImmediately(chunkX, chunkZ); + if (nmsChunk != null) { + addTicket(serverLevel, chunkX, chunkZ); + return nmsChunk; + } + nmsChunk = serverLevel.getChunkSource().getChunkAtIfLoadedImmediately(chunkX, chunkZ); + if (nmsChunk != null) { + addTicket(serverLevel, chunkX, chunkZ); + return nmsChunk; + } + // Avoid "async" methods from the main thread. + if (Fawe.isMainThread()) { + return serverLevel.getChunk(chunkX, chunkZ); + } + CompletableFuture future = serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true); + try { + CraftChunk chunk = (CraftChunk) future.get(); + addTicket(serverLevel, chunkX, chunkZ); + return (LevelChunk) CRAFT_CHUNK_GET_HANDLE.invoke(chunk); + } catch (Throwable e) { + e.printStackTrace(); + } + } + return TaskManager.taskManager().sync(() -> serverLevel.getChunk(chunkX, chunkZ)); + } + + private static void addTicket(ServerLevel serverLevel, int chunkX, int chunkZ) { + // Ensure chunk is definitely loaded before applying a ticket + io.papermc.paper.util.MCUtil.MAIN_EXECUTOR.execute(() -> serverLevel + .getChunkSource() + .addRegionTicket(TicketType.UNLOAD_COOLDOWN, new ChunkPos(chunkX, chunkZ), 0, Unit.INSTANCE)); + } + + public static ChunkHolder getPlayerChunk(ServerLevel nmsWorld, final int chunkX, final int chunkZ) { + ChunkMap chunkMap = nmsWorld.getChunkSource().chunkMap; + try { + return (ChunkHolder) methodGetVisibleChunk.invoke(chunkMap, ChunkPos.asLong(chunkX, chunkZ)); + } catch (Throwable thr) { + throw new RuntimeException(thr); + } + } + + @SuppressWarnings("deprecation") + public static void sendChunk(ServerLevel nmsWorld, int chunkX, int chunkZ, boolean lighting) { + ChunkHolder chunkHolder = getPlayerChunk(nmsWorld, chunkX, chunkZ); + if (chunkHolder == null) { + return; + } + ChunkPos coordIntPair = new ChunkPos(chunkX, chunkZ); + LevelChunk levelChunk; + if (PaperLib.isPaper()) { + // getChunkAtIfLoadedImmediately is paper only + levelChunk = nmsWorld + .getChunkSource() + .getChunkAtIfLoadedImmediately(chunkX, chunkZ); + } else { + levelChunk = ((Optional) ((Either) chunkHolder + .getTickingChunkFuture() // method is not present with new paper chunk system + .getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left()) + .orElse(null); + } + if (levelChunk == null) { + return; + } + TaskManager.taskManager().task(() -> { + ClientboundLevelChunkWithLightPacket packet; + if (PaperLib.isPaper()) { + packet = new ClientboundLevelChunkWithLightPacket( + levelChunk, + nmsWorld.getChunkSource().getLightEngine(), + null, + null + // last false is to not bother with x-ray + ); + } else { + // deprecated on paper - deprecation suppressed + packet = new ClientboundLevelChunkWithLightPacket( + levelChunk, + nmsWorld.getChunkSource().getLightEngine(), + null, + null + ); + } + nearbyPlayers(nmsWorld, coordIntPair).forEach(p -> p.connection.send(packet)); + }); + } + + private static List nearbyPlayers(ServerLevel serverLevel, ChunkPos coordIntPair) { + return serverLevel.getChunkSource().chunkMap.getPlayers(coordIntPair, false); + } + + /* + NMS conversion + */ + public static LevelChunkSection newChunkSection( + final int layer, + final char[] blocks, + CachedBukkitAdapter adapter, + Registry biomeRegistry, + @Nullable PalettedContainer> biomes + ) { + return newChunkSection(layer, null, blocks, adapter, biomeRegistry, biomes); + } + + public static LevelChunkSection newChunkSection( + final int layer, + final Function get, + char[] set, + CachedBukkitAdapter adapter, + Registry biomeRegistry, + @Nullable PalettedContainer> biomes + ) { + if (set == null) { + return newChunkSection(layer, biomeRegistry, biomes); + } + final int[] blockToPalette = FaweCache.INSTANCE.BLOCK_TO_PALETTE.get(); + final int[] paletteToBlock = FaweCache.INSTANCE.PALETTE_TO_BLOCK.get(); + final long[] blockStates = FaweCache.INSTANCE.BLOCK_STATES.get(); + final int[] blocksCopy = FaweCache.INSTANCE.SECTION_BLOCKS.get(); + try { + int num_palette; + if (get == null) { + num_palette = createPalette(blockToPalette, paletteToBlock, blocksCopy, set, adapter, null); + } else { + num_palette = createPalette(layer, blockToPalette, paletteToBlock, blocksCopy, get, set, adapter, null); + } + + int bitsPerEntry = MathMan.log2nlz(num_palette - 1); + if (bitsPerEntry > 0 && bitsPerEntry < 5) { + bitsPerEntry = 4; + } else if (bitsPerEntry > 8) { + bitsPerEntry = MathMan.log2nlz(Block.BLOCK_STATE_REGISTRY.size() - 1); + } + + int bitsPerEntryNonZero = Math.max(bitsPerEntry, 1); // We do want to use zero sometimes + final int blocksPerLong = MathMan.floorZero((double) 64 / bitsPerEntryNonZero); + final int blockBitArrayEnd = MathMan.ceilZero((float) 4096 / blocksPerLong); + + if (num_palette == 1) { + for (int i = 0; i < blockBitArrayEnd; i++) { + blockStates[i] = 0; + } + } else { + final BitArrayUnstretched bitArray = new BitArrayUnstretched(bitsPerEntryNonZero, 4096, blockStates); + bitArray.fromRaw(blocksCopy); + } + + final long[] bits = Arrays.copyOfRange(blockStates, 0, blockBitArrayEnd); + final BitStorage nmsBits; + if (bitsPerEntry == 0) { + nmsBits = new ZeroBitStorage(4096); + } else { + nmsBits = new SimpleBitStorage(bitsPerEntry, 4096, bits); + } + List palette; + if (bitsPerEntry < 9) { + palette = new ArrayList<>(); + for (int i = 0; i < num_palette; i++) { + int ordinal = paletteToBlock[i]; + blockToPalette[ordinal] = Integer.MAX_VALUE; + final BlockState state = BlockTypesCache.states[ordinal]; + palette.add(((PaperweightBlockMaterial) state.getMaterial()).getState()); + } + } else { + palette = List.of(); + } + + // Create palette with data + @SuppressWarnings("deprecation") // constructor is deprecated on paper, but needed to keep compatibility with spigot + final PalettedContainer blockStatePalettedContainer = + new PalettedContainer<>( + Block.BLOCK_STATE_REGISTRY, + PalettedContainer.Strategy.SECTION_STATES, + PalettedContainer.Strategy.SECTION_STATES.getConfiguration(Block.BLOCK_STATE_REGISTRY, bitsPerEntry), + nmsBits, + palette + ); + if (biomes == null) { + IdMap> biomeHolderIdMap = biomeRegistry.asHolderIdMap(); + biomes = new PalettedContainer<>( + biomeHolderIdMap, + biomeHolderIdMap.byIdOrThrow(WorldEditPlugin + .getInstance() + .getBukkitImplAdapter() + .getInternalBiomeId( + BiomeTypes.PLAINS)), + PalettedContainer.Strategy.SECTION_BIOMES + ); + } + + return new LevelChunkSection(blockStatePalettedContainer, biomes); + } catch (final Throwable e) { + throw e; + } finally { + Arrays.fill(blockToPalette, Integer.MAX_VALUE); + Arrays.fill(paletteToBlock, Integer.MAX_VALUE); + Arrays.fill(blockStates, 0); + Arrays.fill(blocksCopy, 0); + } + } + + @SuppressWarnings("deprecation") // Only deprecated in paper + private static LevelChunkSection newChunkSection( + int layer, + Registry biomeRegistry, + @Nullable PalettedContainer> biomes + ) { + if (biomes == null) { + return new LevelChunkSection(biomeRegistry); + } + PalettedContainer dataPaletteBlocks = new PalettedContainer<>( + Block.BLOCK_STATE_REGISTRY, + Blocks.AIR.defaultBlockState(), + PalettedContainer.Strategy.SECTION_STATES + ); + return new LevelChunkSection(dataPaletteBlocks, biomes); + } + + /** + * Create a new {@link PalettedContainer}. Should only be used if no biome container existed beforehand. + */ + public static PalettedContainer> getBiomePalettedContainer( + BiomeType[] biomes, + IdMap> biomeRegistry + ) { + if (biomes == null) { + return null; + } + BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); + // Don't stream this as typically will see 1-4 biomes; stream overhead is large for the small length + Map> palette = new HashMap<>(); + for (BiomeType biomeType : new LinkedList<>(Arrays.asList(biomes))) { + Holder biome; + if (biomeType == null) { + biome = biomeRegistry.byId(adapter.getInternalBiomeId(BiomeTypes.PLAINS)); + } else { + biome = biomeRegistry.byId(adapter.getInternalBiomeId(biomeType)); + } + palette.put(biomeType, biome); + } + int biomeCount = palette.size(); + int bitsPerEntry = MathMan.log2nlz(biomeCount - 1); + Object configuration = PalettedContainer.Strategy.SECTION_STATES.getConfiguration( + new FakeIdMapBiome(biomeCount), + bitsPerEntry + ); + if (bitsPerEntry > 3) { + bitsPerEntry = MathMan.log2nlz(biomeRegistry.size() - 1); + } + PalettedContainer> biomePalettedContainer = new PalettedContainer<>( + biomeRegistry, + biomeRegistry.byIdOrThrow(adapter.getInternalBiomeId(BiomeTypes.PLAINS)), + PalettedContainer.Strategy.SECTION_BIOMES + ); + + final Palette> biomePalette; + if (bitsPerEntry == 0) { + biomePalette = new SingleValuePalette<>( + biomePalettedContainer.registry, + biomePalettedContainer, + new ArrayList<>(palette.values()) // Must be modifiable + ); + } else if (bitsPerEntry == 4) { + biomePalette = LinearPalette.create( + 4, + biomePalettedContainer.registry, + biomePalettedContainer, + new ArrayList<>(palette.values()) // Must be modifiable + ); + } else if (bitsPerEntry < 9) { + biomePalette = HashMapPalette.create( + bitsPerEntry, + biomePalettedContainer.registry, + biomePalettedContainer, + new ArrayList<>(palette.values()) // Must be modifiable + ); + } else { + biomePalette = GlobalPalette.create( + bitsPerEntry, + biomePalettedContainer.registry, + biomePalettedContainer, + null // unused + ); + } + + int bitsPerEntryNonZero = Math.max(bitsPerEntry, 1); // We do want to use zero sometimes + final int blocksPerLong = MathMan.floorZero((double) 64 / bitsPerEntryNonZero); + final int arrayLength = MathMan.ceilZero(64f / blocksPerLong); + + + BitStorage bitStorage = bitsPerEntry == 0 ? new ZeroBitStorage(64) : new SimpleBitStorage( + bitsPerEntry, + 64, + new long[arrayLength] + ); + + try { + Object data = dataConstructor.newInstance(configuration, bitStorage, biomePalette); + fieldData.set(biomePalettedContainer, data); + int index = 0; + for (int y = 0; y < 4; y++) { + for (int z = 0; z < 4; z++) { + for (int x = 0; x < 4; x++, index++) { + BiomeType biomeType = biomes[index]; + if (biomeType == null) { + continue; + } + Holder biome = biomeRegistry.byId(WorldEditPlugin + .getInstance() + .getBukkitImplAdapter() + .getInternalBiomeId(biomeType)); + if (biome == null) { + continue; + } + biomePalettedContainer.set(x, y, z, biome); + } + } + } + } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException(e); + } + return biomePalettedContainer; + } + + public static void clearCounts(final LevelChunkSection section) throws IllegalAccessException { + fieldTickingFluidCount.setShort(section, (short) 0); + fieldTickingBlockCount.setShort(section, (short) 0); + } + + public static BiomeType adapt(Holder biome, LevelAccessor levelAccessor) { + final Registry biomeRegistry = levelAccessor.registryAccess().registryOrThrow(BIOME); + if (biomeRegistry.getKey(biome.value()) == null) { + return biomeRegistry.asHolderIdMap().getId(biome) == -1 ? BiomeTypes.OCEAN + : null; + } + return BiomeTypes.get(biome.unwrapKey().orElseThrow().location().toString()); + } + + static void removeBeacon(BlockEntity beacon, LevelChunk levelChunk) { + try { + if (levelChunk.loaded || levelChunk.level.isClientSide()) { + BlockEntity blockEntity = levelChunk.blockEntities.remove(beacon.getBlockPos()); + if (blockEntity != null) { + if (!levelChunk.level.isClientSide) { + methodRemoveGameEventListener.invoke(levelChunk, beacon, levelChunk.level); + } + fieldRemove.set(beacon, true); + } + } + methodremoveTickingBlockEntity.invoke(levelChunk, beacon.getBlockPos()); + } catch (Throwable throwable) { + throwable.printStackTrace(); + } + } + + static List getEntities(LevelChunk chunk) { + ExceptionCollector collector = new ExceptionCollector<>(); + if (PaperLib.isPaper()) { + if (POST_CHUNK_REWRITE) { + try { + //noinspection unchecked + return (List) PAPER_CHUNK_GEN_ALL_ENTITIES.invoke(chunk.level.getEntityLookup().getChunk(chunk.locX, chunk.locZ)); + } catch (IllegalAccessException | InvocationTargetException e) { + throw new RuntimeException("Failed to lookup entities [POST_CHUNK_REWRITE=true]", e); + } + } + try { + EntityList entityList = (EntityList) LEVEL_CHUNK_ENTITIES.get(chunk); + return List.of(entityList.getRawData()); + } catch (IllegalAccessException e) { + collector.add(new RuntimeException("Failed to lookup entities [POST_CHUNK_REWRITE=false]", e)); + // fall through + } + } + try { + //noinspection unchecked + return ((PersistentEntitySectionManager) (SERVER_LEVEL_ENTITY_MANAGER.get(chunk.level))).getEntities(chunk.getPos()); + } catch (IllegalAccessException e) { + collector.add(new RuntimeException("Failed to lookup entities [PAPER=false]", e)); + } + collector.throwIfPresent(); + return List.of(); + } + + record FakeIdMapBlock(int size) implements IdMap { + + @Override + public int getId(final net.minecraft.world.level.block.state.BlockState entry) { + return 0; + } + + @Nullable + @Override + public net.minecraft.world.level.block.state.BlockState byId(final int index) { + return null; + } + + @Nonnull + @Override + public Iterator iterator() { + return Collections.emptyIterator(); + } + + } + + record FakeIdMapBiome(int size) implements IdMap { + + @Override + public int getId(final Biome entry) { + return 0; + } + + @Nullable + @Override + public Biome byId(final int index) { + return null; + } + + @Nonnull + @Override + public Iterator iterator() { + return Collections.emptyIterator(); + } + + } + +} diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPostProcessor.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPostProcessor.java new file mode 100644 index 000000000..0c4bcff85 --- /dev/null +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPostProcessor.java @@ -0,0 +1,175 @@ +package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1; + +import com.fastasyncworldedit.core.configuration.Settings; +import com.fastasyncworldedit.core.extent.processor.ProcessorScope; +import com.fastasyncworldedit.core.queue.IBatchProcessor; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.fastasyncworldedit.core.registry.state.PropertyKey; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockTypes; +import com.sk89q.worldedit.world.block.BlockTypesCache; +import net.minecraft.core.BlockPos; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.world.level.material.Fluid; +import net.minecraft.world.level.material.Fluids; + +import javax.annotation.Nullable; + +public class PaperweightPostProcessor implements IBatchProcessor { + + @Override + public IChunkSet processSet(final IChunk chunk, final IChunkGet get, final IChunkSet set) { + return set; + } + + @SuppressWarnings("deprecation") + @Override + public void postProcess(final IChunk chunk, final IChunkGet iChunkGet, final IChunkSet iChunkSet) { + boolean tickFluid = Settings.settings().EXPERIMENTAL.ALLOW_TICK_FLUIDS; + // The PostProcessor shouldn't be added, but just in case + if (!tickFluid) { + return; + } + PaperweightGetBlocks_Copy getBlocks = (PaperweightGetBlocks_Copy) iChunkGet; + layer: + for (int layer = iChunkSet.getMinSectionPosition(); layer <= iChunkSet.getMaxSectionPosition(); layer++) { + char[] set = iChunkSet.loadIfPresent(layer); + if (set == null) { + // No edit means no need to process + continue; + } + char[] get = null; + for (int i = 0; i < 4096; i++) { + char ordinal = set[i]; + char replacedOrdinal = BlockTypesCache.ReservedIDs.__RESERVED__; + boolean fromGet = false; // Used for liquids + if (ordinal == BlockTypesCache.ReservedIDs.__RESERVED__) { + if (get == null) { + get = getBlocks.load(layer); + } + // If this is null, then it's because we're loading a layer in the range of 0->15, but blocks aren't + // actually being set + if (get == null) { + continue layer; + } + fromGet = true; + ordinal = replacedOrdinal = get[i]; + } + if (ordinal == BlockTypesCache.ReservedIDs.__RESERVED__) { + continue; + } else if (!fromGet) { // if fromGet, don't do the same again + if (get == null) { + get = getBlocks.load(layer); + } + replacedOrdinal = get[i]; + } + boolean ticking = BlockTypesCache.ticking[ordinal]; + boolean replacedWasTicking = BlockTypesCache.ticking[replacedOrdinal]; + boolean replacedWasLiquid = false; + BlockState replacedState = null; + if (!ticking) { + // If the block being replaced was not ticking, it cannot be a liquid + if (!replacedWasTicking) { + continue; + } + // If the block being replaced is not fluid, we do not need to worry + if (!(replacedWasLiquid = + (replacedState = BlockState.getFromOrdinal(replacedOrdinal)).getMaterial().isLiquid())) { + continue; + } + } + BlockState state = BlockState.getFromOrdinal(ordinal); + boolean liquid = state.getMaterial().isLiquid(); + int x = i & 15; + int y = (i >> 8) & 15; + int z = (i >> 4) & 15; + BlockPos position = new BlockPos((chunk.getX() << 4) + x, (layer << 4) + y, (chunk.getZ() << 4) + z); + if (liquid || replacedWasLiquid) { + if (liquid) { + addFluid(getBlocks.serverLevel, state, position); + continue; + } + // If the replaced fluid (is?) adjacent to water. Do not bother to check adjacent chunks(sections) as this + // may be time consuming. Chances are any fluid blocks in adjacent chunks are being replaced or will end up + // being ticked anyway. We only need it to be "hit" once. + if (!wasAdjacentToWater(get, set, i, x, y, z)) { + continue; + } + addFluid(getBlocks.serverLevel, replacedState, position); + } + } + } + } + + @Nullable + @Override + public Extent construct(final Extent child) { + throw new UnsupportedOperationException("Processing only"); + } + + @Override + public ProcessorScope getScope() { + return ProcessorScope.READING_SET_BLOCKS; + } + + private boolean wasAdjacentToWater(char[] get, char[] set, int i, int x, int y, int z) { + if (set == null || get == null) { + return false; + } + char ordinal; + char reserved = BlockTypesCache.ReservedIDs.__RESERVED__; + if (x > 0 && set[i - 1] != reserved) { + if (BlockTypesCache.ticking[(ordinal = get[i - 1])] && isFluid(ordinal)) { + return true; + } + } + if (x < 15 && set[i + 1] != reserved) { + if (BlockTypesCache.ticking[(ordinal = get[i + 1])] && isFluid(ordinal)) { + return true; + } + } + if (z > 0 && set[i - 16] != reserved) { + if (BlockTypesCache.ticking[(ordinal = get[i - 16])] && isFluid(ordinal)) { + return true; + } + } + if (z < 15 && set[i + 16] != reserved) { + if (BlockTypesCache.ticking[(ordinal = get[i + 16])] && isFluid(ordinal)) { + return true; + } + } + if (y > 0 && set[i - 256] != reserved) { + if (BlockTypesCache.ticking[(ordinal = get[i - 256])] && isFluid(ordinal)) { + return true; + } + } + if (y < 15 && set[i + 256] != reserved) { + return BlockTypesCache.ticking[(ordinal = get[i + 256])] && isFluid(ordinal); + } + return false; + } + + @SuppressWarnings("deprecation") + private boolean isFluid(char ordinal) { + return BlockState.getFromOrdinal(ordinal).getMaterial().isLiquid(); + } + + @SuppressWarnings("deprecation") + private void addFluid(final ServerLevel serverLevel, final BlockState replacedState, final BlockPos position) { + Fluid type; + if (replacedState.getBlockType() == BlockTypes.LAVA) { + type = (int) replacedState.getState(PropertyKey.LEVEL) == 0 ? Fluids.LAVA : Fluids.FLOWING_LAVA; + } else { + type = (int) replacedState.getState(PropertyKey.LEVEL) == 0 ? Fluids.WATER : Fluids.FLOWING_WATER; + } + serverLevel.scheduleTick( + position, + type, + type.getTickDelay(serverLevel) + ); + } + +} diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightStarlightRelighter.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightStarlightRelighter.java new file mode 100644 index 000000000..2cc67360b --- /dev/null +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightStarlightRelighter.java @@ -0,0 +1,205 @@ +package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1; + +import com.fastasyncworldedit.core.configuration.Settings; +import com.fastasyncworldedit.core.extent.processor.lighting.NMSRelighter; +import com.fastasyncworldedit.core.extent.processor.lighting.Relighter; +import com.fastasyncworldedit.core.queue.IQueueChunk; +import com.fastasyncworldedit.core.queue.IQueueExtent; +import com.fastasyncworldedit.core.util.MathMan; +import com.fastasyncworldedit.core.util.TaskManager; +import com.sk89q.worldedit.internal.util.LogManagerCompat; +import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; +import it.unimi.dsi.fastutil.longs.LongArraySet; +import it.unimi.dsi.fastutil.longs.LongIterator; +import it.unimi.dsi.fastutil.longs.LongSet; +import net.minecraft.server.level.ChunkMap; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.TicketType; +import net.minecraft.util.Unit; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.chunk.ChunkStatus; +import org.apache.logging.log4j.Logger; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.locks.ReentrantLock; +import java.util.function.Consumer; +import java.util.function.IntConsumer; + +public class PaperweightStarlightRelighter implements Relighter { + + private static final Logger LOGGER = LogManagerCompat.getLogger(); + private static final int CHUNKS_PER_BATCH = 1024; // 32 * 32 + private static final int CHUNKS_PER_BATCH_SQRT_LOG2 = 5; // for shifting + + private static final TicketType FAWE_TICKET = TicketType.create("fawe_ticket", (a, b) -> 0); + private static final int LIGHT_LEVEL = ChunkMap.MAX_VIEW_DISTANCE + ChunkStatus.getDistance(ChunkStatus.LIGHT); + + + private final ServerLevel serverLevel; + private final ReentrantLock lock = new ReentrantLock(); + private final Long2ObjectLinkedOpenHashMap regions = new Long2ObjectLinkedOpenHashMap<>(); + private final ReentrantLock areaLock = new ReentrantLock(); + private final NMSRelighter delegate; + + @SuppressWarnings("rawtypes") + public PaperweightStarlightRelighter(ServerLevel serverLevel, IQueueExtent queue) { + this.serverLevel = serverLevel; + this.delegate = new NMSRelighter(queue); + } + + @Override + public boolean addChunk(int cx, int cz, byte[] skipReason, int bitmask) { + areaLock.lock(); + try { + long key = MathMan.pairInt(cx >> CHUNKS_PER_BATCH_SQRT_LOG2, cz >> CHUNKS_PER_BATCH_SQRT_LOG2); + // TODO probably submit here already if chunks.size == CHUNKS_PER_BATCH? + LongSet chunks = this.regions.computeIfAbsent(key, k -> new LongArraySet(CHUNKS_PER_BATCH >> 2)); + chunks.add(ChunkPos.asLong(cx, cz)); + } finally { + areaLock.unlock(); + } + return true; + } + + @Override + public void addLightUpdate(int x, int y, int z) { + delegate.addLightUpdate(x, y, z); + } + + /* + * This method is called "recursively", iterating and removing elements + * from the regions linked map. This way, chunks are loaded in batches to avoid + * OOMEs. + */ + @Override + public void fixLightingSafe(boolean sky) { + this.areaLock.lock(); + try { + if (regions.isEmpty()) { + return; + } + LongSet first = regions.removeFirst(); + fixLighting(first, () -> fixLightingSafe(true)); + } finally { + this.areaLock.unlock(); + } + } + + /* + * Processes a set of chunks and runs an action afterwards. + * The action is run async, the chunks are partly processed on the main thread + * (as required by the server). + */ + private void fixLighting(LongSet chunks, Runnable andThen) { + // convert from long keys to ChunkPos + Set coords = new HashSet<>(); + LongIterator iterator = chunks.iterator(); + while (iterator.hasNext()) { + coords.add(new ChunkPos(iterator.nextLong())); + } + TaskManager.taskManager().task(() -> { + // trigger chunk load and apply ticket on main thread + List> futures = new ArrayList<>(); + for (ChunkPos pos : coords) { + futures.add(serverLevel.getWorld().getChunkAtAsync(pos.x, pos.z) + .thenAccept(c -> serverLevel.getChunkSource().addTicketAtLevel( + FAWE_TICKET, + pos, + LIGHT_LEVEL, + Unit.INSTANCE + )) + ); + } + // collect futures and trigger relight once all chunks are loaded + CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).thenAccept(v -> + invokeRelight( + coords, + c -> { + }, // no callback for single chunks required + i -> { + if (i != coords.size()) { + LOGGER.warn("Processed {} chunks instead of {}", i, coords.size()); + } + // post process chunks on main thread + TaskManager.taskManager().task(() -> postProcessChunks(coords)); + // call callback on our own threads + TaskManager.taskManager().async(andThen); + } + ) + ); + }); + } + + private void invokeRelight( + Set coords, + Consumer chunkCallback, + IntConsumer processCallback + ) { + try { + serverLevel.getChunkSource().getLightEngine().relight(coords, chunkCallback, processCallback); + } catch (Exception e) { + LOGGER.error("Error occurred on relighting", e); + } + } + + /* + * Allow the server to unload the chunks again. + * Also, if chunk packets are sent delayed, we need to do that here + */ + private void postProcessChunks(Set coords) { + boolean delay = Settings.settings().LIGHTING.DELAY_PACKET_SENDING; + for (ChunkPos pos : coords) { + int x = pos.x; + int z = pos.z; + if (delay) { // we still need to send the block changes of that chunk + PaperweightPlatformAdapter.sendChunk(serverLevel, x, z, false); + } + serverLevel.getChunkSource().removeTicketAtLevel(FAWE_TICKET, pos, LIGHT_LEVEL, Unit.INSTANCE); + } + } + + @Override + public void clear() { + + } + + @Override + public void removeLighting() { + this.delegate.removeLighting(); + } + + @Override + public void fixBlockLighting() { + fixLightingSafe(true); + } + + @Override + public void fixSkyLighting() { + fixLightingSafe(true); + } + + @Override + public boolean isEmpty() { + return true; + } + + @Override + public ReentrantLock getLock() { + return this.lock; + } + + @Override + public boolean isFinished() { + return false; + } + + @Override + public void close() throws Exception { + fixLightingSafe(true); + } + +} diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightStarlightRelighterFactory.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightStarlightRelighterFactory.java new file mode 100644 index 000000000..e2658ee0e --- /dev/null +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightStarlightRelighterFactory.java @@ -0,0 +1,28 @@ +package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1; + +import com.fastasyncworldedit.core.extent.processor.lighting.NullRelighter; +import com.fastasyncworldedit.core.extent.processor.lighting.RelightMode; +import com.fastasyncworldedit.core.extent.processor.lighting.Relighter; +import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory; +import com.fastasyncworldedit.core.queue.IQueueChunk; +import com.fastasyncworldedit.core.queue.IQueueExtent; +import com.sk89q.worldedit.world.World; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.v1_20_R1.CraftWorld; + +import javax.annotation.Nonnull; + +public class PaperweightStarlightRelighterFactory implements RelighterFactory { + + @Override + public @Nonnull + @SuppressWarnings("rawtypes") + Relighter createRelighter(RelightMode relightMode, World world, IQueueExtent queue) { + org.bukkit.World w = Bukkit.getWorld(world.getName()); + if (w == null) { + return NullRelighter.INSTANCE; + } + return new PaperweightStarlightRelighter(((CraftWorld) w).getHandle(), queue); + } + +} diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/nbt/PaperweightLazyCompoundTag.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/nbt/PaperweightLazyCompoundTag.java new file mode 100644 index 000000000..dbdece689 --- /dev/null +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/nbt/PaperweightLazyCompoundTag.java @@ -0,0 +1,161 @@ +package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1.nbt; + +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.LazyCompoundTag; +import com.sk89q.jnbt.ListTag; +import com.sk89q.jnbt.StringTag; +import com.sk89q.jnbt.Tag; +import com.sk89q.worldedit.bukkit.WorldEditPlugin; +import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; +import net.minecraft.nbt.NumericTag; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; + +public class PaperweightLazyCompoundTag extends LazyCompoundTag { + + private final Supplier compoundTagSupplier; + private CompoundTag compoundTag; + + public PaperweightLazyCompoundTag(Supplier compoundTagSupplier) { + super(new HashMap<>()); + this.compoundTagSupplier = compoundTagSupplier; + } + + public PaperweightLazyCompoundTag(net.minecraft.nbt.CompoundTag compoundTag) { + this(() -> compoundTag); + } + + public net.minecraft.nbt.CompoundTag get() { + return compoundTagSupplier.get(); + } + + @Override + @SuppressWarnings("unchecked") + public Map getValue() { + if (compoundTag == null) { + compoundTag = (CompoundTag) WorldEditPlugin.getInstance().getBukkitImplAdapter().toNative(compoundTagSupplier.get()); + } + return compoundTag.getValue(); + } + + @Override + public CompoundBinaryTag asBinaryTag() { + getValue(); + return compoundTag.asBinaryTag(); + } + + public boolean containsKey(String key) { + return compoundTagSupplier.get().contains(key); + } + + public byte[] getByteArray(String key) { + return compoundTagSupplier.get().getByteArray(key); + } + + public byte getByte(String key) { + return compoundTagSupplier.get().getByte(key); + } + + public double getDouble(String key) { + return compoundTagSupplier.get().getDouble(key); + } + + public double asDouble(String key) { + net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key); + if (tag instanceof NumericTag numTag) { + return numTag.getAsDouble(); + } + return 0; + } + + public float getFloat(String key) { + return compoundTagSupplier.get().getFloat(key); + } + + public int[] getIntArray(String key) { + return compoundTagSupplier.get().getIntArray(key); + } + + public int getInt(String key) { + return compoundTagSupplier.get().getInt(key); + } + + public int asInt(String key) { + net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key); + if (tag instanceof NumericTag numTag) { + return numTag.getAsInt(); + } + return 0; + } + + @SuppressWarnings("unchecked") + public List getList(String key) { + net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key); + if (tag instanceof net.minecraft.nbt.ListTag nbtList) { + ArrayList list = new ArrayList<>(); + for (net.minecraft.nbt.Tag elem : nbtList) { + if (elem instanceof net.minecraft.nbt.CompoundTag compoundTag) { + list.add(new PaperweightLazyCompoundTag(compoundTag)); + } else { + list.add(WorldEditPlugin.getInstance().getBukkitImplAdapter().toNative(elem)); + } + } + return list; + } + return Collections.emptyList(); + } + + @SuppressWarnings("unchecked") + public ListTag getListTag(String key) { + net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key); + if (tag instanceof net.minecraft.nbt.ListTag) { + return (ListTag) WorldEditPlugin.getInstance().getBukkitImplAdapter().toNative(tag); + } + return new ListTag(StringTag.class, Collections.emptyList()); + } + + @SuppressWarnings("unchecked") + public List getList(String key, Class listType) { + ListTag listTag = getListTag(key); + if (listTag.getType().equals(listType)) { + return (List) listTag.getValue(); + } else { + return Collections.emptyList(); + } + } + + public long[] getLongArray(String key) { + return compoundTagSupplier.get().getLongArray(key); + } + + public long getLong(String key) { + return compoundTagSupplier.get().getLong(key); + } + + public long asLong(String key) { + net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key); + if (tag instanceof NumericTag numTag) { + return numTag.getAsLong(); + } + return 0; + } + + public short getShort(String key) { + return compoundTagSupplier.get().getShort(key); + } + + public String getString(String key) { + return compoundTagSupplier.get().getString(key); + } + + @Override + public String toString() { + return compoundTagSupplier.get().toString(); + } + +} diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/regen/PaperweightRegen.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/regen/PaperweightRegen.java new file mode 100644 index 000000000..b5d5a2733 --- /dev/null +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/regen/PaperweightRegen.java @@ -0,0 +1,594 @@ +package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1.regen; + +import com.fastasyncworldedit.bukkit.adapter.Regenerator; +import com.fastasyncworldedit.core.Fawe; +import com.fastasyncworldedit.core.queue.IChunkCache; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.util.ReflectionUtils; +import com.fastasyncworldedit.core.util.TaskManager; +import com.google.common.collect.ImmutableList; +import com.mojang.datafixers.util.Either; +import com.mojang.serialization.Lifecycle; +import com.sk89q.worldedit.bukkit.WorldEditPlugin; +import com.sk89q.worldedit.bukkit.adapter.Refraction; +import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_20_R1.PaperweightGetBlocks; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.internal.util.LogManagerCompat; +import com.sk89q.worldedit.regions.Region; +import com.sk89q.worldedit.util.io.file.SafeFiles; +import com.sk89q.worldedit.world.RegenOptions; +import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; +import net.minecraft.core.Holder; +import net.minecraft.core.Registry; +import net.minecraft.core.registries.Registries; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.resources.ResourceKey; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.dedicated.DedicatedServer; +import net.minecraft.server.level.ChunkMap; +import net.minecraft.server.level.ChunkTaskPriorityQueueSorter.Message; +import net.minecraft.server.level.ServerChunkCache; +import net.minecraft.server.level.ServerLevel; +import net.minecraft.server.level.ThreadedLevelLightEngine; +import net.minecraft.server.level.progress.ChunkProgressListener; +import net.minecraft.util.thread.ProcessorHandle; +import net.minecraft.util.thread.ProcessorMailbox; +import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.LevelHeightAccessor; +import net.minecraft.world.level.LevelSettings; +import net.minecraft.world.level.biome.Biome; +import net.minecraft.world.level.biome.BiomeSource; +import net.minecraft.world.level.biome.FixedBiomeSource; +import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraft.world.level.chunk.ChunkGenerator; +import net.minecraft.world.level.chunk.ChunkGeneratorStructureState; +import net.minecraft.world.level.chunk.ChunkStatus; +import net.minecraft.world.level.chunk.LevelChunk; +import net.minecraft.world.level.chunk.ProtoChunk; +import net.minecraft.world.level.chunk.UpgradeData; +import net.minecraft.world.level.dimension.LevelStem; +import net.minecraft.world.level.levelgen.FlatLevelSource; +import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator; +import net.minecraft.world.level.levelgen.NoiseGeneratorSettings; +import net.minecraft.world.level.levelgen.WorldOptions; +import net.minecraft.world.level.levelgen.blending.BlendingData; +import net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorSettings; +import net.minecraft.world.level.levelgen.structure.placement.ConcentricRingsStructurePlacement; +import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager; +import net.minecraft.world.level.storage.LevelStorageSource; +import net.minecraft.world.level.storage.PrimaryLevelData; +import org.apache.logging.log4j.Logger; +import org.bukkit.Bukkit; +import org.bukkit.Chunk; +import org.bukkit.craftbukkit.v1_20_R1.CraftServer; +import org.bukkit.craftbukkit.v1_20_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_20_R1.generator.CustomChunkGenerator; +import org.bukkit.generator.BiomeProvider; +import org.bukkit.generator.BlockPopulator; + +import javax.annotation.Nullable; +import java.lang.reflect.Field; +import java.nio.file.Path; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.OptionalLong; +import java.util.Random; +import java.util.concurrent.CompletableFuture; +import java.util.function.BooleanSupplier; +import java.util.function.Supplier; + +import static net.minecraft.core.registries.Registries.BIOME; + +public class PaperweightRegen extends Regenerator { + + private static final Logger LOGGER = LogManagerCompat.getLogger(); + + private static final Field serverWorldsField; + private static final Field paperConfigField; + private static final Field flatBedrockField; + private static final Field generatorSettingFlatField; + private static final Field generatorSettingBaseSupplierField; + private static final Field delegateField; + private static final Field chunkSourceField; + private static final Field generatorStructureStateField; + private static final Field ringPositionsField; + private static final Field hasGeneratedPositionsField; + + //list of chunk stati in correct order without FULL + private static final Map chunkStati = new LinkedHashMap<>(); + + static { + chunkStati.put(ChunkStatus.EMPTY, Concurrency.FULL); // empty: radius -1, does nothing + chunkStati.put(ChunkStatus.STRUCTURE_STARTS, Concurrency.NONE); // structure starts: uses unsynchronized maps + chunkStati.put( + ChunkStatus.STRUCTURE_REFERENCES, + Concurrency.FULL + ); // structure refs: radius 8, but only writes to current chunk + chunkStati.put(ChunkStatus.BIOMES, Concurrency.FULL); // biomes: radius 0 + chunkStati.put(ChunkStatus.NOISE, Concurrency.RADIUS); // noise: radius 8 + chunkStati.put(ChunkStatus.SURFACE, Concurrency.NONE); // surface: radius 0, requires NONE + chunkStati.put(ChunkStatus.CARVERS, Concurrency.NONE); // carvers: radius 0, but RADIUS and FULL change results + /*chunkStati.put( + ChunkStatus.LIQUID_CARVERS, + Concurrency.NONE + ); // liquid carvers: radius 0, but RADIUS and FULL change results*/ + chunkStati.put(ChunkStatus.FEATURES, Concurrency.NONE); // features: uses unsynchronized maps + chunkStati.put( + ChunkStatus.LIGHT, + Concurrency.FULL + ); // light: radius 1, but no writes to other chunks, only current chunk + chunkStati.put(ChunkStatus.SPAWN, Concurrency.FULL); // spawn: radius 0 + // chunkStati.put(ChunkStatus.HEIGHTMAPS, Concurrency.FULL); // heightmaps: radius 0 + + try { + serverWorldsField = CraftServer.class.getDeclaredField("worlds"); + serverWorldsField.setAccessible(true); + + Field tmpPaperConfigField; + Field tmpFlatBedrockField; + try { //only present on paper + tmpPaperConfigField = Level.class.getDeclaredField("paperConfig"); + tmpPaperConfigField.setAccessible(true); + + tmpFlatBedrockField = tmpPaperConfigField.getType().getDeclaredField("generateFlatBedrock"); + tmpFlatBedrockField.setAccessible(true); + } catch (Exception e) { + tmpPaperConfigField = null; + tmpFlatBedrockField = null; + } + paperConfigField = tmpPaperConfigField; + flatBedrockField = tmpFlatBedrockField; + + generatorSettingBaseSupplierField = NoiseBasedChunkGenerator.class.getDeclaredField(Refraction.pickName( + "settings", "e")); + generatorSettingBaseSupplierField.setAccessible(true); + + generatorSettingFlatField = FlatLevelSource.class.getDeclaredField(Refraction.pickName("settings", "d")); + generatorSettingFlatField.setAccessible(true); + + delegateField = CustomChunkGenerator.class.getDeclaredField("delegate"); + delegateField.setAccessible(true); + + chunkSourceField = ServerLevel.class.getDeclaredField(Refraction.pickName("chunkSource", "I")); + chunkSourceField.setAccessible(true); + + generatorStructureStateField = ChunkMap.class.getDeclaredField(Refraction.pickName("chunkGeneratorState", "v")); + generatorStructureStateField.setAccessible(true); + + ringPositionsField = ChunkGeneratorStructureState.class.getDeclaredField(Refraction.pickName("ringPositions", "g")); + ringPositionsField.setAccessible(true); + + hasGeneratedPositionsField = ChunkGeneratorStructureState.class.getDeclaredField( + Refraction.pickName("hasGeneratedPositions", "h") + ); + hasGeneratedPositionsField.setAccessible(true); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + //runtime + private ServerLevel originalServerWorld; + private ServerChunkCache originalChunkProvider; + private ServerLevel freshWorld; + private ServerChunkCache freshChunkProvider; + private LevelStorageSource.LevelStorageAccess session; + private StructureTemplateManager structureTemplateManager; + private ThreadedLevelLightEngine threadedLevelLightEngine; + private ChunkGenerator chunkGenerator; + + private Path tempDir; + + private boolean generateFlatBedrock = false; + + public PaperweightRegen(org.bukkit.World originalBukkitWorld, Region region, Extent target, RegenOptions options) { + super(originalBukkitWorld, region, target, options); + } + + @Override + protected boolean prepare() { + this.originalServerWorld = ((CraftWorld) originalBukkitWorld).getHandle(); + originalChunkProvider = originalServerWorld.getChunkSource(); + if (!(originalChunkProvider instanceof ServerChunkCache)) { + return false; + } + + //flat bedrock? (only on paper) + if (paperConfigField != null) { + try { + generateFlatBedrock = flatBedrockField.getBoolean(paperConfigField.get(originalServerWorld)); + } catch (Exception ignored) { + } + } + + seed = options.getSeed().orElse(originalServerWorld.getSeed()); + chunkStati.forEach((s, c) -> super.chunkStati.put(new ChunkStatusWrap(s), c)); + + return true; + } + + @Override + @SuppressWarnings("unchecked") + protected boolean initNewWorld() throws Exception { + //world folder + tempDir = java.nio.file.Files.createTempDirectory("FastAsyncWorldEditWorldGen"); + + //prepare for world init (see upstream implementation for reference) + org.bukkit.World.Environment environment = originalBukkitWorld.getEnvironment(); + org.bukkit.generator.ChunkGenerator generator = originalBukkitWorld.getGenerator(); + LevelStorageSource levelStorageSource = LevelStorageSource.createDefault(tempDir); + ResourceKey levelStemResourceKey = getWorldDimKey(environment); + session = levelStorageSource.createAccess("faweregentempworld", levelStemResourceKey); + PrimaryLevelData originalWorldData = originalServerWorld.serverLevelData; + + MinecraftServer server = originalServerWorld.getCraftServer().getServer(); + WorldOptions originalOpts = originalWorldData.worldGenOptions(); + WorldOptions newOpts = options.getSeed().isPresent() + ? originalOpts.withSeed(OptionalLong.of(seed)) + : originalOpts; + LevelSettings newWorldSettings = new LevelSettings( + "faweregentempworld", + originalWorldData.settings.gameType(), + originalWorldData.settings.hardcore(), + originalWorldData.settings.difficulty(), + originalWorldData.settings.allowCommands(), + originalWorldData.settings.gameRules(), + originalWorldData.settings.getDataConfiguration() + ); + + PrimaryLevelData.SpecialWorldProperty specialWorldProperty = + originalWorldData.isFlatWorld() + ? PrimaryLevelData.SpecialWorldProperty.FLAT + : originalWorldData.isDebugWorld() + ? PrimaryLevelData.SpecialWorldProperty.DEBUG + : PrimaryLevelData.SpecialWorldProperty.NONE; + PrimaryLevelData newWorldData = new PrimaryLevelData(newWorldSettings, newOpts, specialWorldProperty, Lifecycle.stable()); + + BiomeProvider biomeProvider = getBiomeProvider(); + + + //init world + freshWorld = Fawe.instance().getQueueHandler().sync((Supplier) () -> new ServerLevel( + server, + server.executor, + session, + newWorldData, + originalServerWorld.dimension(), + DedicatedServer.getServer().registryAccess().registry(Registries.LEVEL_STEM).orElseThrow() + .getOrThrow(levelStemResourceKey), + new RegenNoOpWorldLoadListener(), + originalServerWorld.isDebug(), + seed, + ImmutableList.of(), + false, + originalServerWorld.getRandomSequences(), + environment, + generator, + biomeProvider + ) { + + private final Holder singleBiome = options.hasBiomeType() ? DedicatedServer.getServer().registryAccess() + .registryOrThrow(BIOME).asHolderIdMap().byIdOrThrow( + WorldEditPlugin.getInstance().getBukkitImplAdapter().getInternalBiomeId(options.getBiomeType()) + ) : null; + + @Override + public void tick(BooleanSupplier shouldKeepTicking) { //no ticking + } + + @Override + public Holder getUncachedNoiseBiome(int biomeX, int biomeY, int biomeZ) { + if (options.hasBiomeType()) { + return singleBiome; + } + return PaperweightRegen.this.chunkGenerator.getBiomeSource().getNoiseBiome( + biomeX, biomeY, biomeZ, getChunkSource().randomState().sampler() + ); + } + }).get(); + freshWorld.noSave = true; + removeWorldFromWorldsMap(); + newWorldData.checkName(originalServerWorld.serverLevelData.getLevelName()); //rename to original world name + if (paperConfigField != null) { + paperConfigField.set(freshWorld, originalServerWorld.paperConfig()); + } + + ChunkGenerator originalGenerator = originalChunkProvider.getGenerator(); + if (originalGenerator instanceof FlatLevelSource flatLevelSource) { + FlatLevelGeneratorSettings generatorSettingFlat = flatLevelSource.settings(); + chunkGenerator = new FlatLevelSource(generatorSettingFlat); + } else if (originalGenerator instanceof NoiseBasedChunkGenerator noiseBasedChunkGenerator) { + Holder generatorSettingBaseSupplier = (Holder) generatorSettingBaseSupplierField.get( + originalGenerator); + BiomeSource biomeSource; + if (options.hasBiomeType()) { + + biomeSource = new FixedBiomeSource( + DedicatedServer.getServer().registryAccess() + .registryOrThrow(BIOME).asHolderIdMap().byIdOrThrow( + WorldEditPlugin.getInstance().getBukkitImplAdapter().getInternalBiomeId(options.getBiomeType()) + ) + ); + } else { + biomeSource = originalGenerator.getBiomeSource(); + } + chunkGenerator = new NoiseBasedChunkGenerator( + biomeSource, + generatorSettingBaseSupplier + ); + } else if (originalGenerator instanceof CustomChunkGenerator customChunkGenerator) { + chunkGenerator = customChunkGenerator.getDelegate(); + } else { + LOGGER.error("Unsupported generator type {}", originalGenerator.getClass().getName()); + return false; + } + if (generator != null) { + chunkGenerator = new CustomChunkGenerator(freshWorld, chunkGenerator, generator); + generateConcurrent = generator.isParallelCapable(); + } +// chunkGenerator.conf = freshWorld.spigotConfig; - Does not exist anymore, may need to be re-addressed + + freshChunkProvider = new ServerChunkCache( + freshWorld, + session, + server.getFixerUpper(), + server.getStructureManager(), + server.executor, + chunkGenerator, + freshWorld.spigotConfig.viewDistance, + freshWorld.spigotConfig.simulationDistance, + server.forceSynchronousWrites(), + new RegenNoOpWorldLoadListener(), + (chunkCoordIntPair, state) -> { + }, + () -> server.overworld().getDataStorage() + ) { + // redirect to LevelChunks created in #createChunks + @Override + public ChunkAccess getChunk(int x, int z, ChunkStatus chunkstatus, boolean create) { + ChunkAccess chunkAccess = getChunkAt(x, z); + if (chunkAccess == null && create) { + chunkAccess = createChunk(getProtoChunkAt(x, z)); + } + return chunkAccess; + } + }; + + if (seed == originalOpts.seed() && !options.hasBiomeType()) { + // Optimisation for needless ring position calculation when the seed and biome is the same. + ChunkGeneratorStructureState state = (ChunkGeneratorStructureState) generatorStructureStateField.get(originalChunkProvider.chunkMap); + boolean hasGeneratedPositions = hasGeneratedPositionsField.getBoolean(state); + if (hasGeneratedPositions) { + Map>> origPositions = + (Map>>) ringPositionsField.get(state); + Map>> copy = new Object2ObjectArrayMap<>( + origPositions); + ChunkGeneratorStructureState newState = (ChunkGeneratorStructureState) generatorStructureStateField.get(freshChunkProvider.chunkMap); + ringPositionsField.set(newState, copy); + hasGeneratedPositionsField.setBoolean(newState, true); + } + } + + + ReflectionUtils.unsafeSet(chunkSourceField, freshWorld, freshChunkProvider); + //let's start then + structureTemplateManager = server.getStructureManager(); + threadedLevelLightEngine = new NoOpLightEngine(freshChunkProvider); + + return true; + } + + @Override + protected void cleanup() { + try { + session.close(); + } catch (Exception ignored) { + } + + //shutdown chunk provider + try { + Fawe.instance().getQueueHandler().sync(() -> { + try { + freshChunkProvider.close(false); + } catch (Exception e) { + throw new RuntimeException(e); + } + }); + } catch (Exception ignored) { + } + + //remove world from server + try { + Fawe.instance().getQueueHandler().sync(this::removeWorldFromWorldsMap); + } catch (Exception ignored) { + } + + //delete directory + try { + SafeFiles.tryHardToDeleteDir(tempDir); + } catch (Exception ignored) { + } + } + + @Override + protected ProtoChunk createProtoChunk(int x, int z) { + return new FastProtoChunk(new ChunkPos(x, z), UpgradeData.EMPTY, freshWorld, + this.freshWorld.registryAccess().registryOrThrow(BIOME), null + ); + } + + @Override + protected LevelChunk createChunk(ProtoChunk protoChunk) { + return new LevelChunk( + freshWorld, + protoChunk, + null // we don't want to add entities + ); + } + + @Override + protected ChunkStatusWrap getFullChunkStatus() { + return new ChunkStatusWrap(ChunkStatus.FULL); + } + + @Override + protected List getBlockPopulators() { + return originalServerWorld.getWorld().getPopulators(); + } + + @Override + protected void populate(LevelChunk levelChunk, Random random, BlockPopulator blockPopulator) { + // BlockPopulator#populate has to be called synchronously for TileEntity access + TaskManager.taskManager().task(() -> { + final CraftWorld world = freshWorld.getWorld(); + final Chunk chunk = world.getChunkAt(levelChunk.locX, levelChunk.locZ); + blockPopulator.populate(world, random, chunk); + }); + } + + @Override + protected IChunkCache initSourceQueueCache() { + return (chunkX, chunkZ) -> new PaperweightGetBlocks(freshWorld, chunkX, chunkZ) { + @Override + public LevelChunk ensureLoaded(ServerLevel nmsWorld, int x, int z) { + return getChunkAt(x, z); + } + }; + } + + //util + @SuppressWarnings("unchecked") + private void removeWorldFromWorldsMap() { + Fawe.instance().getQueueHandler().sync(() -> { + try { + Map map = (Map) serverWorldsField.get(Bukkit.getServer()); + map.remove("faweregentempworld"); + } catch (IllegalAccessException e) { + throw new RuntimeException(e); + } + }); + } + + private ResourceKey getWorldDimKey(org.bukkit.World.Environment env) { + return switch (env) { + case NETHER -> LevelStem.NETHER; + case THE_END -> LevelStem.END; + default -> LevelStem.OVERWORLD; + }; + } + + private static class RegenNoOpWorldLoadListener implements ChunkProgressListener { + + private RegenNoOpWorldLoadListener() { + } + + @Override + public void updateSpawnPos(ChunkPos spawnPos) { + } + + @Override + public void onStatusChange(ChunkPos pos, @Nullable ChunkStatus status) { + } + + @Override + public void start() { + + } + + @Override + public void stop() { + } + + // TODO Paper only(?) @Override + public void setChunkRadius(int radius) { + } + + } + + private class FastProtoChunk extends ProtoChunk { + + public FastProtoChunk( + final ChunkPos pos, + final UpgradeData upgradeData, + final LevelHeightAccessor world, + final Registry biomeRegistry, + @Nullable final BlendingData blendingData + ) { + super(pos, upgradeData, world, biomeRegistry, blendingData); + } + + // avoid warning on paper + + // compatibility with spigot + + public boolean generateFlatBedrock() { + return generateFlatBedrock; + } + + // no one will ever see the entities! + @Override + public List getEntities() { + return Collections.emptyList(); + } + + } + + protected class ChunkStatusWrap extends ChunkStatusWrapper { + + private final ChunkStatus chunkStatus; + + public ChunkStatusWrap(ChunkStatus chunkStatus) { + this.chunkStatus = chunkStatus; + } + + @Override + public int requiredNeighborChunkRadius() { + return chunkStatus.getRange(); + } + + @Override + public String name() { + return chunkStatus.toString(); + } + + @Override + public CompletableFuture processChunk(Long xz, List accessibleChunks) { + return chunkStatus.generate( + Runnable::run, // TODO revisit, we might profit from this somehow? + freshWorld, + chunkGenerator, + structureTemplateManager, + threadedLevelLightEngine, + c -> CompletableFuture.completedFuture(Either.left(c)), + accessibleChunks + ); + } + + } + + /** + * A light engine that does nothing. As light is calculated after pasting anyway, we can avoid + * work this way. + */ + static class NoOpLightEngine extends ThreadedLevelLightEngine { + + private static final ProcessorMailbox MAILBOX = ProcessorMailbox.create(task -> { + }, "fawe-no-op"); + private static final ProcessorHandle> HANDLE = ProcessorHandle.of("fawe-no-op", m -> { + }); + + public NoOpLightEngine(final ServerChunkCache chunkProvider) { + super(chunkProvider, chunkProvider.chunkMap, false, MAILBOX, HANDLE); + } + + @Override + public CompletableFuture lightChunk(final ChunkAccess chunk, final boolean excludeBlocks) { + return CompletableFuture.completedFuture(chunk); + } + + } + +} diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index 303e8fb0c..426eb4c4f 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -3,7 +3,7 @@ import io.papermc.paperweight.userdev.attribute.Obfuscation plugins { `java-library` - id("com.modrinth.minotaur") version "2.7.5" + id("com.modrinth.minotaur") version "2.8.0" } project.description = "Bukkit" @@ -206,7 +206,7 @@ tasks { versionNumber.set("${project.version}") versionType.set("release") uploadFile.set(file("build/libs/${rootProject.name}-Bukkit-${project.version}.jar")) - gameVersions.addAll(listOf("1.19.4", "1.19.3", "1.19.2", "1.19.1", "1.19", "1.18.2", "1.17.1", "1.16.5")) + gameVersions.addAll(listOf("1.20", "1.19.4", "1.19.3", "1.19.2", "1.19.1", "1.19", "1.18.2", "1.17.1", "1.16.5")) loaders.addAll(listOf("paper", "spigot")) changelog.set("The changelog is available on GitHub: https://github.com/IntellectualSites/" + "FastAsyncWorldEdit/releases/tag/${project.version}") diff --git a/worldedit-core/build.gradle.kts b/worldedit-core/build.gradle.kts index 21ccaa0b8..c9b34d5b1 100644 --- a/worldedit-core/build.gradle.kts +++ b/worldedit-core/build.gradle.kts @@ -12,7 +12,7 @@ applyPlatformAndCoreConfiguration() dependencies { constraints { implementation("org.yaml:snakeyaml") { - version { strictly("1.33") } + version { strictly("2.0") } because("Bukkit provides SnakeYaml") } } @@ -28,7 +28,8 @@ dependencies { implementation("com.google.code.gson:gson") // Platform expectations - implementation("org.yaml:snakeyaml") + // TODO update bom-newest + implementation("org.yaml:snakeyaml:2.0") // Logging implementation("org.apache.logging.log4j:log4j-api") diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/file/YamlConstructor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/file/YamlConstructor.java index 72fce11e9..341cd5c23 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/file/YamlConstructor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/file/YamlConstructor.java @@ -1,6 +1,7 @@ package com.fastasyncworldedit.core.configuration.file; import com.fastasyncworldedit.core.configuration.serialization.ConfigurationSerialization; +import org.yaml.snakeyaml.LoaderOptions; import org.yaml.snakeyaml.constructor.SafeConstructor; import org.yaml.snakeyaml.error.YAMLException; import org.yaml.snakeyaml.nodes.Node; @@ -12,6 +13,7 @@ import java.util.Map; public class YamlConstructor extends SafeConstructor { public YamlConstructor() { + super(new LoaderOptions()); yamlConstructors.put(Tag.MAP, new ConstructCustomObject()); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/file/YamlRepresenter.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/file/YamlRepresenter.java index d784eb483..a8f8d985a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/file/YamlRepresenter.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/file/YamlRepresenter.java @@ -3,6 +3,7 @@ package com.fastasyncworldedit.core.configuration.file; import com.fastasyncworldedit.core.configuration.ConfigurationSection; import com.fastasyncworldedit.core.configuration.serialization.ConfigurationSerializable; import com.fastasyncworldedit.core.configuration.serialization.ConfigurationSerialization; +import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.nodes.Node; import org.yaml.snakeyaml.representer.Representer; @@ -12,6 +13,7 @@ import java.util.Map; public class YamlRepresenter extends Representer { public YamlRepresenter() { + super(new DumperOptions()); this.multiRepresenters.put(ConfigurationSection.class, new RepresentConfigurationSection()); this.multiRepresenters.put(ConfigurationSerializable.class, new RepresentConfigurationSerializable()); } diff --git a/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java b/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java index dd65adab1..146428c3e 100644 --- a/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java +++ b/worldedit-core/src/main/java/com/sk89q/util/yaml/YAMLProcessor.java @@ -105,7 +105,7 @@ public class YAMLProcessor extends YAMLNode { // pre-1.32 snakeyaml } - yaml = new Yaml(new SafeConstructor(), representer, dumperOptions, loaderOptions); + yaml = new Yaml(new SafeConstructor(new LoaderOptions()), representer, dumperOptions, loaderOptions); this.file = file; } @@ -310,6 +310,7 @@ public class YAMLProcessor extends YAMLNode { private static class FancyRepresenter extends Representer { private FancyRepresenter() { + super(new DumperOptions()); this.nullRepresenter = o -> representScalar(Tag.NULL, ""); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/Constants.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/Constants.java index 1418015f4..0cdd9e8dc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/Constants.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/Constants.java @@ -81,4 +81,9 @@ public final class Constants { */ public static final int DATA_VERSION_MC_1_19 = 3105; + /** + * The DataVersion for Minecraft 1.20 + */ + public static final int DATA_VERSION_MC_1_20 = 3463; + } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeTypes.java index ae8e227a4..6fe08a295 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/biome/BiomeTypes.java @@ -50,6 +50,8 @@ public final class BiomeTypes { @Deprecated public static final BiomeType BIRCH_FOREST_HILLS = get("minecraft:birch_forest_hills"); @Nullable + public static final BiomeType CHERRY_GROVE = get("minecraft:cherry_grove"); + @Nullable public static final BiomeType COLD_OCEAN = get("minecraft:cold_ocean"); @Nullable public static final BiomeType CRIMSON_FOREST = get("minecraft:crimson_forest"); @@ -137,6 +139,9 @@ public final class BiomeTypes { @Nullable @Deprecated public static final BiomeType MODIFIED_BADLANDS_PLATEAU = get("minecraft:modified_badlands_plateau"); + @Deprecated + @Nullable + public static final BiomeType MODIFIED_GRAVELLY_HILLS = get("minecraft:modified_gravelly_hills"); @Nullable @Deprecated public static final BiomeType MODIFIED_GRAVELLY_MOUNTAINS = get("minecraft:modified_gravelly_mountains"); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java index aa3e16a6c..47905dcd4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockCategories.java @@ -28,12 +28,15 @@ package com.sk89q.worldedit.world.block; public final class BlockCategories { public static final BlockCategory ACACIA_LOGS = get("minecraft:acacia_logs"); + public static final BlockCategory ALL_HANGING_SIGNS = get("minecraft:all_hanging_signs"); + public static final BlockCategory ALL_SIGNS = get("minecraft:all_signs"); public static final BlockCategory ANCIENT_CITY_REPLACEABLE = get("minecraft:ancient_city_replaceable"); public static final BlockCategory ANIMALS_SPAWNABLE_ON = get("minecraft:animals_spawnable_on"); public static final BlockCategory ANVIL = get("minecraft:anvil"); public static final BlockCategory AXOLOTLS_SPAWNABLE_ON = get("minecraft:axolotls_spawnable_on"); public static final BlockCategory AZALEA_GROWS_ON = get("minecraft:azalea_grows_on"); public static final BlockCategory AZALEA_ROOT_REPLACEABLE = get("minecraft:azalea_root_replaceable"); + public static final BlockCategory BAMBOO_BLOCKS = get("minecraft:bamboo_blocks"); public static final BlockCategory BAMBOO_PLANTABLE_ON = get("minecraft:bamboo_plantable_on"); public static final BlockCategory BANNERS = get("minecraft:banners"); public static final BlockCategory BASE_STONE_NETHER = get("minecraft:base_stone_nether"); @@ -51,8 +54,11 @@ public final class BlockCategories { @Deprecated public static final BlockCategory CARPETS = get("minecraft:carpets"); public static final BlockCategory CAULDRONS = get("minecraft:cauldrons"); public static final BlockCategory CAVE_VINES = get("minecraft:cave_vines"); + public static final BlockCategory CEILING_HANGING_SIGNS = get("minecraft:ceiling_hanging_signs"); + public static final BlockCategory CHERRY_LOGS = get("minecraft:cherry_logs"); public static final BlockCategory CLIMBABLE = get("minecraft:climbable"); public static final BlockCategory COAL_ORES = get("minecraft:coal_ores"); + public static final BlockCategory COMBINATION_STEP_SOUND_BLOCKS = get("minecraft:combination_step_sound_blocks"); public static final BlockCategory COMPLETES_FIND_TREE_TUTORIAL = get("minecraft:completes_find_tree_tutorial"); public static final BlockCategory CONVERTABLE_TO_MUD = get("minecraft:convertable_to_mud"); public static final BlockCategory COPPER_ORES = get("minecraft:copper_ores"); @@ -75,6 +81,8 @@ public final class BlockCategories { public static final BlockCategory DRAGON_TRANSPARENT = get("minecraft:dragon_transparent"); public static final BlockCategory DRIPSTONE_REPLACEABLE_BLOCKS = get("minecraft:dripstone_replaceable_blocks"); public static final BlockCategory EMERALD_ORES = get("minecraft:emerald_ores"); + public static final BlockCategory ENCHANTMENT_POWER_PROVIDER = get("minecraft:enchantment_power_provider"); + public static final BlockCategory ENCHANTMENT_POWER_TRANSMITTER = get("minecraft:enchantment_power_transmitter"); public static final BlockCategory ENDERMAN_HOLDABLE = get("minecraft:enderman_holdable"); public static final BlockCategory FALL_DAMAGE_RESETTING = get("minecraft:fall_damage_resetting"); public static final BlockCategory FEATURES_CANNOT_REPLACE = get("minecraft:features_cannot_replace"); @@ -97,6 +105,7 @@ public final class BlockCategories { public static final BlockCategory INFINIBURN_NETHER = get("minecraft:infiniburn_nether"); public static final BlockCategory INFINIBURN_OVERWORLD = get("minecraft:infiniburn_overworld"); public static final BlockCategory INSIDE_STEP_SOUND_BLOCKS = get("minecraft:inside_step_sound_blocks"); + public static final BlockCategory INVALID_SPAWN_INSIDE = get("minecraft:invalid_spawn_inside"); public static final BlockCategory IRON_ORES = get("minecraft:iron_ores"); public static final BlockCategory JUNGLE_LOGS = get("minecraft:jungle_logs"); public static final BlockCategory LAPIS_ORES = get("minecraft:lapis_ores"); @@ -106,6 +115,7 @@ public final class BlockCategories { public static final BlockCategory LOGS = get("minecraft:logs"); public static final BlockCategory LOGS_THAT_BURN = get("minecraft:logs_that_burn"); public static final BlockCategory LUSH_GROUND_REPLACEABLE = get("minecraft:lush_ground_replaceable"); + public static final BlockCategory MAINTAINS_FARMLAND = get("minecraft:maintains_farmland"); public static final BlockCategory MANGROVE_LOGS = get("minecraft:mangrove_logs"); public static final BlockCategory MANGROVE_LOGS_CAN_GROW_THROUGH = get("minecraft:mangrove_logs_can_grow_through"); public static final BlockCategory MANGROVE_ROOTS_CAN_GROW_THROUGH = get("minecraft:mangrove_roots_can_grow_through"); @@ -120,7 +130,6 @@ public final class BlockCategories { public static final BlockCategory NEEDS_IRON_TOOL = get("minecraft:needs_iron_tool"); public static final BlockCategory NEEDS_STONE_TOOL = get("minecraft:needs_stone_tool"); public static final BlockCategory NETHER_CARVER_REPLACEABLES = get("minecraft:nether_carver_replaceables"); - public static final BlockCategory NON_FLAMMABLE_WOOD = get("minecraft:non_flammable_wood"); public static final BlockCategory NYLIUM = get("minecraft:nylium"); public static final BlockCategory OAK_LOGS = get("minecraft:oak_logs"); public static final BlockCategory OCCLUDES_VIBRATION_SIGNALS = get("minecraft:occludes_vibration_signals"); @@ -136,7 +145,9 @@ public final class BlockCategories { public static final BlockCategory RABBITS_SPAWNABLE_ON = get("minecraft:rabbits_spawnable_on"); public static final BlockCategory RAILS = get("minecraft:rails"); public static final BlockCategory REDSTONE_ORES = get("minecraft:redstone_ores"); - public static final BlockCategory REPLACEABLE_PLANTS = get("minecraft:replaceable_plants"); + public static final BlockCategory REPLACEABLE = get("minecraft:replaceable"); + public static final BlockCategory REPLACEABLE_BY_TREES = get("minecraft:replaceable_by_trees"); + @Deprecated public static final BlockCategory REPLACEABLE_PLANTS = get("minecraft:replaceable_plants"); public static final BlockCategory SAND = get("minecraft:sand"); public static final BlockCategory SAPLINGS = get("minecraft:saplings"); public static final BlockCategory SCULK_REPLACEABLE = get("minecraft:sculk_replaceable"); @@ -146,7 +157,10 @@ public final class BlockCategories { public static final BlockCategory SLABS = get("minecraft:slabs"); public static final BlockCategory SMALL_DRIPLEAF_PLACEABLE = get("minecraft:small_dripleaf_placeable"); public static final BlockCategory SMALL_FLOWERS = get("minecraft:small_flowers"); + public static final BlockCategory SMELTS_TO_GLASS = get("minecraft:smelts_to_glass"); public static final BlockCategory SNAPS_GOAT_HORN = get("minecraft:snaps_goat_horn"); + public static final BlockCategory SNIFFER_DIGGABLE_BLOCK = get("minecraft:sniffer_diggable_block"); + public static final BlockCategory SNIFFER_EGG_HATCH_BOOST = get("minecraft:sniffer_egg_hatch_boost"); public static final BlockCategory SNOW = get("minecraft:snow"); public static final BlockCategory SNOW_LAYER_CAN_SURVIVE_ON = get("minecraft:snow_layer_can_survive_on"); public static final BlockCategory SNOW_LAYER_CANNOT_SURVIVE_ON = get("minecraft:snow_layer_cannot_survive_on"); @@ -156,16 +170,21 @@ public final class BlockCategories { public static final BlockCategory STAIRS = get("minecraft:stairs"); public static final BlockCategory STANDING_SIGNS = get("minecraft:standing_signs"); public static final BlockCategory STONE_BRICKS = get("minecraft:stone_bricks"); + public static final BlockCategory STONE_BUTTONS = get("minecraft:stone_buttons"); public static final BlockCategory STONE_ORE_REPLACEABLES = get("minecraft:stone_ore_replaceables"); public static final BlockCategory STONE_PRESSURE_PLATES = get("minecraft:stone_pressure_plates"); public static final BlockCategory STRIDER_WARM_BLOCKS = get("minecraft:strider_warm_blocks"); + public static final BlockCategory SWORD_EFFICIENT = get("minecraft:sword_efficient"); public static final BlockCategory TALL_FLOWERS = get("minecraft:tall_flowers"); public static final BlockCategory TERRACOTTA = get("minecraft:terracotta"); + public static final BlockCategory TRAIL_RUINS_REPLACEABLE = get("minecraft:trail_ruins_replaceable"); public static final BlockCategory TRAPDOORS = get("minecraft:trapdoors"); public static final BlockCategory UNDERWATER_BONEMEALS = get("minecraft:underwater_bonemeals"); public static final BlockCategory UNSTABLE_BOTTOM_CENTER = get("minecraft:unstable_bottom_center"); public static final BlockCategory VALID_SPAWN = get("minecraft:valid_spawn"); + public static final BlockCategory VIBRATION_RESONATORS = get("minecraft:vibration_resonators"); public static final BlockCategory WALL_CORALS = get("minecraft:wall_corals"); + public static final BlockCategory WALL_HANGING_SIGNS = get("minecraft:wall_hanging_signs"); public static final BlockCategory WALL_POST_OVERRIDE = get("minecraft:wall_post_override"); public static final BlockCategory WALL_SIGNS = get("minecraft:wall_signs"); public static final BlockCategory WALLS = get("minecraft:walls"); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java index b8af4bce5..0cd3f55e5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockTypes.java @@ -55,6 +55,8 @@ public final class BlockTypes { @Nullable public static final BlockType ACACIA_FENCE_GATE = init(); @Nullable + public static final BlockType ACACIA_HANGING_SIGN = init(); + @Nullable public static final BlockType ACACIA_LEAVES = init(); @Nullable public static final BlockType ACACIA_LOG = init(); @@ -73,6 +75,8 @@ public final class BlockTypes { @Nullable public static final BlockType ACACIA_TRAPDOOR = init(); @Nullable + public static final BlockType ACACIA_WALL_HANGING_SIGN = init(); + @Nullable public static final BlockType ACACIA_WALL_SIGN = init(); @Nullable public static final BlockType ACACIA_WOOD = init(); @@ -111,8 +115,42 @@ public final class BlockTypes { @Nullable public static final BlockType BAMBOO = init(); @Nullable + public static final BlockType BAMBOO_BLOCK = init(); + @Nullable + public static final BlockType BAMBOO_BUTTON = init(); + @Nullable + public static final BlockType BAMBOO_DOOR = init(); + @Nullable + public static final BlockType BAMBOO_FENCE = init(); + @Nullable + public static final BlockType BAMBOO_FENCE_GATE = init(); + @Nullable + public static final BlockType BAMBOO_HANGING_SIGN = init(); + @Nullable + public static final BlockType BAMBOO_MOSAIC = init(); + @Nullable + public static final BlockType BAMBOO_MOSAIC_SLAB = init(); + @Nullable + public static final BlockType BAMBOO_MOSAIC_STAIRS = init(); + @Nullable + public static final BlockType BAMBOO_PLANKS = init(); + @Nullable + public static final BlockType BAMBOO_PRESSURE_PLATE = init(); + @Nullable public static final BlockType BAMBOO_SAPLING = init(); @Nullable + public static final BlockType BAMBOO_SIGN = init(); + @Nullable + public static final BlockType BAMBOO_SLAB = init(); + @Nullable + public static final BlockType BAMBOO_STAIRS = init(); + @Nullable + public static final BlockType BAMBOO_TRAPDOOR = init(); + @Nullable + public static final BlockType BAMBOO_WALL_HANGING_SIGN = init(); + @Nullable + public static final BlockType BAMBOO_WALL_SIGN = init(); + @Nullable public static final BlockType BARREL = init(); @Nullable public static final BlockType BARRIER = init(); @@ -143,6 +181,8 @@ public final class BlockTypes { @Nullable public static final BlockType BIRCH_FENCE_GATE = init(); @Nullable + public static final BlockType BIRCH_HANGING_SIGN = init(); + @Nullable public static final BlockType BIRCH_LEAVES = init(); @Nullable public static final BlockType BIRCH_LOG = init(); @@ -161,6 +201,8 @@ public final class BlockTypes { @Nullable public static final BlockType BIRCH_TRAPDOOR = init(); @Nullable + public static final BlockType BIRCH_WALL_HANGING_SIGN = init(); + @Nullable public static final BlockType BIRCH_WALL_SIGN = init(); @Nullable public static final BlockType BIRCH_WOOD = init(); @@ -307,6 +349,8 @@ public final class BlockTypes { @Nullable public static final BlockType CALCITE = init(); @Nullable + public static final BlockType CALIBRATED_SCULK_SENSOR = init(); + @Nullable public static final BlockType CAMPFIRE = init(); @Nullable public static final BlockType CANDLE = init(); @@ -331,10 +375,46 @@ public final class BlockTypes { @Nullable public static final BlockType CHAIN_COMMAND_BLOCK = init(); @Nullable + public static final BlockType CHERRY_BUTTON = init(); + @Nullable + public static final BlockType CHERRY_DOOR = init(); + @Nullable + public static final BlockType CHERRY_FENCE = init(); + @Nullable + public static final BlockType CHERRY_FENCE_GATE = init(); + @Nullable + public static final BlockType CHERRY_HANGING_SIGN = init(); + @Nullable + public static final BlockType CHERRY_LEAVES = init(); + @Nullable + public static final BlockType CHERRY_LOG = init(); + @Nullable + public static final BlockType CHERRY_PLANKS = init(); + @Nullable + public static final BlockType CHERRY_PRESSURE_PLATE = init(); + @Nullable + public static final BlockType CHERRY_SAPLING = init(); + @Nullable + public static final BlockType CHERRY_SIGN = init(); + @Nullable + public static final BlockType CHERRY_SLAB = init(); + @Nullable + public static final BlockType CHERRY_STAIRS = init(); + @Nullable + public static final BlockType CHERRY_TRAPDOOR = init(); + @Nullable + public static final BlockType CHERRY_WALL_HANGING_SIGN = init(); + @Nullable + public static final BlockType CHERRY_WALL_SIGN = init(); + @Nullable + public static final BlockType CHERRY_WOOD = init(); + @Nullable public static final BlockType CHEST = init(); @Nullable public static final BlockType CHIPPED_ANVIL = init(); @Nullable + public static final BlockType CHISELED_BOOKSHELF = init(); + @Nullable public static final BlockType CHISELED_DEEPSLATE = init(); @Nullable public static final BlockType CHISELED_NETHER_BRICKS = init(); @@ -419,6 +499,8 @@ public final class BlockTypes { @Nullable public static final BlockType CRIMSON_FUNGUS = init(); @Nullable + public static final BlockType CRIMSON_HANGING_SIGN = init(); + @Nullable public static final BlockType CRIMSON_HYPHAE = init(); @Nullable public static final BlockType CRIMSON_NYLIUM = init(); @@ -439,6 +521,8 @@ public final class BlockTypes { @Nullable public static final BlockType CRIMSON_TRAPDOOR = init(); @Nullable + public static final BlockType CRIMSON_WALL_HANGING_SIGN = init(); + @Nullable public static final BlockType CRIMSON_WALL_SIGN = init(); @Nullable public static final BlockType CRYING_OBSIDIAN = init(); @@ -497,6 +581,8 @@ public final class BlockTypes { @Nullable public static final BlockType DARK_OAK_FENCE_GATE = init(); @Nullable + public static final BlockType DARK_OAK_HANGING_SIGN = init(); + @Nullable public static final BlockType DARK_OAK_LEAVES = init(); @Nullable public static final BlockType DARK_OAK_LOG = init(); @@ -515,6 +601,8 @@ public final class BlockTypes { @Nullable public static final BlockType DARK_OAK_TRAPDOOR = init(); @Nullable + public static final BlockType DARK_OAK_WALL_HANGING_SIGN = init(); + @Nullable public static final BlockType DARK_OAK_WALL_SIGN = init(); @Nullable public static final BlockType DARK_OAK_WOOD = init(); @@ -569,6 +657,8 @@ public final class BlockTypes { @Nullable public static final BlockType DEAD_TUBE_CORAL_WALL_FAN = init(); @Nullable + public static final BlockType DECORATED_POT = init(); + @Nullable public static final BlockType DEEPSLATE = init(); @Nullable public static final BlockType DEEPSLATE_BRICKS = init(); @@ -843,6 +933,8 @@ public final class BlockTypes { @Nullable public static final BlockType JUNGLE_FENCE_GATE = init(); @Nullable + public static final BlockType JUNGLE_HANGING_SIGN = init(); + @Nullable public static final BlockType JUNGLE_LEAVES = init(); @Nullable public static final BlockType JUNGLE_LOG = init(); @@ -861,6 +953,8 @@ public final class BlockTypes { @Nullable public static final BlockType JUNGLE_TRAPDOOR = init(); @Nullable + public static final BlockType JUNGLE_WALL_HANGING_SIGN = init(); + @Nullable public static final BlockType JUNGLE_WALL_SIGN = init(); @Nullable public static final BlockType JUNGLE_WOOD = init(); @@ -1027,6 +1121,8 @@ public final class BlockTypes { @Nullable public static final BlockType MANGROVE_FENCE_GATE = init(); @Nullable + public static final BlockType MANGROVE_HANGING_SIGN = init(); + @Nullable public static final BlockType MANGROVE_LEAVES = init(); @Nullable public static final BlockType MANGROVE_LOG = init(); @@ -1047,6 +1143,8 @@ public final class BlockTypes { @Nullable public static final BlockType MANGROVE_TRAPDOOR = init(); @Nullable + public static final BlockType MANGROVE_WALL_HANGING_SIGN = init(); + @Nullable public static final BlockType MANGROVE_WALL_SIGN = init(); @Nullable public static final BlockType MANGROVE_WOOD = init(); @@ -1131,6 +1229,8 @@ public final class BlockTypes { @Nullable public static final BlockType OAK_FENCE_GATE = init(); @Nullable + public static final BlockType OAK_HANGING_SIGN = init(); + @Nullable public static final BlockType OAK_LEAVES = init(); @Nullable public static final BlockType OAK_LOG = init(); @@ -1149,6 +1249,8 @@ public final class BlockTypes { @Nullable public static final BlockType OAK_TRAPDOOR = init(); @Nullable + public static final BlockType OAK_WALL_HANGING_SIGN = init(); + @Nullable public static final BlockType OAK_WALL_SIGN = init(); @Nullable public static final BlockType OAK_WOOD = init(); @@ -1209,6 +1311,10 @@ public final class BlockTypes { @Nullable public static final BlockType PETRIFIED_OAK_SLAB = init(); @Nullable + public static final BlockType PIGLIN_HEAD = init(); + @Nullable + public static final BlockType PIGLIN_WALL_HEAD = init(); + @Nullable public static final BlockType PINK_BANNER = init(); @Nullable public static final BlockType PINK_BED = init(); @@ -1225,6 +1331,8 @@ public final class BlockTypes { @Nullable public static final BlockType PINK_GLAZED_TERRACOTTA = init(); @Nullable + public static final BlockType PINK_PETALS = init(); + @Nullable public static final BlockType PINK_SHULKER_BOX = init(); @Nullable public static final BlockType PINK_STAINED_GLASS = init(); @@ -1243,6 +1351,10 @@ public final class BlockTypes { @Nullable public static final BlockType PISTON_HEAD = init(); @Nullable + public static final BlockType PITCHER_CROP = init(); + @Nullable + public static final BlockType PITCHER_PLANT = init(); + @Nullable public static final BlockType PLAYER_HEAD = init(); @Nullable public static final BlockType PLAYER_WALL_HEAD = init(); @@ -1324,6 +1436,8 @@ public final class BlockTypes { @Nullable public static final BlockType POTTED_CACTUS = init(); @Nullable + public static final BlockType POTTED_CHERRY_SAPLING = init(); + @Nullable public static final BlockType POTTED_CORNFLOWER = init(); @Nullable public static final BlockType POTTED_CRIMSON_FUNGUS = init(); @@ -1365,6 +1479,8 @@ public final class BlockTypes { @Nullable public static final BlockType POTTED_SPRUCE_SAPLING = init(); @Nullable + public static final BlockType POTTED_TORCHFLOWER = init(); + @Nullable public static final BlockType POTTED_WARPED_FUNGUS = init(); @Nullable public static final BlockType POTTED_WARPED_ROOTS = init(); @@ -1600,6 +1716,8 @@ public final class BlockTypes { @Nullable public static final BlockType SMOOTH_STONE_SLAB = init(); @Nullable + public static final BlockType SNIFFER_EGG = init(); + @Nullable public static final BlockType SNOW = init(); @Nullable public static final BlockType SNOW_BLOCK = init(); @@ -1632,6 +1750,8 @@ public final class BlockTypes { @Nullable public static final BlockType SPRUCE_FENCE_GATE = init(); @Nullable + public static final BlockType SPRUCE_HANGING_SIGN = init(); + @Nullable public static final BlockType SPRUCE_LEAVES = init(); @Nullable public static final BlockType SPRUCE_LOG = init(); @@ -1650,6 +1770,8 @@ public final class BlockTypes { @Nullable public static final BlockType SPRUCE_TRAPDOOR = init(); @Nullable + public static final BlockType SPRUCE_WALL_HANGING_SIGN = init(); + @Nullable public static final BlockType SPRUCE_WALL_SIGN = init(); @Nullable public static final BlockType SPRUCE_WOOD = init(); @@ -1680,10 +1802,16 @@ public final class BlockTypes { @Nullable public static final BlockType STRIPPED_ACACIA_WOOD = init(); @Nullable + public static final BlockType STRIPPED_BAMBOO_BLOCK = init(); + @Nullable public static final BlockType STRIPPED_BIRCH_LOG = init(); @Nullable public static final BlockType STRIPPED_BIRCH_WOOD = init(); @Nullable + public static final BlockType STRIPPED_CHERRY_LOG = init(); + @Nullable + public static final BlockType STRIPPED_CHERRY_WOOD = init(); + @Nullable public static final BlockType STRIPPED_CRIMSON_HYPHAE = init(); @Nullable public static final BlockType STRIPPED_CRIMSON_STEM = init(); @@ -1720,6 +1848,10 @@ public final class BlockTypes { @Nullable public static final BlockType SUNFLOWER = init(); @Nullable + public static final BlockType SUSPICIOUS_GRAVEL = init(); + @Nullable + public static final BlockType SUSPICIOUS_SAND = init(); + @Nullable public static final BlockType SWEET_BERRY_BUSH = init(); @Nullable public static final BlockType TALL_GRASS = init(); @@ -1736,6 +1868,10 @@ public final class BlockTypes { @Nullable public static final BlockType TORCH = init(); @Nullable + public static final BlockType TORCHFLOWER = init(); + @Nullable + public static final BlockType TORCHFLOWER_CROP = init(); + @Nullable public static final BlockType TRAPPED_CHEST = init(); @Nullable public static final BlockType TRIPWIRE = init(); @@ -1779,6 +1915,8 @@ public final class BlockTypes { @Nullable public static final BlockType WARPED_FUNGUS = init(); @Nullable + public static final BlockType WARPED_HANGING_SIGN = init(); + @Nullable public static final BlockType WARPED_HYPHAE = init(); @Nullable public static final BlockType WARPED_NYLIUM = init(); @@ -1799,6 +1937,8 @@ public final class BlockTypes { @Nullable public static final BlockType WARPED_TRAPDOOR = init(); @Nullable + public static final BlockType WARPED_WALL_HANGING_SIGN = init(); + @Nullable public static final BlockType WARPED_WALL_SIGN = init(); @Nullable public static final BlockType WARPED_WART_BLOCK = init(); @@ -1926,6 +2066,8 @@ public final class BlockTypes { private static Field[] fieldsTmp; private static int initIndex = 0; + // Init each field + // The order is important public static BlockType init() { if (fieldsTmp == null) { fieldsTmp = BlockTypes.class.getDeclaredFields(); @@ -1935,6 +2077,7 @@ public final class BlockTypes { return BlockType.REGISTRY.get(name); } + // Clears memory after initialization static { fieldsTmp = null; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityTypes.java index 83a4cf06d..4b650ac07 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/entity/EntityTypes.java @@ -47,8 +47,12 @@ public final class EntityTypes { @Nullable public static final EntityType BLAZE = get("minecraft:blaze"); @Nullable + public static final EntityType BLOCK_DISPLAY = get("minecraft:block_display"); + @Nullable public static final EntityType BOAT = get("minecraft:boat"); @Nullable + public static final EntityType CAMEL = get("minecraft:camel"); + @Nullable public static final EntityType CAT = get("minecraft:cat"); @Nullable public static final EntityType CAVE_SPIDER = get("minecraft:cave_spider"); @@ -135,10 +139,14 @@ public final class EntityTypes { @Nullable public static final EntityType ILLUSIONER = get("minecraft:illusioner"); @Nullable + public static final EntityType INTERACTION = get("minecraft:interaction"); + @Nullable public static final EntityType IRON_GOLEM = get("minecraft:iron_golem"); @Nullable public static final EntityType ITEM = get("minecraft:item"); @Nullable + public static final EntityType ITEM_DISPLAY = get("minecraft:item_display"); + @Nullable public static final EntityType ITEM_FRAME = get("minecraft:item_frame"); @Nullable public static final EntityType LEASH_KNOT = get("minecraft:leash_knot"); @@ -207,6 +215,8 @@ public final class EntityTypes { @Nullable public static final EntityType SMALL_FIREBALL = get("minecraft:small_fireball"); @Nullable + public static final EntityType SNIFFER = get("minecraft:sniffer"); + @Nullable public static final EntityType SNOW_GOLEM = get("minecraft:snow_golem"); @Nullable public static final EntityType SNOWBALL = get("minecraft:snowball"); @@ -225,6 +235,8 @@ public final class EntityTypes { @Nullable public static final EntityType TADPOLE = get("minecraft:tadpole"); @Nullable + public static final EntityType TEXT_DISPLAY = get("minecraft:text_display"); + @Nullable public static final EntityType TNT = get("minecraft:tnt"); @Nullable public static final EntityType TNT_MINECART = get("minecraft:tnt_minecart"); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemCategories.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemCategories.java index 240c8728c..3b6bdc6b6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemCategories.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemCategories.java @@ -30,15 +30,20 @@ public final class ItemCategories { public static final ItemCategory ACACIA_LOGS = get("minecraft:acacia_logs"); public static final ItemCategory ANVIL = get("minecraft:anvil"); public static final ItemCategory ARROWS = get("minecraft:arrows"); + public static final ItemCategory AXES = get("minecraft:axes"); public static final ItemCategory AXOLOTL_TEMPT_ITEMS = get("minecraft:axolotl_tempt_items"); + public static final ItemCategory BAMBOO_BLOCKS = get("minecraft:bamboo_blocks"); public static final ItemCategory BANNERS = get("minecraft:banners"); public static final ItemCategory BEACON_PAYMENT_ITEMS = get("minecraft:beacon_payment_items"); public static final ItemCategory BEDS = get("minecraft:beds"); public static final ItemCategory BIRCH_LOGS = get("minecraft:birch_logs"); public static final ItemCategory BOATS = get("minecraft:boats"); + public static final ItemCategory BOOKSHELF_BOOKS = get("minecraft:bookshelf_books"); + public static final ItemCategory BREAKS_DECORATED_POTS = get("minecraft:breaks_decorated_pots"); public static final ItemCategory BUTTONS = get("minecraft:buttons"); public static final ItemCategory CANDLES = get("minecraft:candles"); @Deprecated public static final ItemCategory CARPETS = get("minecraft:carpets"); + public static final ItemCategory CHERRY_LOGS = get("minecraft:cherry_logs"); public static final ItemCategory CHEST_BOATS = get("minecraft:chest_boats"); public static final ItemCategory CLUSTER_MAX_HARVESTABLES = get("minecraft:cluster_max_harvestables"); public static final ItemCategory COAL_ORES = get("minecraft:coal_ores"); @@ -47,13 +52,17 @@ public final class ItemCategories { public static final ItemCategory COMPLETES_FIND_TREE_TUTORIAL = get("minecraft:completes_find_tree_tutorial"); public static final ItemCategory COPPER_ORES = get("minecraft:copper_ores"); public static final ItemCategory CREEPER_DROP_MUSIC_DISCS = get("minecraft:creeper_drop_music_discs"); + public static final ItemCategory CREEPER_IGNITERS = get("minecraft:creeper_igniters"); public static final ItemCategory CRIMSON_STEMS = get("minecraft:crimson_stems"); public static final ItemCategory DAMPENS_VIBRATIONS = get("minecraft:dampens_vibrations"); public static final ItemCategory DARK_OAK_LOGS = get("minecraft:dark_oak_logs"); + public static final ItemCategory DECORATED_POT_INGREDIENTS = get("minecraft:decorated_pot_ingredients"); + public static final ItemCategory DECORATED_POT_SHERDS = get("minecraft:decorated_pot_sherds"); public static final ItemCategory DIAMOND_ORES = get("minecraft:diamond_ores"); public static final ItemCategory DIRT = get("minecraft:dirt"); public static final ItemCategory DOORS = get("minecraft:doors"); public static final ItemCategory EMERALD_ORES = get("minecraft:emerald_ores"); + public static final ItemCategory FENCE_GATES = get("minecraft:fence_gates"); public static final ItemCategory FENCES = get("minecraft:fences"); public static final ItemCategory FISHES = get("minecraft:fishes"); public static final ItemCategory FLOWERS = get("minecraft:flowers"); @@ -62,6 +71,8 @@ public final class ItemCategories { @Deprecated public static final ItemCategory FURNACE_MATERIALS = get("minecraft:furnace_materials"); public static final ItemCategory GOLD_ORES = get("minecraft:gold_ores"); + public static final ItemCategory HANGING_SIGNS = get("minecraft:hanging_signs"); + public static final ItemCategory HOES = get("minecraft:hoes"); public static final ItemCategory IGNORED_BY_PIGLIN_BABIES = get("minecraft:ignored_by_piglin_babies"); public static final ItemCategory IRON_ORES = get("minecraft:iron_ores"); public static final ItemCategory JUNGLE_LOGS = get("minecraft:jungle_logs"); @@ -73,9 +84,11 @@ public final class ItemCategories { public static final ItemCategory MANGROVE_LOGS = get("minecraft:mangrove_logs"); public static final ItemCategory MUSIC_DISCS = get("minecraft:music_discs"); public static final ItemCategory NON_FLAMMABLE_WOOD = get("minecraft:non_flammable_wood"); + public static final ItemCategory NOTEBLOCK_TOP_INSTRUMENTS = get("minecraft:noteblock_top_instruments"); public static final ItemCategory OAK_LOGS = get("minecraft:oak_logs"); @Deprecated public static final ItemCategory OCCLUDES_VIBRATION_SIGNALS = get("minecraft:occludes_vibration_signals"); - public static final ItemCategory OVERWORLD_NATURAL_LOGS = get("minecraft:overworld_natural_logs"); + @Deprecated public static final ItemCategory OVERWORLD_NATURAL_LOGS = get("minecraft:overworld_natural_logs"); + public static final ItemCategory PICKAXES = get("minecraft:pickaxes"); public static final ItemCategory PIGLIN_FOOD = get("minecraft:piglin_food"); public static final ItemCategory PIGLIN_LOVED = get("minecraft:piglin_loved"); public static final ItemCategory PIGLIN_REPELLENTS = get("minecraft:piglin_repellents"); @@ -84,18 +97,28 @@ public final class ItemCategories { public static final ItemCategory REDSTONE_ORES = get("minecraft:redstone_ores"); public static final ItemCategory SAND = get("minecraft:sand"); public static final ItemCategory SAPLINGS = get("minecraft:saplings"); + public static final ItemCategory SHOVELS = get("minecraft:shovels"); public static final ItemCategory SIGNS = get("minecraft:signs"); public static final ItemCategory SLABS = get("minecraft:slabs"); public static final ItemCategory SMALL_FLOWERS = get("minecraft:small_flowers"); + public static final ItemCategory SMELTS_TO_GLASS = get("minecraft:smelts_to_glass"); + public static final ItemCategory SNIFFER_FOOD = get("minecraft:sniffer_food"); public static final ItemCategory SOUL_FIRE_BASE_BLOCKS = get("minecraft:soul_fire_base_blocks"); public static final ItemCategory SPRUCE_LOGS = get("minecraft:spruce_logs"); public static final ItemCategory STAIRS = get("minecraft:stairs"); public static final ItemCategory STONE_BRICKS = get("minecraft:stone_bricks"); + public static final ItemCategory STONE_BUTTONS = get("minecraft:stone_buttons"); public static final ItemCategory STONE_CRAFTING_MATERIALS = get("minecraft:stone_crafting_materials"); public static final ItemCategory STONE_TOOL_MATERIALS = get("minecraft:stone_tool_materials"); + public static final ItemCategory SWORDS = get("minecraft:swords"); public static final ItemCategory TALL_FLOWERS = get("minecraft:tall_flowers"); public static final ItemCategory TERRACOTTA = get("minecraft:terracotta"); + public static final ItemCategory TOOLS = get("minecraft:tools"); public static final ItemCategory TRAPDOORS = get("minecraft:trapdoors"); + public static final ItemCategory TRIM_MATERIALS = get("minecraft:trim_materials"); + public static final ItemCategory TRIM_TEMPLATES = get("minecraft:trim_templates"); + public static final ItemCategory TRIMMABLE_ARMOR = get("minecraft:trimmable_armor"); + public static final ItemCategory VILLAGER_PLANTABLE_SEEDS = get("minecraft:villager_plantable_seeds"); public static final ItemCategory WALLS = get("minecraft:walls"); public static final ItemCategory WARPED_STEMS = get("minecraft:warped_stems"); public static final ItemCategory WART_BLOCKS = get("minecraft:wart_blocks"); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java index 51369161a..663cf5c61 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemTypes.java @@ -49,6 +49,8 @@ public final class ItemTypes { @Nullable public static final ItemType ACACIA_FENCE_GATE = init(); @Nullable + public static final ItemType ACACIA_HANGING_SIGN = init(); + @Nullable public static final ItemType ACACIA_LEAVES = init(); @Nullable public static final ItemType ACACIA_LOG = init(); @@ -93,12 +95,18 @@ public final class ItemTypes { @Nullable public static final ItemType ANDESITE_WALL = init(); @Nullable + public static final ItemType ANGLER_POTTERY_SHERD = init(); + @Nullable public static final ItemType ANVIL = init(); @Nullable public static final ItemType APPLE = init(); @Nullable + public static final ItemType ARCHER_POTTERY_SHERD = init(); + @Nullable public static final ItemType ARMOR_STAND = init(); @Nullable + public static final ItemType ARMS_UP_POTTERY_SHERD = init(); + @Nullable public static final ItemType ARROW = init(); @Nullable public static final ItemType AXOLOTL_BUCKET = init(); @@ -115,6 +123,40 @@ public final class ItemTypes { @Nullable public static final ItemType BAMBOO = init(); @Nullable + public static final ItemType BAMBOO_BLOCK = init(); + @Nullable + public static final ItemType BAMBOO_BUTTON = init(); + @Nullable + public static final ItemType BAMBOO_CHEST_RAFT = init(); + @Nullable + public static final ItemType BAMBOO_DOOR = init(); + @Nullable + public static final ItemType BAMBOO_FENCE = init(); + @Nullable + public static final ItemType BAMBOO_FENCE_GATE = init(); + @Nullable + public static final ItemType BAMBOO_HANGING_SIGN = init(); + @Nullable + public static final ItemType BAMBOO_MOSAIC = init(); + @Nullable + public static final ItemType BAMBOO_MOSAIC_SLAB = init(); + @Nullable + public static final ItemType BAMBOO_MOSAIC_STAIRS = init(); + @Nullable + public static final ItemType BAMBOO_PLANKS = init(); + @Nullable + public static final ItemType BAMBOO_PRESSURE_PLATE = init(); + @Nullable + public static final ItemType BAMBOO_RAFT = init(); + @Nullable + public static final ItemType BAMBOO_SIGN = init(); + @Nullable + public static final ItemType BAMBOO_SLAB = init(); + @Nullable + public static final ItemType BAMBOO_STAIRS = init(); + @Nullable + public static final ItemType BAMBOO_TRAPDOOR = init(); + @Nullable public static final ItemType BARREL = init(); @Nullable public static final ItemType BARRIER = init(); @@ -157,6 +199,8 @@ public final class ItemTypes { @Nullable public static final ItemType BIRCH_FENCE_GATE = init(); @Nullable + public static final ItemType BIRCH_HANGING_SIGN = init(); + @Nullable public static final ItemType BIRCH_LEAVES = init(); @Nullable public static final ItemType BIRCH_LOG = init(); @@ -211,6 +255,8 @@ public final class ItemTypes { @Nullable public static final ItemType BLACKSTONE_WALL = init(); @Nullable + public static final ItemType BLADE_POTTERY_SHERD = init(); + @Nullable public static final ItemType BLAST_FURNACE = init(); @Nullable public static final ItemType BLAZE_POWDER = init(); @@ -273,6 +319,8 @@ public final class ItemTypes { @Nullable public static final ItemType BREAD = init(); @Nullable + public static final ItemType BREWER_POTTERY_SHERD = init(); + @Nullable public static final ItemType BREWING_STAND = init(); @Nullable public static final ItemType BRICK = init(); @@ -313,6 +361,8 @@ public final class ItemTypes { @Nullable public static final ItemType BROWN_WOOL = init(); @Nullable + public static final ItemType BRUSH = init(); + @Nullable public static final ItemType BUBBLE_CORAL = init(); @Nullable public static final ItemType BUBBLE_CORAL_BLOCK = init(); @@ -325,6 +375,8 @@ public final class ItemTypes { @Nullable public static final ItemType BUNDLE = init(); @Nullable + public static final ItemType BURN_POTTERY_SHERD = init(); + @Nullable public static final ItemType CACTUS = init(); @Deprecated @Nullable @@ -334,6 +386,10 @@ public final class ItemTypes { @Nullable public static final ItemType CALCITE = init(); @Nullable + public static final ItemType CALIBRATED_SCULK_SENSOR = init(); + @Nullable + public static final ItemType CAMEL_SPAWN_EGG = init(); + @Nullable public static final ItemType CAMPFIRE = init(); @Nullable public static final ItemType CANDLE = init(); @@ -366,6 +422,40 @@ public final class ItemTypes { @Nullable public static final ItemType CHARCOAL = init(); @Nullable + public static final ItemType CHERRY_BOAT = init(); + @Nullable + public static final ItemType CHERRY_BUTTON = init(); + @Nullable + public static final ItemType CHERRY_CHEST_BOAT = init(); + @Nullable + public static final ItemType CHERRY_DOOR = init(); + @Nullable + public static final ItemType CHERRY_FENCE = init(); + @Nullable + public static final ItemType CHERRY_FENCE_GATE = init(); + @Nullable + public static final ItemType CHERRY_HANGING_SIGN = init(); + @Nullable + public static final ItemType CHERRY_LEAVES = init(); + @Nullable + public static final ItemType CHERRY_LOG = init(); + @Nullable + public static final ItemType CHERRY_PLANKS = init(); + @Nullable + public static final ItemType CHERRY_PRESSURE_PLATE = init(); + @Nullable + public static final ItemType CHERRY_SAPLING = init(); + @Nullable + public static final ItemType CHERRY_SIGN = init(); + @Nullable + public static final ItemType CHERRY_SLAB = init(); + @Nullable + public static final ItemType CHERRY_STAIRS = init(); + @Nullable + public static final ItemType CHERRY_TRAPDOOR = init(); + @Nullable + public static final ItemType CHERRY_WOOD = init(); + @Nullable public static final ItemType CHEST = init(); @Nullable public static final ItemType CHEST_MINECART = init(); @@ -376,6 +466,8 @@ public final class ItemTypes { @Nullable public static final ItemType CHIPPED_ANVIL = init(); @Nullable + public static final ItemType CHISELED_BOOKSHELF = init(); + @Nullable public static final ItemType CHISELED_DEEPSLATE = init(); @Nullable public static final ItemType CHISELED_NETHER_BRICKS = init(); @@ -410,6 +502,8 @@ public final class ItemTypes { @Nullable public static final ItemType COARSE_DIRT = init(); @Nullable + public static final ItemType COAST_ARMOR_TRIM_SMITHING_TEMPLATE = init(); + @Nullable public static final ItemType COBBLED_DEEPSLATE = init(); @Nullable public static final ItemType COBBLED_DEEPSLATE_SLAB = init(); @@ -502,6 +596,8 @@ public final class ItemTypes { @Nullable public static final ItemType CRIMSON_FUNGUS = init(); @Nullable + public static final ItemType CRIMSON_HANGING_SIGN = init(); + @Nullable public static final ItemType CRIMSON_HYPHAE = init(); @Nullable public static final ItemType CRIMSON_NYLIUM = init(); @@ -573,6 +669,8 @@ public final class ItemTypes { @Nullable public static final ItemType DANDELION_YELLOW = init(); @Nullable + public static final ItemType DANGER_POTTERY_SHERD = init(); + @Nullable public static final ItemType DARK_OAK_BOAT = init(); @Nullable public static final ItemType DARK_OAK_BUTTON = init(); @@ -585,6 +683,8 @@ public final class ItemTypes { @Nullable public static final ItemType DARK_OAK_FENCE_GATE = init(); @Nullable + public static final ItemType DARK_OAK_HANGING_SIGN = init(); + @Nullable public static final ItemType DARK_OAK_LEAVES = init(); @Nullable public static final ItemType DARK_OAK_LOG = init(); @@ -647,6 +747,8 @@ public final class ItemTypes { @Nullable public static final ItemType DEBUG_STICK = init(); @Nullable + public static final ItemType DECORATED_POT = init(); + @Nullable public static final ItemType DEEPSLATE = init(); @Nullable public static final ItemType DEEPSLATE_BRICK_SLAB = init(); @@ -745,6 +847,8 @@ public final class ItemTypes { @Nullable public static final ItemType DROWNED_SPAWN_EGG = init(); @Nullable + public static final ItemType DUNE_ARMOR_TRIM_SMITHING_TEMPLATE = init(); + @Nullable public static final ItemType ECHO_SHARD = init(); @Nullable public static final ItemType EGG = init(); @@ -783,6 +887,8 @@ public final class ItemTypes { @Nullable public static final ItemType ENDER_CHEST = init(); @Nullable + public static final ItemType ENDER_DRAGON_SPAWN_EGG = init(); + @Nullable public static final ItemType ENDER_EYE = init(); @Nullable public static final ItemType ENDER_PEARL = init(); @@ -795,6 +901,8 @@ public final class ItemTypes { @Nullable public static final ItemType EXPERIENCE_BOTTLE = init(); @Nullable + public static final ItemType EXPLORER_POTTERY_SHERD = init(); + @Nullable public static final ItemType EXPOSED_COPPER = init(); @Nullable public static final ItemType EXPOSED_CUT_COPPER = init(); @@ -803,6 +911,8 @@ public final class ItemTypes { @Nullable public static final ItemType EXPOSED_CUT_COPPER_STAIRS = init(); @Nullable + public static final ItemType EYE_ARMOR_TRIM_SMITHING_TEMPLATE = init(); + @Nullable public static final ItemType FARMLAND = init(); @Nullable public static final ItemType FEATHER = init(); @@ -843,6 +953,8 @@ public final class ItemTypes { @Nullable public static final ItemType FOX_SPAWN_EGG = init(); @Nullable + public static final ItemType FRIEND_POTTERY_SHERD = init(); + @Nullable public static final ItemType FROG_SPAWN_EGG = init(); @Nullable public static final ItemType FROGSPAWN = init(); @@ -998,6 +1110,10 @@ public final class ItemTypes { @Nullable public static final ItemType HEART_OF_THE_SEA = init(); @Nullable + public static final ItemType HEART_POTTERY_SHERD = init(); + @Nullable + public static final ItemType HEARTBREAK_POTTERY_SHERD = init(); + @Nullable public static final ItemType HEAVY_WEIGHTED_PRESSURE_PLATE = init(); @Nullable public static final ItemType HOGLIN_SPAWN_EGG = init(); @@ -1022,6 +1138,10 @@ public final class ItemTypes { @Nullable public static final ItemType HORSE_SPAWN_EGG = init(); @Nullable + public static final ItemType HOST_ARMOR_TRIM_SMITHING_TEMPLATE = init(); + @Nullable + public static final ItemType HOWL_POTTERY_SHERD = init(); + @Nullable public static final ItemType HUSK_SPAWN_EGG = init(); @Nullable public static final ItemType ICE = init(); @@ -1054,6 +1174,8 @@ public final class ItemTypes { @Nullable public static final ItemType IRON_DOOR = init(); @Nullable + public static final ItemType IRON_GOLEM_SPAWN_EGG = init(); + @Nullable public static final ItemType IRON_HELMET = init(); @Nullable public static final ItemType IRON_HOE = init(); @@ -1096,6 +1218,8 @@ public final class ItemTypes { @Nullable public static final ItemType JUNGLE_FENCE_GATE = init(); @Nullable + public static final ItemType JUNGLE_HANGING_SIGN = init(); + @Nullable public static final ItemType JUNGLE_LEAVES = init(); @Nullable public static final ItemType JUNGLE_LOG = init(); @@ -1296,6 +1420,8 @@ public final class ItemTypes { @Nullable public static final ItemType MANGROVE_FENCE_GATE = init(); @Nullable + public static final ItemType MANGROVE_HANGING_SIGN = init(); + @Nullable public static final ItemType MANGROVE_LEAVES = init(); @Nullable public static final ItemType MANGROVE_LOG = init(); @@ -1332,6 +1458,8 @@ public final class ItemTypes { @Nullable public static final ItemType MINECART = init(); @Nullable + public static final ItemType MINER_POTTERY_SHERD = init(); + @Nullable public static final ItemType MOJANG_BANNER_PATTERN = init(); @Nullable public static final ItemType MOOSHROOM_SPAWN_EGG = init(); @@ -1356,6 +1484,8 @@ public final class ItemTypes { @Nullable public static final ItemType MOSSY_STONE_BRICKS = init(); @Nullable + public static final ItemType MOURNER_POTTERY_SHERD = init(); + @Nullable public static final ItemType MUD = init(); @Nullable public static final ItemType MUD_BRICK_SLAB = init(); @@ -1396,6 +1526,8 @@ public final class ItemTypes { @Nullable public static final ItemType MUSIC_DISC_PIGSTEP = init(); @Nullable + public static final ItemType MUSIC_DISC_RELIC = init(); + @Nullable public static final ItemType MUSIC_DISC_STAL = init(); @Nullable public static final ItemType MUSIC_DISC_STRAD = init(); @@ -1460,6 +1592,8 @@ public final class ItemTypes { @Nullable public static final ItemType NETHERITE_SWORD = init(); @Nullable + public static final ItemType NETHERITE_UPGRADE_SMITHING_TEMPLATE = init(); + @Nullable public static final ItemType NETHERRACK = init(); @Nullable public static final ItemType NOTE_BLOCK = init(); @@ -1476,6 +1610,8 @@ public final class ItemTypes { @Nullable public static final ItemType OAK_FENCE_GATE = init(); @Nullable + public static final ItemType OAK_HANGING_SIGN = init(); + @Nullable public static final ItemType OAK_LEAVES = init(); @Nullable public static final ItemType OAK_LOG = init(); @@ -1568,6 +1704,10 @@ public final class ItemTypes { @Nullable public static final ItemType PIGLIN_BANNER_PATTERN = init(); @Nullable + public static final ItemType PIGLIN_BRUTE_SPAWN_EGG = init(); + @Nullable + public static final ItemType PIGLIN_HEAD = init(); + @Nullable public static final ItemType PIGLIN_SPAWN_EGG = init(); @Nullable public static final ItemType PILLAGER_SPAWN_EGG = init(); @@ -1588,6 +1728,8 @@ public final class ItemTypes { @Nullable public static final ItemType PINK_GLAZED_TERRACOTTA = init(); @Nullable + public static final ItemType PINK_PETALS = init(); + @Nullable public static final ItemType PINK_SHULKER_BOX = init(); @Nullable public static final ItemType PINK_STAINED_GLASS = init(); @@ -1602,8 +1744,14 @@ public final class ItemTypes { @Nullable public static final ItemType PISTON = init(); @Nullable + public static final ItemType PITCHER_PLANT = init(); + @Nullable + public static final ItemType PITCHER_POD = init(); + @Nullable public static final ItemType PLAYER_HEAD = init(); @Nullable + public static final ItemType PLENTY_POTTERY_SHERD = init(); + @Nullable public static final ItemType PODZOL = init(); @Nullable public static final ItemType POINTED_DRIPSTONE = init(); @@ -1692,6 +1840,8 @@ public final class ItemTypes { @Nullable public static final ItemType PRISMARINE_WALL = init(); @Nullable + public static final ItemType PRIZE_POTTERY_SHERD = init(); + @Nullable public static final ItemType PUFFERFISH = init(); @Nullable public static final ItemType PUFFERFISH_BUCKET = init(); @@ -1762,6 +1912,8 @@ public final class ItemTypes { @Nullable public static final ItemType RAIL = init(); @Nullable + public static final ItemType RAISER_ARMOR_TRIM_SMITHING_TEMPLATE = init(); + @Nullable public static final ItemType RAVAGER_SPAWN_EGG = init(); @Nullable public static final ItemType RAW_COPPER = init(); @@ -1846,6 +1998,8 @@ public final class ItemTypes { @Nullable public static final ItemType RESPAWN_ANCHOR = init(); @Nullable + public static final ItemType RIB_ARMOR_TRIM_SMITHING_TEMPLATE = init(); + @Nullable public static final ItemType ROOTED_DIRT = init(); @Nullable public static final ItemType ROSE_BUSH = init(); @@ -1893,10 +2047,18 @@ public final class ItemTypes { @Nullable public static final ItemType SEAGRASS = init(); @Nullable + public static final ItemType SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE = init(); + @Nullable + public static final ItemType SHAPER_ARMOR_TRIM_SMITHING_TEMPLATE = init(); + @Nullable + public static final ItemType SHEAF_POTTERY_SHERD = init(); + @Nullable public static final ItemType SHEARS = init(); @Nullable public static final ItemType SHEEP_SPAWN_EGG = init(); @Nullable + public static final ItemType SHELTER_POTTERY_SHERD = init(); + @Nullable public static final ItemType SHIELD = init(); @Nullable public static final ItemType SHROOMLIGHT = init(); @@ -1910,6 +2072,8 @@ public final class ItemTypes { @Nullable public static final ItemType SIGN = init(); @Nullable + public static final ItemType SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE = init(); + @Nullable public static final ItemType SILVERFISH_SPAWN_EGG = init(); @Nullable public static final ItemType SKELETON_HORSE_SPAWN_EGG = init(); @@ -1920,6 +2084,8 @@ public final class ItemTypes { @Nullable public static final ItemType SKULL_BANNER_PATTERN = init(); @Nullable + public static final ItemType SKULL_POTTERY_SHERD = init(); + @Nullable public static final ItemType SLIME_BALL = init(); @Nullable public static final ItemType SLIME_BLOCK = init(); @@ -1958,10 +2124,20 @@ public final class ItemTypes { @Nullable public static final ItemType SMOOTH_STONE_SLAB = init(); @Nullable + public static final ItemType SNIFFER_EGG = init(); + @Nullable + public static final ItemType SNIFFER_SPAWN_EGG = init(); + @Nullable + public static final ItemType SNORT_POTTERY_SHERD = init(); + @Nullable + public static final ItemType SNOUT_ARMOR_TRIM_SMITHING_TEMPLATE = init(); + @Nullable public static final ItemType SNOW = init(); @Nullable public static final ItemType SNOW_BLOCK = init(); @Nullable + public static final ItemType SNOW_GOLEM_SPAWN_EGG = init(); + @Nullable public static final ItemType SNOWBALL = init(); @Nullable public static final ItemType SOUL_CAMPFIRE = init(); @@ -1982,6 +2158,8 @@ public final class ItemTypes { @Nullable public static final ItemType SPIDER_SPAWN_EGG = init(); @Nullable + public static final ItemType SPIRE_ARMOR_TRIM_SMITHING_TEMPLATE = init(); + @Nullable public static final ItemType SPLASH_POTION = init(); @Nullable public static final ItemType SPONGE = init(); @@ -2000,6 +2178,8 @@ public final class ItemTypes { @Nullable public static final ItemType SPRUCE_FENCE_GATE = init(); @Nullable + public static final ItemType SPRUCE_HANGING_SIGN = init(); + @Nullable public static final ItemType SPRUCE_LEAVES = init(); @Nullable public static final ItemType SPRUCE_LOG = init(); @@ -2068,10 +2248,16 @@ public final class ItemTypes { @Nullable public static final ItemType STRIPPED_ACACIA_WOOD = init(); @Nullable + public static final ItemType STRIPPED_BAMBOO_BLOCK = init(); + @Nullable public static final ItemType STRIPPED_BIRCH_LOG = init(); @Nullable public static final ItemType STRIPPED_BIRCH_WOOD = init(); @Nullable + public static final ItemType STRIPPED_CHERRY_LOG = init(); + @Nullable + public static final ItemType STRIPPED_CHERRY_WOOD = init(); + @Nullable public static final ItemType STRIPPED_CRIMSON_HYPHAE = init(); @Nullable public static final ItemType STRIPPED_CRIMSON_STEM = init(); @@ -2110,6 +2296,10 @@ public final class ItemTypes { @Nullable public static final ItemType SUNFLOWER = init(); @Nullable + public static final ItemType SUSPICIOUS_GRAVEL = init(); + @Nullable + public static final ItemType SUSPICIOUS_SAND = init(); + @Nullable public static final ItemType SUSPICIOUS_STEW = init(); @Nullable public static final ItemType SWEET_BERRIES = init(); @@ -2124,6 +2314,8 @@ public final class ItemTypes { @Nullable public static final ItemType TERRACOTTA = init(); @Nullable + public static final ItemType TIDE_ARMOR_TRIM_SMITHING_TEMPLATE = init(); + @Nullable public static final ItemType TINTED_GLASS = init(); @Nullable public static final ItemType TIPPED_ARROW = init(); @@ -2134,6 +2326,10 @@ public final class ItemTypes { @Nullable public static final ItemType TORCH = init(); @Nullable + public static final ItemType TORCHFLOWER = init(); + @Nullable + public static final ItemType TORCHFLOWER_SEEDS = init(); + @Nullable public static final ItemType TOTEM_OF_UNDYING = init(); @Nullable public static final ItemType TRADER_LLAMA_SPAWN_EGG = init(); @@ -2168,6 +2364,8 @@ public final class ItemTypes { @Nullable public static final ItemType VERDANT_FROGLIGHT = init(); @Nullable + public static final ItemType VEX_ARMOR_TRIM_SMITHING_TEMPLATE = init(); + @Nullable public static final ItemType VEX_SPAWN_EGG = init(); @Nullable public static final ItemType VILLAGER_SPAWN_EGG = init(); @@ -2178,6 +2376,8 @@ public final class ItemTypes { @Nullable public static final ItemType WANDERING_TRADER_SPAWN_EGG = init(); @Nullable + public static final ItemType WARD_ARMOR_TRIM_SMITHING_TEMPLATE = init(); + @Nullable public static final ItemType WARDEN_SPAWN_EGG = init(); @Nullable public static final ItemType WARPED_BUTTON = init(); @@ -2192,6 +2392,8 @@ public final class ItemTypes { @Nullable public static final ItemType WARPED_FUNGUS_ON_A_STICK = init(); @Nullable + public static final ItemType WARPED_HANGING_SIGN = init(); + @Nullable public static final ItemType WARPED_HYPHAE = init(); @Nullable public static final ItemType WARPED_NYLIUM = init(); @@ -2248,6 +2450,8 @@ public final class ItemTypes { @Nullable public static final ItemType WAXED_WEATHERED_CUT_COPPER_STAIRS = init(); @Nullable + public static final ItemType WAYFINDER_ARMOR_TRIM_SMITHING_TEMPLATE = init(); + @Nullable public static final ItemType WEATHERED_COPPER = init(); @Nullable public static final ItemType WEATHERED_CUT_COPPER = init(); @@ -2292,6 +2496,8 @@ public final class ItemTypes { @Nullable public static final ItemType WHITE_WOOL = init(); @Nullable + public static final ItemType WILD_ARMOR_TRIM_SMITHING_TEMPLATE = init(); + @Nullable public static final ItemType WITCH_SPAWN_EGG = init(); @Nullable public static final ItemType WITHER_ROSE = init(); @@ -2300,6 +2506,8 @@ public final class ItemTypes { @Nullable public static final ItemType WITHER_SKELETON_SPAWN_EGG = init(); @Nullable + public static final ItemType WITHER_SPAWN_EGG = init(); + @Nullable public static final ItemType WOLF_SPAWN_EGG = init(); @Nullable public static final ItemType WOODEN_AXE = init(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledRegistries.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledRegistries.java index 8338f7900..26113dd6e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledRegistries.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledRegistries.java @@ -47,6 +47,7 @@ public class BundledRegistries implements Registries { versionMap.put(Range.atLeast(Constants.DATA_VERSION_MC_1_17), "117"); // 1.18 did have one item change, but we didn't get it. It's fine. versionMap.put(Range.atLeast(Constants.DATA_VERSION_MC_1_19), "119"); + versionMap.put(Range.atLeast(Constants.DATA_VERSION_MC_1_20), "120"); VERSION_MAP = ImmutableRangeMap.copyOf(versionMap); } diff --git a/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/blocks.120.json b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/blocks.120.json new file mode 100644 index 000000000..aac351bd9 --- /dev/null +++ b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/blocks.120.json @@ -0,0 +1 @@ +[{"id":"minecraft:acacia_button","localizedName":"Acacia Button","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:acacia_door","localizedName":"Acacia Door","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:acacia_fence","localizedName":"Acacia Fence","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:acacia_fence_gate","localizedName":"Acacia Fence Gate","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:acacia_hanging_sign","localizedName":"Acacia Hanging Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:acacia_leaves","localizedName":"Acacia Leaves","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":true,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:acacia_log","localizedName":"Acacia Log","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:acacia_planks","localizedName":"Acacia Planks","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:acacia_pressure_plate","localizedName":"Acacia Pressure Plate","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:acacia_sapling","localizedName":"Acacia Sapling","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:acacia_sign","localizedName":"Acacia Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:acacia_slab","localizedName":"Acacia Slab","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:acacia_stairs","localizedName":"Acacia Stairs","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:acacia_trapdoor","localizedName":"Acacia Trapdoor","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:acacia_wall_hanging_sign","localizedName":"Acacia Hanging Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:acacia_wall_sign","localizedName":"Acacia Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:acacia_wood","localizedName":"Acacia Wood","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:activator_rail","localizedName":"Activator Rail","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.7,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.7,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:air","localizedName":"Air","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:allium","localizedName":"Allium","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:amethyst_block","localizedName":"Block of Amethyst","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:amethyst_cluster","localizedName":"Amethyst Cluster","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":5,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.5,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:ancient_debris","localizedName":"Ancient Debris","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":30.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1200.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:andesite","localizedName":"Andesite","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:andesite_slab","localizedName":"Andesite Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:andesite_stairs","localizedName":"Andesite Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:andesite_wall","localizedName":"Andesite Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:anvil","localizedName":"Anvil","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":5.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a7a7a7","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1200.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":true}},{"id":"minecraft:attached_melon_stem","localizedName":"Attached Melon Stem","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:attached_pumpkin_stem","localizedName":"Attached Pumpkin Stem","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:azalea","localizedName":"Azalea","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:azalea_leaves","localizedName":"Azalea Leaves","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":true,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:azure_bluet","localizedName":"Azure Bluet","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo","localizedName":"Bamboo","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo_block","localizedName":"Block of Bamboo","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo_button","localizedName":"Bamboo Button","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo_door","localizedName":"Bamboo Door","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo_fence","localizedName":"Bamboo Fence","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo_fence_gate","localizedName":"Bamboo Fence Gate","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo_hanging_sign","localizedName":"Bamboo Hanging Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo_mosaic","localizedName":"Bamboo Mosaic","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo_mosaic_slab","localizedName":"Bamboo Mosaic Slab","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo_mosaic_stairs","localizedName":"Bamboo Mosaic Stairs","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo_planks","localizedName":"Bamboo Planks","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo_pressure_plate","localizedName":"Bamboo Pressure Plate","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo_sapling","localizedName":"Bamboo Shoot","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo_sign","localizedName":"Bamboo Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo_slab","localizedName":"Bamboo Slab","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo_stairs","localizedName":"Bamboo Stairs","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo_trapdoor","localizedName":"Bamboo Trapdoor","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo_wall_hanging_sign","localizedName":"Bamboo Hanging Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bamboo_wall_sign","localizedName":"Bamboo Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:barrel","localizedName":"Barrel","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.5,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:barrier","localizedName":"Barrier","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":-1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3600000.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":true}},{"id":"minecraft:basalt","localizedName":"Basalt","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:beacon","localizedName":"Beacon","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":15,"liquid":false,"mapColor":"#5cdbd5","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bedrock","localizedName":"Bedrock","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":-1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3600000.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bee_nest","localizedName":"Bee Nest","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:beehive","localizedName":"Beehive","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.6,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.6,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:beetroots","localizedName":"Beetroots","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bell","localizedName":"Bell","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":5.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#faee4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":5.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:big_dripleaf","localizedName":"Big Dripleaf","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:big_dripleaf_stem","localizedName":"Big Dripleaf Stem","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:birch_button","localizedName":"Birch Button","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:birch_door","localizedName":"Birch Door","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:birch_fence","localizedName":"Birch Fence","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:birch_fence_gate","localizedName":"Birch Fence Gate","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:birch_hanging_sign","localizedName":"Birch Hanging Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:birch_leaves","localizedName":"Birch Leaves","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":true,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:birch_log","localizedName":"Birch Log","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:birch_planks","localizedName":"Birch Planks","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:birch_pressure_plate","localizedName":"Birch Pressure Plate","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:birch_sapling","localizedName":"Birch Sapling","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:birch_sign","localizedName":"Birch Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:birch_slab","localizedName":"Birch Slab","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:birch_stairs","localizedName":"Birch Stairs","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:birch_trapdoor","localizedName":"Birch Trapdoor","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:birch_wall_hanging_sign","localizedName":"Birch Hanging Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:birch_wall_sign","localizedName":"Birch Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:birch_wood","localizedName":"Birch Wood","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:black_banner","localizedName":"Black Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:black_bed","localizedName":"Black Bed","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:black_candle","localizedName":"Black Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:black_candle_cake","localizedName":"Cake with Black Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:black_carpet","localizedName":"Black Carpet","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:black_concrete","localizedName":"Black Concrete","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:black_concrete_powder","localizedName":"Black Concrete Powder","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:black_glazed_terracotta","localizedName":"Black Glazed Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.4,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:black_shulker_box","localizedName":"Black Shulker Box","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":2.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:black_stained_glass","localizedName":"Black Stained Glass","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:black_stained_glass_pane","localizedName":"Black Stained Glass Pane","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:black_terracotta","localizedName":"Black Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#251610","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:black_wall_banner","localizedName":"Black Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:black_wool","localizedName":"Black Wool","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:blackstone","localizedName":"Blackstone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:blackstone_slab","localizedName":"Blackstone Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:blackstone_stairs","localizedName":"Blackstone Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:blackstone_wall","localizedName":"Blackstone Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:blast_furnace","localizedName":"Blast Furnace","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.5,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:blue_banner","localizedName":"Blue Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:blue_bed","localizedName":"Blue Bed","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#334cb2","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:blue_candle","localizedName":"Blue Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#334cb2","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:blue_candle_cake","localizedName":"Cake with Blue Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:blue_carpet","localizedName":"Blue Carpet","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#334cb2","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:blue_concrete","localizedName":"Blue Concrete","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#334cb2","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:blue_concrete_powder","localizedName":"Blue Concrete Powder","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#334cb2","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:blue_glazed_terracotta","localizedName":"Blue Glazed Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#334cb2","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.4,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:blue_ice","localizedName":"Blue Ice","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a0a0ff","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.8,"slipperiness":0.989,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:blue_orchid","localizedName":"Blue Orchid","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:blue_shulker_box","localizedName":"Blue Shulker Box","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":2.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#334cb2","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:blue_stained_glass","localizedName":"Blue Stained Glass","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#334cb2","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:blue_stained_glass_pane","localizedName":"Blue Stained Glass Pane","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:blue_terracotta","localizedName":"Blue Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c3e5c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:blue_wall_banner","localizedName":"Blue Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:blue_wool","localizedName":"Blue Wool","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#334cb2","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bone_block","localizedName":"Bone Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:bookshelf","localizedName":"Bookshelf","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:brain_coral","localizedName":"Brain Coral","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f27fa5","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:brain_coral_block","localizedName":"Brain Coral Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f27fa5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:brain_coral_fan","localizedName":"Brain Coral Fan","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f27fa5","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:brain_coral_wall_fan","localizedName":"Brain Coral Wall Fan","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f27fa5","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:brewing_stand","localizedName":"Brewing Stand","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.5,"hasContainer":true,"lightValue":1,"liquid":false,"mapColor":"#a7a7a7","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:brick_slab","localizedName":"Brick Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:brick_stairs","localizedName":"Brick Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:brick_wall","localizedName":"Brick Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:bricks","localizedName":"Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:brown_banner","localizedName":"Brown Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:brown_bed","localizedName":"Brown Bed","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:brown_candle","localizedName":"Brown Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:brown_candle_cake","localizedName":"Cake with Brown Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:brown_carpet","localizedName":"Brown Carpet","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:brown_concrete","localizedName":"Brown Concrete","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:brown_concrete_powder","localizedName":"Brown Concrete Powder","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:brown_glazed_terracotta","localizedName":"Brown Glazed Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.4,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:brown_mushroom","localizedName":"Brown Mushroom","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":1,"liquid":false,"mapColor":"#664c33","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:brown_mushroom_block","localizedName":"Brown Mushroom Block","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:brown_shulker_box","localizedName":"Brown Shulker Box","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":2.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:brown_stained_glass","localizedName":"Brown Stained Glass","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:brown_stained_glass_pane","localizedName":"Brown Stained Glass Pane","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:brown_terracotta","localizedName":"Brown Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c3223","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:brown_wall_banner","localizedName":"Brown Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:brown_wool","localizedName":"Brown Wool","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bubble_column","localizedName":"Bubble Column","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":true,"mapColor":"#4040ff","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bubble_coral","localizedName":"Bubble Coral","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bubble_coral_block","localizedName":"Bubble Coral Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:bubble_coral_fan","localizedName":"Bubble Coral Fan","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:bubble_coral_wall_fan","localizedName":"Bubble Coral Wall Fan","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:budding_amethyst","localizedName":"Budding Amethyst","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.5,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cactus","localizedName":"Cactus","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.4,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cake","localizedName":"Cake","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:calcite","localizedName":"Calcite","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.75,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d1b1a1","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.75,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:calibrated_sculk_sensor","localizedName":"Calibrated Sculk Sensor","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":1,"liquid":false,"mapColor":"#4c7f99","movementBlocker":true,"opaque":true,"powerSource":true,"replacedDuringPlacement":false,"resistance":1.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:campfire","localizedName":"Campfire","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":true,"lightValue":15,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:candle","localizedName":"Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:candle_cake","localizedName":"Cake with Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:carrots","localizedName":"Carrots","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cartography_table","localizedName":"Cartography Table","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:carved_pumpkin","localizedName":"Carved Pumpkin","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cauldron","localizedName":"Cauldron","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cave_air","localizedName":"Cave Air","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cave_vines","localizedName":"Cave Vines","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cave_vines_plant","localizedName":"Cave Vines Plant","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:chain","localizedName":"Chain","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":5.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:chain_command_block","localizedName":"Chain Command Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":-1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#667f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3600000.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cherry_button","localizedName":"Cherry Button","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cherry_door","localizedName":"Cherry Door","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d1b1a1","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cherry_fence","localizedName":"Cherry Fence","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d1b1a1","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cherry_fence_gate","localizedName":"Cherry Fence Gate","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d1b1a1","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cherry_hanging_sign","localizedName":"Cherry Hanging Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a04d4e","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cherry_leaves","localizedName":"Cherry Leaves","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":true,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f27fa5","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cherry_log","localizedName":"Cherry Log","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d1b1a1","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cherry_planks","localizedName":"Cherry Planks","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d1b1a1","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cherry_pressure_plate","localizedName":"Cherry Pressure Plate","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d1b1a1","movementBlocker":true,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cherry_sapling","localizedName":"Cherry Sapling","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f27fa5","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cherry_sign","localizedName":"Cherry Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d1b1a1","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cherry_slab","localizedName":"Cherry Slab","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d1b1a1","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cherry_stairs","localizedName":"Cherry Stairs","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d1b1a1","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cherry_trapdoor","localizedName":"Cherry Trapdoor","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d1b1a1","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cherry_wall_hanging_sign","localizedName":"Cherry Hanging Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a04d4e","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cherry_wall_sign","localizedName":"Cherry Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d1b1a1","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cherry_wood","localizedName":"Cherry Wood","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#392923","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:chest","localizedName":"Chest","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.5,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:chipped_anvil","localizedName":"Chipped Anvil","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":5.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a7a7a7","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1200.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":true}},{"id":"minecraft:chiseled_bookshelf","localizedName":"Chiseled Bookshelf","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:chiseled_deepslate","localizedName":"Chiseled Deepslate","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:chiseled_nether_bricks","localizedName":"Chiseled Nether Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#700200","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:chiseled_polished_blackstone","localizedName":"Chiseled Polished Blackstone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:chiseled_quartz_block","localizedName":"Chiseled Quartz Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#fffcf5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:chiseled_red_sandstone","localizedName":"Chiseled Red Sandstone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:chiseled_sandstone","localizedName":"Chiseled Sandstone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:chiseled_stone_bricks","localizedName":"Chiseled Stone Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:chorus_flower","localizedName":"Chorus Flower","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":0.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.4,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:chorus_plant","localizedName":"Chorus Plant","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.4,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:clay","localizedName":"Clay","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.6,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a4a8b8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.6,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:coal_block","localizedName":"Block of Coal","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":5.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:coal_ore","localizedName":"Coal Ore","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:coarse_dirt","localizedName":"Coarse Dirt","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cobbled_deepslate","localizedName":"Cobbled Deepslate","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cobbled_deepslate_slab","localizedName":"Cobbled Deepslate Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cobbled_deepslate_stairs","localizedName":"Cobbled Deepslate Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cobbled_deepslate_wall","localizedName":"Cobbled Deepslate Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cobblestone","localizedName":"Cobblestone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cobblestone_slab","localizedName":"Cobblestone Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cobblestone_stairs","localizedName":"Cobblestone Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cobblestone_wall","localizedName":"Cobblestone Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cobweb","localizedName":"Cobweb","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":4.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#c7c7c7","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cocoa","localizedName":"Cocoa","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:command_block","localizedName":"Command Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":-1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3600000.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:comparator","localizedName":"Redstone Comparator","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":true,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:composter","localizedName":"Composter","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.6,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.6,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:conduit","localizedName":"Conduit","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":15,"liquid":false,"mapColor":"#5cdbd5","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:copper_block","localizedName":"Block of Copper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":true,"unpushable":false}},{"id":"minecraft:copper_ore","localizedName":"Copper Ore","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cornflower","localizedName":"Cornflower","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cracked_deepslate_bricks","localizedName":"Cracked Deepslate Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cracked_deepslate_tiles","localizedName":"Cracked Deepslate Tiles","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cracked_nether_bricks","localizedName":"Cracked Nether Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#700200","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cracked_polished_blackstone_bricks","localizedName":"Cracked Polished Blackstone Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cracked_stone_bricks","localizedName":"Cracked Stone Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:crafting_table","localizedName":"Crafting Table","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:creeper_head","localizedName":"Creeper Head","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:creeper_wall_head","localizedName":"Creeper Head","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:crimson_button","localizedName":"Crimson Button","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:crimson_door","localizedName":"Crimson Door","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#943f61","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:crimson_fence","localizedName":"Crimson Fence","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#943f61","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:crimson_fence_gate","localizedName":"Crimson Fence Gate","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#943f61","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:crimson_fungus","localizedName":"Crimson Fungus","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#700200","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:crimson_hanging_sign","localizedName":"Crimson Hanging Sign","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#943f61","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:crimson_hyphae","localizedName":"Crimson Hyphae","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#5c191d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:crimson_nylium","localizedName":"Crimson Nylium","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#bd3031","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.4,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":true,"unpushable":false}},{"id":"minecraft:crimson_planks","localizedName":"Crimson Planks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#943f61","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:crimson_pressure_plate","localizedName":"Crimson Pressure Plate","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#943f61","movementBlocker":true,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:crimson_roots","localizedName":"Crimson Roots","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#700200","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:crimson_sign","localizedName":"Crimson Sign","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#943f61","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:crimson_slab","localizedName":"Crimson Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#943f61","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:crimson_stairs","localizedName":"Crimson Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#943f61","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:crimson_stem","localizedName":"Crimson Stem","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#943f61","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:crimson_trapdoor","localizedName":"Crimson Trapdoor","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#943f61","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:crimson_wall_hanging_sign","localizedName":"Crimson Hanging Sign","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#943f61","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:crimson_wall_sign","localizedName":"Crimson Sign","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#943f61","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:crying_obsidian","localizedName":"Crying Obsidian","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":50.0,"hasContainer":false,"lightValue":10,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1200.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cut_copper","localizedName":"Cut Copper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cut_copper_slab","localizedName":"Cut Copper Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cut_copper_stairs","localizedName":"Cut Copper Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cut_red_sandstone","localizedName":"Cut Red Sandstone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cut_red_sandstone_slab","localizedName":"Cut Red Sandstone Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cut_sandstone","localizedName":"Cut Sandstone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cut_sandstone_slab","localizedName":"Cut Sandstone Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cyan_banner","localizedName":"Cyan Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cyan_bed","localizedName":"Cyan Bed","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c7f99","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cyan_candle","localizedName":"Cyan Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c7f99","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cyan_candle_cake","localizedName":"Cake with Cyan Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cyan_carpet","localizedName":"Cyan Carpet","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c7f99","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cyan_concrete","localizedName":"Cyan Concrete","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c7f99","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cyan_concrete_powder","localizedName":"Cyan Concrete Powder","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c7f99","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cyan_glazed_terracotta","localizedName":"Cyan Glazed Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c7f99","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.4,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cyan_shulker_box","localizedName":"Cyan Shulker Box","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":2.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#4c7f99","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cyan_stained_glass","localizedName":"Cyan Stained Glass","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c7f99","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cyan_stained_glass_pane","localizedName":"Cyan Stained Glass Pane","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cyan_terracotta","localizedName":"Cyan Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#575c5c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:cyan_wall_banner","localizedName":"Cyan Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:cyan_wool","localizedName":"Cyan Wool","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c7f99","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:damaged_anvil","localizedName":"Damaged Anvil","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":5.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a7a7a7","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1200.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":true}},{"id":"minecraft:dandelion","localizedName":"Dandelion","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dark_oak_button","localizedName":"Dark Oak Button","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dark_oak_door","localizedName":"Dark Oak Door","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dark_oak_fence","localizedName":"Dark Oak Fence","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dark_oak_fence_gate","localizedName":"Dark Oak Fence Gate","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dark_oak_hanging_sign","localizedName":"Dark Oak Hanging Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dark_oak_leaves","localizedName":"Dark Oak Leaves","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":true,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dark_oak_log","localizedName":"Dark Oak Log","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dark_oak_planks","localizedName":"Dark Oak Planks","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dark_oak_pressure_plate","localizedName":"Dark Oak Pressure Plate","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dark_oak_sapling","localizedName":"Dark Oak Sapling","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dark_oak_sign","localizedName":"Dark Oak Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dark_oak_slab","localizedName":"Dark Oak Slab","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dark_oak_stairs","localizedName":"Dark Oak Stairs","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dark_oak_trapdoor","localizedName":"Dark Oak Trapdoor","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dark_oak_wall_hanging_sign","localizedName":"Dark Oak Hanging Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dark_oak_wall_sign","localizedName":"Dark Oak Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dark_oak_wood","localizedName":"Dark Oak Wood","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dark_prismarine","localizedName":"Dark Prismarine","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#5cdbd5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dark_prismarine_slab","localizedName":"Dark Prismarine Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#5cdbd5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dark_prismarine_stairs","localizedName":"Dark Prismarine Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#5cdbd5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:daylight_detector","localizedName":"Daylight Detector","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dead_brain_coral","localizedName":"Dead Brain Coral","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_brain_coral_block","localizedName":"Dead Brain Coral Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_brain_coral_fan","localizedName":"Dead Brain Coral Fan","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_brain_coral_wall_fan","localizedName":"Dead Brain Coral Wall Fan","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_bubble_coral","localizedName":"Dead Bubble Coral","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_bubble_coral_block","localizedName":"Dead Bubble Coral Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_bubble_coral_fan","localizedName":"Dead Bubble Coral Fan","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_bubble_coral_wall_fan","localizedName":"Dead Bubble Coral Wall Fan","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_bush","localizedName":"Dead Bush","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dead_fire_coral","localizedName":"Dead Fire Coral","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_fire_coral_block","localizedName":"Dead Fire Coral Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_fire_coral_fan","localizedName":"Dead Fire Coral Fan","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_fire_coral_wall_fan","localizedName":"Dead Fire Coral Wall Fan","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_horn_coral","localizedName":"Dead Horn Coral","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_horn_coral_block","localizedName":"Dead Horn Coral Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_horn_coral_fan","localizedName":"Dead Horn Coral Fan","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_horn_coral_wall_fan","localizedName":"Dead Horn Coral Wall Fan","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_tube_coral","localizedName":"Dead Tube Coral","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_tube_coral_block","localizedName":"Dead Tube Coral Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_tube_coral_fan","localizedName":"Dead Tube Coral Fan","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dead_tube_coral_wall_fan","localizedName":"Dead Tube Coral Wall Fan","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:decorated_pot","localizedName":"Decorated Pot","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8e3c2e","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:deepslate","localizedName":"Deepslate","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:deepslate_brick_slab","localizedName":"Deepslate Brick Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:deepslate_brick_stairs","localizedName":"Deepslate Brick Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:deepslate_brick_wall","localizedName":"Deepslate Brick Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:deepslate_bricks","localizedName":"Deepslate Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:deepslate_coal_ore","localizedName":"Deepslate Coal Ore","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":4.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:deepslate_copper_ore","localizedName":"Deepslate Copper Ore","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":4.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:deepslate_diamond_ore","localizedName":"Deepslate Diamond Ore","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":4.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:deepslate_emerald_ore","localizedName":"Deepslate Emerald Ore","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":4.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:deepslate_gold_ore","localizedName":"Deepslate Gold Ore","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":4.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:deepslate_iron_ore","localizedName":"Deepslate Iron Ore","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":4.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:deepslate_lapis_ore","localizedName":"Deepslate Lapis Lazuli Ore","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":4.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:deepslate_redstone_ore","localizedName":"Deepslate Redstone Ore","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":4.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:deepslate_tile_slab","localizedName":"Deepslate Tile Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:deepslate_tile_stairs","localizedName":"Deepslate Tile Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:deepslate_tile_wall","localizedName":"Deepslate Tile Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:deepslate_tiles","localizedName":"Deepslate Tiles","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:detector_rail","localizedName":"Detector Rail","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.7,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.7,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:diamond_block","localizedName":"Block of Diamond","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":5.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#5cdbd5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:diamond_ore","localizedName":"Diamond Ore","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:diorite","localizedName":"Diorite","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#fffcf5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:diorite_slab","localizedName":"Diorite Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#fffcf5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:diorite_stairs","localizedName":"Diorite Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#fffcf5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:diorite_wall","localizedName":"Diorite Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#fffcf5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dirt","localizedName":"Dirt","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dirt_path","localizedName":"Dirt Path","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.65,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.65,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dispenser","localizedName":"Dispenser","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.5,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dragon_egg","localizedName":"Dragon Egg","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":1,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":9.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dragon_head","localizedName":"Dragon Head","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dragon_wall_head","localizedName":"Dragon Head","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dried_kelp_block","localizedName":"Dried Kelp Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#667f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:dripstone_block","localizedName":"Dripstone Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c3223","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:dropper","localizedName":"Dropper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.5,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:emerald_block","localizedName":"Block of Emerald","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":5.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#00d93a","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:emerald_ore","localizedName":"Emerald Ore","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:enchanting_table","localizedName":"Enchanting Table","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":5.0,"hasContainer":false,"lightValue":7,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1200.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:end_gateway","localizedName":"End Gateway","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":-1.0,"hasContainer":false,"lightValue":15,"liquid":false,"mapColor":"#191919","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3600000.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":true}},{"id":"minecraft:end_portal","localizedName":"End Portal","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":-1.0,"hasContainer":false,"lightValue":15,"liquid":false,"mapColor":"#191919","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3600000.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":true}},{"id":"minecraft:end_portal_frame","localizedName":"End Portal Frame","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":-1.0,"hasContainer":false,"lightValue":1,"liquid":false,"mapColor":"#667f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3600000.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:end_rod","localizedName":"End Rod","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":14,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:end_stone","localizedName":"End Stone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":9.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:end_stone_brick_slab","localizedName":"End Stone Brick Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":9.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:end_stone_brick_stairs","localizedName":"End Stone Brick Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":9.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:end_stone_brick_wall","localizedName":"End Stone Brick Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":9.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:end_stone_bricks","localizedName":"End Stone Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":9.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:ender_chest","localizedName":"Ender Chest","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":22.5,"hasContainer":false,"lightValue":7,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":600.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:exposed_copper","localizedName":"Exposed Copper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#876b62","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":true,"unpushable":false}},{"id":"minecraft:exposed_cut_copper","localizedName":"Exposed Cut Copper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#876b62","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":true,"unpushable":false}},{"id":"minecraft:exposed_cut_copper_slab","localizedName":"Exposed Cut Copper Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#876b62","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":true,"unpushable":false}},{"id":"minecraft:exposed_cut_copper_stairs","localizedName":"Exposed Cut Copper Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#876b62","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":true,"unpushable":false}},{"id":"minecraft:farmland","localizedName":"Farmland","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.6,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.6,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:fern","localizedName":"Fern","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:fire","localizedName":"Fire","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":15,"liquid":false,"mapColor":"#ff0000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:fire_coral","localizedName":"Fire Coral","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:fire_coral_block","localizedName":"Fire Coral Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:fire_coral_fan","localizedName":"Fire Coral Fan","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:fire_coral_wall_fan","localizedName":"Fire Coral Wall Fan","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:fletching_table","localizedName":"Fletching Table","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:flower_pot","localizedName":"Flower Pot","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:flowering_azalea","localizedName":"Flowering Azalea","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:flowering_azalea_leaves","localizedName":"Flowering Azalea Leaves","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":true,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:frogspawn","localizedName":"Frogspawn","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4040ff","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:frosted_ice","localizedName":"Frosted Ice","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a0a0ff","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.98,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:furnace","localizedName":"Furnace","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.5,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:gilded_blackstone","localizedName":"Gilded Blackstone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:glass","localizedName":"Glass","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:glass_pane","localizedName":"Glass Pane","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:glow_lichen","localizedName":"Glow Lichen","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7fa796","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.2,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:glowstone","localizedName":"Glowstone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":15,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:gold_block","localizedName":"Block of Gold","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#faee4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:gold_ore","localizedName":"Gold Ore","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:granite","localizedName":"Granite","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:granite_slab","localizedName":"Granite Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:granite_stairs","localizedName":"Granite Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:granite_wall","localizedName":"Granite Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:grass","localizedName":"Grass","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:grass_block","localizedName":"Grass Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.6,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7fb238","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.6,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:gravel","localizedName":"Gravel","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.6,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.6,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:gray_banner","localizedName":"Gray Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:gray_bed","localizedName":"Gray Bed","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:gray_candle","localizedName":"Gray Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:gray_candle_cake","localizedName":"Cake with Gray Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:gray_carpet","localizedName":"Gray Carpet","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:gray_concrete","localizedName":"Gray Concrete","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:gray_concrete_powder","localizedName":"Gray Concrete Powder","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:gray_glazed_terracotta","localizedName":"Gray Glazed Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.4,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:gray_shulker_box","localizedName":"Gray Shulker Box","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":2.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:gray_stained_glass","localizedName":"Gray Stained Glass","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:gray_stained_glass_pane","localizedName":"Gray Stained Glass Pane","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:gray_terracotta","localizedName":"Gray Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#392923","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:gray_wall_banner","localizedName":"Gray Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:gray_wool","localizedName":"Gray Wool","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:green_banner","localizedName":"Green Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:green_bed","localizedName":"Green Bed","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#667f33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:green_candle","localizedName":"Green Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#667f33","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:green_candle_cake","localizedName":"Cake with Green Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:green_carpet","localizedName":"Green Carpet","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#667f33","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:green_concrete","localizedName":"Green Concrete","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#667f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:green_concrete_powder","localizedName":"Green Concrete Powder","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#667f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:green_glazed_terracotta","localizedName":"Green Glazed Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#667f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.4,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:green_shulker_box","localizedName":"Green Shulker Box","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":2.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#667f33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:green_stained_glass","localizedName":"Green Stained Glass","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#667f33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:green_stained_glass_pane","localizedName":"Green Stained Glass Pane","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:green_terracotta","localizedName":"Green Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c522a","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:green_wall_banner","localizedName":"Green Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:green_wool","localizedName":"Green Wool","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#667f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:grindstone","localizedName":"Grindstone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a7a7a7","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":true}},{"id":"minecraft:hanging_roots","localizedName":"Hanging Roots","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:hay_block","localizedName":"Hay Bale","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:heavy_weighted_pressure_plate","localizedName":"Heavy Weighted Pressure Plate","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a7a7a7","movementBlocker":true,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:honey_block","localizedName":"Honey Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:honeycomb_block","localizedName":"Honeycomb Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.6,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.6,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:hopper","localizedName":"Hopper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:horn_coral","localizedName":"Horn Coral","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:horn_coral_block","localizedName":"Horn Coral Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:horn_coral_fan","localizedName":"Horn Coral Fan","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:horn_coral_wall_fan","localizedName":"Horn Coral Wall Fan","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:ice","localizedName":"Ice","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a0a0ff","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.98,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:infested_chiseled_stone_bricks","localizedName":"Infested Chiseled Stone Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.75,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a4a8b8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.75,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:infested_cobblestone","localizedName":"Infested Cobblestone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a4a8b8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.75,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:infested_cracked_stone_bricks","localizedName":"Infested Cracked Stone Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.75,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a4a8b8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.75,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:infested_deepslate","localizedName":"Infested Deepslate","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.75,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:infested_mossy_stone_bricks","localizedName":"Infested Mossy Stone Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.75,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a4a8b8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.75,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:infested_stone","localizedName":"Infested Stone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.75,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a4a8b8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.75,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:infested_stone_bricks","localizedName":"Infested Stone Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.75,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a4a8b8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.75,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:iron_bars","localizedName":"Iron Bars","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":5.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:iron_block","localizedName":"Block of Iron","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":5.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a7a7a7","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:iron_door","localizedName":"Iron Door","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":5.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a7a7a7","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":5.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:iron_ore","localizedName":"Iron Ore","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:iron_trapdoor","localizedName":"Iron Trapdoor","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":5.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a7a7a7","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":5.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:jack_o_lantern","localizedName":"Jack o\u0027Lantern","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":1.0,"hasContainer":false,"lightValue":15,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:jigsaw","localizedName":"Jigsaw Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":-1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#999999","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3600000.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:jukebox","localizedName":"Jukebox","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":true,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:jungle_button","localizedName":"Jungle Button","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:jungle_door","localizedName":"Jungle Door","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:jungle_fence","localizedName":"Jungle Fence","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:jungle_fence_gate","localizedName":"Jungle Fence Gate","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:jungle_hanging_sign","localizedName":"Jungle Hanging Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:jungle_leaves","localizedName":"Jungle Leaves","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":true,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:jungle_log","localizedName":"Jungle Log","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:jungle_planks","localizedName":"Jungle Planks","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:jungle_pressure_plate","localizedName":"Jungle Pressure Plate","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:jungle_sapling","localizedName":"Jungle Sapling","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:jungle_sign","localizedName":"Jungle Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:jungle_slab","localizedName":"Jungle Slab","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:jungle_stairs","localizedName":"Jungle Stairs","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:jungle_trapdoor","localizedName":"Jungle Trapdoor","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:jungle_wall_hanging_sign","localizedName":"Jungle Hanging Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:jungle_wall_sign","localizedName":"Jungle Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:jungle_wood","localizedName":"Jungle Wood","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:kelp","localizedName":"Kelp","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4040ff","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:kelp_plant","localizedName":"Kelp Plant","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4040ff","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:ladder","localizedName":"Ladder","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.4,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:lantern","localizedName":"Lantern","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":3.5,"hasContainer":false,"lightValue":15,"liquid":false,"mapColor":"#a7a7a7","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:lapis_block","localizedName":"Block of Lapis Lazuli","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4a80ff","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:lapis_ore","localizedName":"Lapis Lazuli Ore","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:large_amethyst_bud","localizedName":"Large Amethyst Bud","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":4,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.5,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:large_fern","localizedName":"Large Fern","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:lava","localizedName":"Lava","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":100.0,"hasContainer":false,"lightValue":15,"liquid":true,"mapColor":"#ff0000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":100.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:lava_cauldron","localizedName":"Lava Cauldron","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":15,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:lectern","localizedName":"Lectern","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.5,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":true,"replacedDuringPlacement":false,"resistance":2.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:lever","localizedName":"Lever","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light","localizedName":"Light","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":-1.0,"hasContainer":false,"lightValue":15,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":3600000.8,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_blue_banner","localizedName":"Light Blue Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_blue_bed","localizedName":"Light Blue Bed","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#6699d8","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_blue_candle","localizedName":"Light Blue Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#6699d8","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_blue_candle_cake","localizedName":"Cake with Light Blue Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_blue_carpet","localizedName":"Light Blue Carpet","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#6699d8","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_blue_concrete","localizedName":"Light Blue Concrete","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#6699d8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:light_blue_concrete_powder","localizedName":"Light Blue Concrete Powder","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#6699d8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_blue_glazed_terracotta","localizedName":"Light Blue Glazed Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#6699d8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.4,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:light_blue_shulker_box","localizedName":"Light Blue Shulker Box","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":2.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#6699d8","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_blue_stained_glass","localizedName":"Light Blue Stained Glass","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#6699d8","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_blue_stained_glass_pane","localizedName":"Light Blue Stained Glass Pane","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_blue_terracotta","localizedName":"Light Blue Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#706c8a","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:light_blue_wall_banner","localizedName":"Light Blue Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_blue_wool","localizedName":"Light Blue Wool","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#6699d8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_gray_banner","localizedName":"Light Gray Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_gray_bed","localizedName":"Light Gray Bed","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#999999","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_gray_candle","localizedName":"Light Gray Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#999999","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_gray_candle_cake","localizedName":"Cake with Light Gray Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_gray_carpet","localizedName":"Light Gray Carpet","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#999999","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_gray_concrete","localizedName":"Light Gray Concrete","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#999999","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:light_gray_concrete_powder","localizedName":"Light Gray Concrete Powder","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#999999","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_gray_glazed_terracotta","localizedName":"Light Gray Glazed Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#999999","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.4,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:light_gray_shulker_box","localizedName":"Light Gray Shulker Box","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":2.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#999999","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_gray_stained_glass","localizedName":"Light Gray Stained Glass","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#999999","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_gray_stained_glass_pane","localizedName":"Light Gray Stained Glass Pane","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_gray_terracotta","localizedName":"Light Gray Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#876b62","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:light_gray_wall_banner","localizedName":"Light Gray Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_gray_wool","localizedName":"Light Gray Wool","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#999999","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:light_weighted_pressure_plate","localizedName":"Light Weighted Pressure Plate","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#faee4d","movementBlocker":true,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:lightning_rod","localizedName":"Lightning Rod","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:lilac","localizedName":"Lilac","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:lily_of_the_valley","localizedName":"Lily of the Valley","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:lily_pad","localizedName":"Lily Pad","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:lime_banner","localizedName":"Lime Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:lime_bed","localizedName":"Lime Bed","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7fcc19","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:lime_candle","localizedName":"Lime Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7fcc19","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:lime_candle_cake","localizedName":"Cake with Lime Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:lime_carpet","localizedName":"Lime Carpet","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7fcc19","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:lime_concrete","localizedName":"Lime Concrete","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7fcc19","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:lime_concrete_powder","localizedName":"Lime Concrete Powder","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7fcc19","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:lime_glazed_terracotta","localizedName":"Lime Glazed Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7fcc19","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.4,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:lime_shulker_box","localizedName":"Lime Shulker Box","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":2.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#7fcc19","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:lime_stained_glass","localizedName":"Lime Stained Glass","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7fcc19","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:lime_stained_glass_pane","localizedName":"Lime Stained Glass Pane","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:lime_terracotta","localizedName":"Lime Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#677535","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:lime_wall_banner","localizedName":"Lime Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:lime_wool","localizedName":"Lime Wool","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7fcc19","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:lodestone","localizedName":"Lodestone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a7a7a7","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":true}},{"id":"minecraft:loom","localizedName":"Loom","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:magenta_banner","localizedName":"Magenta Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:magenta_bed","localizedName":"Magenta Bed","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#b24cd8","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:magenta_candle","localizedName":"Magenta Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#b24cd8","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:magenta_candle_cake","localizedName":"Cake with Magenta Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:magenta_carpet","localizedName":"Magenta Carpet","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#b24cd8","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:magenta_concrete","localizedName":"Magenta Concrete","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#b24cd8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:magenta_concrete_powder","localizedName":"Magenta Concrete Powder","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#b24cd8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:magenta_glazed_terracotta","localizedName":"Magenta Glazed Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#b24cd8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.4,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:magenta_shulker_box","localizedName":"Magenta Shulker Box","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":2.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#b24cd8","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:magenta_stained_glass","localizedName":"Magenta Stained Glass","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#b24cd8","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:magenta_stained_glass_pane","localizedName":"Magenta Stained Glass Pane","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:magenta_terracotta","localizedName":"Magenta Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#95576c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:magenta_wall_banner","localizedName":"Magenta Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:magenta_wool","localizedName":"Magenta Wool","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#b24cd8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:magma_block","localizedName":"Magma Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":3,"liquid":false,"mapColor":"#700200","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:mangrove_button","localizedName":"Mangrove Button","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mangrove_door","localizedName":"Mangrove Door","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mangrove_fence","localizedName":"Mangrove Fence","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mangrove_fence_gate","localizedName":"Mangrove Fence Gate","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mangrove_hanging_sign","localizedName":"Mangrove Hanging Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mangrove_leaves","localizedName":"Mangrove Leaves","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":true,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mangrove_log","localizedName":"Mangrove Log","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mangrove_planks","localizedName":"Mangrove Planks","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mangrove_pressure_plate","localizedName":"Mangrove Pressure Plate","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mangrove_propagule","localizedName":"Mangrove Propagule","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mangrove_roots","localizedName":"Mangrove Roots","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.7,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.7,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mangrove_sign","localizedName":"Mangrove Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mangrove_slab","localizedName":"Mangrove Slab","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mangrove_stairs","localizedName":"Mangrove Stairs","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mangrove_trapdoor","localizedName":"Mangrove Trapdoor","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mangrove_wall_hanging_sign","localizedName":"Mangrove Hanging Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mangrove_wall_sign","localizedName":"Mangrove Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mangrove_wood","localizedName":"Mangrove Wood","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:medium_amethyst_bud","localizedName":"Medium Amethyst Bud","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":2,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.5,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:melon","localizedName":"Melon","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7fcc19","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:melon_stem","localizedName":"Melon Stem","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:moss_block","localizedName":"Moss Block","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#667f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:moss_carpet","localizedName":"Moss Carpet","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#667f33","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mossy_cobblestone","localizedName":"Mossy Cobblestone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:mossy_cobblestone_slab","localizedName":"Mossy Cobblestone Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:mossy_cobblestone_stairs","localizedName":"Mossy Cobblestone Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:mossy_cobblestone_wall","localizedName":"Mossy Cobblestone Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:mossy_stone_brick_slab","localizedName":"Mossy Stone Brick Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:mossy_stone_brick_stairs","localizedName":"Mossy Stone Brick Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:mossy_stone_brick_wall","localizedName":"Mossy Stone Brick Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:mossy_stone_bricks","localizedName":"Mossy Stone Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:moving_piston","localizedName":"Moving Piston","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":-1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":true}},{"id":"minecraft:mud","localizedName":"Mud","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#575c5c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mud_brick_slab","localizedName":"Mud Brick Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#876b62","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:mud_brick_stairs","localizedName":"Mud Brick Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#876b62","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:mud_brick_wall","localizedName":"Mud Brick Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#876b62","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:mud_bricks","localizedName":"Mud Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#876b62","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:muddy_mangrove_roots","localizedName":"Muddy Mangrove Roots","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.7,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.7,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mushroom_stem","localizedName":"Mushroom Stem","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#c7c7c7","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:mycelium","localizedName":"Mycelium","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.6,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.6,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:nether_brick_fence","localizedName":"Nether Brick Fence","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#700200","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:nether_brick_slab","localizedName":"Nether Brick Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#700200","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:nether_brick_stairs","localizedName":"Nether Brick Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#700200","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:nether_brick_wall","localizedName":"Nether Brick Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#700200","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:nether_bricks","localizedName":"Nether Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#700200","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:nether_gold_ore","localizedName":"Nether Gold Ore","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#700200","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:nether_portal","localizedName":"Nether Portal","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":-1.0,"hasContainer":false,"lightValue":11,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":true}},{"id":"minecraft:nether_quartz_ore","localizedName":"Nether Quartz Ore","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#700200","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:nether_sprouts","localizedName":"Nether Sprouts","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c7f99","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:nether_wart","localizedName":"Nether Wart","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:nether_wart_block","localizedName":"Nether Wart Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:netherite_block","localizedName":"Block of Netherite","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":50.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1200.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:netherrack","localizedName":"Netherrack","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#700200","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.4,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:note_block","localizedName":"Note Block","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oak_button","localizedName":"Oak Button","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oak_door","localizedName":"Oak Door","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oak_fence","localizedName":"Oak Fence","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oak_fence_gate","localizedName":"Oak Fence Gate","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oak_hanging_sign","localizedName":"Oak Hanging Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oak_leaves","localizedName":"Oak Leaves","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":true,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oak_log","localizedName":"Oak Log","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oak_planks","localizedName":"Oak Planks","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oak_pressure_plate","localizedName":"Oak Pressure Plate","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oak_sapling","localizedName":"Oak Sapling","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oak_sign","localizedName":"Oak Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oak_slab","localizedName":"Oak Slab","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oak_stairs","localizedName":"Oak Stairs","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oak_trapdoor","localizedName":"Oak Trapdoor","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oak_wall_hanging_sign","localizedName":"Oak Hanging Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oak_wall_sign","localizedName":"Oak Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oak_wood","localizedName":"Oak Wood","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:observer","localizedName":"Observer","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":true,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:obsidian","localizedName":"Obsidian","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":50.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1200.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:ochre_froglight","localizedName":"Ochre Froglight","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":15,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:orange_banner","localizedName":"Orange Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:orange_bed","localizedName":"Orange Bed","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:orange_candle","localizedName":"Orange Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:orange_candle_cake","localizedName":"Cake with Orange Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:orange_carpet","localizedName":"Orange Carpet","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:orange_concrete","localizedName":"Orange Concrete","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:orange_concrete_powder","localizedName":"Orange Concrete Powder","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:orange_glazed_terracotta","localizedName":"Orange Glazed Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.4,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:orange_shulker_box","localizedName":"Orange Shulker Box","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":2.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:orange_stained_glass","localizedName":"Orange Stained Glass","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:orange_stained_glass_pane","localizedName":"Orange Stained Glass Pane","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:orange_terracotta","localizedName":"Orange Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#9f5224","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:orange_tulip","localizedName":"Orange Tulip","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:orange_wall_banner","localizedName":"Orange Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:orange_wool","localizedName":"Orange Wool","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oxeye_daisy","localizedName":"Oxeye Daisy","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:oxidized_copper","localizedName":"Oxidized Copper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#167e86","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:oxidized_cut_copper","localizedName":"Oxidized Cut Copper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#167e86","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:oxidized_cut_copper_slab","localizedName":"Oxidized Cut Copper Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#167e86","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:oxidized_cut_copper_stairs","localizedName":"Oxidized Cut Copper Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#167e86","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:packed_ice","localizedName":"Packed Ice","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a0a0ff","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.98,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:packed_mud","localizedName":"Packed Mud","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:pearlescent_froglight","localizedName":"Pearlescent Froglight","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":15,"liquid":false,"mapColor":"#f27fa5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:peony","localizedName":"Peony","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:petrified_oak_slab","localizedName":"Petrified Oak Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:piglin_head","localizedName":"Piglin Head","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:piglin_wall_head","localizedName":"Piglin Head","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:pink_banner","localizedName":"Pink Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:pink_bed","localizedName":"Pink Bed","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f27fa5","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:pink_candle","localizedName":"Pink Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f27fa5","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:pink_candle_cake","localizedName":"Cake with Pink Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:pink_carpet","localizedName":"Pink Carpet","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f27fa5","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:pink_concrete","localizedName":"Pink Concrete","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f27fa5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:pink_concrete_powder","localizedName":"Pink Concrete Powder","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f27fa5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:pink_glazed_terracotta","localizedName":"Pink Glazed Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f27fa5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.4,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:pink_petals","localizedName":"Pink Petals","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:pink_shulker_box","localizedName":"Pink Shulker Box","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":2.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#f27fa5","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:pink_stained_glass","localizedName":"Pink Stained Glass","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f27fa5","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:pink_stained_glass_pane","localizedName":"Pink Stained Glass Pane","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:pink_terracotta","localizedName":"Pink Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a04d4e","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:pink_tulip","localizedName":"Pink Tulip","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:pink_wall_banner","localizedName":"Pink Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:pink_wool","localizedName":"Pink Wool","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f27fa5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:piston","localizedName":"Piston","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":true}},{"id":"minecraft:piston_head","localizedName":"Piston Head","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":true}},{"id":"minecraft:pitcher_crop","localizedName":"Pitcher Crop","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:pitcher_plant","localizedName":"Pitcher Plant","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:player_head","localizedName":"Player Head","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:player_wall_head","localizedName":"Player Head","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:podzol","localizedName":"Podzol","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:pointed_dripstone","localizedName":"Pointed Dripstone","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c3223","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:polished_andesite","localizedName":"Polished Andesite","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_andesite_slab","localizedName":"Polished Andesite Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_andesite_stairs","localizedName":"Polished Andesite Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_basalt","localizedName":"Polished Basalt","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_blackstone","localizedName":"Polished Blackstone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_blackstone_brick_slab","localizedName":"Polished Blackstone Brick Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_blackstone_brick_stairs","localizedName":"Polished Blackstone Brick Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_blackstone_brick_wall","localizedName":"Polished Blackstone Brick Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_blackstone_bricks","localizedName":"Polished Blackstone Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_blackstone_button","localizedName":"Polished Blackstone Button","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:polished_blackstone_pressure_plate","localizedName":"Polished Blackstone Pressure Plate","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_blackstone_slab","localizedName":"Polished Blackstone Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_blackstone_stairs","localizedName":"Polished Blackstone Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_blackstone_wall","localizedName":"Polished Blackstone Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_deepslate","localizedName":"Polished Deepslate","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_deepslate_slab","localizedName":"Polished Deepslate Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_deepslate_stairs","localizedName":"Polished Deepslate Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_deepslate_wall","localizedName":"Polished Deepslate Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_diorite","localizedName":"Polished Diorite","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#fffcf5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_diorite_slab","localizedName":"Polished Diorite Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#fffcf5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_diorite_stairs","localizedName":"Polished Diorite Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#fffcf5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_granite","localizedName":"Polished Granite","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_granite_slab","localizedName":"Polished Granite Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:polished_granite_stairs","localizedName":"Polished Granite Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:poppy","localizedName":"Poppy","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potatoes","localizedName":"Potatoes","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_acacia_sapling","localizedName":"Potted Acacia Sapling","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_allium","localizedName":"Potted Allium","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_azalea_bush","localizedName":"Potted Azalea","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_azure_bluet","localizedName":"Potted Azure Bluet","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_bamboo","localizedName":"Potted Bamboo","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_birch_sapling","localizedName":"Potted Birch Sapling","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_blue_orchid","localizedName":"Potted Blue Orchid","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_brown_mushroom","localizedName":"Potted Brown Mushroom","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_cactus","localizedName":"Potted Cactus","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_cherry_sapling","localizedName":"Potted Cherry Sapling","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_cornflower","localizedName":"Potted Cornflower","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_crimson_fungus","localizedName":"Potted Crimson Fungus","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_crimson_roots","localizedName":"Potted Crimson Roots","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_dandelion","localizedName":"Potted Dandelion","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_dark_oak_sapling","localizedName":"Potted Dark Oak Sapling","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_dead_bush","localizedName":"Potted Dead Bush","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_fern","localizedName":"Potted Fern","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_flowering_azalea_bush","localizedName":"Potted Flowering Azalea","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_jungle_sapling","localizedName":"Potted Jungle Sapling","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_lily_of_the_valley","localizedName":"Potted Lily of the Valley","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_mangrove_propagule","localizedName":"Potted Mangrove Propagule","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_oak_sapling","localizedName":"Potted Oak Sapling","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_orange_tulip","localizedName":"Potted Orange Tulip","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_oxeye_daisy","localizedName":"Potted Oxeye Daisy","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_pink_tulip","localizedName":"Potted Pink Tulip","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_poppy","localizedName":"Potted Poppy","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_red_mushroom","localizedName":"Potted Red Mushroom","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_red_tulip","localizedName":"Potted Red Tulip","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_spruce_sapling","localizedName":"Potted Spruce Sapling","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_torchflower","localizedName":"Potted Torchflower","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_warped_fungus","localizedName":"Potted Warped Fungus","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_warped_roots","localizedName":"Potted Warped Roots","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_white_tulip","localizedName":"Potted White Tulip","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:potted_wither_rose","localizedName":"Potted Wither Rose","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:powder_snow","localizedName":"Powder Snow","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#ffffff","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.25,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:powder_snow_cauldron","localizedName":"Powder Snow Cauldron","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:powered_rail","localizedName":"Powered Rail","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.7,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.7,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:prismarine","localizedName":"Prismarine","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c7f99","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:prismarine_brick_slab","localizedName":"Prismarine Brick Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#5cdbd5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:prismarine_brick_stairs","localizedName":"Prismarine Brick Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#5cdbd5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:prismarine_bricks","localizedName":"Prismarine Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#5cdbd5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:prismarine_slab","localizedName":"Prismarine Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c7f99","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:prismarine_stairs","localizedName":"Prismarine Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c7f99","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:prismarine_wall","localizedName":"Prismarine Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c7f99","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:pumpkin","localizedName":"Pumpkin","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:pumpkin_stem","localizedName":"Pumpkin Stem","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:purple_banner","localizedName":"Purple Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:purple_bed","localizedName":"Purple Bed","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:purple_candle","localizedName":"Purple Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:purple_candle_cake","localizedName":"Cake with Purple Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:purple_carpet","localizedName":"Purple Carpet","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:purple_concrete","localizedName":"Purple Concrete","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:purple_concrete_powder","localizedName":"Purple Concrete Powder","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:purple_glazed_terracotta","localizedName":"Purple Glazed Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.4,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:purple_shulker_box","localizedName":"Purple Shulker Box","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":2.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#7a4958","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:purple_stained_glass","localizedName":"Purple Stained Glass","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:purple_stained_glass_pane","localizedName":"Purple Stained Glass Pane","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:purple_terracotta","localizedName":"Purple Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7a4958","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:purple_wall_banner","localizedName":"Purple Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:purple_wool","localizedName":"Purple Wool","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:purpur_block","localizedName":"Purpur Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#b24cd8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:purpur_pillar","localizedName":"Purpur Pillar","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#b24cd8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:purpur_slab","localizedName":"Purpur Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#b24cd8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:purpur_stairs","localizedName":"Purpur Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#b24cd8","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:quartz_block","localizedName":"Block of Quartz","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#fffcf5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:quartz_bricks","localizedName":"Quartz Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#fffcf5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:quartz_pillar","localizedName":"Quartz Pillar","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#fffcf5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:quartz_slab","localizedName":"Quartz Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#fffcf5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:quartz_stairs","localizedName":"Quartz Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#fffcf5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:rail","localizedName":"Rail","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.7,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.7,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:raw_copper_block","localizedName":"Block of Raw Copper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":5.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:raw_gold_block","localizedName":"Block of Raw Gold","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":5.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#faee4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:raw_iron_block","localizedName":"Block of Raw Iron","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":5.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d8af93","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:red_banner","localizedName":"Red Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:red_bed","localizedName":"Red Bed","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:red_candle","localizedName":"Red Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:red_candle_cake","localizedName":"Cake with Red Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:red_carpet","localizedName":"Red Carpet","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:red_concrete","localizedName":"Red Concrete","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:red_concrete_powder","localizedName":"Red Concrete Powder","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:red_glazed_terracotta","localizedName":"Red Glazed Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.4,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:red_mushroom","localizedName":"Red Mushroom","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:red_mushroom_block","localizedName":"Red Mushroom Block","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:red_nether_brick_slab","localizedName":"Red Nether Brick Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#700200","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:red_nether_brick_stairs","localizedName":"Red Nether Brick Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#700200","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:red_nether_brick_wall","localizedName":"Red Nether Brick Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#700200","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:red_nether_bricks","localizedName":"Red Nether Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#700200","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:red_sand","localizedName":"Red Sand","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:red_sandstone","localizedName":"Red Sandstone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:red_sandstone_slab","localizedName":"Red Sandstone Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:red_sandstone_stairs","localizedName":"Red Sandstone Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:red_sandstone_wall","localizedName":"Red Sandstone Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:red_shulker_box","localizedName":"Red Shulker Box","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":2.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:red_stained_glass","localizedName":"Red Stained Glass","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:red_stained_glass_pane","localizedName":"Red Stained Glass Pane","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:red_terracotta","localizedName":"Red Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8e3c2e","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:red_tulip","localizedName":"Red Tulip","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:red_wall_banner","localizedName":"Red Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:red_wool","localizedName":"Red Wool","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:redstone_block","localizedName":"Block of Redstone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":5.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#ff0000","movementBlocker":true,"opaque":true,"powerSource":true,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:redstone_lamp","localizedName":"Redstone Lamp","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:redstone_ore","localizedName":"Redstone Ore","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:redstone_torch","localizedName":"Redstone Torch","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":7,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:redstone_wall_torch","localizedName":"Redstone Torch","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":7,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:redstone_wire","localizedName":"Redstone Wire","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:reinforced_deepslate","localizedName":"Reinforced Deepslate","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":55.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#646464","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1200.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:repeater","localizedName":"Redstone Repeater","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":true,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:repeating_command_block","localizedName":"Repeating Command Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":-1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3600000.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:respawn_anchor","localizedName":"Respawn Anchor","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":50.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1200.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:rooted_dirt","localizedName":"Rooted Dirt","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:rose_bush","localizedName":"Rose Bush","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:sand","localizedName":"Sand","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:sandstone","localizedName":"Sandstone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:sandstone_slab","localizedName":"Sandstone Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:sandstone_stairs","localizedName":"Sandstone Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:sandstone_wall","localizedName":"Sandstone Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:scaffolding","localizedName":"Scaffolding","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:sculk","localizedName":"Sculk","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:sculk_catalyst","localizedName":"Sculk Catalyst","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":6,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:sculk_sensor","localizedName":"Sculk Sensor","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":1,"liquid":false,"mapColor":"#4c7f99","movementBlocker":true,"opaque":true,"powerSource":true,"replacedDuringPlacement":false,"resistance":1.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:sculk_shrieker","localizedName":"Sculk Shrieker","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:sculk_vein","localizedName":"Sculk Vein","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:sea_lantern","localizedName":"Sea Lantern","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":15,"liquid":false,"mapColor":"#fffcf5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:sea_pickle","localizedName":"Sea Pickle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":6,"liquid":false,"mapColor":"#667f33","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:seagrass","localizedName":"Seagrass","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4040ff","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:shroomlight","localizedName":"Shroomlight","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.0,"hasContainer":false,"lightValue":15,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:shulker_box","localizedName":"Shulker Box","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":2.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:skeleton_skull","localizedName":"Skeleton Skull","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:skeleton_wall_skull","localizedName":"Skeleton Skull","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:slime_block","localizedName":"Slime Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#7fb238","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.8,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:small_amethyst_bud","localizedName":"Small Amethyst Bud","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":1,"liquid":false,"mapColor":"#7f3fb2","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.5,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:small_dripleaf","localizedName":"Small Dripleaf","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:smithing_table","localizedName":"Smithing Table","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:smoker","localizedName":"Smoker","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.5,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:smooth_basalt","localizedName":"Smooth Basalt","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#191919","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:smooth_quartz","localizedName":"Smooth Quartz Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#fffcf5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:smooth_quartz_slab","localizedName":"Smooth Quartz Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#fffcf5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:smooth_quartz_stairs","localizedName":"Smooth Quartz Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#fffcf5","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:smooth_red_sandstone","localizedName":"Smooth Red Sandstone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:smooth_red_sandstone_slab","localizedName":"Smooth Red Sandstone Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:smooth_red_sandstone_stairs","localizedName":"Smooth Red Sandstone Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:smooth_sandstone","localizedName":"Smooth Sandstone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:smooth_sandstone_slab","localizedName":"Smooth Sandstone Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:smooth_sandstone_stairs","localizedName":"Smooth Sandstone Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:smooth_stone","localizedName":"Smooth Stone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:smooth_stone_slab","localizedName":"Smooth Stone Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:sniffer_egg","localizedName":"Sniffer Egg","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:snow","localizedName":"Snow","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#ffffff","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":true,"unpushable":false}},{"id":"minecraft:snow_block","localizedName":"Snow Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#ffffff","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:soul_campfire","localizedName":"Soul Campfire","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":true,"lightValue":10,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:soul_fire","localizedName":"Soul Fire","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":10,"liquid":false,"mapColor":"#6699d8","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:soul_lantern","localizedName":"Soul Lantern","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":3.5,"hasContainer":false,"lightValue":10,"liquid":false,"mapColor":"#a7a7a7","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:soul_sand","localizedName":"Soul Sand","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:soul_soil","localizedName":"Soul Soil","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:soul_torch","localizedName":"Soul Torch","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":10,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:soul_wall_torch","localizedName":"Soul Torch","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":10,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spawner","localizedName":"Monster Spawner","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":5.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":5.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:sponge","localizedName":"Sponge","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.6,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.6,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spore_blossom","localizedName":"Spore Blossom","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spruce_button","localizedName":"Spruce Button","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spruce_door","localizedName":"Spruce Door","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spruce_fence","localizedName":"Spruce Fence","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spruce_fence_gate","localizedName":"Spruce Fence Gate","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spruce_hanging_sign","localizedName":"Spruce Hanging Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spruce_leaves","localizedName":"Spruce Leaves","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":true,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spruce_log","localizedName":"Spruce Log","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spruce_planks","localizedName":"Spruce Planks","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spruce_pressure_plate","localizedName":"Spruce Pressure Plate","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spruce_sapling","localizedName":"Spruce Sapling","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spruce_sign","localizedName":"Spruce Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spruce_slab","localizedName":"Spruce Slab","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spruce_stairs","localizedName":"Spruce Stairs","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spruce_trapdoor","localizedName":"Spruce Trapdoor","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spruce_wall_hanging_sign","localizedName":"Spruce Hanging Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spruce_wall_sign","localizedName":"Spruce Sign","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:spruce_wood","localizedName":"Spruce Wood","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:sticky_piston","localizedName":"Sticky Piston","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":true}},{"id":"minecraft:stone","localizedName":"Stone","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:stone_brick_slab","localizedName":"Stone Brick Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:stone_brick_stairs","localizedName":"Stone Brick Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:stone_brick_wall","localizedName":"Stone Brick Wall","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:stone_bricks","localizedName":"Stone Bricks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:stone_button","localizedName":"Stone Button","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stone_pressure_plate","localizedName":"Stone Pressure Plate","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:stone_slab","localizedName":"Stone Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:stone_stairs","localizedName":"Stone Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:stonecutter","localizedName":"Stonecutter","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:stripped_acacia_log","localizedName":"Stripped Acacia Log","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_acacia_wood","localizedName":"Stripped Acacia Wood","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_bamboo_block","localizedName":"Block of Stripped Bamboo","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_birch_log","localizedName":"Stripped Birch Log","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_birch_wood","localizedName":"Stripped Birch Wood","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_cherry_log","localizedName":"Stripped Cherry Log","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d1b1a1","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_cherry_wood","localizedName":"Stripped Cherry Wood","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#a04d4e","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_crimson_hyphae","localizedName":"Stripped Crimson Hyphae","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#5c191d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_crimson_stem","localizedName":"Stripped Crimson Stem","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#943f61","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_dark_oak_log","localizedName":"Stripped Dark Oak Log","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_dark_oak_wood","localizedName":"Stripped Dark Oak Wood","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#664c33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_jungle_log","localizedName":"Stripped Jungle Log","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_jungle_wood","localizedName":"Stripped Jungle Wood","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#976d4d","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_mangrove_log","localizedName":"Stripped Mangrove Log","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_mangrove_wood","localizedName":"Stripped Mangrove Wood","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#993333","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_oak_log","localizedName":"Stripped Oak Log","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_oak_wood","localizedName":"Stripped Oak Wood","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_spruce_log","localizedName":"Stripped Spruce Log","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_spruce_wood","localizedName":"Stripped Spruce Wood","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#815631","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_warped_hyphae","localizedName":"Stripped Warped Hyphae","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#562c3e","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:stripped_warped_stem","localizedName":"Stripped Warped Stem","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:structure_block","localizedName":"Structure Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":-1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#999999","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3600000.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:structure_void","localizedName":"Structure Void","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:sugar_cane","localizedName":"Sugar Cane","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:sunflower","localizedName":"Sunflower","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:suspicious_gravel","localizedName":"Suspicious Gravel","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":0.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.25,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:suspicious_sand","localizedName":"Suspicious Sand","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":0.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.25,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:sweet_berry_bush","localizedName":"Sweet Berry Bush","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:tall_grass","localizedName":"Tall Grass","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:tall_seagrass","localizedName":"Tall Seagrass","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4040ff","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:target","localizedName":"Target","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#fffcf5","movementBlocker":true,"opaque":true,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:terracotta","localizedName":"Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:tinted_glass","localizedName":"Tinted Glass","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c4c4c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:tnt","localizedName":"TNT","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#ff0000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:torch","localizedName":"Torch","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":14,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:torchflower","localizedName":"Torchflower","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:torchflower_crop","localizedName":"Torchflower Crop","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:trapped_chest","localizedName":"Trapped Chest","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":2.5,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":true,"powerSource":true,"replacedDuringPlacement":false,"resistance":2.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:tripwire","localizedName":"Tripwire","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:tripwire_hook","localizedName":"Tripwire Hook","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:tube_coral","localizedName":"Tube Coral","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#334cb2","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:tube_coral_block","localizedName":"Tube Coral Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#334cb2","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:tube_coral_fan","localizedName":"Tube Coral Fan","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#334cb2","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:tube_coral_wall_fan","localizedName":"Tube Coral Wall Fan","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#334cb2","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:tuff","localizedName":"Tuff","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#392923","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:turtle_egg","localizedName":"Turtle Egg","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#f7e9a3","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:twisting_vines","localizedName":"Twisting Vines","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c7f99","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:twisting_vines_plant","localizedName":"Twisting Vines Plant","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c7f99","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:verdant_froglight","localizedName":"Verdant Froglight","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":15,"liquid":false,"mapColor":"#7fa796","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:vine","localizedName":"Vines","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.2,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:void_air","localizedName":"Void Air","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:wall_torch","localizedName":"Torch","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":14,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:warped_button","localizedName":"Warped Button","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:warped_door","localizedName":"Warped Door","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:warped_fence","localizedName":"Warped Fence","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:warped_fence_gate","localizedName":"Warped Fence Gate","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:warped_fungus","localizedName":"Warped Fungus","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c7f99","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:warped_hanging_sign","localizedName":"Warped Hanging Sign","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:warped_hyphae","localizedName":"Warped Hyphae","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#562c3e","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:warped_nylium","localizedName":"Warped Nylium","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#167e86","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.4,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":true,"unpushable":false}},{"id":"minecraft:warped_planks","localizedName":"Warped Planks","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:warped_pressure_plate","localizedName":"Warped Pressure Plate","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":false,"powerSource":true,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:warped_roots","localizedName":"Warped Roots","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#4c7f99","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:warped_sign","localizedName":"Warped Sign","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:warped_slab","localizedName":"Warped Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:warped_stairs","localizedName":"Warped Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:warped_stem","localizedName":"Warped Stem","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:warped_trapdoor","localizedName":"Warped Trapdoor","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":3.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:warped_wall_hanging_sign","localizedName":"Warped Hanging Sign","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:warped_wall_sign","localizedName":"Warped Sign","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:warped_wart_block","localizedName":"Warped Wart Block","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#14b485","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:water","localizedName":"Water","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":100.0,"hasContainer":false,"lightValue":0,"liquid":true,"mapColor":"#4040ff","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":true,"resistance":100.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:water_cauldron","localizedName":"Water Cauldron","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":2.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#707070","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:waxed_copper_block","localizedName":"Waxed Block of Copper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:waxed_cut_copper","localizedName":"Waxed Cut Copper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:waxed_cut_copper_slab","localizedName":"Waxed Cut Copper Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:waxed_cut_copper_stairs","localizedName":"Waxed Cut Copper Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d87f33","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:waxed_exposed_copper","localizedName":"Waxed Exposed Copper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#876b62","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:waxed_exposed_cut_copper","localizedName":"Waxed Exposed Cut Copper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#876b62","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:waxed_exposed_cut_copper_slab","localizedName":"Waxed Exposed Cut Copper Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#876b62","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:waxed_exposed_cut_copper_stairs","localizedName":"Waxed Exposed Cut Copper Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#876b62","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:waxed_oxidized_copper","localizedName":"Waxed Oxidized Copper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#167e86","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:waxed_oxidized_cut_copper","localizedName":"Waxed Oxidized Cut Copper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#167e86","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:waxed_oxidized_cut_copper_slab","localizedName":"Waxed Oxidized Cut Copper Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#167e86","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:waxed_oxidized_cut_copper_stairs","localizedName":"Waxed Oxidized Cut Copper Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#167e86","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:waxed_weathered_copper","localizedName":"Waxed Weathered Copper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:waxed_weathered_cut_copper","localizedName":"Waxed Weathered Cut Copper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:waxed_weathered_cut_copper_slab","localizedName":"Waxed Weathered Cut Copper Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:waxed_weathered_cut_copper_stairs","localizedName":"Waxed Weathered Cut Copper Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:weathered_copper","localizedName":"Weathered Copper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":true,"unpushable":false}},{"id":"minecraft:weathered_cut_copper","localizedName":"Weathered Cut Copper","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":true,"unpushable":false}},{"id":"minecraft:weathered_cut_copper_slab","localizedName":"Weathered Cut Copper Slab","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":true,"unpushable":false}},{"id":"minecraft:weathered_cut_copper_stairs","localizedName":"Weathered Cut Copper Stairs","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":3.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#3a8e8c","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":6.0,"slipperiness":0.6,"solid":true,"ticksRandomly":true,"toolRequired":true,"unpushable":false}},{"id":"minecraft:weeping_vines","localizedName":"Weeping Vines","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#700200","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:weeping_vines_plant","localizedName":"Weeping Vines Plant","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#700200","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:wet_sponge","localizedName":"Wet Sponge","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.6,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.6,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:wheat","localizedName":"Wheat Crops","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":true,"toolRequired":false,"unpushable":false}},{"id":"minecraft:white_banner","localizedName":"White Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:white_bed","localizedName":"White Bed","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#ffffff","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:white_candle","localizedName":"White Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#c7c7c7","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:white_candle_cake","localizedName":"Cake with White Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:white_carpet","localizedName":"White Carpet","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#ffffff","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:white_concrete","localizedName":"White Concrete","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#ffffff","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:white_concrete_powder","localizedName":"White Concrete Powder","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#ffffff","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:white_glazed_terracotta","localizedName":"White Glazed Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#ffffff","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.4,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:white_shulker_box","localizedName":"White Shulker Box","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":2.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#ffffff","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:white_stained_glass","localizedName":"White Stained Glass","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#ffffff","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:white_stained_glass_pane","localizedName":"White Stained Glass Pane","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:white_terracotta","localizedName":"White Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#d1b1a1","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:white_tulip","localizedName":"White Tulip","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:white_wall_banner","localizedName":"White Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:white_wool","localizedName":"White Wool","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#ffffff","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:wither_rose","localizedName":"Wither Rose","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#007c00","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:wither_skeleton_skull","localizedName":"Wither Skeleton Skull","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:wither_skeleton_wall_skull","localizedName":"Wither Skeleton Skull","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:yellow_banner","localizedName":"Yellow Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:yellow_bed","localizedName":"Yellow Bed","material":{"burnable":true,"fragileWhenPushed":true,"fullCube":false,"hardness":0.2,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:yellow_candle","localizedName":"Yellow Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":false,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:yellow_candle_cake","localizedName":"Cake with Yellow Candle","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:yellow_carpet","localizedName":"Yellow Carpet","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":0.1,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.1,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:yellow_concrete","localizedName":"Yellow Concrete","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:yellow_concrete_powder","localizedName":"Yellow Concrete Powder","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.5,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.5,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:yellow_glazed_terracotta","localizedName":"Yellow Glazed Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.4,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.4,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:yellow_shulker_box","localizedName":"Yellow Shulker Box","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":true,"hardness":2.0,"hasContainer":true,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":2.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:yellow_stained_glass","localizedName":"Yellow Stained Glass","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:yellow_stained_glass_pane","localizedName":"Yellow Stained Glass Pane","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":false,"hardness":0.3,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.3,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:yellow_terracotta","localizedName":"Yellow Terracotta","material":{"burnable":false,"fragileWhenPushed":false,"fullCube":true,"hardness":1.25,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#ba8524","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":4.2,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":true,"unpushable":false}},{"id":"minecraft:yellow_wall_banner","localizedName":"Yellow Banner","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#8f7748","movementBlocker":true,"opaque":false,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:yellow_wool","localizedName":"Yellow Wool","material":{"burnable":true,"fragileWhenPushed":false,"fullCube":true,"hardness":0.8,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#e5e533","movementBlocker":true,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":0.8,"slipperiness":0.6,"solid":true,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:zombie_head","localizedName":"Zombie Head","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}},{"id":"minecraft:zombie_wall_head","localizedName":"Zombie Head","material":{"burnable":false,"fragileWhenPushed":true,"fullCube":false,"hardness":1.0,"hasContainer":false,"lightValue":0,"liquid":false,"mapColor":"#000000","movementBlocker":false,"opaque":true,"powerSource":false,"replacedDuringPlacement":false,"resistance":1.0,"slipperiness":0.6,"solid":false,"ticksRandomly":false,"toolRequired":false,"unpushable":false}}] diff --git a/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/items.120.json b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/items.120.json new file mode 100644 index 000000000..373ce0631 --- /dev/null +++ b/worldedit-core/src/main/resources/com/sk89q/worldedit/world/registry/items.120.json @@ -0,0 +1 @@ +[{"id":"minecraft:acacia_boat","localizedName":"Acacia Boat","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.acacia_boat"},{"id":"minecraft:acacia_button","localizedName":"Acacia Button","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.acacia_button"},{"id":"minecraft:acacia_chest_boat","localizedName":"Acacia Boat with Chest","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.acacia_chest_boat"},{"id":"minecraft:acacia_door","localizedName":"Acacia Door","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.acacia_door"},{"id":"minecraft:acacia_fence","localizedName":"Acacia Fence","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.acacia_fence"},{"id":"minecraft:acacia_fence_gate","localizedName":"Acacia Fence Gate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.acacia_fence_gate"},{"id":"minecraft:acacia_hanging_sign","localizedName":"Acacia Hanging Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.acacia_hanging_sign"},{"id":"minecraft:acacia_leaves","localizedName":"Acacia Leaves","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.acacia_leaves"},{"id":"minecraft:acacia_log","localizedName":"Acacia Log","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.acacia_log"},{"id":"minecraft:acacia_planks","localizedName":"Acacia Planks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.acacia_planks"},{"id":"minecraft:acacia_pressure_plate","localizedName":"Acacia Pressure Plate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.acacia_pressure_plate"},{"id":"minecraft:acacia_sapling","localizedName":"Acacia Sapling","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.acacia_sapling"},{"id":"minecraft:acacia_sign","localizedName":"Acacia Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.acacia_sign"},{"id":"minecraft:acacia_slab","localizedName":"Acacia Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.acacia_slab"},{"id":"minecraft:acacia_stairs","localizedName":"Acacia Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.acacia_stairs"},{"id":"minecraft:acacia_trapdoor","localizedName":"Acacia Trapdoor","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.acacia_trapdoor"},{"id":"minecraft:acacia_wood","localizedName":"Acacia Wood","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.acacia_wood"},{"id":"minecraft:activator_rail","localizedName":"Activator Rail","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.activator_rail"},{"id":"minecraft:air","localizedName":"Air","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.air"},{"id":"minecraft:allay_spawn_egg","localizedName":"Allay Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.allay_spawn_egg"},{"id":"minecraft:allium","localizedName":"Allium","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.allium"},{"id":"minecraft:amethyst_block","localizedName":"Block of Amethyst","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.amethyst_block"},{"id":"minecraft:amethyst_cluster","localizedName":"Amethyst Cluster","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.amethyst_cluster"},{"id":"minecraft:amethyst_shard","localizedName":"Amethyst Shard","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.amethyst_shard"},{"id":"minecraft:ancient_debris","localizedName":"Ancient Debris","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.ancient_debris"},{"id":"minecraft:andesite","localizedName":"Andesite","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.andesite"},{"id":"minecraft:andesite_slab","localizedName":"Andesite Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.andesite_slab"},{"id":"minecraft:andesite_stairs","localizedName":"Andesite Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.andesite_stairs"},{"id":"minecraft:andesite_wall","localizedName":"Andesite Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.andesite_wall"},{"id":"minecraft:angler_pottery_sherd","localizedName":"Angler Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.angler_pottery_sherd"},{"id":"minecraft:anvil","localizedName":"Anvil","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.anvil"},{"id":"minecraft:apple","localizedName":"Apple","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.apple"},{"id":"minecraft:archer_pottery_sherd","localizedName":"Archer Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.archer_pottery_sherd"},{"id":"minecraft:armor_stand","localizedName":"Armor Stand","maxDamage":0,"maxStackSize":16,"unlocalizedName":"item.minecraft.armor_stand"},{"id":"minecraft:arms_up_pottery_sherd","localizedName":"Arms Up Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.arms_up_pottery_sherd"},{"id":"minecraft:arrow","localizedName":"Arrow","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.arrow"},{"id":"minecraft:axolotl_bucket","localizedName":"Bucket of Axolotl","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.axolotl_bucket"},{"id":"minecraft:axolotl_spawn_egg","localizedName":"Axolotl Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.axolotl_spawn_egg"},{"id":"minecraft:azalea","localizedName":"Azalea","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.azalea"},{"id":"minecraft:azalea_leaves","localizedName":"Azalea Leaves","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.azalea_leaves"},{"id":"minecraft:azure_bluet","localizedName":"Azure Bluet","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.azure_bluet"},{"id":"minecraft:baked_potato","localizedName":"Baked Potato","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.baked_potato"},{"id":"minecraft:bamboo","localizedName":"Bamboo","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bamboo"},{"id":"minecraft:bamboo_block","localizedName":"Block of Bamboo","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bamboo_block"},{"id":"minecraft:bamboo_button","localizedName":"Bamboo Button","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bamboo_button"},{"id":"minecraft:bamboo_chest_raft","localizedName":"Bamboo Raft with Chest","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.bamboo_chest_raft"},{"id":"minecraft:bamboo_door","localizedName":"Bamboo Door","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bamboo_door"},{"id":"minecraft:bamboo_fence","localizedName":"Bamboo Fence","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bamboo_fence"},{"id":"minecraft:bamboo_fence_gate","localizedName":"Bamboo Fence Gate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bamboo_fence_gate"},{"id":"minecraft:bamboo_hanging_sign","localizedName":"Bamboo Hanging Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.bamboo_hanging_sign"},{"id":"minecraft:bamboo_mosaic","localizedName":"Bamboo Mosaic","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bamboo_mosaic"},{"id":"minecraft:bamboo_mosaic_slab","localizedName":"Bamboo Mosaic Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bamboo_mosaic_slab"},{"id":"minecraft:bamboo_mosaic_stairs","localizedName":"Bamboo Mosaic Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bamboo_mosaic_stairs"},{"id":"minecraft:bamboo_planks","localizedName":"Bamboo Planks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bamboo_planks"},{"id":"minecraft:bamboo_pressure_plate","localizedName":"Bamboo Pressure Plate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bamboo_pressure_plate"},{"id":"minecraft:bamboo_raft","localizedName":"Bamboo Raft","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.bamboo_raft"},{"id":"minecraft:bamboo_sign","localizedName":"Bamboo Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.bamboo_sign"},{"id":"minecraft:bamboo_slab","localizedName":"Bamboo Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bamboo_slab"},{"id":"minecraft:bamboo_stairs","localizedName":"Bamboo Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bamboo_stairs"},{"id":"minecraft:bamboo_trapdoor","localizedName":"Bamboo Trapdoor","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bamboo_trapdoor"},{"id":"minecraft:barrel","localizedName":"Barrel","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.barrel"},{"id":"minecraft:barrier","localizedName":"Barrier","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.barrier"},{"id":"minecraft:basalt","localizedName":"Basalt","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.basalt"},{"id":"minecraft:bat_spawn_egg","localizedName":"Bat Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.bat_spawn_egg"},{"id":"minecraft:beacon","localizedName":"Beacon","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.beacon"},{"id":"minecraft:bedrock","localizedName":"Bedrock","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bedrock"},{"id":"minecraft:bee_nest","localizedName":"Bee Nest","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bee_nest"},{"id":"minecraft:bee_spawn_egg","localizedName":"Bee Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.bee_spawn_egg"},{"id":"minecraft:beef","localizedName":"Raw Beef","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.beef"},{"id":"minecraft:beehive","localizedName":"Beehive","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.beehive"},{"id":"minecraft:beetroot","localizedName":"Beetroot","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.beetroot"},{"id":"minecraft:beetroot_seeds","localizedName":"Beetroot Seeds","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.beetroot_seeds"},{"id":"minecraft:beetroot_soup","localizedName":"Beetroot Soup","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.beetroot_soup"},{"id":"minecraft:bell","localizedName":"Bell","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bell"},{"id":"minecraft:big_dripleaf","localizedName":"Big Dripleaf","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.big_dripleaf"},{"id":"minecraft:birch_boat","localizedName":"Birch Boat","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.birch_boat"},{"id":"minecraft:birch_button","localizedName":"Birch Button","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.birch_button"},{"id":"minecraft:birch_chest_boat","localizedName":"Birch Boat with Chest","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.birch_chest_boat"},{"id":"minecraft:birch_door","localizedName":"Birch Door","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.birch_door"},{"id":"minecraft:birch_fence","localizedName":"Birch Fence","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.birch_fence"},{"id":"minecraft:birch_fence_gate","localizedName":"Birch Fence Gate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.birch_fence_gate"},{"id":"minecraft:birch_hanging_sign","localizedName":"Birch Hanging Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.birch_hanging_sign"},{"id":"minecraft:birch_leaves","localizedName":"Birch Leaves","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.birch_leaves"},{"id":"minecraft:birch_log","localizedName":"Birch Log","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.birch_log"},{"id":"minecraft:birch_planks","localizedName":"Birch Planks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.birch_planks"},{"id":"minecraft:birch_pressure_plate","localizedName":"Birch Pressure Plate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.birch_pressure_plate"},{"id":"minecraft:birch_sapling","localizedName":"Birch Sapling","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.birch_sapling"},{"id":"minecraft:birch_sign","localizedName":"Birch Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.birch_sign"},{"id":"minecraft:birch_slab","localizedName":"Birch Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.birch_slab"},{"id":"minecraft:birch_stairs","localizedName":"Birch Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.birch_stairs"},{"id":"minecraft:birch_trapdoor","localizedName":"Birch Trapdoor","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.birch_trapdoor"},{"id":"minecraft:birch_wood","localizedName":"Birch Wood","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.birch_wood"},{"id":"minecraft:black_banner","localizedName":"Black Banner","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.black_banner"},{"id":"minecraft:black_bed","localizedName":"Black Bed","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.black_bed"},{"id":"minecraft:black_candle","localizedName":"Black Candle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.black_candle"},{"id":"minecraft:black_carpet","localizedName":"Black Carpet","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.black_carpet"},{"id":"minecraft:black_concrete","localizedName":"Black Concrete","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.black_concrete"},{"id":"minecraft:black_concrete_powder","localizedName":"Black Concrete Powder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.black_concrete_powder"},{"id":"minecraft:black_dye","localizedName":"Black Dye","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.black_dye"},{"id":"minecraft:black_glazed_terracotta","localizedName":"Black Glazed Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.black_glazed_terracotta"},{"id":"minecraft:black_shulker_box","localizedName":"Black Shulker Box","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.black_shulker_box"},{"id":"minecraft:black_stained_glass","localizedName":"Black Stained Glass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.black_stained_glass"},{"id":"minecraft:black_stained_glass_pane","localizedName":"Black Stained Glass Pane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.black_stained_glass_pane"},{"id":"minecraft:black_terracotta","localizedName":"Black Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.black_terracotta"},{"id":"minecraft:black_wool","localizedName":"Black Wool","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.black_wool"},{"id":"minecraft:blackstone","localizedName":"Blackstone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.blackstone"},{"id":"minecraft:blackstone_slab","localizedName":"Blackstone Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.blackstone_slab"},{"id":"minecraft:blackstone_stairs","localizedName":"Blackstone Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.blackstone_stairs"},{"id":"minecraft:blackstone_wall","localizedName":"Blackstone Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.blackstone_wall"},{"id":"minecraft:blade_pottery_sherd","localizedName":"Blade Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.blade_pottery_sherd"},{"id":"minecraft:blast_furnace","localizedName":"Blast Furnace","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.blast_furnace"},{"id":"minecraft:blaze_powder","localizedName":"Blaze Powder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.blaze_powder"},{"id":"minecraft:blaze_rod","localizedName":"Blaze Rod","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.blaze_rod"},{"id":"minecraft:blaze_spawn_egg","localizedName":"Blaze Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.blaze_spawn_egg"},{"id":"minecraft:blue_banner","localizedName":"Blue Banner","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.blue_banner"},{"id":"minecraft:blue_bed","localizedName":"Blue Bed","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.blue_bed"},{"id":"minecraft:blue_candle","localizedName":"Blue Candle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.blue_candle"},{"id":"minecraft:blue_carpet","localizedName":"Blue Carpet","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.blue_carpet"},{"id":"minecraft:blue_concrete","localizedName":"Blue Concrete","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.blue_concrete"},{"id":"minecraft:blue_concrete_powder","localizedName":"Blue Concrete Powder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.blue_concrete_powder"},{"id":"minecraft:blue_dye","localizedName":"Blue Dye","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.blue_dye"},{"id":"minecraft:blue_glazed_terracotta","localizedName":"Blue Glazed Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.blue_glazed_terracotta"},{"id":"minecraft:blue_ice","localizedName":"Blue Ice","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.blue_ice"},{"id":"minecraft:blue_orchid","localizedName":"Blue Orchid","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.blue_orchid"},{"id":"minecraft:blue_shulker_box","localizedName":"Blue Shulker Box","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.blue_shulker_box"},{"id":"minecraft:blue_stained_glass","localizedName":"Blue Stained Glass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.blue_stained_glass"},{"id":"minecraft:blue_stained_glass_pane","localizedName":"Blue Stained Glass Pane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.blue_stained_glass_pane"},{"id":"minecraft:blue_terracotta","localizedName":"Blue Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.blue_terracotta"},{"id":"minecraft:blue_wool","localizedName":"Blue Wool","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.blue_wool"},{"id":"minecraft:bone","localizedName":"Bone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.bone"},{"id":"minecraft:bone_block","localizedName":"Bone Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bone_block"},{"id":"minecraft:bone_meal","localizedName":"Bone Meal","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.bone_meal"},{"id":"minecraft:book","localizedName":"Book","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.book"},{"id":"minecraft:bookshelf","localizedName":"Bookshelf","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bookshelf"},{"id":"minecraft:bow","localizedName":"Bow","maxDamage":384,"maxStackSize":1,"unlocalizedName":"item.minecraft.bow"},{"id":"minecraft:bowl","localizedName":"Bowl","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.bowl"},{"id":"minecraft:brain_coral","localizedName":"Brain Coral","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.brain_coral"},{"id":"minecraft:brain_coral_block","localizedName":"Brain Coral Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.brain_coral_block"},{"id":"minecraft:brain_coral_fan","localizedName":"Brain Coral Fan","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.brain_coral_fan"},{"id":"minecraft:bread","localizedName":"Bread","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.bread"},{"id":"minecraft:brewer_pottery_sherd","localizedName":"Brewer Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.brewer_pottery_sherd"},{"id":"minecraft:brewing_stand","localizedName":"Brewing Stand","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.brewing_stand"},{"id":"minecraft:brick","localizedName":"Brick","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.brick"},{"id":"minecraft:brick_slab","localizedName":"Brick Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.brick_slab"},{"id":"minecraft:brick_stairs","localizedName":"Brick Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.brick_stairs"},{"id":"minecraft:brick_wall","localizedName":"Brick Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.brick_wall"},{"id":"minecraft:bricks","localizedName":"Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bricks"},{"id":"minecraft:brown_banner","localizedName":"Brown Banner","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.brown_banner"},{"id":"minecraft:brown_bed","localizedName":"Brown Bed","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.brown_bed"},{"id":"minecraft:brown_candle","localizedName":"Brown Candle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.brown_candle"},{"id":"minecraft:brown_carpet","localizedName":"Brown Carpet","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.brown_carpet"},{"id":"minecraft:brown_concrete","localizedName":"Brown Concrete","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.brown_concrete"},{"id":"minecraft:brown_concrete_powder","localizedName":"Brown Concrete Powder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.brown_concrete_powder"},{"id":"minecraft:brown_dye","localizedName":"Brown Dye","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.brown_dye"},{"id":"minecraft:brown_glazed_terracotta","localizedName":"Brown Glazed Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.brown_glazed_terracotta"},{"id":"minecraft:brown_mushroom","localizedName":"Brown Mushroom","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.brown_mushroom"},{"id":"minecraft:brown_mushroom_block","localizedName":"Brown Mushroom Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.brown_mushroom_block"},{"id":"minecraft:brown_shulker_box","localizedName":"Brown Shulker Box","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.brown_shulker_box"},{"id":"minecraft:brown_stained_glass","localizedName":"Brown Stained Glass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.brown_stained_glass"},{"id":"minecraft:brown_stained_glass_pane","localizedName":"Brown Stained Glass Pane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.brown_stained_glass_pane"},{"id":"minecraft:brown_terracotta","localizedName":"Brown Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.brown_terracotta"},{"id":"minecraft:brown_wool","localizedName":"Brown Wool","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.brown_wool"},{"id":"minecraft:brush","localizedName":"Brush","maxDamage":64,"maxStackSize":1,"unlocalizedName":"item.minecraft.brush"},{"id":"minecraft:bubble_coral","localizedName":"Bubble Coral","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bubble_coral"},{"id":"minecraft:bubble_coral_block","localizedName":"Bubble Coral Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bubble_coral_block"},{"id":"minecraft:bubble_coral_fan","localizedName":"Bubble Coral Fan","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.bubble_coral_fan"},{"id":"minecraft:bucket","localizedName":"Bucket","maxDamage":0,"maxStackSize":16,"unlocalizedName":"item.minecraft.bucket"},{"id":"minecraft:budding_amethyst","localizedName":"Budding Amethyst","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.budding_amethyst"},{"id":"minecraft:bundle","localizedName":"Bundle","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.bundle"},{"id":"minecraft:burn_pottery_sherd","localizedName":"Burn Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.burn_pottery_sherd"},{"id":"minecraft:cactus","localizedName":"Cactus","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cactus"},{"id":"minecraft:cake","localizedName":"Cake","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.cake"},{"id":"minecraft:calcite","localizedName":"Calcite","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.calcite"},{"id":"minecraft:calibrated_sculk_sensor","localizedName":"Calibrated Sculk Sensor","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.calibrated_sculk_sensor"},{"id":"minecraft:camel_spawn_egg","localizedName":"Camel Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.camel_spawn_egg"},{"id":"minecraft:campfire","localizedName":"Campfire","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.campfire"},{"id":"minecraft:candle","localizedName":"Candle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.candle"},{"id":"minecraft:carrot","localizedName":"Carrot","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.carrot"},{"id":"minecraft:carrot_on_a_stick","localizedName":"Carrot on a Stick","maxDamage":25,"maxStackSize":1,"unlocalizedName":"item.minecraft.carrot_on_a_stick"},{"id":"minecraft:cartography_table","localizedName":"Cartography Table","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cartography_table"},{"id":"minecraft:carved_pumpkin","localizedName":"Carved Pumpkin","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.carved_pumpkin"},{"id":"minecraft:cat_spawn_egg","localizedName":"Cat Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.cat_spawn_egg"},{"id":"minecraft:cauldron","localizedName":"Cauldron","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cauldron"},{"id":"minecraft:cave_spider_spawn_egg","localizedName":"Cave Spider Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.cave_spider_spawn_egg"},{"id":"minecraft:chain","localizedName":"Chain","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.chain"},{"id":"minecraft:chain_command_block","localizedName":"Chain Command Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.chain_command_block"},{"id":"minecraft:chainmail_boots","localizedName":"Chainmail Boots","maxDamage":195,"maxStackSize":1,"unlocalizedName":"item.minecraft.chainmail_boots"},{"id":"minecraft:chainmail_chestplate","localizedName":"Chainmail Chestplate","maxDamage":240,"maxStackSize":1,"unlocalizedName":"item.minecraft.chainmail_chestplate"},{"id":"minecraft:chainmail_helmet","localizedName":"Chainmail Helmet","maxDamage":165,"maxStackSize":1,"unlocalizedName":"item.minecraft.chainmail_helmet"},{"id":"minecraft:chainmail_leggings","localizedName":"Chainmail Leggings","maxDamage":225,"maxStackSize":1,"unlocalizedName":"item.minecraft.chainmail_leggings"},{"id":"minecraft:charcoal","localizedName":"Charcoal","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.charcoal"},{"id":"minecraft:cherry_boat","localizedName":"Cherry Boat","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.cherry_boat"},{"id":"minecraft:cherry_button","localizedName":"Cherry Button","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cherry_button"},{"id":"minecraft:cherry_chest_boat","localizedName":"Cherry Boat with Chest","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.cherry_chest_boat"},{"id":"minecraft:cherry_door","localizedName":"Cherry Door","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cherry_door"},{"id":"minecraft:cherry_fence","localizedName":"Cherry Fence","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cherry_fence"},{"id":"minecraft:cherry_fence_gate","localizedName":"Cherry Fence Gate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cherry_fence_gate"},{"id":"minecraft:cherry_hanging_sign","localizedName":"Cherry Hanging Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.cherry_hanging_sign"},{"id":"minecraft:cherry_leaves","localizedName":"Cherry Leaves","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cherry_leaves"},{"id":"minecraft:cherry_log","localizedName":"Cherry Log","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cherry_log"},{"id":"minecraft:cherry_planks","localizedName":"Cherry Planks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cherry_planks"},{"id":"minecraft:cherry_pressure_plate","localizedName":"Cherry Pressure Plate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cherry_pressure_plate"},{"id":"minecraft:cherry_sapling","localizedName":"Cherry Sapling","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cherry_sapling"},{"id":"minecraft:cherry_sign","localizedName":"Cherry Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.cherry_sign"},{"id":"minecraft:cherry_slab","localizedName":"Cherry Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cherry_slab"},{"id":"minecraft:cherry_stairs","localizedName":"Cherry Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cherry_stairs"},{"id":"minecraft:cherry_trapdoor","localizedName":"Cherry Trapdoor","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cherry_trapdoor"},{"id":"minecraft:cherry_wood","localizedName":"Cherry Wood","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cherry_wood"},{"id":"minecraft:chest","localizedName":"Chest","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.chest"},{"id":"minecraft:chest_minecart","localizedName":"Minecart with Chest","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.chest_minecart"},{"id":"minecraft:chicken","localizedName":"Raw Chicken","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.chicken"},{"id":"minecraft:chicken_spawn_egg","localizedName":"Chicken Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.chicken_spawn_egg"},{"id":"minecraft:chipped_anvil","localizedName":"Chipped Anvil","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.chipped_anvil"},{"id":"minecraft:chiseled_bookshelf","localizedName":"Chiseled Bookshelf","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.chiseled_bookshelf"},{"id":"minecraft:chiseled_deepslate","localizedName":"Chiseled Deepslate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.chiseled_deepslate"},{"id":"minecraft:chiseled_nether_bricks","localizedName":"Chiseled Nether Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.chiseled_nether_bricks"},{"id":"minecraft:chiseled_polished_blackstone","localizedName":"Chiseled Polished Blackstone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.chiseled_polished_blackstone"},{"id":"minecraft:chiseled_quartz_block","localizedName":"Chiseled Quartz Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.chiseled_quartz_block"},{"id":"minecraft:chiseled_red_sandstone","localizedName":"Chiseled Red Sandstone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.chiseled_red_sandstone"},{"id":"minecraft:chiseled_sandstone","localizedName":"Chiseled Sandstone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.chiseled_sandstone"},{"id":"minecraft:chiseled_stone_bricks","localizedName":"Chiseled Stone Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.chiseled_stone_bricks"},{"id":"minecraft:chorus_flower","localizedName":"Chorus Flower","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.chorus_flower"},{"id":"minecraft:chorus_fruit","localizedName":"Chorus Fruit","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.chorus_fruit"},{"id":"minecraft:chorus_plant","localizedName":"Chorus Plant","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.chorus_plant"},{"id":"minecraft:clay","localizedName":"Clay","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.clay"},{"id":"minecraft:clay_ball","localizedName":"Clay Ball","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.clay_ball"},{"id":"minecraft:clock","localizedName":"Clock","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.clock"},{"id":"minecraft:coal","localizedName":"Coal","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.coal"},{"id":"minecraft:coal_block","localizedName":"Block of Coal","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.coal_block"},{"id":"minecraft:coal_ore","localizedName":"Coal Ore","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.coal_ore"},{"id":"minecraft:coarse_dirt","localizedName":"Coarse Dirt","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.coarse_dirt"},{"id":"minecraft:coast_armor_trim_smithing_template","localizedName":"Smithing Template","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.smithing_template"},{"id":"minecraft:cobbled_deepslate","localizedName":"Cobbled Deepslate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cobbled_deepslate"},{"id":"minecraft:cobbled_deepslate_slab","localizedName":"Cobbled Deepslate Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cobbled_deepslate_slab"},{"id":"minecraft:cobbled_deepslate_stairs","localizedName":"Cobbled Deepslate Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cobbled_deepslate_stairs"},{"id":"minecraft:cobbled_deepslate_wall","localizedName":"Cobbled Deepslate Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cobbled_deepslate_wall"},{"id":"minecraft:cobblestone","localizedName":"Cobblestone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cobblestone"},{"id":"minecraft:cobblestone_slab","localizedName":"Cobblestone Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cobblestone_slab"},{"id":"minecraft:cobblestone_stairs","localizedName":"Cobblestone Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cobblestone_stairs"},{"id":"minecraft:cobblestone_wall","localizedName":"Cobblestone Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cobblestone_wall"},{"id":"minecraft:cobweb","localizedName":"Cobweb","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cobweb"},{"id":"minecraft:cocoa_beans","localizedName":"Cocoa Beans","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.cocoa_beans"},{"id":"minecraft:cod","localizedName":"Raw Cod","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.cod"},{"id":"minecraft:cod_bucket","localizedName":"Bucket of Cod","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.cod_bucket"},{"id":"minecraft:cod_spawn_egg","localizedName":"Cod Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.cod_spawn_egg"},{"id":"minecraft:command_block","localizedName":"Command Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.command_block"},{"id":"minecraft:command_block_minecart","localizedName":"Minecart with Command Block","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.command_block_minecart"},{"id":"minecraft:comparator","localizedName":"Redstone Comparator","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.comparator"},{"id":"minecraft:compass","localizedName":"Compass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.compass"},{"id":"minecraft:composter","localizedName":"Composter","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.composter"},{"id":"minecraft:conduit","localizedName":"Conduit","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.conduit"},{"id":"minecraft:cooked_beef","localizedName":"Steak","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.cooked_beef"},{"id":"minecraft:cooked_chicken","localizedName":"Cooked Chicken","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.cooked_chicken"},{"id":"minecraft:cooked_cod","localizedName":"Cooked Cod","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.cooked_cod"},{"id":"minecraft:cooked_mutton","localizedName":"Cooked Mutton","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.cooked_mutton"},{"id":"minecraft:cooked_porkchop","localizedName":"Cooked Porkchop","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.cooked_porkchop"},{"id":"minecraft:cooked_rabbit","localizedName":"Cooked Rabbit","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.cooked_rabbit"},{"id":"minecraft:cooked_salmon","localizedName":"Cooked Salmon","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.cooked_salmon"},{"id":"minecraft:cookie","localizedName":"Cookie","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.cookie"},{"id":"minecraft:copper_block","localizedName":"Block of Copper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.copper_block"},{"id":"minecraft:copper_ingot","localizedName":"Copper Ingot","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.copper_ingot"},{"id":"minecraft:copper_ore","localizedName":"Copper Ore","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.copper_ore"},{"id":"minecraft:cornflower","localizedName":"Cornflower","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cornflower"},{"id":"minecraft:cow_spawn_egg","localizedName":"Cow Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.cow_spawn_egg"},{"id":"minecraft:cracked_deepslate_bricks","localizedName":"Cracked Deepslate Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cracked_deepslate_bricks"},{"id":"minecraft:cracked_deepslate_tiles","localizedName":"Cracked Deepslate Tiles","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cracked_deepslate_tiles"},{"id":"minecraft:cracked_nether_bricks","localizedName":"Cracked Nether Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cracked_nether_bricks"},{"id":"minecraft:cracked_polished_blackstone_bricks","localizedName":"Cracked Polished Blackstone Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cracked_polished_blackstone_bricks"},{"id":"minecraft:cracked_stone_bricks","localizedName":"Cracked Stone Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cracked_stone_bricks"},{"id":"minecraft:crafting_table","localizedName":"Crafting Table","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.crafting_table"},{"id":"minecraft:creeper_banner_pattern","localizedName":"Banner Pattern","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.creeper_banner_pattern"},{"id":"minecraft:creeper_head","localizedName":"Creeper Head","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.creeper_head"},{"id":"minecraft:creeper_spawn_egg","localizedName":"Creeper Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.creeper_spawn_egg"},{"id":"minecraft:crimson_button","localizedName":"Crimson Button","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.crimson_button"},{"id":"minecraft:crimson_door","localizedName":"Crimson Door","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.crimson_door"},{"id":"minecraft:crimson_fence","localizedName":"Crimson Fence","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.crimson_fence"},{"id":"minecraft:crimson_fence_gate","localizedName":"Crimson Fence Gate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.crimson_fence_gate"},{"id":"minecraft:crimson_fungus","localizedName":"Crimson Fungus","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.crimson_fungus"},{"id":"minecraft:crimson_hanging_sign","localizedName":"Crimson Hanging Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.crimson_hanging_sign"},{"id":"minecraft:crimson_hyphae","localizedName":"Crimson Hyphae","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.crimson_hyphae"},{"id":"minecraft:crimson_nylium","localizedName":"Crimson Nylium","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.crimson_nylium"},{"id":"minecraft:crimson_planks","localizedName":"Crimson Planks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.crimson_planks"},{"id":"minecraft:crimson_pressure_plate","localizedName":"Crimson Pressure Plate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.crimson_pressure_plate"},{"id":"minecraft:crimson_roots","localizedName":"Crimson Roots","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.crimson_roots"},{"id":"minecraft:crimson_sign","localizedName":"Crimson Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.crimson_sign"},{"id":"minecraft:crimson_slab","localizedName":"Crimson Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.crimson_slab"},{"id":"minecraft:crimson_stairs","localizedName":"Crimson Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.crimson_stairs"},{"id":"minecraft:crimson_stem","localizedName":"Crimson Stem","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.crimson_stem"},{"id":"minecraft:crimson_trapdoor","localizedName":"Crimson Trapdoor","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.crimson_trapdoor"},{"id":"minecraft:crossbow","localizedName":"Crossbow","maxDamage":465,"maxStackSize":1,"unlocalizedName":"item.minecraft.crossbow"},{"id":"minecraft:crying_obsidian","localizedName":"Crying Obsidian","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.crying_obsidian"},{"id":"minecraft:cut_copper","localizedName":"Cut Copper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cut_copper"},{"id":"minecraft:cut_copper_slab","localizedName":"Cut Copper Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cut_copper_slab"},{"id":"minecraft:cut_copper_stairs","localizedName":"Cut Copper Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cut_copper_stairs"},{"id":"minecraft:cut_red_sandstone","localizedName":"Cut Red Sandstone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cut_red_sandstone"},{"id":"minecraft:cut_red_sandstone_slab","localizedName":"Cut Red Sandstone Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cut_red_sandstone_slab"},{"id":"minecraft:cut_sandstone","localizedName":"Cut Sandstone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cut_sandstone"},{"id":"minecraft:cut_sandstone_slab","localizedName":"Cut Sandstone Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cut_sandstone_slab"},{"id":"minecraft:cyan_banner","localizedName":"Cyan Banner","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.cyan_banner"},{"id":"minecraft:cyan_bed","localizedName":"Cyan Bed","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.cyan_bed"},{"id":"minecraft:cyan_candle","localizedName":"Cyan Candle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cyan_candle"},{"id":"minecraft:cyan_carpet","localizedName":"Cyan Carpet","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cyan_carpet"},{"id":"minecraft:cyan_concrete","localizedName":"Cyan Concrete","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cyan_concrete"},{"id":"minecraft:cyan_concrete_powder","localizedName":"Cyan Concrete Powder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cyan_concrete_powder"},{"id":"minecraft:cyan_dye","localizedName":"Cyan Dye","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.cyan_dye"},{"id":"minecraft:cyan_glazed_terracotta","localizedName":"Cyan Glazed Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cyan_glazed_terracotta"},{"id":"minecraft:cyan_shulker_box","localizedName":"Cyan Shulker Box","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.cyan_shulker_box"},{"id":"minecraft:cyan_stained_glass","localizedName":"Cyan Stained Glass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cyan_stained_glass"},{"id":"minecraft:cyan_stained_glass_pane","localizedName":"Cyan Stained Glass Pane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cyan_stained_glass_pane"},{"id":"minecraft:cyan_terracotta","localizedName":"Cyan Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cyan_terracotta"},{"id":"minecraft:cyan_wool","localizedName":"Cyan Wool","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.cyan_wool"},{"id":"minecraft:damaged_anvil","localizedName":"Damaged Anvil","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.damaged_anvil"},{"id":"minecraft:dandelion","localizedName":"Dandelion","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dandelion"},{"id":"minecraft:danger_pottery_sherd","localizedName":"Danger Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.danger_pottery_sherd"},{"id":"minecraft:dark_oak_boat","localizedName":"Dark Oak Boat","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.dark_oak_boat"},{"id":"minecraft:dark_oak_button","localizedName":"Dark Oak Button","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dark_oak_button"},{"id":"minecraft:dark_oak_chest_boat","localizedName":"Dark Oak Boat with Chest","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.dark_oak_chest_boat"},{"id":"minecraft:dark_oak_door","localizedName":"Dark Oak Door","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dark_oak_door"},{"id":"minecraft:dark_oak_fence","localizedName":"Dark Oak Fence","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dark_oak_fence"},{"id":"minecraft:dark_oak_fence_gate","localizedName":"Dark Oak Fence Gate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dark_oak_fence_gate"},{"id":"minecraft:dark_oak_hanging_sign","localizedName":"Dark Oak Hanging Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.dark_oak_hanging_sign"},{"id":"minecraft:dark_oak_leaves","localizedName":"Dark Oak Leaves","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dark_oak_leaves"},{"id":"minecraft:dark_oak_log","localizedName":"Dark Oak Log","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dark_oak_log"},{"id":"minecraft:dark_oak_planks","localizedName":"Dark Oak Planks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dark_oak_planks"},{"id":"minecraft:dark_oak_pressure_plate","localizedName":"Dark Oak Pressure Plate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dark_oak_pressure_plate"},{"id":"minecraft:dark_oak_sapling","localizedName":"Dark Oak Sapling","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dark_oak_sapling"},{"id":"minecraft:dark_oak_sign","localizedName":"Dark Oak Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.dark_oak_sign"},{"id":"minecraft:dark_oak_slab","localizedName":"Dark Oak Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dark_oak_slab"},{"id":"minecraft:dark_oak_stairs","localizedName":"Dark Oak Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dark_oak_stairs"},{"id":"minecraft:dark_oak_trapdoor","localizedName":"Dark Oak Trapdoor","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dark_oak_trapdoor"},{"id":"minecraft:dark_oak_wood","localizedName":"Dark Oak Wood","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dark_oak_wood"},{"id":"minecraft:dark_prismarine","localizedName":"Dark Prismarine","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dark_prismarine"},{"id":"minecraft:dark_prismarine_slab","localizedName":"Dark Prismarine Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dark_prismarine_slab"},{"id":"minecraft:dark_prismarine_stairs","localizedName":"Dark Prismarine Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dark_prismarine_stairs"},{"id":"minecraft:daylight_detector","localizedName":"Daylight Detector","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.daylight_detector"},{"id":"minecraft:dead_brain_coral","localizedName":"Dead Brain Coral","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dead_brain_coral"},{"id":"minecraft:dead_brain_coral_block","localizedName":"Dead Brain Coral Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dead_brain_coral_block"},{"id":"minecraft:dead_brain_coral_fan","localizedName":"Dead Brain Coral Fan","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dead_brain_coral_fan"},{"id":"minecraft:dead_bubble_coral","localizedName":"Dead Bubble Coral","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dead_bubble_coral"},{"id":"minecraft:dead_bubble_coral_block","localizedName":"Dead Bubble Coral Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dead_bubble_coral_block"},{"id":"minecraft:dead_bubble_coral_fan","localizedName":"Dead Bubble Coral Fan","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dead_bubble_coral_fan"},{"id":"minecraft:dead_bush","localizedName":"Dead Bush","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dead_bush"},{"id":"minecraft:dead_fire_coral","localizedName":"Dead Fire Coral","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dead_fire_coral"},{"id":"minecraft:dead_fire_coral_block","localizedName":"Dead Fire Coral Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dead_fire_coral_block"},{"id":"minecraft:dead_fire_coral_fan","localizedName":"Dead Fire Coral Fan","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dead_fire_coral_fan"},{"id":"minecraft:dead_horn_coral","localizedName":"Dead Horn Coral","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dead_horn_coral"},{"id":"minecraft:dead_horn_coral_block","localizedName":"Dead Horn Coral Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dead_horn_coral_block"},{"id":"minecraft:dead_horn_coral_fan","localizedName":"Dead Horn Coral Fan","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dead_horn_coral_fan"},{"id":"minecraft:dead_tube_coral","localizedName":"Dead Tube Coral","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dead_tube_coral"},{"id":"minecraft:dead_tube_coral_block","localizedName":"Dead Tube Coral Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dead_tube_coral_block"},{"id":"minecraft:dead_tube_coral_fan","localizedName":"Dead Tube Coral Fan","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dead_tube_coral_fan"},{"id":"minecraft:debug_stick","localizedName":"Debug Stick","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.debug_stick"},{"id":"minecraft:decorated_pot","localizedName":"Decorated Pot","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.decorated_pot"},{"id":"minecraft:deepslate","localizedName":"Deepslate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.deepslate"},{"id":"minecraft:deepslate_brick_slab","localizedName":"Deepslate Brick Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.deepslate_brick_slab"},{"id":"minecraft:deepslate_brick_stairs","localizedName":"Deepslate Brick Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.deepslate_brick_stairs"},{"id":"minecraft:deepslate_brick_wall","localizedName":"Deepslate Brick Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.deepslate_brick_wall"},{"id":"minecraft:deepslate_bricks","localizedName":"Deepslate Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.deepslate_bricks"},{"id":"minecraft:deepslate_coal_ore","localizedName":"Deepslate Coal Ore","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.deepslate_coal_ore"},{"id":"minecraft:deepslate_copper_ore","localizedName":"Deepslate Copper Ore","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.deepslate_copper_ore"},{"id":"minecraft:deepslate_diamond_ore","localizedName":"Deepslate Diamond Ore","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.deepslate_diamond_ore"},{"id":"minecraft:deepslate_emerald_ore","localizedName":"Deepslate Emerald Ore","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.deepslate_emerald_ore"},{"id":"minecraft:deepslate_gold_ore","localizedName":"Deepslate Gold Ore","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.deepslate_gold_ore"},{"id":"minecraft:deepslate_iron_ore","localizedName":"Deepslate Iron Ore","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.deepslate_iron_ore"},{"id":"minecraft:deepslate_lapis_ore","localizedName":"Deepslate Lapis Lazuli Ore","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.deepslate_lapis_ore"},{"id":"minecraft:deepslate_redstone_ore","localizedName":"Deepslate Redstone Ore","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.deepslate_redstone_ore"},{"id":"minecraft:deepslate_tile_slab","localizedName":"Deepslate Tile Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.deepslate_tile_slab"},{"id":"minecraft:deepslate_tile_stairs","localizedName":"Deepslate Tile Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.deepslate_tile_stairs"},{"id":"minecraft:deepslate_tile_wall","localizedName":"Deepslate Tile Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.deepslate_tile_wall"},{"id":"minecraft:deepslate_tiles","localizedName":"Deepslate Tiles","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.deepslate_tiles"},{"id":"minecraft:detector_rail","localizedName":"Detector Rail","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.detector_rail"},{"id":"minecraft:diamond","localizedName":"Diamond","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.diamond"},{"id":"minecraft:diamond_axe","localizedName":"Diamond Axe","maxDamage":1561,"maxStackSize":1,"unlocalizedName":"item.minecraft.diamond_axe"},{"id":"minecraft:diamond_block","localizedName":"Block of Diamond","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.diamond_block"},{"id":"minecraft:diamond_boots","localizedName":"Diamond Boots","maxDamage":429,"maxStackSize":1,"unlocalizedName":"item.minecraft.diamond_boots"},{"id":"minecraft:diamond_chestplate","localizedName":"Diamond Chestplate","maxDamage":528,"maxStackSize":1,"unlocalizedName":"item.minecraft.diamond_chestplate"},{"id":"minecraft:diamond_helmet","localizedName":"Diamond Helmet","maxDamage":363,"maxStackSize":1,"unlocalizedName":"item.minecraft.diamond_helmet"},{"id":"minecraft:diamond_hoe","localizedName":"Diamond Hoe","maxDamage":1561,"maxStackSize":1,"unlocalizedName":"item.minecraft.diamond_hoe"},{"id":"minecraft:diamond_horse_armor","localizedName":"Diamond Horse Armor","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.diamond_horse_armor"},{"id":"minecraft:diamond_leggings","localizedName":"Diamond Leggings","maxDamage":495,"maxStackSize":1,"unlocalizedName":"item.minecraft.diamond_leggings"},{"id":"minecraft:diamond_ore","localizedName":"Diamond Ore","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.diamond_ore"},{"id":"minecraft:diamond_pickaxe","localizedName":"Diamond Pickaxe","maxDamage":1561,"maxStackSize":1,"unlocalizedName":"item.minecraft.diamond_pickaxe"},{"id":"minecraft:diamond_shovel","localizedName":"Diamond Shovel","maxDamage":1561,"maxStackSize":1,"unlocalizedName":"item.minecraft.diamond_shovel"},{"id":"minecraft:diamond_sword","localizedName":"Diamond Sword","maxDamage":1561,"maxStackSize":1,"unlocalizedName":"item.minecraft.diamond_sword"},{"id":"minecraft:diorite","localizedName":"Diorite","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.diorite"},{"id":"minecraft:diorite_slab","localizedName":"Diorite Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.diorite_slab"},{"id":"minecraft:diorite_stairs","localizedName":"Diorite Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.diorite_stairs"},{"id":"minecraft:diorite_wall","localizedName":"Diorite Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.diorite_wall"},{"id":"minecraft:dirt","localizedName":"Dirt","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dirt"},{"id":"minecraft:dirt_path","localizedName":"Dirt Path","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dirt_path"},{"id":"minecraft:disc_fragment_5","localizedName":"Disc Fragment","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.disc_fragment_5"},{"id":"minecraft:dispenser","localizedName":"Dispenser","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dispenser"},{"id":"minecraft:dolphin_spawn_egg","localizedName":"Dolphin Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.dolphin_spawn_egg"},{"id":"minecraft:donkey_spawn_egg","localizedName":"Donkey Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.donkey_spawn_egg"},{"id":"minecraft:dragon_breath","localizedName":"Dragon\u0027s Breath","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.dragon_breath"},{"id":"minecraft:dragon_egg","localizedName":"Dragon Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dragon_egg"},{"id":"minecraft:dragon_head","localizedName":"Dragon Head","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dragon_head"},{"id":"minecraft:dried_kelp","localizedName":"Dried Kelp","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.dried_kelp"},{"id":"minecraft:dried_kelp_block","localizedName":"Dried Kelp Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dried_kelp_block"},{"id":"minecraft:dripstone_block","localizedName":"Dripstone Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dripstone_block"},{"id":"minecraft:dropper","localizedName":"Dropper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.dropper"},{"id":"minecraft:drowned_spawn_egg","localizedName":"Drowned Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.drowned_spawn_egg"},{"id":"minecraft:dune_armor_trim_smithing_template","localizedName":"Smithing Template","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.smithing_template"},{"id":"minecraft:echo_shard","localizedName":"Echo Shard","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.echo_shard"},{"id":"minecraft:egg","localizedName":"Egg","maxDamage":0,"maxStackSize":16,"unlocalizedName":"item.minecraft.egg"},{"id":"minecraft:elder_guardian_spawn_egg","localizedName":"Elder Guardian Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.elder_guardian_spawn_egg"},{"id":"minecraft:elytra","localizedName":"Elytra","maxDamage":432,"maxStackSize":1,"unlocalizedName":"item.minecraft.elytra"},{"id":"minecraft:emerald","localizedName":"Emerald","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.emerald"},{"id":"minecraft:emerald_block","localizedName":"Block of Emerald","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.emerald_block"},{"id":"minecraft:emerald_ore","localizedName":"Emerald Ore","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.emerald_ore"},{"id":"minecraft:enchanted_book","localizedName":"Enchanted Book","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.enchanted_book"},{"id":"minecraft:enchanted_golden_apple","localizedName":"Enchanted Golden Apple","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.enchanted_golden_apple"},{"id":"minecraft:enchanting_table","localizedName":"Enchanting Table","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.enchanting_table"},{"id":"minecraft:end_crystal","localizedName":"End Crystal","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.end_crystal"},{"id":"minecraft:end_portal_frame","localizedName":"End Portal Frame","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.end_portal_frame"},{"id":"minecraft:end_rod","localizedName":"End Rod","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.end_rod"},{"id":"minecraft:end_stone","localizedName":"End Stone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.end_stone"},{"id":"minecraft:end_stone_brick_slab","localizedName":"End Stone Brick Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.end_stone_brick_slab"},{"id":"minecraft:end_stone_brick_stairs","localizedName":"End Stone Brick Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.end_stone_brick_stairs"},{"id":"minecraft:end_stone_brick_wall","localizedName":"End Stone Brick Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.end_stone_brick_wall"},{"id":"minecraft:end_stone_bricks","localizedName":"End Stone Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.end_stone_bricks"},{"id":"minecraft:ender_chest","localizedName":"Ender Chest","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.ender_chest"},{"id":"minecraft:ender_dragon_spawn_egg","localizedName":"Ender Dragon Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.ender_dragon_spawn_egg"},{"id":"minecraft:ender_eye","localizedName":"Eye of Ender","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.ender_eye"},{"id":"minecraft:ender_pearl","localizedName":"Ender Pearl","maxDamage":0,"maxStackSize":16,"unlocalizedName":"item.minecraft.ender_pearl"},{"id":"minecraft:enderman_spawn_egg","localizedName":"Enderman Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.enderman_spawn_egg"},{"id":"minecraft:endermite_spawn_egg","localizedName":"Endermite Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.endermite_spawn_egg"},{"id":"minecraft:evoker_spawn_egg","localizedName":"Evoker Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.evoker_spawn_egg"},{"id":"minecraft:experience_bottle","localizedName":"Bottle o\u0027 Enchanting","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.experience_bottle"},{"id":"minecraft:explorer_pottery_sherd","localizedName":"Explorer Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.explorer_pottery_sherd"},{"id":"minecraft:exposed_copper","localizedName":"Exposed Copper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.exposed_copper"},{"id":"minecraft:exposed_cut_copper","localizedName":"Exposed Cut Copper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.exposed_cut_copper"},{"id":"minecraft:exposed_cut_copper_slab","localizedName":"Exposed Cut Copper Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.exposed_cut_copper_slab"},{"id":"minecraft:exposed_cut_copper_stairs","localizedName":"Exposed Cut Copper Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.exposed_cut_copper_stairs"},{"id":"minecraft:eye_armor_trim_smithing_template","localizedName":"Smithing Template","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.smithing_template"},{"id":"minecraft:farmland","localizedName":"Farmland","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.farmland"},{"id":"minecraft:feather","localizedName":"Feather","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.feather"},{"id":"minecraft:fermented_spider_eye","localizedName":"Fermented Spider Eye","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.fermented_spider_eye"},{"id":"minecraft:fern","localizedName":"Fern","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.fern"},{"id":"minecraft:filled_map","localizedName":"Map","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.filled_map"},{"id":"minecraft:fire_charge","localizedName":"Fire Charge","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.fire_charge"},{"id":"minecraft:fire_coral","localizedName":"Fire Coral","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.fire_coral"},{"id":"minecraft:fire_coral_block","localizedName":"Fire Coral Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.fire_coral_block"},{"id":"minecraft:fire_coral_fan","localizedName":"Fire Coral Fan","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.fire_coral_fan"},{"id":"minecraft:firework_rocket","localizedName":"Firework Rocket","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.firework_rocket"},{"id":"minecraft:firework_star","localizedName":"Firework Star","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.firework_star"},{"id":"minecraft:fishing_rod","localizedName":"Fishing Rod","maxDamage":64,"maxStackSize":1,"unlocalizedName":"item.minecraft.fishing_rod"},{"id":"minecraft:fletching_table","localizedName":"Fletching Table","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.fletching_table"},{"id":"minecraft:flint","localizedName":"Flint","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.flint"},{"id":"minecraft:flint_and_steel","localizedName":"Flint and Steel","maxDamage":64,"maxStackSize":1,"unlocalizedName":"item.minecraft.flint_and_steel"},{"id":"minecraft:flower_banner_pattern","localizedName":"Banner Pattern","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.flower_banner_pattern"},{"id":"minecraft:flower_pot","localizedName":"Flower Pot","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.flower_pot"},{"id":"minecraft:flowering_azalea","localizedName":"Flowering Azalea","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.flowering_azalea"},{"id":"minecraft:flowering_azalea_leaves","localizedName":"Flowering Azalea Leaves","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.flowering_azalea_leaves"},{"id":"minecraft:fox_spawn_egg","localizedName":"Fox Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.fox_spawn_egg"},{"id":"minecraft:friend_pottery_sherd","localizedName":"Friend Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.friend_pottery_sherd"},{"id":"minecraft:frog_spawn_egg","localizedName":"Frog Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.frog_spawn_egg"},{"id":"minecraft:frogspawn","localizedName":"Frogspawn","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.frogspawn"},{"id":"minecraft:furnace","localizedName":"Furnace","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.furnace"},{"id":"minecraft:furnace_minecart","localizedName":"Minecart with Furnace","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.furnace_minecart"},{"id":"minecraft:ghast_spawn_egg","localizedName":"Ghast Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.ghast_spawn_egg"},{"id":"minecraft:ghast_tear","localizedName":"Ghast Tear","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.ghast_tear"},{"id":"minecraft:gilded_blackstone","localizedName":"Gilded Blackstone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.gilded_blackstone"},{"id":"minecraft:glass","localizedName":"Glass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.glass"},{"id":"minecraft:glass_bottle","localizedName":"Glass Bottle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.glass_bottle"},{"id":"minecraft:glass_pane","localizedName":"Glass Pane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.glass_pane"},{"id":"minecraft:glistering_melon_slice","localizedName":"Glistering Melon Slice","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.glistering_melon_slice"},{"id":"minecraft:globe_banner_pattern","localizedName":"Banner Pattern","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.globe_banner_pattern"},{"id":"minecraft:glow_berries","localizedName":"Glow Berries","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.glow_berries"},{"id":"minecraft:glow_ink_sac","localizedName":"Glow Ink Sac","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.glow_ink_sac"},{"id":"minecraft:glow_item_frame","localizedName":"Glow Item Frame","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.glow_item_frame"},{"id":"minecraft:glow_lichen","localizedName":"Glow Lichen","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.glow_lichen"},{"id":"minecraft:glow_squid_spawn_egg","localizedName":"Glow Squid Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.glow_squid_spawn_egg"},{"id":"minecraft:glowstone","localizedName":"Glowstone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.glowstone"},{"id":"minecraft:glowstone_dust","localizedName":"Glowstone Dust","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.glowstone_dust"},{"id":"minecraft:goat_horn","localizedName":"Goat Horn","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.goat_horn"},{"id":"minecraft:goat_spawn_egg","localizedName":"Goat Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.goat_spawn_egg"},{"id":"minecraft:gold_block","localizedName":"Block of Gold","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.gold_block"},{"id":"minecraft:gold_ingot","localizedName":"Gold Ingot","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.gold_ingot"},{"id":"minecraft:gold_nugget","localizedName":"Gold Nugget","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.gold_nugget"},{"id":"minecraft:gold_ore","localizedName":"Gold Ore","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.gold_ore"},{"id":"minecraft:golden_apple","localizedName":"Golden Apple","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.golden_apple"},{"id":"minecraft:golden_axe","localizedName":"Golden Axe","maxDamage":32,"maxStackSize":1,"unlocalizedName":"item.minecraft.golden_axe"},{"id":"minecraft:golden_boots","localizedName":"Golden Boots","maxDamage":91,"maxStackSize":1,"unlocalizedName":"item.minecraft.golden_boots"},{"id":"minecraft:golden_carrot","localizedName":"Golden Carrot","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.golden_carrot"},{"id":"minecraft:golden_chestplate","localizedName":"Golden Chestplate","maxDamage":112,"maxStackSize":1,"unlocalizedName":"item.minecraft.golden_chestplate"},{"id":"minecraft:golden_helmet","localizedName":"Golden Helmet","maxDamage":77,"maxStackSize":1,"unlocalizedName":"item.minecraft.golden_helmet"},{"id":"minecraft:golden_hoe","localizedName":"Golden Hoe","maxDamage":32,"maxStackSize":1,"unlocalizedName":"item.minecraft.golden_hoe"},{"id":"minecraft:golden_horse_armor","localizedName":"Golden Horse Armor","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.golden_horse_armor"},{"id":"minecraft:golden_leggings","localizedName":"Golden Leggings","maxDamage":105,"maxStackSize":1,"unlocalizedName":"item.minecraft.golden_leggings"},{"id":"minecraft:golden_pickaxe","localizedName":"Golden Pickaxe","maxDamage":32,"maxStackSize":1,"unlocalizedName":"item.minecraft.golden_pickaxe"},{"id":"minecraft:golden_shovel","localizedName":"Golden Shovel","maxDamage":32,"maxStackSize":1,"unlocalizedName":"item.minecraft.golden_shovel"},{"id":"minecraft:golden_sword","localizedName":"Golden Sword","maxDamage":32,"maxStackSize":1,"unlocalizedName":"item.minecraft.golden_sword"},{"id":"minecraft:granite","localizedName":"Granite","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.granite"},{"id":"minecraft:granite_slab","localizedName":"Granite Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.granite_slab"},{"id":"minecraft:granite_stairs","localizedName":"Granite Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.granite_stairs"},{"id":"minecraft:granite_wall","localizedName":"Granite Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.granite_wall"},{"id":"minecraft:grass","localizedName":"Grass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.grass"},{"id":"minecraft:grass_block","localizedName":"Grass Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.grass_block"},{"id":"minecraft:gravel","localizedName":"Gravel","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.gravel"},{"id":"minecraft:gray_banner","localizedName":"Gray Banner","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.gray_banner"},{"id":"minecraft:gray_bed","localizedName":"Gray Bed","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.gray_bed"},{"id":"minecraft:gray_candle","localizedName":"Gray Candle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.gray_candle"},{"id":"minecraft:gray_carpet","localizedName":"Gray Carpet","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.gray_carpet"},{"id":"minecraft:gray_concrete","localizedName":"Gray Concrete","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.gray_concrete"},{"id":"minecraft:gray_concrete_powder","localizedName":"Gray Concrete Powder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.gray_concrete_powder"},{"id":"minecraft:gray_dye","localizedName":"Gray Dye","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.gray_dye"},{"id":"minecraft:gray_glazed_terracotta","localizedName":"Gray Glazed Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.gray_glazed_terracotta"},{"id":"minecraft:gray_shulker_box","localizedName":"Gray Shulker Box","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.gray_shulker_box"},{"id":"minecraft:gray_stained_glass","localizedName":"Gray Stained Glass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.gray_stained_glass"},{"id":"minecraft:gray_stained_glass_pane","localizedName":"Gray Stained Glass Pane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.gray_stained_glass_pane"},{"id":"minecraft:gray_terracotta","localizedName":"Gray Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.gray_terracotta"},{"id":"minecraft:gray_wool","localizedName":"Gray Wool","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.gray_wool"},{"id":"minecraft:green_banner","localizedName":"Green Banner","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.green_banner"},{"id":"minecraft:green_bed","localizedName":"Green Bed","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.green_bed"},{"id":"minecraft:green_candle","localizedName":"Green Candle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.green_candle"},{"id":"minecraft:green_carpet","localizedName":"Green Carpet","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.green_carpet"},{"id":"minecraft:green_concrete","localizedName":"Green Concrete","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.green_concrete"},{"id":"minecraft:green_concrete_powder","localizedName":"Green Concrete Powder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.green_concrete_powder"},{"id":"minecraft:green_dye","localizedName":"Green Dye","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.green_dye"},{"id":"minecraft:green_glazed_terracotta","localizedName":"Green Glazed Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.green_glazed_terracotta"},{"id":"minecraft:green_shulker_box","localizedName":"Green Shulker Box","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.green_shulker_box"},{"id":"minecraft:green_stained_glass","localizedName":"Green Stained Glass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.green_stained_glass"},{"id":"minecraft:green_stained_glass_pane","localizedName":"Green Stained Glass Pane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.green_stained_glass_pane"},{"id":"minecraft:green_terracotta","localizedName":"Green Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.green_terracotta"},{"id":"minecraft:green_wool","localizedName":"Green Wool","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.green_wool"},{"id":"minecraft:grindstone","localizedName":"Grindstone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.grindstone"},{"id":"minecraft:guardian_spawn_egg","localizedName":"Guardian Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.guardian_spawn_egg"},{"id":"minecraft:gunpowder","localizedName":"Gunpowder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.gunpowder"},{"id":"minecraft:hanging_roots","localizedName":"Hanging Roots","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.hanging_roots"},{"id":"minecraft:hay_block","localizedName":"Hay Bale","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.hay_block"},{"id":"minecraft:heart_of_the_sea","localizedName":"Heart of the Sea","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.heart_of_the_sea"},{"id":"minecraft:heart_pottery_sherd","localizedName":"Heart Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.heart_pottery_sherd"},{"id":"minecraft:heartbreak_pottery_sherd","localizedName":"Heartbreak Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.heartbreak_pottery_sherd"},{"id":"minecraft:heavy_weighted_pressure_plate","localizedName":"Heavy Weighted Pressure Plate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.heavy_weighted_pressure_plate"},{"id":"minecraft:hoglin_spawn_egg","localizedName":"Hoglin Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.hoglin_spawn_egg"},{"id":"minecraft:honey_block","localizedName":"Honey Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.honey_block"},{"id":"minecraft:honey_bottle","localizedName":"Honey Bottle","maxDamage":0,"maxStackSize":16,"unlocalizedName":"item.minecraft.honey_bottle"},{"id":"minecraft:honeycomb","localizedName":"Honeycomb","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.honeycomb"},{"id":"minecraft:honeycomb_block","localizedName":"Honeycomb Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.honeycomb_block"},{"id":"minecraft:hopper","localizedName":"Hopper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.hopper"},{"id":"minecraft:hopper_minecart","localizedName":"Minecart with Hopper","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.hopper_minecart"},{"id":"minecraft:horn_coral","localizedName":"Horn Coral","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.horn_coral"},{"id":"minecraft:horn_coral_block","localizedName":"Horn Coral Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.horn_coral_block"},{"id":"minecraft:horn_coral_fan","localizedName":"Horn Coral Fan","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.horn_coral_fan"},{"id":"minecraft:horse_spawn_egg","localizedName":"Horse Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.horse_spawn_egg"},{"id":"minecraft:host_armor_trim_smithing_template","localizedName":"Smithing Template","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.smithing_template"},{"id":"minecraft:howl_pottery_sherd","localizedName":"Howl Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.howl_pottery_sherd"},{"id":"minecraft:husk_spawn_egg","localizedName":"Husk Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.husk_spawn_egg"},{"id":"minecraft:ice","localizedName":"Ice","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.ice"},{"id":"minecraft:infested_chiseled_stone_bricks","localizedName":"Infested Chiseled Stone Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.infested_chiseled_stone_bricks"},{"id":"minecraft:infested_cobblestone","localizedName":"Infested Cobblestone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.infested_cobblestone"},{"id":"minecraft:infested_cracked_stone_bricks","localizedName":"Infested Cracked Stone Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.infested_cracked_stone_bricks"},{"id":"minecraft:infested_deepslate","localizedName":"Infested Deepslate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.infested_deepslate"},{"id":"minecraft:infested_mossy_stone_bricks","localizedName":"Infested Mossy Stone Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.infested_mossy_stone_bricks"},{"id":"minecraft:infested_stone","localizedName":"Infested Stone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.infested_stone"},{"id":"minecraft:infested_stone_bricks","localizedName":"Infested Stone Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.infested_stone_bricks"},{"id":"minecraft:ink_sac","localizedName":"Ink Sac","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.ink_sac"},{"id":"minecraft:iron_axe","localizedName":"Iron Axe","maxDamage":250,"maxStackSize":1,"unlocalizedName":"item.minecraft.iron_axe"},{"id":"minecraft:iron_bars","localizedName":"Iron Bars","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.iron_bars"},{"id":"minecraft:iron_block","localizedName":"Block of Iron","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.iron_block"},{"id":"minecraft:iron_boots","localizedName":"Iron Boots","maxDamage":195,"maxStackSize":1,"unlocalizedName":"item.minecraft.iron_boots"},{"id":"minecraft:iron_chestplate","localizedName":"Iron Chestplate","maxDamage":240,"maxStackSize":1,"unlocalizedName":"item.minecraft.iron_chestplate"},{"id":"minecraft:iron_door","localizedName":"Iron Door","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.iron_door"},{"id":"minecraft:iron_golem_spawn_egg","localizedName":"Iron Golem Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.iron_golem_spawn_egg"},{"id":"minecraft:iron_helmet","localizedName":"Iron Helmet","maxDamage":165,"maxStackSize":1,"unlocalizedName":"item.minecraft.iron_helmet"},{"id":"minecraft:iron_hoe","localizedName":"Iron Hoe","maxDamage":250,"maxStackSize":1,"unlocalizedName":"item.minecraft.iron_hoe"},{"id":"minecraft:iron_horse_armor","localizedName":"Iron Horse Armor","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.iron_horse_armor"},{"id":"minecraft:iron_ingot","localizedName":"Iron Ingot","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.iron_ingot"},{"id":"minecraft:iron_leggings","localizedName":"Iron Leggings","maxDamage":225,"maxStackSize":1,"unlocalizedName":"item.minecraft.iron_leggings"},{"id":"minecraft:iron_nugget","localizedName":"Iron Nugget","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.iron_nugget"},{"id":"minecraft:iron_ore","localizedName":"Iron Ore","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.iron_ore"},{"id":"minecraft:iron_pickaxe","localizedName":"Iron Pickaxe","maxDamage":250,"maxStackSize":1,"unlocalizedName":"item.minecraft.iron_pickaxe"},{"id":"minecraft:iron_shovel","localizedName":"Iron Shovel","maxDamage":250,"maxStackSize":1,"unlocalizedName":"item.minecraft.iron_shovel"},{"id":"minecraft:iron_sword","localizedName":"Iron Sword","maxDamage":250,"maxStackSize":1,"unlocalizedName":"item.minecraft.iron_sword"},{"id":"minecraft:iron_trapdoor","localizedName":"Iron Trapdoor","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.iron_trapdoor"},{"id":"minecraft:item_frame","localizedName":"Item Frame","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.item_frame"},{"id":"minecraft:jack_o_lantern","localizedName":"Jack o\u0027Lantern","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.jack_o_lantern"},{"id":"minecraft:jigsaw","localizedName":"Jigsaw Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.jigsaw"},{"id":"minecraft:jukebox","localizedName":"Jukebox","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.jukebox"},{"id":"minecraft:jungle_boat","localizedName":"Jungle Boat","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.jungle_boat"},{"id":"minecraft:jungle_button","localizedName":"Jungle Button","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.jungle_button"},{"id":"minecraft:jungle_chest_boat","localizedName":"Jungle Boat with Chest","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.jungle_chest_boat"},{"id":"minecraft:jungle_door","localizedName":"Jungle Door","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.jungle_door"},{"id":"minecraft:jungle_fence","localizedName":"Jungle Fence","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.jungle_fence"},{"id":"minecraft:jungle_fence_gate","localizedName":"Jungle Fence Gate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.jungle_fence_gate"},{"id":"minecraft:jungle_hanging_sign","localizedName":"Jungle Hanging Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.jungle_hanging_sign"},{"id":"minecraft:jungle_leaves","localizedName":"Jungle Leaves","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.jungle_leaves"},{"id":"minecraft:jungle_log","localizedName":"Jungle Log","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.jungle_log"},{"id":"minecraft:jungle_planks","localizedName":"Jungle Planks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.jungle_planks"},{"id":"minecraft:jungle_pressure_plate","localizedName":"Jungle Pressure Plate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.jungle_pressure_plate"},{"id":"minecraft:jungle_sapling","localizedName":"Jungle Sapling","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.jungle_sapling"},{"id":"minecraft:jungle_sign","localizedName":"Jungle Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.jungle_sign"},{"id":"minecraft:jungle_slab","localizedName":"Jungle Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.jungle_slab"},{"id":"minecraft:jungle_stairs","localizedName":"Jungle Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.jungle_stairs"},{"id":"minecraft:jungle_trapdoor","localizedName":"Jungle Trapdoor","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.jungle_trapdoor"},{"id":"minecraft:jungle_wood","localizedName":"Jungle Wood","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.jungle_wood"},{"id":"minecraft:kelp","localizedName":"Kelp","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.kelp"},{"id":"minecraft:knowledge_book","localizedName":"Knowledge Book","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.knowledge_book"},{"id":"minecraft:ladder","localizedName":"Ladder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.ladder"},{"id":"minecraft:lantern","localizedName":"Lantern","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lantern"},{"id":"minecraft:lapis_block","localizedName":"Block of Lapis Lazuli","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lapis_block"},{"id":"minecraft:lapis_lazuli","localizedName":"Lapis Lazuli","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.lapis_lazuli"},{"id":"minecraft:lapis_ore","localizedName":"Lapis Lazuli Ore","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lapis_ore"},{"id":"minecraft:large_amethyst_bud","localizedName":"Large Amethyst Bud","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.large_amethyst_bud"},{"id":"minecraft:large_fern","localizedName":"Large Fern","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.large_fern"},{"id":"minecraft:lava_bucket","localizedName":"Lava Bucket","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.lava_bucket"},{"id":"minecraft:lead","localizedName":"Lead","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.lead"},{"id":"minecraft:leather","localizedName":"Leather","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.leather"},{"id":"minecraft:leather_boots","localizedName":"Leather Boots","maxDamage":65,"maxStackSize":1,"unlocalizedName":"item.minecraft.leather_boots"},{"id":"minecraft:leather_chestplate","localizedName":"Leather Tunic","maxDamage":80,"maxStackSize":1,"unlocalizedName":"item.minecraft.leather_chestplate"},{"id":"minecraft:leather_helmet","localizedName":"Leather Cap","maxDamage":55,"maxStackSize":1,"unlocalizedName":"item.minecraft.leather_helmet"},{"id":"minecraft:leather_horse_armor","localizedName":"Leather Horse Armor","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.leather_horse_armor"},{"id":"minecraft:leather_leggings","localizedName":"Leather Pants","maxDamage":75,"maxStackSize":1,"unlocalizedName":"item.minecraft.leather_leggings"},{"id":"minecraft:lectern","localizedName":"Lectern","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lectern"},{"id":"minecraft:lever","localizedName":"Lever","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lever"},{"id":"minecraft:light","localizedName":"Light","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light"},{"id":"minecraft:light_blue_banner","localizedName":"Light Blue Banner","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.light_blue_banner"},{"id":"minecraft:light_blue_bed","localizedName":"Light Blue Bed","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.light_blue_bed"},{"id":"minecraft:light_blue_candle","localizedName":"Light Blue Candle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_blue_candle"},{"id":"minecraft:light_blue_carpet","localizedName":"Light Blue Carpet","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_blue_carpet"},{"id":"minecraft:light_blue_concrete","localizedName":"Light Blue Concrete","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_blue_concrete"},{"id":"minecraft:light_blue_concrete_powder","localizedName":"Light Blue Concrete Powder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_blue_concrete_powder"},{"id":"minecraft:light_blue_dye","localizedName":"Light Blue Dye","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.light_blue_dye"},{"id":"minecraft:light_blue_glazed_terracotta","localizedName":"Light Blue Glazed Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_blue_glazed_terracotta"},{"id":"minecraft:light_blue_shulker_box","localizedName":"Light Blue Shulker Box","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.light_blue_shulker_box"},{"id":"minecraft:light_blue_stained_glass","localizedName":"Light Blue Stained Glass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_blue_stained_glass"},{"id":"minecraft:light_blue_stained_glass_pane","localizedName":"Light Blue Stained Glass Pane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_blue_stained_glass_pane"},{"id":"minecraft:light_blue_terracotta","localizedName":"Light Blue Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_blue_terracotta"},{"id":"minecraft:light_blue_wool","localizedName":"Light Blue Wool","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_blue_wool"},{"id":"minecraft:light_gray_banner","localizedName":"Light Gray Banner","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.light_gray_banner"},{"id":"minecraft:light_gray_bed","localizedName":"Light Gray Bed","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.light_gray_bed"},{"id":"minecraft:light_gray_candle","localizedName":"Light Gray Candle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_gray_candle"},{"id":"minecraft:light_gray_carpet","localizedName":"Light Gray Carpet","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_gray_carpet"},{"id":"minecraft:light_gray_concrete","localizedName":"Light Gray Concrete","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_gray_concrete"},{"id":"minecraft:light_gray_concrete_powder","localizedName":"Light Gray Concrete Powder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_gray_concrete_powder"},{"id":"minecraft:light_gray_dye","localizedName":"Light Gray Dye","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.light_gray_dye"},{"id":"minecraft:light_gray_glazed_terracotta","localizedName":"Light Gray Glazed Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_gray_glazed_terracotta"},{"id":"minecraft:light_gray_shulker_box","localizedName":"Light Gray Shulker Box","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.light_gray_shulker_box"},{"id":"minecraft:light_gray_stained_glass","localizedName":"Light Gray Stained Glass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_gray_stained_glass"},{"id":"minecraft:light_gray_stained_glass_pane","localizedName":"Light Gray Stained Glass Pane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_gray_stained_glass_pane"},{"id":"minecraft:light_gray_terracotta","localizedName":"Light Gray Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_gray_terracotta"},{"id":"minecraft:light_gray_wool","localizedName":"Light Gray Wool","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_gray_wool"},{"id":"minecraft:light_weighted_pressure_plate","localizedName":"Light Weighted Pressure Plate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.light_weighted_pressure_plate"},{"id":"minecraft:lightning_rod","localizedName":"Lightning Rod","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lightning_rod"},{"id":"minecraft:lilac","localizedName":"Lilac","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lilac"},{"id":"minecraft:lily_of_the_valley","localizedName":"Lily of the Valley","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lily_of_the_valley"},{"id":"minecraft:lily_pad","localizedName":"Lily Pad","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lily_pad"},{"id":"minecraft:lime_banner","localizedName":"Lime Banner","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.lime_banner"},{"id":"minecraft:lime_bed","localizedName":"Lime Bed","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.lime_bed"},{"id":"minecraft:lime_candle","localizedName":"Lime Candle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lime_candle"},{"id":"minecraft:lime_carpet","localizedName":"Lime Carpet","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lime_carpet"},{"id":"minecraft:lime_concrete","localizedName":"Lime Concrete","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lime_concrete"},{"id":"minecraft:lime_concrete_powder","localizedName":"Lime Concrete Powder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lime_concrete_powder"},{"id":"minecraft:lime_dye","localizedName":"Lime Dye","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.lime_dye"},{"id":"minecraft:lime_glazed_terracotta","localizedName":"Lime Glazed Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lime_glazed_terracotta"},{"id":"minecraft:lime_shulker_box","localizedName":"Lime Shulker Box","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.lime_shulker_box"},{"id":"minecraft:lime_stained_glass","localizedName":"Lime Stained Glass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lime_stained_glass"},{"id":"minecraft:lime_stained_glass_pane","localizedName":"Lime Stained Glass Pane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lime_stained_glass_pane"},{"id":"minecraft:lime_terracotta","localizedName":"Lime Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lime_terracotta"},{"id":"minecraft:lime_wool","localizedName":"Lime Wool","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lime_wool"},{"id":"minecraft:lingering_potion","localizedName":"Lingering Water Bottle","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.lingering_potion.effect.water"},{"id":"minecraft:llama_spawn_egg","localizedName":"Llama Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.llama_spawn_egg"},{"id":"minecraft:lodestone","localizedName":"Lodestone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.lodestone"},{"id":"minecraft:loom","localizedName":"Loom","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.loom"},{"id":"minecraft:magenta_banner","localizedName":"Magenta Banner","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.magenta_banner"},{"id":"minecraft:magenta_bed","localizedName":"Magenta Bed","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.magenta_bed"},{"id":"minecraft:magenta_candle","localizedName":"Magenta Candle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.magenta_candle"},{"id":"minecraft:magenta_carpet","localizedName":"Magenta Carpet","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.magenta_carpet"},{"id":"minecraft:magenta_concrete","localizedName":"Magenta Concrete","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.magenta_concrete"},{"id":"minecraft:magenta_concrete_powder","localizedName":"Magenta Concrete Powder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.magenta_concrete_powder"},{"id":"minecraft:magenta_dye","localizedName":"Magenta Dye","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.magenta_dye"},{"id":"minecraft:magenta_glazed_terracotta","localizedName":"Magenta Glazed Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.magenta_glazed_terracotta"},{"id":"minecraft:magenta_shulker_box","localizedName":"Magenta Shulker Box","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.magenta_shulker_box"},{"id":"minecraft:magenta_stained_glass","localizedName":"Magenta Stained Glass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.magenta_stained_glass"},{"id":"minecraft:magenta_stained_glass_pane","localizedName":"Magenta Stained Glass Pane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.magenta_stained_glass_pane"},{"id":"minecraft:magenta_terracotta","localizedName":"Magenta Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.magenta_terracotta"},{"id":"minecraft:magenta_wool","localizedName":"Magenta Wool","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.magenta_wool"},{"id":"minecraft:magma_block","localizedName":"Magma Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.magma_block"},{"id":"minecraft:magma_cream","localizedName":"Magma Cream","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.magma_cream"},{"id":"minecraft:magma_cube_spawn_egg","localizedName":"Magma Cube Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.magma_cube_spawn_egg"},{"id":"minecraft:mangrove_boat","localizedName":"Mangrove Boat","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.mangrove_boat"},{"id":"minecraft:mangrove_button","localizedName":"Mangrove Button","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mangrove_button"},{"id":"minecraft:mangrove_chest_boat","localizedName":"Mangrove Boat with Chest","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.mangrove_chest_boat"},{"id":"minecraft:mangrove_door","localizedName":"Mangrove Door","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mangrove_door"},{"id":"minecraft:mangrove_fence","localizedName":"Mangrove Fence","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mangrove_fence"},{"id":"minecraft:mangrove_fence_gate","localizedName":"Mangrove Fence Gate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mangrove_fence_gate"},{"id":"minecraft:mangrove_hanging_sign","localizedName":"Mangrove Hanging Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.mangrove_hanging_sign"},{"id":"minecraft:mangrove_leaves","localizedName":"Mangrove Leaves","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mangrove_leaves"},{"id":"minecraft:mangrove_log","localizedName":"Mangrove Log","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mangrove_log"},{"id":"minecraft:mangrove_planks","localizedName":"Mangrove Planks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mangrove_planks"},{"id":"minecraft:mangrove_pressure_plate","localizedName":"Mangrove Pressure Plate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mangrove_pressure_plate"},{"id":"minecraft:mangrove_propagule","localizedName":"Mangrove Propagule","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mangrove_propagule"},{"id":"minecraft:mangrove_roots","localizedName":"Mangrove Roots","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mangrove_roots"},{"id":"minecraft:mangrove_sign","localizedName":"Mangrove Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.mangrove_sign"},{"id":"minecraft:mangrove_slab","localizedName":"Mangrove Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mangrove_slab"},{"id":"minecraft:mangrove_stairs","localizedName":"Mangrove Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mangrove_stairs"},{"id":"minecraft:mangrove_trapdoor","localizedName":"Mangrove Trapdoor","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mangrove_trapdoor"},{"id":"minecraft:mangrove_wood","localizedName":"Mangrove Wood","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mangrove_wood"},{"id":"minecraft:map","localizedName":"Empty Map","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.map"},{"id":"minecraft:medium_amethyst_bud","localizedName":"Medium Amethyst Bud","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.medium_amethyst_bud"},{"id":"minecraft:melon","localizedName":"Melon","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.melon"},{"id":"minecraft:melon_seeds","localizedName":"Melon Seeds","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.melon_seeds"},{"id":"minecraft:melon_slice","localizedName":"Melon Slice","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.melon_slice"},{"id":"minecraft:milk_bucket","localizedName":"Milk Bucket","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.milk_bucket"},{"id":"minecraft:minecart","localizedName":"Minecart","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.minecart"},{"id":"minecraft:miner_pottery_sherd","localizedName":"Miner Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.miner_pottery_sherd"},{"id":"minecraft:mojang_banner_pattern","localizedName":"Banner Pattern","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.mojang_banner_pattern"},{"id":"minecraft:mooshroom_spawn_egg","localizedName":"Mooshroom Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.mooshroom_spawn_egg"},{"id":"minecraft:moss_block","localizedName":"Moss Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.moss_block"},{"id":"minecraft:moss_carpet","localizedName":"Moss Carpet","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.moss_carpet"},{"id":"minecraft:mossy_cobblestone","localizedName":"Mossy Cobblestone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mossy_cobblestone"},{"id":"minecraft:mossy_cobblestone_slab","localizedName":"Mossy Cobblestone Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mossy_cobblestone_slab"},{"id":"minecraft:mossy_cobblestone_stairs","localizedName":"Mossy Cobblestone Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mossy_cobblestone_stairs"},{"id":"minecraft:mossy_cobblestone_wall","localizedName":"Mossy Cobblestone Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mossy_cobblestone_wall"},{"id":"minecraft:mossy_stone_brick_slab","localizedName":"Mossy Stone Brick Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mossy_stone_brick_slab"},{"id":"minecraft:mossy_stone_brick_stairs","localizedName":"Mossy Stone Brick Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mossy_stone_brick_stairs"},{"id":"minecraft:mossy_stone_brick_wall","localizedName":"Mossy Stone Brick Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mossy_stone_brick_wall"},{"id":"minecraft:mossy_stone_bricks","localizedName":"Mossy Stone Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mossy_stone_bricks"},{"id":"minecraft:mourner_pottery_sherd","localizedName":"Mourner Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.mourner_pottery_sherd"},{"id":"minecraft:mud","localizedName":"Mud","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mud"},{"id":"minecraft:mud_brick_slab","localizedName":"Mud Brick Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mud_brick_slab"},{"id":"minecraft:mud_brick_stairs","localizedName":"Mud Brick Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mud_brick_stairs"},{"id":"minecraft:mud_brick_wall","localizedName":"Mud Brick Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mud_brick_wall"},{"id":"minecraft:mud_bricks","localizedName":"Mud Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mud_bricks"},{"id":"minecraft:muddy_mangrove_roots","localizedName":"Muddy Mangrove Roots","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.muddy_mangrove_roots"},{"id":"minecraft:mule_spawn_egg","localizedName":"Mule Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.mule_spawn_egg"},{"id":"minecraft:mushroom_stem","localizedName":"Mushroom Stem","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mushroom_stem"},{"id":"minecraft:mushroom_stew","localizedName":"Mushroom Stew","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.mushroom_stew"},{"id":"minecraft:music_disc_11","localizedName":"Music Disc","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.music_disc_11"},{"id":"minecraft:music_disc_13","localizedName":"Music Disc","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.music_disc_13"},{"id":"minecraft:music_disc_5","localizedName":"Music Disc","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.music_disc_5"},{"id":"minecraft:music_disc_blocks","localizedName":"Music Disc","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.music_disc_blocks"},{"id":"minecraft:music_disc_cat","localizedName":"Music Disc","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.music_disc_cat"},{"id":"minecraft:music_disc_chirp","localizedName":"Music Disc","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.music_disc_chirp"},{"id":"minecraft:music_disc_far","localizedName":"Music Disc","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.music_disc_far"},{"id":"minecraft:music_disc_mall","localizedName":"Music Disc","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.music_disc_mall"},{"id":"minecraft:music_disc_mellohi","localizedName":"Music Disc","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.music_disc_mellohi"},{"id":"minecraft:music_disc_otherside","localizedName":"Music Disc","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.music_disc_otherside"},{"id":"minecraft:music_disc_pigstep","localizedName":"Music Disc","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.music_disc_pigstep"},{"id":"minecraft:music_disc_relic","localizedName":"Music Disc","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.music_disc_relic"},{"id":"minecraft:music_disc_stal","localizedName":"Music Disc","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.music_disc_stal"},{"id":"minecraft:music_disc_strad","localizedName":"Music Disc","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.music_disc_strad"},{"id":"minecraft:music_disc_wait","localizedName":"Music Disc","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.music_disc_wait"},{"id":"minecraft:music_disc_ward","localizedName":"Music Disc","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.music_disc_ward"},{"id":"minecraft:mutton","localizedName":"Raw Mutton","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.mutton"},{"id":"minecraft:mycelium","localizedName":"Mycelium","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.mycelium"},{"id":"minecraft:name_tag","localizedName":"Name Tag","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.name_tag"},{"id":"minecraft:nautilus_shell","localizedName":"Nautilus Shell","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.nautilus_shell"},{"id":"minecraft:nether_brick","localizedName":"Nether Brick","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.nether_brick"},{"id":"minecraft:nether_brick_fence","localizedName":"Nether Brick Fence","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.nether_brick_fence"},{"id":"minecraft:nether_brick_slab","localizedName":"Nether Brick Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.nether_brick_slab"},{"id":"minecraft:nether_brick_stairs","localizedName":"Nether Brick Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.nether_brick_stairs"},{"id":"minecraft:nether_brick_wall","localizedName":"Nether Brick Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.nether_brick_wall"},{"id":"minecraft:nether_bricks","localizedName":"Nether Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.nether_bricks"},{"id":"minecraft:nether_gold_ore","localizedName":"Nether Gold Ore","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.nether_gold_ore"},{"id":"minecraft:nether_quartz_ore","localizedName":"Nether Quartz Ore","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.nether_quartz_ore"},{"id":"minecraft:nether_sprouts","localizedName":"Nether Sprouts","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.nether_sprouts"},{"id":"minecraft:nether_star","localizedName":"Nether Star","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.nether_star"},{"id":"minecraft:nether_wart","localizedName":"Nether Wart","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.nether_wart"},{"id":"minecraft:nether_wart_block","localizedName":"Nether Wart Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.nether_wart_block"},{"id":"minecraft:netherite_axe","localizedName":"Netherite Axe","maxDamage":2031,"maxStackSize":1,"unlocalizedName":"item.minecraft.netherite_axe"},{"id":"minecraft:netherite_block","localizedName":"Block of Netherite","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.netherite_block"},{"id":"minecraft:netherite_boots","localizedName":"Netherite Boots","maxDamage":481,"maxStackSize":1,"unlocalizedName":"item.minecraft.netherite_boots"},{"id":"minecraft:netherite_chestplate","localizedName":"Netherite Chestplate","maxDamage":592,"maxStackSize":1,"unlocalizedName":"item.minecraft.netherite_chestplate"},{"id":"minecraft:netherite_helmet","localizedName":"Netherite Helmet","maxDamage":407,"maxStackSize":1,"unlocalizedName":"item.minecraft.netherite_helmet"},{"id":"minecraft:netherite_hoe","localizedName":"Netherite Hoe","maxDamage":2031,"maxStackSize":1,"unlocalizedName":"item.minecraft.netherite_hoe"},{"id":"minecraft:netherite_ingot","localizedName":"Netherite Ingot","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.netherite_ingot"},{"id":"minecraft:netherite_leggings","localizedName":"Netherite Leggings","maxDamage":555,"maxStackSize":1,"unlocalizedName":"item.minecraft.netherite_leggings"},{"id":"minecraft:netherite_pickaxe","localizedName":"Netherite Pickaxe","maxDamage":2031,"maxStackSize":1,"unlocalizedName":"item.minecraft.netherite_pickaxe"},{"id":"minecraft:netherite_scrap","localizedName":"Netherite Scrap","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.netherite_scrap"},{"id":"minecraft:netherite_shovel","localizedName":"Netherite Shovel","maxDamage":2031,"maxStackSize":1,"unlocalizedName":"item.minecraft.netherite_shovel"},{"id":"minecraft:netherite_sword","localizedName":"Netherite Sword","maxDamage":2031,"maxStackSize":1,"unlocalizedName":"item.minecraft.netherite_sword"},{"id":"minecraft:netherite_upgrade_smithing_template","localizedName":"Smithing Template","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.smithing_template"},{"id":"minecraft:netherrack","localizedName":"Netherrack","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.netherrack"},{"id":"minecraft:note_block","localizedName":"Note Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.note_block"},{"id":"minecraft:oak_boat","localizedName":"Oak Boat","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.oak_boat"},{"id":"minecraft:oak_button","localizedName":"Oak Button","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.oak_button"},{"id":"minecraft:oak_chest_boat","localizedName":"Oak Boat with Chest","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.oak_chest_boat"},{"id":"minecraft:oak_door","localizedName":"Oak Door","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.oak_door"},{"id":"minecraft:oak_fence","localizedName":"Oak Fence","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.oak_fence"},{"id":"minecraft:oak_fence_gate","localizedName":"Oak Fence Gate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.oak_fence_gate"},{"id":"minecraft:oak_hanging_sign","localizedName":"Oak Hanging Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.oak_hanging_sign"},{"id":"minecraft:oak_leaves","localizedName":"Oak Leaves","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.oak_leaves"},{"id":"minecraft:oak_log","localizedName":"Oak Log","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.oak_log"},{"id":"minecraft:oak_planks","localizedName":"Oak Planks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.oak_planks"},{"id":"minecraft:oak_pressure_plate","localizedName":"Oak Pressure Plate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.oak_pressure_plate"},{"id":"minecraft:oak_sapling","localizedName":"Oak Sapling","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.oak_sapling"},{"id":"minecraft:oak_sign","localizedName":"Oak Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.oak_sign"},{"id":"minecraft:oak_slab","localizedName":"Oak Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.oak_slab"},{"id":"minecraft:oak_stairs","localizedName":"Oak Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.oak_stairs"},{"id":"minecraft:oak_trapdoor","localizedName":"Oak Trapdoor","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.oak_trapdoor"},{"id":"minecraft:oak_wood","localizedName":"Oak Wood","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.oak_wood"},{"id":"minecraft:observer","localizedName":"Observer","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.observer"},{"id":"minecraft:obsidian","localizedName":"Obsidian","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.obsidian"},{"id":"minecraft:ocelot_spawn_egg","localizedName":"Ocelot Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.ocelot_spawn_egg"},{"id":"minecraft:ochre_froglight","localizedName":"Ochre Froglight","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.ochre_froglight"},{"id":"minecraft:orange_banner","localizedName":"Orange Banner","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.orange_banner"},{"id":"minecraft:orange_bed","localizedName":"Orange Bed","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.orange_bed"},{"id":"minecraft:orange_candle","localizedName":"Orange Candle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.orange_candle"},{"id":"minecraft:orange_carpet","localizedName":"Orange Carpet","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.orange_carpet"},{"id":"minecraft:orange_concrete","localizedName":"Orange Concrete","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.orange_concrete"},{"id":"minecraft:orange_concrete_powder","localizedName":"Orange Concrete Powder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.orange_concrete_powder"},{"id":"minecraft:orange_dye","localizedName":"Orange Dye","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.orange_dye"},{"id":"minecraft:orange_glazed_terracotta","localizedName":"Orange Glazed Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.orange_glazed_terracotta"},{"id":"minecraft:orange_shulker_box","localizedName":"Orange Shulker Box","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.orange_shulker_box"},{"id":"minecraft:orange_stained_glass","localizedName":"Orange Stained Glass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.orange_stained_glass"},{"id":"minecraft:orange_stained_glass_pane","localizedName":"Orange Stained Glass Pane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.orange_stained_glass_pane"},{"id":"minecraft:orange_terracotta","localizedName":"Orange Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.orange_terracotta"},{"id":"minecraft:orange_tulip","localizedName":"Orange Tulip","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.orange_tulip"},{"id":"minecraft:orange_wool","localizedName":"Orange Wool","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.orange_wool"},{"id":"minecraft:oxeye_daisy","localizedName":"Oxeye Daisy","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.oxeye_daisy"},{"id":"minecraft:oxidized_copper","localizedName":"Oxidized Copper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.oxidized_copper"},{"id":"minecraft:oxidized_cut_copper","localizedName":"Oxidized Cut Copper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.oxidized_cut_copper"},{"id":"minecraft:oxidized_cut_copper_slab","localizedName":"Oxidized Cut Copper Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.oxidized_cut_copper_slab"},{"id":"minecraft:oxidized_cut_copper_stairs","localizedName":"Oxidized Cut Copper Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.oxidized_cut_copper_stairs"},{"id":"minecraft:packed_ice","localizedName":"Packed Ice","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.packed_ice"},{"id":"minecraft:packed_mud","localizedName":"Packed Mud","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.packed_mud"},{"id":"minecraft:painting","localizedName":"Painting","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.painting"},{"id":"minecraft:panda_spawn_egg","localizedName":"Panda Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.panda_spawn_egg"},{"id":"minecraft:paper","localizedName":"Paper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.paper"},{"id":"minecraft:parrot_spawn_egg","localizedName":"Parrot Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.parrot_spawn_egg"},{"id":"minecraft:pearlescent_froglight","localizedName":"Pearlescent Froglight","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.pearlescent_froglight"},{"id":"minecraft:peony","localizedName":"Peony","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.peony"},{"id":"minecraft:petrified_oak_slab","localizedName":"Petrified Oak Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.petrified_oak_slab"},{"id":"minecraft:phantom_membrane","localizedName":"Phantom Membrane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.phantom_membrane"},{"id":"minecraft:phantom_spawn_egg","localizedName":"Phantom Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.phantom_spawn_egg"},{"id":"minecraft:pig_spawn_egg","localizedName":"Pig Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.pig_spawn_egg"},{"id":"minecraft:piglin_banner_pattern","localizedName":"Banner Pattern","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.piglin_banner_pattern"},{"id":"minecraft:piglin_brute_spawn_egg","localizedName":"Piglin Brute Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.piglin_brute_spawn_egg"},{"id":"minecraft:piglin_head","localizedName":"Piglin Head","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.piglin_head"},{"id":"minecraft:piglin_spawn_egg","localizedName":"Piglin Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.piglin_spawn_egg"},{"id":"minecraft:pillager_spawn_egg","localizedName":"Pillager Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.pillager_spawn_egg"},{"id":"minecraft:pink_banner","localizedName":"Pink Banner","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.pink_banner"},{"id":"minecraft:pink_bed","localizedName":"Pink Bed","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.pink_bed"},{"id":"minecraft:pink_candle","localizedName":"Pink Candle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.pink_candle"},{"id":"minecraft:pink_carpet","localizedName":"Pink Carpet","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.pink_carpet"},{"id":"minecraft:pink_concrete","localizedName":"Pink Concrete","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.pink_concrete"},{"id":"minecraft:pink_concrete_powder","localizedName":"Pink Concrete Powder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.pink_concrete_powder"},{"id":"minecraft:pink_dye","localizedName":"Pink Dye","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.pink_dye"},{"id":"minecraft:pink_glazed_terracotta","localizedName":"Pink Glazed Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.pink_glazed_terracotta"},{"id":"minecraft:pink_petals","localizedName":"Pink Petals","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.pink_petals"},{"id":"minecraft:pink_shulker_box","localizedName":"Pink Shulker Box","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.pink_shulker_box"},{"id":"minecraft:pink_stained_glass","localizedName":"Pink Stained Glass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.pink_stained_glass"},{"id":"minecraft:pink_stained_glass_pane","localizedName":"Pink Stained Glass Pane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.pink_stained_glass_pane"},{"id":"minecraft:pink_terracotta","localizedName":"Pink Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.pink_terracotta"},{"id":"minecraft:pink_tulip","localizedName":"Pink Tulip","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.pink_tulip"},{"id":"minecraft:pink_wool","localizedName":"Pink Wool","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.pink_wool"},{"id":"minecraft:piston","localizedName":"Piston","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.piston"},{"id":"minecraft:pitcher_plant","localizedName":"Pitcher Plant","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.pitcher_plant"},{"id":"minecraft:pitcher_pod","localizedName":"Pitcher Pod","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.pitcher_pod"},{"id":"minecraft:player_head","localizedName":"Player Head","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.player_head"},{"id":"minecraft:plenty_pottery_sherd","localizedName":"Plenty Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.plenty_pottery_sherd"},{"id":"minecraft:podzol","localizedName":"Podzol","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.podzol"},{"id":"minecraft:pointed_dripstone","localizedName":"Pointed Dripstone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.pointed_dripstone"},{"id":"minecraft:poisonous_potato","localizedName":"Poisonous Potato","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.poisonous_potato"},{"id":"minecraft:polar_bear_spawn_egg","localizedName":"Polar Bear Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.polar_bear_spawn_egg"},{"id":"minecraft:polished_andesite","localizedName":"Polished Andesite","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_andesite"},{"id":"minecraft:polished_andesite_slab","localizedName":"Polished Andesite Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_andesite_slab"},{"id":"minecraft:polished_andesite_stairs","localizedName":"Polished Andesite Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_andesite_stairs"},{"id":"minecraft:polished_basalt","localizedName":"Polished Basalt","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_basalt"},{"id":"minecraft:polished_blackstone","localizedName":"Polished Blackstone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_blackstone"},{"id":"minecraft:polished_blackstone_brick_slab","localizedName":"Polished Blackstone Brick Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_blackstone_brick_slab"},{"id":"minecraft:polished_blackstone_brick_stairs","localizedName":"Polished Blackstone Brick Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_blackstone_brick_stairs"},{"id":"minecraft:polished_blackstone_brick_wall","localizedName":"Polished Blackstone Brick Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_blackstone_brick_wall"},{"id":"minecraft:polished_blackstone_bricks","localizedName":"Polished Blackstone Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_blackstone_bricks"},{"id":"minecraft:polished_blackstone_button","localizedName":"Polished Blackstone Button","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_blackstone_button"},{"id":"minecraft:polished_blackstone_pressure_plate","localizedName":"Polished Blackstone Pressure Plate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_blackstone_pressure_plate"},{"id":"minecraft:polished_blackstone_slab","localizedName":"Polished Blackstone Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_blackstone_slab"},{"id":"minecraft:polished_blackstone_stairs","localizedName":"Polished Blackstone Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_blackstone_stairs"},{"id":"minecraft:polished_blackstone_wall","localizedName":"Polished Blackstone Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_blackstone_wall"},{"id":"minecraft:polished_deepslate","localizedName":"Polished Deepslate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_deepslate"},{"id":"minecraft:polished_deepslate_slab","localizedName":"Polished Deepslate Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_deepslate_slab"},{"id":"minecraft:polished_deepslate_stairs","localizedName":"Polished Deepslate Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_deepslate_stairs"},{"id":"minecraft:polished_deepslate_wall","localizedName":"Polished Deepslate Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_deepslate_wall"},{"id":"minecraft:polished_diorite","localizedName":"Polished Diorite","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_diorite"},{"id":"minecraft:polished_diorite_slab","localizedName":"Polished Diorite Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_diorite_slab"},{"id":"minecraft:polished_diorite_stairs","localizedName":"Polished Diorite Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_diorite_stairs"},{"id":"minecraft:polished_granite","localizedName":"Polished Granite","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_granite"},{"id":"minecraft:polished_granite_slab","localizedName":"Polished Granite Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_granite_slab"},{"id":"minecraft:polished_granite_stairs","localizedName":"Polished Granite Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.polished_granite_stairs"},{"id":"minecraft:popped_chorus_fruit","localizedName":"Popped Chorus Fruit","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.popped_chorus_fruit"},{"id":"minecraft:poppy","localizedName":"Poppy","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.poppy"},{"id":"minecraft:porkchop","localizedName":"Raw Porkchop","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.porkchop"},{"id":"minecraft:potato","localizedName":"Potato","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.potato"},{"id":"minecraft:potion","localizedName":"Water Bottle","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.potion.effect.water"},{"id":"minecraft:powder_snow_bucket","localizedName":"Powder Snow Bucket","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.powder_snow_bucket"},{"id":"minecraft:powered_rail","localizedName":"Powered Rail","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.powered_rail"},{"id":"minecraft:prismarine","localizedName":"Prismarine","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.prismarine"},{"id":"minecraft:prismarine_brick_slab","localizedName":"Prismarine Brick Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.prismarine_brick_slab"},{"id":"minecraft:prismarine_brick_stairs","localizedName":"Prismarine Brick Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.prismarine_brick_stairs"},{"id":"minecraft:prismarine_bricks","localizedName":"Prismarine Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.prismarine_bricks"},{"id":"minecraft:prismarine_crystals","localizedName":"Prismarine Crystals","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.prismarine_crystals"},{"id":"minecraft:prismarine_shard","localizedName":"Prismarine Shard","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.prismarine_shard"},{"id":"minecraft:prismarine_slab","localizedName":"Prismarine Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.prismarine_slab"},{"id":"minecraft:prismarine_stairs","localizedName":"Prismarine Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.prismarine_stairs"},{"id":"minecraft:prismarine_wall","localizedName":"Prismarine Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.prismarine_wall"},{"id":"minecraft:prize_pottery_sherd","localizedName":"Prize Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.prize_pottery_sherd"},{"id":"minecraft:pufferfish","localizedName":"Pufferfish","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.pufferfish"},{"id":"minecraft:pufferfish_bucket","localizedName":"Bucket of Pufferfish","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.pufferfish_bucket"},{"id":"minecraft:pufferfish_spawn_egg","localizedName":"Pufferfish Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.pufferfish_spawn_egg"},{"id":"minecraft:pumpkin","localizedName":"Pumpkin","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.pumpkin"},{"id":"minecraft:pumpkin_pie","localizedName":"Pumpkin Pie","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.pumpkin_pie"},{"id":"minecraft:pumpkin_seeds","localizedName":"Pumpkin Seeds","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.pumpkin_seeds"},{"id":"minecraft:purple_banner","localizedName":"Purple Banner","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.purple_banner"},{"id":"minecraft:purple_bed","localizedName":"Purple Bed","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.purple_bed"},{"id":"minecraft:purple_candle","localizedName":"Purple Candle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.purple_candle"},{"id":"minecraft:purple_carpet","localizedName":"Purple Carpet","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.purple_carpet"},{"id":"minecraft:purple_concrete","localizedName":"Purple Concrete","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.purple_concrete"},{"id":"minecraft:purple_concrete_powder","localizedName":"Purple Concrete Powder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.purple_concrete_powder"},{"id":"minecraft:purple_dye","localizedName":"Purple Dye","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.purple_dye"},{"id":"minecraft:purple_glazed_terracotta","localizedName":"Purple Glazed Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.purple_glazed_terracotta"},{"id":"minecraft:purple_shulker_box","localizedName":"Purple Shulker Box","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.purple_shulker_box"},{"id":"minecraft:purple_stained_glass","localizedName":"Purple Stained Glass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.purple_stained_glass"},{"id":"minecraft:purple_stained_glass_pane","localizedName":"Purple Stained Glass Pane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.purple_stained_glass_pane"},{"id":"minecraft:purple_terracotta","localizedName":"Purple Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.purple_terracotta"},{"id":"minecraft:purple_wool","localizedName":"Purple Wool","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.purple_wool"},{"id":"minecraft:purpur_block","localizedName":"Purpur Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.purpur_block"},{"id":"minecraft:purpur_pillar","localizedName":"Purpur Pillar","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.purpur_pillar"},{"id":"minecraft:purpur_slab","localizedName":"Purpur Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.purpur_slab"},{"id":"minecraft:purpur_stairs","localizedName":"Purpur Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.purpur_stairs"},{"id":"minecraft:quartz","localizedName":"Nether Quartz","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.quartz"},{"id":"minecraft:quartz_block","localizedName":"Block of Quartz","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.quartz_block"},{"id":"minecraft:quartz_bricks","localizedName":"Quartz Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.quartz_bricks"},{"id":"minecraft:quartz_pillar","localizedName":"Quartz Pillar","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.quartz_pillar"},{"id":"minecraft:quartz_slab","localizedName":"Quartz Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.quartz_slab"},{"id":"minecraft:quartz_stairs","localizedName":"Quartz Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.quartz_stairs"},{"id":"minecraft:rabbit","localizedName":"Raw Rabbit","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.rabbit"},{"id":"minecraft:rabbit_foot","localizedName":"Rabbit\u0027s Foot","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.rabbit_foot"},{"id":"minecraft:rabbit_hide","localizedName":"Rabbit Hide","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.rabbit_hide"},{"id":"minecraft:rabbit_spawn_egg","localizedName":"Rabbit Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.rabbit_spawn_egg"},{"id":"minecraft:rabbit_stew","localizedName":"Rabbit Stew","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.rabbit_stew"},{"id":"minecraft:rail","localizedName":"Rail","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.rail"},{"id":"minecraft:raiser_armor_trim_smithing_template","localizedName":"Smithing Template","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.smithing_template"},{"id":"minecraft:ravager_spawn_egg","localizedName":"Ravager Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.ravager_spawn_egg"},{"id":"minecraft:raw_copper","localizedName":"Raw Copper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.raw_copper"},{"id":"minecraft:raw_copper_block","localizedName":"Block of Raw Copper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.raw_copper_block"},{"id":"minecraft:raw_gold","localizedName":"Raw Gold","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.raw_gold"},{"id":"minecraft:raw_gold_block","localizedName":"Block of Raw Gold","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.raw_gold_block"},{"id":"minecraft:raw_iron","localizedName":"Raw Iron","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.raw_iron"},{"id":"minecraft:raw_iron_block","localizedName":"Block of Raw Iron","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.raw_iron_block"},{"id":"minecraft:recovery_compass","localizedName":"Recovery Compass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.recovery_compass"},{"id":"minecraft:red_banner","localizedName":"Red Banner","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.red_banner"},{"id":"minecraft:red_bed","localizedName":"Red Bed","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.red_bed"},{"id":"minecraft:red_candle","localizedName":"Red Candle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_candle"},{"id":"minecraft:red_carpet","localizedName":"Red Carpet","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_carpet"},{"id":"minecraft:red_concrete","localizedName":"Red Concrete","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_concrete"},{"id":"minecraft:red_concrete_powder","localizedName":"Red Concrete Powder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_concrete_powder"},{"id":"minecraft:red_dye","localizedName":"Red Dye","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.red_dye"},{"id":"minecraft:red_glazed_terracotta","localizedName":"Red Glazed Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_glazed_terracotta"},{"id":"minecraft:red_mushroom","localizedName":"Red Mushroom","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_mushroom"},{"id":"minecraft:red_mushroom_block","localizedName":"Red Mushroom Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_mushroom_block"},{"id":"minecraft:red_nether_brick_slab","localizedName":"Red Nether Brick Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_nether_brick_slab"},{"id":"minecraft:red_nether_brick_stairs","localizedName":"Red Nether Brick Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_nether_brick_stairs"},{"id":"minecraft:red_nether_brick_wall","localizedName":"Red Nether Brick Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_nether_brick_wall"},{"id":"minecraft:red_nether_bricks","localizedName":"Red Nether Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_nether_bricks"},{"id":"minecraft:red_sand","localizedName":"Red Sand","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_sand"},{"id":"minecraft:red_sandstone","localizedName":"Red Sandstone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_sandstone"},{"id":"minecraft:red_sandstone_slab","localizedName":"Red Sandstone Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_sandstone_slab"},{"id":"minecraft:red_sandstone_stairs","localizedName":"Red Sandstone Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_sandstone_stairs"},{"id":"minecraft:red_sandstone_wall","localizedName":"Red Sandstone Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_sandstone_wall"},{"id":"minecraft:red_shulker_box","localizedName":"Red Shulker Box","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.red_shulker_box"},{"id":"minecraft:red_stained_glass","localizedName":"Red Stained Glass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_stained_glass"},{"id":"minecraft:red_stained_glass_pane","localizedName":"Red Stained Glass Pane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_stained_glass_pane"},{"id":"minecraft:red_terracotta","localizedName":"Red Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_terracotta"},{"id":"minecraft:red_tulip","localizedName":"Red Tulip","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_tulip"},{"id":"minecraft:red_wool","localizedName":"Red Wool","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.red_wool"},{"id":"minecraft:redstone","localizedName":"Redstone Dust","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.redstone"},{"id":"minecraft:redstone_block","localizedName":"Block of Redstone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.redstone_block"},{"id":"minecraft:redstone_lamp","localizedName":"Redstone Lamp","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.redstone_lamp"},{"id":"minecraft:redstone_ore","localizedName":"Redstone Ore","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.redstone_ore"},{"id":"minecraft:redstone_torch","localizedName":"Redstone Torch","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.redstone_torch"},{"id":"minecraft:reinforced_deepslate","localizedName":"Reinforced Deepslate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.reinforced_deepslate"},{"id":"minecraft:repeater","localizedName":"Redstone Repeater","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.repeater"},{"id":"minecraft:repeating_command_block","localizedName":"Repeating Command Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.repeating_command_block"},{"id":"minecraft:respawn_anchor","localizedName":"Respawn Anchor","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.respawn_anchor"},{"id":"minecraft:rib_armor_trim_smithing_template","localizedName":"Smithing Template","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.smithing_template"},{"id":"minecraft:rooted_dirt","localizedName":"Rooted Dirt","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.rooted_dirt"},{"id":"minecraft:rose_bush","localizedName":"Rose Bush","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.rose_bush"},{"id":"minecraft:rotten_flesh","localizedName":"Rotten Flesh","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.rotten_flesh"},{"id":"minecraft:saddle","localizedName":"Saddle","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.saddle"},{"id":"minecraft:salmon","localizedName":"Raw Salmon","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.salmon"},{"id":"minecraft:salmon_bucket","localizedName":"Bucket of Salmon","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.salmon_bucket"},{"id":"minecraft:salmon_spawn_egg","localizedName":"Salmon Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.salmon_spawn_egg"},{"id":"minecraft:sand","localizedName":"Sand","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.sand"},{"id":"minecraft:sandstone","localizedName":"Sandstone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.sandstone"},{"id":"minecraft:sandstone_slab","localizedName":"Sandstone Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.sandstone_slab"},{"id":"minecraft:sandstone_stairs","localizedName":"Sandstone Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.sandstone_stairs"},{"id":"minecraft:sandstone_wall","localizedName":"Sandstone Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.sandstone_wall"},{"id":"minecraft:scaffolding","localizedName":"Scaffolding","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.scaffolding"},{"id":"minecraft:sculk","localizedName":"Sculk","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.sculk"},{"id":"minecraft:sculk_catalyst","localizedName":"Sculk Catalyst","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.sculk_catalyst"},{"id":"minecraft:sculk_sensor","localizedName":"Sculk Sensor","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.sculk_sensor"},{"id":"minecraft:sculk_shrieker","localizedName":"Sculk Shrieker","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.sculk_shrieker"},{"id":"minecraft:sculk_vein","localizedName":"Sculk Vein","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.sculk_vein"},{"id":"minecraft:scute","localizedName":"Scute","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.scute"},{"id":"minecraft:sea_lantern","localizedName":"Sea Lantern","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.sea_lantern"},{"id":"minecraft:sea_pickle","localizedName":"Sea Pickle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.sea_pickle"},{"id":"minecraft:seagrass","localizedName":"Seagrass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.seagrass"},{"id":"minecraft:sentry_armor_trim_smithing_template","localizedName":"Smithing Template","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.smithing_template"},{"id":"minecraft:shaper_armor_trim_smithing_template","localizedName":"Smithing Template","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.smithing_template"},{"id":"minecraft:sheaf_pottery_sherd","localizedName":"Sheaf Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.sheaf_pottery_sherd"},{"id":"minecraft:shears","localizedName":"Shears","maxDamage":238,"maxStackSize":1,"unlocalizedName":"item.minecraft.shears"},{"id":"minecraft:sheep_spawn_egg","localizedName":"Sheep Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.sheep_spawn_egg"},{"id":"minecraft:shelter_pottery_sherd","localizedName":"Shelter Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.shelter_pottery_sherd"},{"id":"minecraft:shield","localizedName":"Shield","maxDamage":336,"maxStackSize":1,"unlocalizedName":"item.minecraft.shield"},{"id":"minecraft:shroomlight","localizedName":"Shroomlight","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.shroomlight"},{"id":"minecraft:shulker_box","localizedName":"Shulker Box","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.shulker_box"},{"id":"minecraft:shulker_shell","localizedName":"Shulker Shell","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.shulker_shell"},{"id":"minecraft:shulker_spawn_egg","localizedName":"Shulker Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.shulker_spawn_egg"},{"id":"minecraft:silence_armor_trim_smithing_template","localizedName":"Smithing Template","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.smithing_template"},{"id":"minecraft:silverfish_spawn_egg","localizedName":"Silverfish Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.silverfish_spawn_egg"},{"id":"minecraft:skeleton_horse_spawn_egg","localizedName":"Skeleton Horse Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.skeleton_horse_spawn_egg"},{"id":"minecraft:skeleton_skull","localizedName":"Skeleton Skull","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.skeleton_skull"},{"id":"minecraft:skeleton_spawn_egg","localizedName":"Skeleton Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.skeleton_spawn_egg"},{"id":"minecraft:skull_banner_pattern","localizedName":"Banner Pattern","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.skull_banner_pattern"},{"id":"minecraft:skull_pottery_sherd","localizedName":"Skull Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.skull_pottery_sherd"},{"id":"minecraft:slime_ball","localizedName":"Slimeball","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.slime_ball"},{"id":"minecraft:slime_block","localizedName":"Slime Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.slime_block"},{"id":"minecraft:slime_spawn_egg","localizedName":"Slime Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.slime_spawn_egg"},{"id":"minecraft:small_amethyst_bud","localizedName":"Small Amethyst Bud","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.small_amethyst_bud"},{"id":"minecraft:small_dripleaf","localizedName":"Small Dripleaf","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.small_dripleaf"},{"id":"minecraft:smithing_table","localizedName":"Smithing Table","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.smithing_table"},{"id":"minecraft:smoker","localizedName":"Smoker","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.smoker"},{"id":"minecraft:smooth_basalt","localizedName":"Smooth Basalt","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.smooth_basalt"},{"id":"minecraft:smooth_quartz","localizedName":"Smooth Quartz Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.smooth_quartz"},{"id":"minecraft:smooth_quartz_slab","localizedName":"Smooth Quartz Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.smooth_quartz_slab"},{"id":"minecraft:smooth_quartz_stairs","localizedName":"Smooth Quartz Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.smooth_quartz_stairs"},{"id":"minecraft:smooth_red_sandstone","localizedName":"Smooth Red Sandstone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.smooth_red_sandstone"},{"id":"minecraft:smooth_red_sandstone_slab","localizedName":"Smooth Red Sandstone Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.smooth_red_sandstone_slab"},{"id":"minecraft:smooth_red_sandstone_stairs","localizedName":"Smooth Red Sandstone Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.smooth_red_sandstone_stairs"},{"id":"minecraft:smooth_sandstone","localizedName":"Smooth Sandstone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.smooth_sandstone"},{"id":"minecraft:smooth_sandstone_slab","localizedName":"Smooth Sandstone Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.smooth_sandstone_slab"},{"id":"minecraft:smooth_sandstone_stairs","localizedName":"Smooth Sandstone Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.smooth_sandstone_stairs"},{"id":"minecraft:smooth_stone","localizedName":"Smooth Stone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.smooth_stone"},{"id":"minecraft:smooth_stone_slab","localizedName":"Smooth Stone Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.smooth_stone_slab"},{"id":"minecraft:sniffer_egg","localizedName":"Sniffer Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.sniffer_egg"},{"id":"minecraft:sniffer_spawn_egg","localizedName":"Sniffer Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.sniffer_spawn_egg"},{"id":"minecraft:snort_pottery_sherd","localizedName":"Snort Pottery Sherd","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.snort_pottery_sherd"},{"id":"minecraft:snout_armor_trim_smithing_template","localizedName":"Smithing Template","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.smithing_template"},{"id":"minecraft:snow","localizedName":"Snow","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.snow"},{"id":"minecraft:snow_block","localizedName":"Snow Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.snow_block"},{"id":"minecraft:snow_golem_spawn_egg","localizedName":"Snow Golem Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.snow_golem_spawn_egg"},{"id":"minecraft:snowball","localizedName":"Snowball","maxDamage":0,"maxStackSize":16,"unlocalizedName":"item.minecraft.snowball"},{"id":"minecraft:soul_campfire","localizedName":"Soul Campfire","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.soul_campfire"},{"id":"minecraft:soul_lantern","localizedName":"Soul Lantern","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.soul_lantern"},{"id":"minecraft:soul_sand","localizedName":"Soul Sand","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.soul_sand"},{"id":"minecraft:soul_soil","localizedName":"Soul Soil","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.soul_soil"},{"id":"minecraft:soul_torch","localizedName":"Soul Torch","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.soul_torch"},{"id":"minecraft:spawner","localizedName":"Monster Spawner","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.spawner"},{"id":"minecraft:spectral_arrow","localizedName":"Spectral Arrow","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.spectral_arrow"},{"id":"minecraft:spider_eye","localizedName":"Spider Eye","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.spider_eye"},{"id":"minecraft:spider_spawn_egg","localizedName":"Spider Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.spider_spawn_egg"},{"id":"minecraft:spire_armor_trim_smithing_template","localizedName":"Smithing Template","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.smithing_template"},{"id":"minecraft:splash_potion","localizedName":"Splash Water Bottle","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.splash_potion.effect.water"},{"id":"minecraft:sponge","localizedName":"Sponge","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.sponge"},{"id":"minecraft:spore_blossom","localizedName":"Spore Blossom","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.spore_blossom"},{"id":"minecraft:spruce_boat","localizedName":"Spruce Boat","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.spruce_boat"},{"id":"minecraft:spruce_button","localizedName":"Spruce Button","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.spruce_button"},{"id":"minecraft:spruce_chest_boat","localizedName":"Spruce Boat with Chest","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.spruce_chest_boat"},{"id":"minecraft:spruce_door","localizedName":"Spruce Door","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.spruce_door"},{"id":"minecraft:spruce_fence","localizedName":"Spruce Fence","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.spruce_fence"},{"id":"minecraft:spruce_fence_gate","localizedName":"Spruce Fence Gate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.spruce_fence_gate"},{"id":"minecraft:spruce_hanging_sign","localizedName":"Spruce Hanging Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.spruce_hanging_sign"},{"id":"minecraft:spruce_leaves","localizedName":"Spruce Leaves","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.spruce_leaves"},{"id":"minecraft:spruce_log","localizedName":"Spruce Log","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.spruce_log"},{"id":"minecraft:spruce_planks","localizedName":"Spruce Planks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.spruce_planks"},{"id":"minecraft:spruce_pressure_plate","localizedName":"Spruce Pressure Plate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.spruce_pressure_plate"},{"id":"minecraft:spruce_sapling","localizedName":"Spruce Sapling","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.spruce_sapling"},{"id":"minecraft:spruce_sign","localizedName":"Spruce Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.spruce_sign"},{"id":"minecraft:spruce_slab","localizedName":"Spruce Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.spruce_slab"},{"id":"minecraft:spruce_stairs","localizedName":"Spruce Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.spruce_stairs"},{"id":"minecraft:spruce_trapdoor","localizedName":"Spruce Trapdoor","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.spruce_trapdoor"},{"id":"minecraft:spruce_wood","localizedName":"Spruce Wood","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.spruce_wood"},{"id":"minecraft:spyglass","localizedName":"Spyglass","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.spyglass"},{"id":"minecraft:squid_spawn_egg","localizedName":"Squid Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.squid_spawn_egg"},{"id":"minecraft:stick","localizedName":"Stick","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.stick"},{"id":"minecraft:sticky_piston","localizedName":"Sticky Piston","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.sticky_piston"},{"id":"minecraft:stone","localizedName":"Stone","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stone"},{"id":"minecraft:stone_axe","localizedName":"Stone Axe","maxDamage":131,"maxStackSize":1,"unlocalizedName":"item.minecraft.stone_axe"},{"id":"minecraft:stone_brick_slab","localizedName":"Stone Brick Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stone_brick_slab"},{"id":"minecraft:stone_brick_stairs","localizedName":"Stone Brick Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stone_brick_stairs"},{"id":"minecraft:stone_brick_wall","localizedName":"Stone Brick Wall","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stone_brick_wall"},{"id":"minecraft:stone_bricks","localizedName":"Stone Bricks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stone_bricks"},{"id":"minecraft:stone_button","localizedName":"Stone Button","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stone_button"},{"id":"minecraft:stone_hoe","localizedName":"Stone Hoe","maxDamage":131,"maxStackSize":1,"unlocalizedName":"item.minecraft.stone_hoe"},{"id":"minecraft:stone_pickaxe","localizedName":"Stone Pickaxe","maxDamage":131,"maxStackSize":1,"unlocalizedName":"item.minecraft.stone_pickaxe"},{"id":"minecraft:stone_pressure_plate","localizedName":"Stone Pressure Plate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stone_pressure_plate"},{"id":"minecraft:stone_shovel","localizedName":"Stone Shovel","maxDamage":131,"maxStackSize":1,"unlocalizedName":"item.minecraft.stone_shovel"},{"id":"minecraft:stone_slab","localizedName":"Stone Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stone_slab"},{"id":"minecraft:stone_stairs","localizedName":"Stone Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stone_stairs"},{"id":"minecraft:stone_sword","localizedName":"Stone Sword","maxDamage":131,"maxStackSize":1,"unlocalizedName":"item.minecraft.stone_sword"},{"id":"minecraft:stonecutter","localizedName":"Stonecutter","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stonecutter"},{"id":"minecraft:stray_spawn_egg","localizedName":"Stray Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.stray_spawn_egg"},{"id":"minecraft:strider_spawn_egg","localizedName":"Strider Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.strider_spawn_egg"},{"id":"minecraft:string","localizedName":"String","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.string"},{"id":"minecraft:stripped_acacia_log","localizedName":"Stripped Acacia Log","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_acacia_log"},{"id":"minecraft:stripped_acacia_wood","localizedName":"Stripped Acacia Wood","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_acacia_wood"},{"id":"minecraft:stripped_bamboo_block","localizedName":"Block of Stripped Bamboo","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_bamboo_block"},{"id":"minecraft:stripped_birch_log","localizedName":"Stripped Birch Log","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_birch_log"},{"id":"minecraft:stripped_birch_wood","localizedName":"Stripped Birch Wood","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_birch_wood"},{"id":"minecraft:stripped_cherry_log","localizedName":"Stripped Cherry Log","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_cherry_log"},{"id":"minecraft:stripped_cherry_wood","localizedName":"Stripped Cherry Wood","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_cherry_wood"},{"id":"minecraft:stripped_crimson_hyphae","localizedName":"Stripped Crimson Hyphae","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_crimson_hyphae"},{"id":"minecraft:stripped_crimson_stem","localizedName":"Stripped Crimson Stem","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_crimson_stem"},{"id":"minecraft:stripped_dark_oak_log","localizedName":"Stripped Dark Oak Log","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_dark_oak_log"},{"id":"minecraft:stripped_dark_oak_wood","localizedName":"Stripped Dark Oak Wood","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_dark_oak_wood"},{"id":"minecraft:stripped_jungle_log","localizedName":"Stripped Jungle Log","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_jungle_log"},{"id":"minecraft:stripped_jungle_wood","localizedName":"Stripped Jungle Wood","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_jungle_wood"},{"id":"minecraft:stripped_mangrove_log","localizedName":"Stripped Mangrove Log","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_mangrove_log"},{"id":"minecraft:stripped_mangrove_wood","localizedName":"Stripped Mangrove Wood","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_mangrove_wood"},{"id":"minecraft:stripped_oak_log","localizedName":"Stripped Oak Log","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_oak_log"},{"id":"minecraft:stripped_oak_wood","localizedName":"Stripped Oak Wood","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_oak_wood"},{"id":"minecraft:stripped_spruce_log","localizedName":"Stripped Spruce Log","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_spruce_log"},{"id":"minecraft:stripped_spruce_wood","localizedName":"Stripped Spruce Wood","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_spruce_wood"},{"id":"minecraft:stripped_warped_hyphae","localizedName":"Stripped Warped Hyphae","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_warped_hyphae"},{"id":"minecraft:stripped_warped_stem","localizedName":"Stripped Warped Stem","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.stripped_warped_stem"},{"id":"minecraft:structure_block","localizedName":"Structure Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.structure_block"},{"id":"minecraft:structure_void","localizedName":"Structure Void","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.structure_void"},{"id":"minecraft:sugar","localizedName":"Sugar","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.sugar"},{"id":"minecraft:sugar_cane","localizedName":"Sugar Cane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.sugar_cane"},{"id":"minecraft:sunflower","localizedName":"Sunflower","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.sunflower"},{"id":"minecraft:suspicious_gravel","localizedName":"Suspicious Gravel","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.suspicious_gravel"},{"id":"minecraft:suspicious_sand","localizedName":"Suspicious Sand","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.suspicious_sand"},{"id":"minecraft:suspicious_stew","localizedName":"Suspicious Stew","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.suspicious_stew"},{"id":"minecraft:sweet_berries","localizedName":"Sweet Berries","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.sweet_berries"},{"id":"minecraft:tadpole_bucket","localizedName":"Bucket of Tadpole","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.tadpole_bucket"},{"id":"minecraft:tadpole_spawn_egg","localizedName":"Tadpole Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.tadpole_spawn_egg"},{"id":"minecraft:tall_grass","localizedName":"Tall Grass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.tall_grass"},{"id":"minecraft:target","localizedName":"Target","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.target"},{"id":"minecraft:terracotta","localizedName":"Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.terracotta"},{"id":"minecraft:tide_armor_trim_smithing_template","localizedName":"Smithing Template","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.smithing_template"},{"id":"minecraft:tinted_glass","localizedName":"Tinted Glass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.tinted_glass"},{"id":"minecraft:tipped_arrow","localizedName":"Arrow of Poison","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.tipped_arrow.effect.poison"},{"id":"minecraft:tnt","localizedName":"TNT","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.tnt"},{"id":"minecraft:tnt_minecart","localizedName":"Minecart with TNT","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.tnt_minecart"},{"id":"minecraft:torch","localizedName":"Torch","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.torch"},{"id":"minecraft:torchflower","localizedName":"Torchflower","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.torchflower"},{"id":"minecraft:torchflower_seeds","localizedName":"Torchflower Seeds","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.torchflower_seeds"},{"id":"minecraft:totem_of_undying","localizedName":"Totem of Undying","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.totem_of_undying"},{"id":"minecraft:trader_llama_spawn_egg","localizedName":"Trader Llama Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.trader_llama_spawn_egg"},{"id":"minecraft:trapped_chest","localizedName":"Trapped Chest","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.trapped_chest"},{"id":"minecraft:trident","localizedName":"Trident","maxDamage":250,"maxStackSize":1,"unlocalizedName":"item.minecraft.trident"},{"id":"minecraft:tripwire_hook","localizedName":"Tripwire Hook","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.tripwire_hook"},{"id":"minecraft:tropical_fish","localizedName":"Tropical Fish","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.tropical_fish"},{"id":"minecraft:tropical_fish_bucket","localizedName":"Bucket of Tropical Fish","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.tropical_fish_bucket"},{"id":"minecraft:tropical_fish_spawn_egg","localizedName":"Tropical Fish Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.tropical_fish_spawn_egg"},{"id":"minecraft:tube_coral","localizedName":"Tube Coral","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.tube_coral"},{"id":"minecraft:tube_coral_block","localizedName":"Tube Coral Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.tube_coral_block"},{"id":"minecraft:tube_coral_fan","localizedName":"Tube Coral Fan","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.tube_coral_fan"},{"id":"minecraft:tuff","localizedName":"Tuff","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.tuff"},{"id":"minecraft:turtle_egg","localizedName":"Turtle Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.turtle_egg"},{"id":"minecraft:turtle_helmet","localizedName":"Turtle Shell","maxDamage":275,"maxStackSize":1,"unlocalizedName":"item.minecraft.turtle_helmet"},{"id":"minecraft:turtle_spawn_egg","localizedName":"Turtle Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.turtle_spawn_egg"},{"id":"minecraft:twisting_vines","localizedName":"Twisting Vines","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.twisting_vines"},{"id":"minecraft:verdant_froglight","localizedName":"Verdant Froglight","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.verdant_froglight"},{"id":"minecraft:vex_armor_trim_smithing_template","localizedName":"Smithing Template","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.smithing_template"},{"id":"minecraft:vex_spawn_egg","localizedName":"Vex Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.vex_spawn_egg"},{"id":"minecraft:villager_spawn_egg","localizedName":"Villager Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.villager_spawn_egg"},{"id":"minecraft:vindicator_spawn_egg","localizedName":"Vindicator Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.vindicator_spawn_egg"},{"id":"minecraft:vine","localizedName":"Vines","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.vine"},{"id":"minecraft:wandering_trader_spawn_egg","localizedName":"Wandering Trader Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.wandering_trader_spawn_egg"},{"id":"minecraft:ward_armor_trim_smithing_template","localizedName":"Smithing Template","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.smithing_template"},{"id":"minecraft:warden_spawn_egg","localizedName":"Warden Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.warden_spawn_egg"},{"id":"minecraft:warped_button","localizedName":"Warped Button","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.warped_button"},{"id":"minecraft:warped_door","localizedName":"Warped Door","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.warped_door"},{"id":"minecraft:warped_fence","localizedName":"Warped Fence","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.warped_fence"},{"id":"minecraft:warped_fence_gate","localizedName":"Warped Fence Gate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.warped_fence_gate"},{"id":"minecraft:warped_fungus","localizedName":"Warped Fungus","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.warped_fungus"},{"id":"minecraft:warped_fungus_on_a_stick","localizedName":"Warped Fungus on a Stick","maxDamage":100,"maxStackSize":1,"unlocalizedName":"item.minecraft.warped_fungus_on_a_stick"},{"id":"minecraft:warped_hanging_sign","localizedName":"Warped Hanging Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.warped_hanging_sign"},{"id":"minecraft:warped_hyphae","localizedName":"Warped Hyphae","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.warped_hyphae"},{"id":"minecraft:warped_nylium","localizedName":"Warped Nylium","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.warped_nylium"},{"id":"minecraft:warped_planks","localizedName":"Warped Planks","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.warped_planks"},{"id":"minecraft:warped_pressure_plate","localizedName":"Warped Pressure Plate","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.warped_pressure_plate"},{"id":"minecraft:warped_roots","localizedName":"Warped Roots","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.warped_roots"},{"id":"minecraft:warped_sign","localizedName":"Warped Sign","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.warped_sign"},{"id":"minecraft:warped_slab","localizedName":"Warped Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.warped_slab"},{"id":"minecraft:warped_stairs","localizedName":"Warped Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.warped_stairs"},{"id":"minecraft:warped_stem","localizedName":"Warped Stem","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.warped_stem"},{"id":"minecraft:warped_trapdoor","localizedName":"Warped Trapdoor","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.warped_trapdoor"},{"id":"minecraft:warped_wart_block","localizedName":"Warped Wart Block","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.warped_wart_block"},{"id":"minecraft:water_bucket","localizedName":"Water Bucket","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.water_bucket"},{"id":"minecraft:waxed_copper_block","localizedName":"Waxed Block of Copper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.waxed_copper_block"},{"id":"minecraft:waxed_cut_copper","localizedName":"Waxed Cut Copper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.waxed_cut_copper"},{"id":"minecraft:waxed_cut_copper_slab","localizedName":"Waxed Cut Copper Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.waxed_cut_copper_slab"},{"id":"minecraft:waxed_cut_copper_stairs","localizedName":"Waxed Cut Copper Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.waxed_cut_copper_stairs"},{"id":"minecraft:waxed_exposed_copper","localizedName":"Waxed Exposed Copper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.waxed_exposed_copper"},{"id":"minecraft:waxed_exposed_cut_copper","localizedName":"Waxed Exposed Cut Copper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.waxed_exposed_cut_copper"},{"id":"minecraft:waxed_exposed_cut_copper_slab","localizedName":"Waxed Exposed Cut Copper Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.waxed_exposed_cut_copper_slab"},{"id":"minecraft:waxed_exposed_cut_copper_stairs","localizedName":"Waxed Exposed Cut Copper Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.waxed_exposed_cut_copper_stairs"},{"id":"minecraft:waxed_oxidized_copper","localizedName":"Waxed Oxidized Copper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.waxed_oxidized_copper"},{"id":"minecraft:waxed_oxidized_cut_copper","localizedName":"Waxed Oxidized Cut Copper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.waxed_oxidized_cut_copper"},{"id":"minecraft:waxed_oxidized_cut_copper_slab","localizedName":"Waxed Oxidized Cut Copper Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.waxed_oxidized_cut_copper_slab"},{"id":"minecraft:waxed_oxidized_cut_copper_stairs","localizedName":"Waxed Oxidized Cut Copper Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.waxed_oxidized_cut_copper_stairs"},{"id":"minecraft:waxed_weathered_copper","localizedName":"Waxed Weathered Copper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.waxed_weathered_copper"},{"id":"minecraft:waxed_weathered_cut_copper","localizedName":"Waxed Weathered Cut Copper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.waxed_weathered_cut_copper"},{"id":"minecraft:waxed_weathered_cut_copper_slab","localizedName":"Waxed Weathered Cut Copper Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.waxed_weathered_cut_copper_slab"},{"id":"minecraft:waxed_weathered_cut_copper_stairs","localizedName":"Waxed Weathered Cut Copper Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.waxed_weathered_cut_copper_stairs"},{"id":"minecraft:wayfinder_armor_trim_smithing_template","localizedName":"Smithing Template","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.smithing_template"},{"id":"minecraft:weathered_copper","localizedName":"Weathered Copper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.weathered_copper"},{"id":"minecraft:weathered_cut_copper","localizedName":"Weathered Cut Copper","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.weathered_cut_copper"},{"id":"minecraft:weathered_cut_copper_slab","localizedName":"Weathered Cut Copper Slab","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.weathered_cut_copper_slab"},{"id":"minecraft:weathered_cut_copper_stairs","localizedName":"Weathered Cut Copper Stairs","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.weathered_cut_copper_stairs"},{"id":"minecraft:weeping_vines","localizedName":"Weeping Vines","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.weeping_vines"},{"id":"minecraft:wet_sponge","localizedName":"Wet Sponge","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.wet_sponge"},{"id":"minecraft:wheat","localizedName":"Wheat","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.wheat"},{"id":"minecraft:wheat_seeds","localizedName":"Wheat Seeds","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.wheat_seeds"},{"id":"minecraft:white_banner","localizedName":"White Banner","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.white_banner"},{"id":"minecraft:white_bed","localizedName":"White Bed","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.white_bed"},{"id":"minecraft:white_candle","localizedName":"White Candle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.white_candle"},{"id":"minecraft:white_carpet","localizedName":"White Carpet","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.white_carpet"},{"id":"minecraft:white_concrete","localizedName":"White Concrete","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.white_concrete"},{"id":"minecraft:white_concrete_powder","localizedName":"White Concrete Powder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.white_concrete_powder"},{"id":"minecraft:white_dye","localizedName":"White Dye","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.white_dye"},{"id":"minecraft:white_glazed_terracotta","localizedName":"White Glazed Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.white_glazed_terracotta"},{"id":"minecraft:white_shulker_box","localizedName":"White Shulker Box","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.white_shulker_box"},{"id":"minecraft:white_stained_glass","localizedName":"White Stained Glass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.white_stained_glass"},{"id":"minecraft:white_stained_glass_pane","localizedName":"White Stained Glass Pane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.white_stained_glass_pane"},{"id":"minecraft:white_terracotta","localizedName":"White Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.white_terracotta"},{"id":"minecraft:white_tulip","localizedName":"White Tulip","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.white_tulip"},{"id":"minecraft:white_wool","localizedName":"White Wool","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.white_wool"},{"id":"minecraft:wild_armor_trim_smithing_template","localizedName":"Smithing Template","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.smithing_template"},{"id":"minecraft:witch_spawn_egg","localizedName":"Witch Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.witch_spawn_egg"},{"id":"minecraft:wither_rose","localizedName":"Wither Rose","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.wither_rose"},{"id":"minecraft:wither_skeleton_skull","localizedName":"Wither Skeleton Skull","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.wither_skeleton_skull"},{"id":"minecraft:wither_skeleton_spawn_egg","localizedName":"Wither Skeleton Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.wither_skeleton_spawn_egg"},{"id":"minecraft:wither_spawn_egg","localizedName":"Wither Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.wither_spawn_egg"},{"id":"minecraft:wolf_spawn_egg","localizedName":"Wolf Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.wolf_spawn_egg"},{"id":"minecraft:wooden_axe","localizedName":"Wooden Axe","maxDamage":59,"maxStackSize":1,"unlocalizedName":"item.minecraft.wooden_axe"},{"id":"minecraft:wooden_hoe","localizedName":"Wooden Hoe","maxDamage":59,"maxStackSize":1,"unlocalizedName":"item.minecraft.wooden_hoe"},{"id":"minecraft:wooden_pickaxe","localizedName":"Wooden Pickaxe","maxDamage":59,"maxStackSize":1,"unlocalizedName":"item.minecraft.wooden_pickaxe"},{"id":"minecraft:wooden_shovel","localizedName":"Wooden Shovel","maxDamage":59,"maxStackSize":1,"unlocalizedName":"item.minecraft.wooden_shovel"},{"id":"minecraft:wooden_sword","localizedName":"Wooden Sword","maxDamage":59,"maxStackSize":1,"unlocalizedName":"item.minecraft.wooden_sword"},{"id":"minecraft:writable_book","localizedName":"Book and Quill","maxDamage":0,"maxStackSize":1,"unlocalizedName":"item.minecraft.writable_book"},{"id":"minecraft:written_book","localizedName":"Written Book","maxDamage":0,"maxStackSize":16,"unlocalizedName":"item.minecraft.written_book"},{"id":"minecraft:yellow_banner","localizedName":"Yellow Banner","maxDamage":0,"maxStackSize":16,"unlocalizedName":"block.minecraft.yellow_banner"},{"id":"minecraft:yellow_bed","localizedName":"Yellow Bed","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.yellow_bed"},{"id":"minecraft:yellow_candle","localizedName":"Yellow Candle","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.yellow_candle"},{"id":"minecraft:yellow_carpet","localizedName":"Yellow Carpet","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.yellow_carpet"},{"id":"minecraft:yellow_concrete","localizedName":"Yellow Concrete","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.yellow_concrete"},{"id":"minecraft:yellow_concrete_powder","localizedName":"Yellow Concrete Powder","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.yellow_concrete_powder"},{"id":"minecraft:yellow_dye","localizedName":"Yellow Dye","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.yellow_dye"},{"id":"minecraft:yellow_glazed_terracotta","localizedName":"Yellow Glazed Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.yellow_glazed_terracotta"},{"id":"minecraft:yellow_shulker_box","localizedName":"Yellow Shulker Box","maxDamage":0,"maxStackSize":1,"unlocalizedName":"block.minecraft.yellow_shulker_box"},{"id":"minecraft:yellow_stained_glass","localizedName":"Yellow Stained Glass","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.yellow_stained_glass"},{"id":"minecraft:yellow_stained_glass_pane","localizedName":"Yellow Stained Glass Pane","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.yellow_stained_glass_pane"},{"id":"minecraft:yellow_terracotta","localizedName":"Yellow Terracotta","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.yellow_terracotta"},{"id":"minecraft:yellow_wool","localizedName":"Yellow Wool","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.yellow_wool"},{"id":"minecraft:zoglin_spawn_egg","localizedName":"Zoglin Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.zoglin_spawn_egg"},{"id":"minecraft:zombie_head","localizedName":"Zombie Head","maxDamage":0,"maxStackSize":64,"unlocalizedName":"block.minecraft.zombie_head"},{"id":"minecraft:zombie_horse_spawn_egg","localizedName":"Zombie Horse Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.zombie_horse_spawn_egg"},{"id":"minecraft:zombie_spawn_egg","localizedName":"Zombie Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.zombie_spawn_egg"},{"id":"minecraft:zombie_villager_spawn_egg","localizedName":"Zombie Villager Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.zombie_villager_spawn_egg"},{"id":"minecraft:zombified_piglin_spawn_egg","localizedName":"Zombified Piglin Spawn Egg","maxDamage":0,"maxStackSize":64,"unlocalizedName":"item.minecraft.zombified_piglin_spawn_egg"}] From bb14d93a8db0bac655f80327637c4566ba550520 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Fri, 9 Jun 2023 13:58:45 +0200 Subject: [PATCH 072/161] Add Console/CommandBlock support to Fabric/Forge/Sponge (2317) --- .../bukkit/BukkitBlockCommandSender.java | 26 ++-------- .../worldedit/bukkit/BukkitConfiguration.java | 2 - .../sk89q/worldedit/LocalConfiguration.java | 1 + .../platform/AbstractCommandBlockActor.java | 49 +++++++++++++++++++ .../util/PropertiesConfiguration.java | 1 + .../worldedit/util/YAMLConfiguration.java | 2 + 6 files changed, 56 insertions(+), 25 deletions(-) create mode 100644 worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractCommandBlockActor.java diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockCommandSender.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockCommandSender.java index f967fa3fa..3c2e99f42 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockCommandSender.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockCommandSender.java @@ -21,11 +21,8 @@ package com.sk89q.worldedit.bukkit; import com.fastasyncworldedit.core.util.TaskManager; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.extension.platform.AbstractNonPlayerActor; -import com.sk89q.worldedit.extension.platform.Locatable; -import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.extension.platform.AbstractCommandBlockActor; import com.sk89q.worldedit.session.SessionKey; -import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.auth.AuthorizationException; import com.sk89q.worldedit.util.formatting.WorldEditText; import com.sk89q.worldedit.util.formatting.text.Component; @@ -43,22 +40,20 @@ import java.util.UUID; import static com.google.common.base.Preconditions.checkNotNull; -public class BukkitBlockCommandSender extends AbstractNonPlayerActor implements Locatable { +public class BukkitBlockCommandSender extends AbstractCommandBlockActor { private static final String UUID_PREFIX = "CMD"; private final BlockCommandSender sender; private final WorldEditPlugin plugin; - private final Location location; private final UUID uuid; public BukkitBlockCommandSender(WorldEditPlugin plugin, BlockCommandSender sender) { + super(BukkitAdapter.adapt(checkNotNull(sender).getBlock().getLocation())); checkNotNull(plugin); - checkNotNull(sender); this.plugin = plugin; this.sender = sender; - this.location = BukkitAdapter.adapt(sender.getBlock().getLocation()); this.uuid = UUID.nameUUIDFromBytes((UUID_PREFIX + sender.getName()).getBytes(StandardCharsets.UTF_8)); } @@ -134,21 +129,6 @@ public class BukkitBlockCommandSender extends AbstractNonPlayerActor implements return WorldEdit.getInstance().getConfiguration().defaultLocale; } - @Override - public Location getLocation() { - return this.location; - } - - @Override - public boolean setLocation(Location location) { - return false; - } - - @Override - public Extent getExtent() { - return this.location.getExtent(); - } - @Override public UUID getUniqueId() { return uuid; diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitConfiguration.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitConfiguration.java index fb4130abf..eaa592395 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitConfiguration.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitConfiguration.java @@ -36,7 +36,6 @@ public class BukkitConfiguration extends YAMLConfiguration { @Unreported private final WorldEditPlugin plugin; public boolean noOpPermissions = false; - public boolean commandBlockSupport = false; public boolean unsupportedVersionEditing = false; public BukkitConfiguration(YAMLProcessor config, WorldEditPlugin plugin) { @@ -48,7 +47,6 @@ public class BukkitConfiguration extends YAMLConfiguration { public void load() { super.load(); noOpPermissions = config.getBoolean("no-op-permissions", false); - commandBlockSupport = config.getBoolean("command-block-support", false); unsupportedVersionEditing = "I accept that I will receive no support with this flag enabled.".equals( config.getString("allow-editing-on-unsupported-versions", "false")); if (unsupportedVersionEditing) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java index 6d178b363..57ec6f186 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalConfiguration.java @@ -96,6 +96,7 @@ public abstract class LocalConfiguration { public boolean allowSymlinks = false; public boolean serverSideCUI = true; public boolean extendedYLimit = false; + public boolean commandBlockSupport = false; public String defaultLocaleName = "default"; public Locale defaultLocale = Locale.getDefault(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractCommandBlockActor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractCommandBlockActor.java new file mode 100644 index 000000000..d18c7028d --- /dev/null +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractCommandBlockActor.java @@ -0,0 +1,49 @@ +/* + * WorldEdit, a Minecraft world manipulation toolkit + * Copyright (C) sk89q + * Copyright (C) WorldEdit team and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.sk89q.worldedit.extension.platform; + +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.util.Location; + +public abstract class AbstractCommandBlockActor extends AbstractNonPlayerActor implements Locatable { + protected static final String UUID_PREFIX = "CMD"; + + private final Location location; + + public AbstractCommandBlockActor(Location location) { + this.location = location; + } + + @Override + public Location getLocation() { + return this.location; + } + + @Override + public boolean setLocation(Location location) { + // Can't move a CommandBlock + return false; + } + + @Override + public Extent getExtent() { + return this.location.getExtent(); + } +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java index f1785b4f5..f350af03f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/PropertiesConfiguration.java @@ -140,6 +140,7 @@ public class PropertiesConfiguration extends LocalConfiguration { serverSideCUI = getBool("server-side-cui", serverSideCUI); extendedYLimit = getBool("extended-y-limit", extendedYLimit); setDefaultLocaleName(getString("default-locale", defaultLocaleName)); + commandBlockSupport = getBool("command-block-support", commandBlockSupport); LocalSession.MAX_HISTORY_SIZE = Math.max(15, getInt("history-size", 15)); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java index e10e4ac4f..1a8b0667c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/YAMLConfiguration.java @@ -152,6 +152,8 @@ public class YAMLConfiguration extends LocalConfiguration { extendedYLimit = config.getBoolean("compat.extended-y-limit", false); setDefaultLocaleName(config.getString("default-locale", defaultLocaleName)); + + commandBlockSupport = config.getBoolean("command-block-support", false); } public void unload() { From 689c7f62b866107333829b6480c3945da57e47eb Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Fri, 9 Jun 2023 15:27:02 +0200 Subject: [PATCH 073/161] Fixed setting sign text on 1.20 --- .../com/sk89q/worldedit/blocks/SignBlock.java | 71 ++++++++++++------- 1 file changed, 47 insertions(+), 24 deletions(-) diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SignBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SignBlock.java index 2817365ff..333c3336b 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SignBlock.java +++ b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/SignBlock.java @@ -20,27 +20,29 @@ package com.sk89q.worldedit.blocks; import com.sk89q.jnbt.CompoundTag; +import com.sk89q.jnbt.ListTag; import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.Tag; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.platform.Capability; +import com.sk89q.worldedit.internal.Constants; import com.sk89q.worldedit.util.gson.GsonUtil; import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockState; +import java.util.Arrays; import java.util.HashMap; import java.util.Map; +import java.util.stream.Collectors; /** * Represents a sign block. - * - * @deprecated WorldEdit does not handle interpreting NBT, - * deprecated for removal without replacement */ -@Deprecated(forRemoval = true) public class SignBlock extends BaseBlock { private String[] text; - private static String EMPTY = "{\"text\":\"\"}"; + private static final String EMPTY = "{\"text\":\"\"}"; /** * Construct the sign with text. @@ -64,6 +66,11 @@ public class SignBlock extends BaseBlock { this.text = text; } + private boolean isLegacy() { + int dataVersion = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING).getDataVersion(); + return dataVersion < Constants.DATA_VERSION_MC_1_20; + } + /** * Get the text. * @@ -98,10 +105,17 @@ public class SignBlock extends BaseBlock { @Override public CompoundTag getNbtData() { Map values = new HashMap<>(); - values.put("Text1", new StringTag(text[0])); - values.put("Text2", new StringTag(text[1])); - values.put("Text3", new StringTag(text[2])); - values.put("Text4", new StringTag(text[3])); + if (isLegacy()) { + values.put("Text1", new StringTag(text[0])); + values.put("Text2", new StringTag(text[1])); + values.put("Text3", new StringTag(text[2])); + values.put("Text4", new StringTag(text[3])); + } else { + ListTag messages = new ListTag(StringTag.class, Arrays.stream(text).map(StringTag::new).collect(Collectors.toList())); + Map frontTextTag = new HashMap<>(); + frontTextTag.put("messages", messages); + values.put("front_text", new CompoundTag(frontTextTag)); + } return new CompoundTag(values); } @@ -122,24 +136,33 @@ public class SignBlock extends BaseBlock { throw new RuntimeException(String.format("'%s' tile entity expected", getNbtId())); } - t = values.get("Text1"); - if (t instanceof StringTag) { - text[0] = ((StringTag) t).getValue(); - } + if (isLegacy()) { + t = values.get("Text1"); + if (t instanceof StringTag) { + text[0] = ((StringTag) t).getValue(); + } - t = values.get("Text2"); - if (t instanceof StringTag) { - text[1] = ((StringTag) t).getValue(); - } + t = values.get("Text2"); + if (t instanceof StringTag) { + text[1] = ((StringTag) t).getValue(); + } - t = values.get("Text3"); - if (t instanceof StringTag) { - text[2] = ((StringTag) t).getValue(); - } + t = values.get("Text3"); + if (t instanceof StringTag) { + text[2] = ((StringTag) t).getValue(); + } - t = values.get("Text4"); - if (t instanceof StringTag) { - text[3] = ((StringTag) t).getValue(); + t = values.get("Text4"); + if (t instanceof StringTag) { + text[3] = ((StringTag) t).getValue(); + } + } else { + CompoundTag frontTextTag = (CompoundTag) values.get("front_text"); + ListTag messagesTag = frontTextTag.getListTag("messages"); + for (int i = 0; i < messagesTag.getValue().size(); i++) { + StringTag tag = (StringTag) messagesTag.getValue().get(i); + text[i] = tag.getValue(); + } } } From 083f8a4dd8b5ccb315da66603ee32fdbe108e02c Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Sat, 10 Jun 2023 22:47:22 +0200 Subject: [PATCH 074/161] Set proper field access and use mappings for entities on spigot (#2282) set proper field access and use mappings --- .../impl/fawe/v1_19_R1/PaperweightPlatformAdapter.java | 4 ++-- .../impl/fawe/v1_19_R2/PaperweightPlatformAdapter.java | 4 ++-- .../impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java | 4 ++-- .../impl/fawe/v1_20_R1/PaperweightPlatformAdapter.java | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightPlatformAdapter.java index 2fcb72225..ae3d91027 100644 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightPlatformAdapter.java @@ -202,8 +202,8 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { } try { // Non-Paper - SERVER_LEVEL_ENTITY_MANAGER = ServerLevel.class.getDeclaredField("entityManager"); - LEVEL_CHUNK_ENTITIES.setAccessible(true); + SERVER_LEVEL_ENTITY_MANAGER = ServerLevel.class.getDeclaredField(Refraction.pickName("entityManager", "P")); + SERVER_LEVEL_ENTITY_MANAGER.setAccessible(true); } catch (NoSuchFieldException ignored) { } POST_CHUNK_REWRITE = chunkRewrite; diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightPlatformAdapter.java index 5f8e39940..479df3b1a 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightPlatformAdapter.java @@ -199,8 +199,8 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { } try { // Non-Paper - SERVER_LEVEL_ENTITY_MANAGER = ServerLevel.class.getDeclaredField("entityManager"); - LEVEL_CHUNK_ENTITIES.setAccessible(true); + SERVER_LEVEL_ENTITY_MANAGER = ServerLevel.class.getDeclaredField(Refraction.pickName("entityManager", "P")); + SERVER_LEVEL_ENTITY_MANAGER.setAccessible(true); } catch (NoSuchFieldException ignored) { } POST_CHUNK_REWRITE = chunkRewrite; diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java index 887d7a3d3..5af8f2806 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java @@ -204,8 +204,8 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { } try { // Non-Paper - SERVER_LEVEL_ENTITY_MANAGER = ServerLevel.class.getDeclaredField("entityManager"); - LEVEL_CHUNK_ENTITIES.setAccessible(true); + SERVER_LEVEL_ENTITY_MANAGER = ServerLevel.class.getDeclaredField(Refraction.pickName("entityManager", "L")); + SERVER_LEVEL_ENTITY_MANAGER.setAccessible(true); } catch (NoSuchFieldException ignored) { } POST_CHUNK_REWRITE = chunkRewrite; diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPlatformAdapter.java index 4d8498dce..f66e7dd6a 100644 --- a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPlatformAdapter.java @@ -211,7 +211,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { try { // Non-Paper SERVER_LEVEL_ENTITY_MANAGER = ServerLevel.class.getDeclaredField(Refraction.pickName("entityManager", "M")); - LEVEL_CHUNK_ENTITIES.setAccessible(true); + SERVER_LEVEL_ENTITY_MANAGER.setAccessible(true); } catch (NoSuchFieldException ignored) { } POST_CHUNK_REWRITE = chunkRewrite; From 71c172cced200820a949d42b1065cf5cf3acd3df Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sun, 11 Jun 2023 12:09:27 +0200 Subject: [PATCH 075/161] [ci skip] Update bug_report.yml --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 5fef8cc10..22993216e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -8,7 +8,7 @@ body: value: | Thanks for taking the time to fill out this bug report for FastAsyncWorldEdit! Fill out the following form to your best ability to help us fix the problem. Only use this if you're absolutely sure that you found a bug and can reproduce it. For anything else, use: [our Discord server](https://discord.gg/intellectualsites) or [the wiki](https://intellectualsites.github.io/fastasyncworldedit-documentation/). - Do NOT use the public issue tracker to report security vulnerabilities! They are disclosed using [this](https://forms.gle/btgdRn9yhGtzEiGW8) form! + Do NOT use the public issue tracker to report security vulnerabilities! They are disclosed using [this](https://github.com/IntellectualSites/FastAsyncWorldEdit/security/policy) GitHub form! - type: dropdown attributes: From ca4080eea71fd4c2984c04c01d5cc26fad754719 Mon Sep 17 00:00:00 2001 From: LlmDl Date: Sun, 11 Jun 2023 16:55:11 -0500 Subject: [PATCH 076/161] Update & Fix TownyFeature support. (#2279) --- .../bukkit/regions/TownyFeature.java | 89 ++++++++----------- 1 file changed, 37 insertions(+), 52 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/TownyFeature.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/TownyFeature.java index c46c4c0a3..7c5aa7e6f 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/TownyFeature.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/TownyFeature.java @@ -2,9 +2,7 @@ package com.fastasyncworldedit.bukkit.regions; import com.fastasyncworldedit.core.regions.FaweMask; import com.palmergames.bukkit.towny.Towny; -import com.palmergames.bukkit.towny.TownyUniverse; -import com.palmergames.bukkit.towny.exceptions.NotRegisteredException; -import com.palmergames.bukkit.towny.object.PlayerCache; +import com.palmergames.bukkit.towny.TownyAPI; import com.palmergames.bukkit.towny.object.Resident; import com.palmergames.bukkit.towny.object.Town; import com.palmergames.bukkit.towny.object.TownBlock; @@ -36,31 +34,27 @@ public class TownyFeature extends BukkitMaskManager implements Listener { if (block == null) { return false; } - Resident resident; - try { - resident = TownyUniverse.getInstance().getResident(player.getName()); - try { - if (block.getResident().equals(resident)) { - return true; - } - } catch (NotRegisteredException ignored) { - } - Town town = block.getTown(); - if (town.isMayor(resident)) { + Resident resident = TownyAPI.getInstance().getResident(player); + if (resident == null) { + return false; + } + if (block.hasResident(resident) || block.hasTrustedResident(resident)) { + return true; + } + Town town = block.getTownOrNull(); // Will not be null, because block is not null. + if (town.isMayor(resident) || town.hasTrustedResident(resident)) { + return true; + } + if (!town.hasResident(resident)) { + return false; + } + if (player.hasPermission("fawe.towny.*")) { + return true; + } + for (String rank : resident.getTownRanks()) { + if (player.hasPermission("fawe.towny." + rank)) { return true; } - if (!town.hasResident(resident)) { - return false; - } - if (player.hasPermission("fawe.towny.*")) { - return true; - } - for (String rank : resident.getTownRanks()) { - if (player.hasPermission("fawe.towny." + rank)) { - return true; - } - } - } catch (NotRegisteredException ignored) { } return false; } @@ -69,32 +63,23 @@ public class TownyFeature extends BukkitMaskManager implements Listener { public FaweMask getMask(final com.sk89q.worldedit.entity.Player wePlayer, MaskType type, boolean isWhitelist) { final Player player = BukkitAdapter.adapt(wePlayer); final Location location = player.getLocation(); - try { - final PlayerCache cache = ((Towny) this.towny).getCache(player); - final WorldCoord mycoord = cache.getLastTownBlock(); - if (mycoord == null) { - return null; - } - final TownBlock myplot = mycoord.getTownBlock(); - if (myplot == null) { - return null; - } - boolean isMember = isAllowed(player, myplot); - if (isMember) { - final Chunk chunk = location.getChunk(); - final BlockVector3 pos1 = BlockVector3 - .at(chunk.getX() * 16, 0, chunk.getZ() * 16); - final BlockVector3 pos2 = BlockVector3.at( - chunk.getX() * 16 + 15, 156, chunk.getZ() * 16 - + 15); - return new FaweMask(new CuboidRegion(pos1, pos2)) { - @Override - public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) { - return isAllowed(BukkitAdapter.adapt(player), myplot); - } - }; - } - } catch (Exception ignored) { + final WorldCoord mycoord = WorldCoord.parseWorldCoord(location); + if (mycoord.isWilderness()) { + return null; + } + final TownBlock myplot = mycoord.getTownBlockOrNull(); // Will not be null, because of the isWilderness() test above. + boolean isMember = isAllowed(player, myplot); + if (isMember) { + final Location loc1 = mycoord.getLowerMostCornerLocation(); + final Location loc2 = mycoord.getUpperMostCornerLocation(); + final BlockVector3 pos1 = BlockVector3.at(loc1.getX(), loc1.getY(), loc1.getZ()); + final BlockVector3 pos2 = BlockVector3.at(loc2.getX(), loc2.getY(), loc2.getZ()); + return new FaweMask(new CuboidRegion(pos1, pos2)) { + @Override + public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) { + return isAllowed(BukkitAdapter.adapt(player), myplot); + } + }; } return null; } From e449910af5855b69b04024234272a9176ead7eea Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 12 Jun 2023 10:27:07 +0100 Subject: [PATCH 077/161] feat: prevent edits outside +/- 30,000,000 blocks (#2285) * feat: prevent edits outside +/- 30,000,000 blocks * Remove import --- .../sk89q/worldedit/bukkit/BukkitWorld.java | 52 +++++++++++++++++++ .../fastasyncworldedit/core/FaweCache.java | 5 ++ .../core/configuration/Settings.java | 6 +++ .../internal/exception/FaweException.java | 1 + .../SingleThreadQueueExtent.java | 4 +- .../preloader/AsyncPreloader.java | 8 +++ .../src/main/resources/lang/strings.json | 1 + 7 files changed, 76 insertions(+), 1 deletion(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index 769bcbd03..7afe0aaff 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -21,6 +21,8 @@ package com.sk89q.worldedit.bukkit; import com.fastasyncworldedit.bukkit.util.WorldUnloadedException; import com.fastasyncworldedit.core.Fawe; +import com.fastasyncworldedit.core.FaweCache; +import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.internal.exception.FaweException; import com.fastasyncworldedit.core.queue.IChunkGet; import com.fastasyncworldedit.core.queue.implementation.packet.ChunkPacket; @@ -242,6 +244,9 @@ public class BukkitWorld extends AbstractWorld { @Override public int getBlockLightLevel(BlockVector3 pt) { + //FAWE start - safe edit region + testCoords(pt); + //FAWE end return getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).getLightLevel(); } @@ -265,6 +270,9 @@ public class BukkitWorld extends AbstractWorld { @Override public boolean clearContainerBlockContents(BlockVector3 pt) { checkNotNull(pt); + //FAWE start - safe edit region + testCoords(pt); + //FAWE end BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); if (adapter != null) { try { @@ -337,6 +345,7 @@ public class BukkitWorld extends AbstractWorld { @Override public boolean generateTree(TreeGenerator.TreeType type, EditSession editSession, BlockVector3 pt) { //FAWE start - allow tree commands to be undone and obey region restrictions + testCoords(pt); return WorldEditPlugin.getInstance().getBukkitImplAdapter().generateTree(type, editSession, pt, getWorld()); //FAWE end } @@ -349,6 +358,9 @@ public class BukkitWorld extends AbstractWorld { @Override public void checkLoadedChunk(BlockVector3 pt) { + //FAWE start - safe edit region + testCoords(pt); + //FAWE end World world = getWorld(); //FAWE start int X = pt.getBlockX() >> 4; @@ -480,6 +492,9 @@ public class BukkitWorld extends AbstractWorld { @Override public void simulateBlockMine(BlockVector3 pt) { + //FAWE start - safe edit region + testCoords(pt); + //FAWE end getWorld().getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()).breakNaturally(); } @@ -493,6 +508,9 @@ public class BukkitWorld extends AbstractWorld { @Override public boolean canPlaceAt(BlockVector3 position, com.sk89q.worldedit.world.block.BlockState blockState) { + //FAWE start - safe edit region + testCoords(position); + //FAWE end BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); if (adapter != null) { return adapter.canPlaceAt(getWorld(), position, blockState); @@ -505,6 +523,9 @@ public class BukkitWorld extends AbstractWorld { @Override public com.sk89q.worldedit.world.block.BlockState getBlock(BlockVector3 position) { + //FAWE start - safe edit region + testCoords(position); + //FAWE end BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); if (adapter != null) { try { @@ -526,6 +547,9 @@ public class BukkitWorld extends AbstractWorld { @Override public > boolean setBlock(BlockVector3 position, B block, SideEffectSet sideEffects) { + //FAWE start - safe edit region + testCoords(position); + //FAWE end if (worldNativeAccess != null) { try { return worldNativeAccess.setBlock(position, block, sideEffects); @@ -545,6 +569,9 @@ public class BukkitWorld extends AbstractWorld { @Override public BaseBlock getFullBlock(BlockVector3 position) { + //FAWE start - safe edit region + testCoords(position); + //FAWE end BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); if (adapter != null) { return adapter.getFullBlock(BukkitAdapter.adapt(getWorld(), position)); @@ -553,11 +580,25 @@ public class BukkitWorld extends AbstractWorld { } } + private void testCoords(BlockVector3 position) throws FaweException { + if (!Settings.settings().REGION_RESTRICTIONS_OPTIONS.RESTRICT_TO_SAFE_RANGE) { + return; + } + int x = position.getX(); + int z = position.getZ(); + if (x > 30000000 || z > 30000000 || x < -30000000 || z < -30000000) { + throw FaweCache.OUTSIDE_SAFE_REGION; + } + } + @Override public Set applySideEffects( BlockVector3 position, com.sk89q.worldedit.world.block.BlockState previousType, SideEffectSet sideEffectSet ) { + //FAWE start - safe edit region + testCoords(position); + //FAWE end if (worldNativeAccess != null) { worldNativeAccess.applySideEffects(position, previousType, sideEffectSet); return Sets.intersection( @@ -571,6 +612,9 @@ public class BukkitWorld extends AbstractWorld { @Override public boolean useItem(BlockVector3 position, BaseItem item, Direction face) { + //FAWE start - safe edit region + testCoords(position); + //FAWE end BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); if (adapter != null) { return adapter.simulateItemUse(getWorld(), position, item, face); @@ -588,6 +632,9 @@ public class BukkitWorld extends AbstractWorld { @SuppressWarnings("deprecation") @Override public BiomeType getBiome(BlockVector3 position) { + //FAWE start - safe edit region + testCoords(position); + //FAWE end if (HAS_3D_BIOMES) { return BukkitAdapter.adapt(getWorld().getBiome(position.getBlockX(), position.getBlockY(), position.getBlockZ())); } else { @@ -598,6 +645,9 @@ public class BukkitWorld extends AbstractWorld { @SuppressWarnings("deprecation") @Override public boolean setBiome(BlockVector3 position, BiomeType biome) { + //FAWE start - safe edit region + testCoords(position); + //FAWE end if (HAS_3D_BIOMES) { getWorld().setBiome(position.getBlockX(), position.getBlockY(), position.getBlockZ(), BukkitAdapter.adapt(biome)); } else { @@ -626,11 +676,13 @@ public class BukkitWorld extends AbstractWorld { @Override public void refreshChunk(int chunkX, int chunkZ) { + testCoords(BlockVector3.at(chunkX << 16, 0, chunkZ << 16)); getWorld().refreshChunk(chunkX, chunkZ); } @Override public IChunkGet get(int chunkX, int chunkZ) { + testCoords(BlockVector3.at(chunkX << 16, 0, chunkZ << 16)); return WorldEditPlugin.getInstance().getBukkitImplAdapter().get(getWorldChecked(), chunkX, chunkZ); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweCache.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweCache.java index a6d035155..b66b4ef06 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweCache.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweCache.java @@ -182,6 +182,11 @@ public enum FaweCache implements Trimable { "fawe.cancel.reason.outside.region"), Type.OUTSIDE_REGION ); + public static final FaweException OUTSIDE_SAFE_REGION = new FaweException( + Caption.of( + "fawe.cancel.reason.outside.safe.region"), + Type.OUTSIDE_REGION + ); public static final FaweException MAX_CHECKS = new FaweException( Caption.of("fawe.cancel.reason.max" + ".checks"), Type.MAX_CHECKS diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java index 5eba1f01f..90ed792fa 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java @@ -312,6 +312,12 @@ public class Settings extends Config { " - Any blacklist regions are likely to override any internal allowed regions." }) public boolean WORLDGUARD_REGION_BLACKLIST = false; + @Comment({ + "Restrict all edits to within the safe chunk limits of +/- 30 million blocks", + " - Edits outside this range may induce crashing", + " - Forcefully prevents any edit outside this range" + }) + public boolean RESTRICT_TO_SAFE_RANGE = true; } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweException.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweException.java index ff1d7913d..f59de907c 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweException.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweException.java @@ -80,6 +80,7 @@ public class FaweException extends RuntimeException { MANUAL, NO_REGION, OUTSIDE_REGION, + OUTSIDE_SAFE_REGION, MAX_CHECKS, MAX_CHANGES, LOW_MEMORY, diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java index a41d8786b..59427c8ef 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java @@ -293,7 +293,9 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen if (pair == lastPair) { return lastChunk; } - if (!processGet(x, z)) { + if (!processGet(x, z) || (Settings.settings().REGION_RESTRICTIONS_OPTIONS.RESTRICT_TO_SAFE_RANGE + // if any chunk coord is outside 30 million blocks + && (x > 1875000 || z > 1875000 || x < -1875000 || z < -1875000))) { lastPair = pair; lastChunk = NullChunk.getInstance(); return NullChunk.getInstance(); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/preloader/AsyncPreloader.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/preloader/AsyncPreloader.java index 29e82790d..7a74ed8ac 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/preloader/AsyncPreloader.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/preloader/AsyncPreloader.java @@ -110,6 +110,14 @@ public class AsyncPreloader implements Preloader, Runnable { Iterator chunksIter = chunks.iterator(); while (chunksIter.hasNext() && pair.getValue() == chunks) { // Ensure the queued load is still valid BlockVector2 chunk = chunksIter.next(); + if (Settings.settings().REGION_RESTRICTIONS_OPTIONS.RESTRICT_TO_SAFE_RANGE) { + int x = chunk.getX(); + int z = chunk.getZ(); + // if any chunk coord is outside 30 million blocks + if (x > 1875000 || z > 1875000 || x < -1875000 || z < -1875000) { + continue; + } + } queueLoad(world, chunk); } } diff --git a/worldedit-core/src/main/resources/lang/strings.json b/worldedit-core/src/main/resources/lang/strings.json index ac3c2d3ac..46445a2d9 100644 --- a/worldedit-core/src/main/resources/lang/strings.json +++ b/worldedit-core/src/main/resources/lang/strings.json @@ -149,6 +149,7 @@ "fawe.cancel.reason.max.iterations": "Max iterations", "fawe.cancel.reason.outside.level": "Outside world", "fawe.cancel.reason.outside.region": "Outside allowed region (bypass with /wea, or disable `region-restrictions` in config.yml)", + "fawe.cancel.reason.outside.safe.region": "Outside safe edit region of +/- 30,000,000 blocks.", "fawe.cancel.reason.no.region": "No allowed region (bypass with /wea, or disable `region-restrictions` in config.yml)", "fawe.cancel.reason.no.region.reason": "No allowed region: {0}", "fawe.cancel.reason.no.region.plot.noworldeditflag": "Plot flag NoWorldeditFlag set", From 956a5182381e64c2e1959452a2c780e16ea31492 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Mon, 12 Jun 2023 11:58:38 +0200 Subject: [PATCH 078/161] Release 2.6.3 --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 82caafa3f..db392b690 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -52,7 +52,7 @@ ext { } } -version = String.format("%s-%s", rootVersion, buildNumber) +version = String.format("%s", rootVersion) if (!project.hasProperty("gitCommitHash")) { apply(plugin = "org.ajoberstar.grgit") From ed128797ececd9db21d5b47ccfbef6cbad95290a Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Mon, 12 Jun 2023 12:13:49 +0200 Subject: [PATCH 079/161] Back to snapshot for development --- build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index db392b690..f1d4bb80e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,7 +34,7 @@ logger.lifecycle(""" ******************************************* """) -var rootVersion by extra("2.6.3") +var rootVersion by extra("2.6.4") var snapshot by extra("SNAPSHOT") var revision: String by extra("") var buildNumber by extra("") @@ -52,7 +52,7 @@ ext { } } -version = String.format("%s", rootVersion) +version = String.format("%s-%s", rootVersion, buildNumber) if (!project.hasProperty("gitCommitHash")) { apply(plugin = "org.ajoberstar.grgit") From dae6c69e54c90490a8e8e44b1aecb23ea7f2967d Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 12 Jun 2023 11:14:24 +0100 Subject: [PATCH 080/161] feat: send one of an error message during edits if otherwise squashed by LimitExtent (#2246) * feat: send one of an error message during edits if otherwise squashed by LimitExtent * no region is not ingorable --- .../fastasyncworldedit/core/FaweCache.java | 33 +++-- .../core/extent/LimitExtent.java | 132 +++++++----------- .../internal/exception/FaweException.java | 21 +++ .../sk89q/worldedit/EditSessionBuilder.java | 14 +- .../src/main/resources/lang/strings.json | 1 + 5 files changed, 110 insertions(+), 91 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweCache.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweCache.java index b66b4ef06..af14624df 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweCache.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/FaweCache.java @@ -171,16 +171,19 @@ public enum FaweCache implements Trimable { public static final FaweBlockBagException BLOCK_BAG = new FaweBlockBagException(); public static final FaweException MANUAL = new FaweException( Caption.of("fawe.cancel.reason.manual"), - Type.MANUAL + Type.MANUAL, + false ); public static final FaweException NO_REGION = new FaweException( Caption.of("fawe.cancel.reason.no.region"), - Type.NO_REGION + Type.NO_REGION, + false ); public static final FaweException OUTSIDE_REGION = new FaweException( Caption.of( "fawe.cancel.reason.outside.region"), - Type.OUTSIDE_REGION + Type.OUTSIDE_REGION, + true ); public static final FaweException OUTSIDE_SAFE_REGION = new FaweException( Caption.of( @@ -189,39 +192,47 @@ public enum FaweCache implements Trimable { ); public static final FaweException MAX_CHECKS = new FaweException( Caption.of("fawe.cancel.reason.max" + ".checks"), - Type.MAX_CHECKS + Type.MAX_CHECKS, + true ); public static final FaweException MAX_CHANGES = new FaweException( Caption.of("fawe.cancel.reason.max" + ".changes"), - Type.MAX_CHANGES + Type.MAX_CHANGES, + false ); public static final FaweException LOW_MEMORY = new FaweException( Caption.of("fawe.cancel.reason.low" + ".memory"), - Type.LOW_MEMORY + Type.LOW_MEMORY, + false ); public static final FaweException MAX_ENTITIES = new FaweException( Caption.of( "fawe.cancel.reason.max.entities"), - Type.MAX_ENTITIES + Type.MAX_ENTITIES, + true ); public static final FaweException MAX_TILES = new FaweException(Caption.of( "fawe.cancel.reason.max.tiles", - Type.MAX_TILES + Type.MAX_TILES, + true )); public static final FaweException MAX_ITERATIONS = new FaweException( Caption.of( "fawe.cancel.reason.max.iterations"), - Type.MAX_ITERATIONS + Type.MAX_ITERATIONS, + true ); public static final FaweException PLAYER_ONLY = new FaweException( Caption.of( "fawe.cancel.reason.player-only"), - Type.PLAYER_ONLY + Type.PLAYER_ONLY, + false ); public static final FaweException ACTOR_REQUIRED = new FaweException( Caption.of( "fawe.cancel.reason.actor-required"), - Type.ACTOR_REQUIRED + Type.ACTOR_REQUIRED, + false ); /* diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/LimitExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/LimitExtent.java index 15a47d973..24d440c57 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/LimitExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/LimitExtent.java @@ -20,6 +20,7 @@ import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.session.ClipboardHolder; import com.sk89q.worldedit.util.Countable; import com.sk89q.worldedit.util.Location; +import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.block.BaseBlock; @@ -34,19 +35,46 @@ import java.util.Collections; import java.util.List; import java.util.Set; import java.util.UUID; +import java.util.function.Consumer; public class LimitExtent extends AbstractDelegateExtent { private final FaweLimit limit; + private final boolean[] faweExceptionReasonsUsed = new boolean[FaweException.Type.values().length]; + private final Consumer onErrorMessage; /** * Create a new instance. * * @param extent the extent + * @param limit the limit */ public LimitExtent(Extent extent, FaweLimit limit) { + this(extent, limit, c -> { + }); + } + + /** + * Create a new instance. + * + * @param extent the extent + * @param limit the limit + * @param onErrorMessage consumer to handle a component generated by exceptions + */ + public LimitExtent(Extent extent, FaweLimit limit, Consumer onErrorMessage) { super(extent); this.limit = limit; + this.onErrorMessage = onErrorMessage; + } + + private void handleException(FaweException e) { + if (e.ignorable() || !limit.MAX_FAILS()) { + throw e; + } + if (!faweExceptionReasonsUsed[e.getType().ordinal()]) { + faweExceptionReasonsUsed[e.getType().ordinal()] = true; + onErrorMessage.accept(e.getComponent()); + } } @Override @@ -55,9 +83,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.getEntities(region); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return Collections.emptyList(); } } @@ -68,9 +94,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.getEntities(); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return Collections.emptyList(); } } @@ -83,9 +107,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.createEntity(location, entity); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return null; } } @@ -98,9 +120,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.createEntity(location, entity, uuid); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return null; } } @@ -112,9 +132,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { super.removeEntity(x, y, z, uuid); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); } } @@ -124,9 +142,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.regenerateChunk(x, z, type, seed); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return false; } } @@ -137,9 +153,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.getHighestTerrainBlock(x, z, minY, maxY); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return minY; } } @@ -150,9 +164,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.getHighestTerrainBlock(x, z, minY, maxY, filter); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return minY; } } @@ -163,9 +175,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.getNearestSurfaceLayer(x, z, y, minY, maxY); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return minY; } } @@ -176,9 +186,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, ignoreAir); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return minY; } } @@ -189,9 +197,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return minY; } } @@ -202,9 +208,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return minY; } } @@ -215,9 +219,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, mask); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return minY; } } @@ -237,9 +239,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.getNearestSurfaceTerrainBlock(x, z, y, minY, maxY, failedMin, failedMax, ignoreAir); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return minY; } } @@ -386,9 +386,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { filter.applyBlock(block.init(pos)); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); } } return filter; @@ -404,9 +402,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.getBlock(position); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return BlockTypes.AIR.getDefaultState(); } } @@ -417,9 +413,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.getBlock(x, y, z); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return BlockTypes.AIR.getDefaultState(); } } @@ -430,9 +424,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.getFullBlock(position); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return BlockTypes.AIR.getDefaultState().toBaseBlock(); } } @@ -443,9 +435,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.getFullBlock(x, y, z); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return BlockTypes.AIR.getDefaultState().toBaseBlock(); } } @@ -456,9 +446,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.getBiome(position); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return BiomeTypes.FOREST; } } @@ -469,9 +457,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.getBiomeType(x, y, z); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return BiomeTypes.FOREST; } } @@ -486,9 +472,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.setBlock(position, block); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return false; } } @@ -502,9 +486,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.setBlock(x, y, z, block); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return false; } } @@ -516,9 +498,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.setTile(x, y, z, tile); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return false; } } @@ -529,9 +509,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.setBiome(position, biome); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return false; } } @@ -542,9 +520,7 @@ public class LimitExtent extends AbstractDelegateExtent { try { return super.setBiome(x, y, z, biome); } catch (FaweException e) { - if (e.getType() == FaweException.Type.MANUAL || !limit.MAX_FAILS()) { - throw e; - } + handleException(e); return false; } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweException.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweException.java index f59de907c..fd74ac5de 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweException.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweException.java @@ -14,6 +14,7 @@ public class FaweException extends RuntimeException { private final Component message; private final Type type; + private final boolean ignorable; /** * New instance. Defaults to {@link FaweException.Type#OTHER}. @@ -33,8 +34,19 @@ public class FaweException extends RuntimeException { * New instance of a given {@link FaweException.Type} */ public FaweException(Component reason, Type type) { + this(reason, type, false); + } + + /** + * New instance of a given {@link FaweException.Type} + * + * @param ignorable if an edit can continue if this exception is caught, e.g. by {@link com.fastasyncworldedit.core.extent.LimitExtent} + * @since TODO + */ + public FaweException(Component reason, Type type, boolean ignorable) { this.message = reason; this.type = type; + this.ignorable = ignorable; } @Override @@ -55,6 +67,15 @@ public class FaweException extends RuntimeException { return type; } + /** + * If an edit can continue if this exception is caught, e.g. by {@link com.fastasyncworldedit.core.extent.LimitExtent} + * + * @since TODO + */ + public boolean ignorable() { + return ignorable; + } + public static FaweException get(Throwable e) { if (e instanceof FaweException) { return (FaweException) e; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java index 2512af96c..ead916f45 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java @@ -65,16 +65,19 @@ import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.Identifiable; import com.sk89q.worldedit.util.eventbus.EventBus; +import com.sk89q.worldedit.util.formatting.text.Component; import com.sk89q.worldedit.util.formatting.text.TextComponent; import com.sk89q.worldedit.world.World; import org.apache.logging.log4j.Logger; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import java.util.Arrays; import java.util.HashSet; import java.util.Locale; import java.util.Set; import java.util.UUID; +import java.util.function.Consumer; /** * A builder-style factory for {@link EditSession EditSessions}. @@ -590,10 +593,17 @@ public final class EditSessionBuilder { } else { relighter = NullRelighter.INSTANCE; } + Consumer onErrorMessage; + if (getActor() != null) { + onErrorMessage = c -> getActor().print(Caption.of("fawe.error.occurred-continuing", c)); + } else { + onErrorMessage = c -> { + }; + } if (limit != null && !limit.isUnlimited() && regionExtent != null) { - this.extent = new LimitExtent(regionExtent, limit); + this.extent = new LimitExtent(regionExtent, limit, onErrorMessage); } else if (limit != null && !limit.isUnlimited()) { - this.extent = new LimitExtent(this.extent, limit); + this.extent = new LimitExtent(this.extent, limit, onErrorMessage); } else if (regionExtent != null) { this.extent = regionExtent; } diff --git a/worldedit-core/src/main/resources/lang/strings.json b/worldedit-core/src/main/resources/lang/strings.json index 46445a2d9..790f7b6fa 100644 --- a/worldedit-core/src/main/resources/lang/strings.json +++ b/worldedit-core/src/main/resources/lang/strings.json @@ -134,6 +134,7 @@ "fawe.error.limit.disallowed-block": "Your limit disallows use of block '{0}'", "fawe.error.limit.disallowed-property": "Your limit disallows use of property '{0}'", "fawe.error.region-mask-invalid": "Invalid region mask: {0}", + "fawe.error.occurred-continuing": "Ignorable error occurred during edit: {0}", "fawe.cancel.count": "Cancelled {0} edits.", "fawe.cancel.reason.confirm": "Use //confirm to execute {0}", "fawe.cancel.reason.confirm.region": "Your selection is large ({0} -> {1}, containing {3} blocks). Use //confirm to execute {2}", From d9463ce8b5ff155e1fd56cb2cc4d18cde2ca7c50 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Mon, 12 Jun 2023 16:36:06 +0200 Subject: [PATCH 081/161] Add support for 1.20.1 --- .../bukkit/adapter/ext/fawe/v1_20_R1/PaperweightAdapter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightAdapter.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightAdapter.java index f39fe98f4..e495a078c 100644 --- a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightAdapter.java @@ -182,8 +182,8 @@ public final class PaperweightAdapter implements BukkitImplAdapter Date: Tue, 13 Jun 2023 19:12:24 +0200 Subject: [PATCH 082/161] fix #2292 --- .../src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index 7afe0aaff..a9ba45afe 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -676,13 +676,13 @@ public class BukkitWorld extends AbstractWorld { @Override public void refreshChunk(int chunkX, int chunkZ) { - testCoords(BlockVector3.at(chunkX << 16, 0, chunkZ << 16)); + testCoords(BlockVector3.at(chunkX << 4, 0, chunkZ << 4)); getWorld().refreshChunk(chunkX, chunkZ); } @Override public IChunkGet get(int chunkX, int chunkZ) { - testCoords(BlockVector3.at(chunkX << 16, 0, chunkZ << 16)); + testCoords(BlockVector3.at(chunkX << 4, 0, chunkZ << 4)); return WorldEditPlugin.getInstance().getBukkitImplAdapter().get(getWorldChecked(), chunkX, chunkZ); } From 51e238c352c0851b02ca459a21d239fdbd798684 Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 15 Jun 2023 10:18:01 +0200 Subject: [PATCH 083/161] feat: add new tree types to tree tool and brush (#2286) * feat: add new tree types - implements #2197 * Remove nonsensical test case --------- Co-authored-by: Alexander Brandes --- .../test/java/com/sk89q/worldedit/bukkit/BukkitWorldTest.java | 1 - .../src/main/java/com/sk89q/worldedit/util/TreeGenerator.java | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/worldedit-bukkit/src/test/java/com/sk89q/worldedit/bukkit/BukkitWorldTest.java b/worldedit-bukkit/src/test/java/com/sk89q/worldedit/bukkit/BukkitWorldTest.java index 447f2ec9a..df6b33b7b 100644 --- a/worldedit-bukkit/src/test/java/com/sk89q/worldedit/bukkit/BukkitWorldTest.java +++ b/worldedit-bukkit/src/test/java/com/sk89q/worldedit/bukkit/BukkitWorldTest.java @@ -26,7 +26,6 @@ import static org.junit.jupiter.api.Assertions.assertNotNull; public class BukkitWorldTest { - @Test public void testTreeTypeMapping() { for (TreeGenerator.TreeType type : TreeGenerator.TreeType.values()) { assertNotNull(BukkitWorld.toBukkitTreeType(type), "No mapping for: " + type); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java index 7d7d71e75..cf5c05278 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/util/TreeGenerator.java @@ -165,6 +165,9 @@ public final class TreeGenerator { } //FAWE end }, + MANGROVE("Mangrove tree", "mangrove"), + TALL_MANGROVE("Tall mangrove tree", "tall_mangrove"), + CHERRY("Cherry blossom", "cherry"), RANDOM("Random tree", "rand", "random") { @Override public boolean generate(EditSession editSession, BlockVector3 pos) throws MaxChangedBlocksException { From 7a7373fd3d87267cf16b0329e5cb017baec46257 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sat, 17 Jun 2023 16:16:16 +0200 Subject: [PATCH 084/161] Update paperweight --- worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts index c9a239ebf..4c0d110e2 100644 --- a/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts +++ b/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts @@ -12,6 +12,6 @@ repositories { dependencies { // https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/ - the().paperDevBundle("1.20-R0.1-20230609.070122-4") + the().paperDevBundle("1.20.1-R0.1-20230617.023453-15") compileOnly("io.papermc:paperlib") } From 78fb74665f9e3cb9f34f6c262cd980dffe46cd78 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 17 Jun 2023 16:36:57 +0200 Subject: [PATCH 085/161] Update plugin com.modrinth.minotaur to v2.8.1 (#2298) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- worldedit-bukkit/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index 426eb4c4f..a393413f3 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -3,7 +3,7 @@ import io.papermc.paperweight.userdev.attribute.Obfuscation plugins { `java-library` - id("com.modrinth.minotaur") version "2.8.0" + id("com.modrinth.minotaur") version "2.8.1" } project.description = "Bukkit" From 135c77cfb5073cb4b94e16d2f732abd17d32ff66 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sun, 18 Jun 2023 15:03:51 +0100 Subject: [PATCH 086/161] chore: minor changes - null check get tile in ThreadUnsafeCharBlocks - 0 to reserved ID --- .../adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java | 2 +- .../bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java | 2 +- .../bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java | 2 +- .../bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java | 2 +- .../bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java | 2 +- .../bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java | 2 +- .../core/history/changeset/SimpleChangeSetSummary.java | 2 +- .../queue/implementation/blocks/ThreadUnsafeCharBlocks.java | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java index 09fa8f7a5..85be84901 100644 --- a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java @@ -415,7 +415,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc } int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); - if (ordinal != 0) { + if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) { BlockEntity tile = entry.getValue(); if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { if (beacons == null) { diff --git a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java index 06a74cfd1..4e435e7ee 100644 --- a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java @@ -408,7 +408,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc } int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); - if (ordinal != 0) { + if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) { BlockEntity tile = entry.getValue(); if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { if (beacons == null) { diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java index e0a851c1b..6466ea828 100644 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java @@ -406,7 +406,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc } int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); - if (ordinal != 0) { + if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) { BlockEntity tile = entry.getValue(); if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { if (beacons == null) { diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java index 3ee8314fd..9edb79974 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java @@ -408,7 +408,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc } int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); - if (ordinal != 0) { + if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) { BlockEntity tile = entry.getValue(); if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { if (beacons == null) { diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java index 1b10ddd77..ba1bfe574 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java @@ -408,7 +408,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc } int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); - if (ordinal != 0) { + if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) { BlockEntity tile = entry.getValue(); if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { if (beacons == null) { diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java index 38c871ea8..0dd292207 100644 --- a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java @@ -386,7 +386,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc } int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); - if (ordinal != 0) { + if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) { BlockEntity tile = entry.getValue(); if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { if (beacons == null) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/SimpleChangeSetSummary.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/SimpleChangeSetSummary.java index 7b6565355..dadb7ee83 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/SimpleChangeSetSummary.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/history/changeset/SimpleChangeSetSummary.java @@ -50,7 +50,7 @@ public class SimpleChangeSetSummary implements ChangeSetSummary { public Map getBlocks() { HashMap map = new HashMap<>(); for (int i = 0; i < blocks.length; i++) { - if (blocks[i] != 0) { + if (blocks[i] != BlockTypesCache.ReservedIDs.__RESERVED__) { BlockState state = BlockTypesCache.states[i]; map.put(state, blocks[i]); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java index f3dda058f..ca0dd3442 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/blocks/ThreadUnsafeCharBlocks.java @@ -122,7 +122,7 @@ public class ThreadUnsafeCharBlocks implements IChunkSet, IBlocks { @Override public CompoundTag getTile(int x, int y, int z) { - return tiles.get(x, y, z); + return tiles == null ? null : tiles.get(x, y, z); } @Override From f0aef9887078ada7895a73e89206543d177e53cf Mon Sep 17 00:00:00 2001 From: Jordan Date: Sun, 18 Jun 2023 18:08:31 +0200 Subject: [PATCH 087/161] fix: don't "double-up" a setblocks if a region is being set (#2299) - Fixes #2294 --- .../core/queue/implementation/ParallelQueueExtent.java | 1 + 1 file changed, 1 insertion(+) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/ParallelQueueExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/ParallelQueueExtent.java index 0d7436ca5..2d2b45aae 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/ParallelQueueExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/ParallelQueueExtent.java @@ -193,6 +193,7 @@ public class ParallelQueueExtent extends PassthroughExtent { public int setBlocks(Set vset, Pattern pattern) { if (vset instanceof Region) { this.changes = setBlocks((Region) vset, pattern); + return this.changes; } // TODO optimize parallel for (BlockVector3 blockVector3 : vset) { From 39de48cdb117d1734d1374bac5fe54b0d71deebe Mon Sep 17 00:00:00 2001 From: Jordan Date: Sun, 18 Jun 2023 18:31:49 +0200 Subject: [PATCH 088/161] chore: Address kotlin String#capitalize() deprecation (#2308) * chore: Address kotlin String#capitalize() deprecation - Fixes #2283 - Don't bother with the longer version that allows Locales, we don't need that * Address comments --- buildSrc/src/main/kotlin/LibsConfig.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/LibsConfig.kt b/buildSrc/src/main/kotlin/LibsConfig.kt index d2c1a8e1d..4fd69cb65 100644 --- a/buildSrc/src/main/kotlin/LibsConfig.kt +++ b/buildSrc/src/main/kotlin/LibsConfig.kt @@ -204,7 +204,7 @@ fun Project.applyLibrariesConfiguration() { from(libsComponent) group = "com.fastasyncworldedit" - artifactId = "FastAsyncWorldEdit-Libs-${project.name.capitalize()}" + artifactId = "FastAsyncWorldEdit-Libs-${project.name.replaceFirstChar(Char::titlecase)}" version = version pom { From 1ede11b12910b288fe8d63c0d68a9e6dcdc48e6b Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 19 Jun 2023 15:34:02 +0200 Subject: [PATCH 089/161] fix: use new array when creating palette (#2305) - Fixes #2291 --- .../bukkit/adapter/NMSAdapter.java | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/NMSAdapter.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/NMSAdapter.java index a69d7865f..b41da1679 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/NMSAdapter.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/NMSAdapter.java @@ -30,7 +30,8 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl { ordinal = BlockTypesCache.ReservedIDs.AIR; nonAir--; } - case BlockTypesCache.ReservedIDs.AIR, BlockTypesCache.ReservedIDs.CAVE_AIR, BlockTypesCache.ReservedIDs.VOID_AIR -> nonAir--; + case BlockTypesCache.ReservedIDs.AIR, BlockTypesCache.ReservedIDs.CAVE_AIR, BlockTypesCache.ReservedIDs.VOID_AIR -> + nonAir--; } int palette = blockToPalette[ordinal]; if (palette == Integer.MAX_VALUE) { @@ -73,6 +74,8 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl { CachedBukkitAdapter adapter, short[] nonEmptyBlockCount ) { + // Write to new array to avoid editing SET array + char[] copy = new char[set.length]; short nonAir = 4096; int num_palette = 0; char[] getArr = null; @@ -83,23 +86,19 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl { if (getArr == null) { getArr = get.apply(layer); } - // write to set array as this should be a copied array, and will be important when the changes are written - // to the GET chunk cached by FAWE - set[i] = switch (ordinal = getArr[i]) { + switch (ordinal = getArr[i]) { case BlockTypesCache.ReservedIDs.__RESERVED__ -> { nonAir--; - yield (ordinal = BlockTypesCache.ReservedIDs.AIR); + ordinal = BlockTypesCache.ReservedIDs.AIR; } - case BlockTypesCache.ReservedIDs.AIR, BlockTypesCache.ReservedIDs.CAVE_AIR, - BlockTypesCache.ReservedIDs.VOID_AIR -> { - nonAir--; - yield ordinal; - } - default -> ordinal; - }; + case BlockTypesCache.ReservedIDs.AIR, BlockTypesCache.ReservedIDs.CAVE_AIR, BlockTypesCache.ReservedIDs.VOID_AIR -> + nonAir--; + } } - case BlockTypesCache.ReservedIDs.AIR, BlockTypesCache.ReservedIDs.CAVE_AIR, BlockTypesCache.ReservedIDs.VOID_AIR -> nonAir--; + case BlockTypesCache.ReservedIDs.AIR, BlockTypesCache.ReservedIDs.CAVE_AIR, BlockTypesCache.ReservedIDs.VOID_AIR -> + nonAir--; } + copy[i] = ordinal; int palette = blockToPalette[ordinal]; if (palette == Integer.MAX_VALUE) { blockToPalette[ordinal] = num_palette; @@ -117,7 +116,7 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl { System.arraycopy(adapter.getOrdinalToIbdID(), 0, blockToPalette, 0, adapter.getOrdinalToIbdID().length); } for (int i = 0; i < 4096; i++) { - char ordinal = set[i]; + char ordinal = copy[i]; if (ordinal == BlockTypesCache.ReservedIDs.__RESERVED__) { LOGGER.error("Empty (__RESERVED__) ordinal given where not expected, default to air."); ordinal = BlockTypesCache.ReservedIDs.AIR; From a8c8a0fbd62d3bf1e0ea794fd1a6ed26c50a4153 Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 19 Jun 2023 15:34:54 +0200 Subject: [PATCH 090/161] fix: always return the changeset from EditSessionBuilder (#2302) - Ensure history will actually always be closed if combine-stages is false - Fixes #2148 --- .../main/java/com/sk89q/worldedit/EditSessionBuilder.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java index ead916f45..ea27f03b5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java @@ -72,7 +72,6 @@ import org.apache.logging.log4j.Logger; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.Arrays; import java.util.HashSet; import java.util.Locale; import java.util.Set; @@ -99,7 +98,6 @@ public final class EditSessionBuilder { private RelightMode relightMode; private Relighter relighter; private Boolean wnaMode; - private AbstractChangeSet changeTask; private Extent bypassHistory; private Extent bypassAll; private Extent extent; @@ -522,7 +520,6 @@ public final class EditSessionBuilder { changeSet = new BlockBagChangeSet(changeSet, blockBag, limit.INVENTORY_MODE == 1); } if (combineStages) { - changeTask = changeSet; this.extent = extent.enableHistory(changeSet); } else { this.extent = new HistoryExtent(extent, changeSet); @@ -699,7 +696,7 @@ public final class EditSessionBuilder { * Get the change set that will be used for history */ public AbstractChangeSet getChangeTask() { - return changeTask; + return changeSet; } /** From 01be53ed655364f9573b05a52eb26c89a5e9b974 Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 19 Jun 2023 15:36:47 +0200 Subject: [PATCH 091/161] fix: add missing BlockType constructor (#2306) - Deprecate public BlockType constructors - People really should not be initialising their own block types. This can and most likely will cause issues. - Fixes #2290 --- .../worldedit/world/block/BlockType.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java index 01a5d5c8a..e5a466e29 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java @@ -78,13 +78,35 @@ public class BlockType implements Keyed, Pattern { this.id = i == -1 ? id : id.substring(0, i); this.settings = new BlockTypesCache.Settings(this, id, internalId, states); } + //FAWE end + //FAWE start + /** + * @deprecated You should not be initialising your own BlockTypes, use {@link BlockTypes#get(String)} instead. If there is + * a specific requirement to actually create new block types, please contact the FAWE devs to discuss. Use + * {@link BlockTypes#get(String)} instead. + */ + @Deprecated(since = "TODO") + //FAWE end + public BlockType(String id) { + this(id, null); + } + + //FAWE start + /** + * @deprecated You should not be initialising your own BlockTypes, use {@link BlockTypes#get(String)} instead. If there is + * a specific requirement to actually create new block types, please contact the FAWE devs to discuss. Use + * {@link BlockTypes#get(String)} instead. + */ + @Deprecated(since = "TODO") + //FAWE end public BlockType(String id, Function values) { // If it has no namespace, assume minecraft. if (!id.contains(":")) { id = "minecraft:" + id; } this.id = id; + //FAWE start //TODO fix the line below this.settings = new BlockTypesCache.Settings(this, id, 0, null); } From 8ca25fa7d7ec04d51edd5a21444312891bec3101 Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 19 Jun 2023 22:46:01 +0200 Subject: [PATCH 092/161] fix: towny max bounds are exclusive (#2301) fix: towny max bounds are exlusive - Fixes #2293 --- .../fastasyncworldedit/bukkit/regions/TownyFeature.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/TownyFeature.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/TownyFeature.java index 7c5aa7e6f..ca5c81a6a 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/TownyFeature.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/TownyFeature.java @@ -1,7 +1,6 @@ package com.fastasyncworldedit.bukkit.regions; import com.fastasyncworldedit.core.regions.FaweMask; -import com.palmergames.bukkit.towny.Towny; import com.palmergames.bukkit.towny.TownyAPI; import com.palmergames.bukkit.towny.object.Resident; import com.palmergames.bukkit.towny.object.Town; @@ -12,7 +11,6 @@ import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; import org.apache.logging.log4j.Logger; -import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.Listener; @@ -22,11 +20,8 @@ public class TownyFeature extends BukkitMaskManager implements Listener { private static final Logger LOGGER = LogManagerCompat.getLogger(); - private final Plugin towny; - public TownyFeature(Plugin townyPlugin) { super(townyPlugin.getName()); - this.towny = townyPlugin; LOGGER.info("Plugin 'Towny' found. Using it now."); } @@ -73,7 +68,7 @@ public class TownyFeature extends BukkitMaskManager implements Listener { final Location loc1 = mycoord.getLowerMostCornerLocation(); final Location loc2 = mycoord.getUpperMostCornerLocation(); final BlockVector3 pos1 = BlockVector3.at(loc1.getX(), loc1.getY(), loc1.getZ()); - final BlockVector3 pos2 = BlockVector3.at(loc2.getX(), loc2.getY(), loc2.getZ()); + final BlockVector3 pos2 = BlockVector3.at(loc2.getX() - 1, loc2.getY(), loc2.getZ() - 1); return new FaweMask(new CuboidRegion(pos1, pos2)) { @Override public boolean isValid(com.sk89q.worldedit.entity.Player player, MaskType type) { From 88533118bcb20f288f33c245d40fc6a3f9805ab3 Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 19 Jun 2023 22:46:10 +0200 Subject: [PATCH 093/161] fix: uncache the chunk SET at a better time in ChunkHolder to prevent "lost" changes (#2300) - blocks could still be set to the ChunkHolder during a call - create a new chunk SET in that case - make cached get/set volatile to improve thread safety --- .../queue/implementation/chunk/ChunkHolder.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java index 7390758bc..9172d8b3e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java @@ -45,8 +45,8 @@ public class ChunkHolder> implements IQueueChunk { private final ReentrantWrappedStampedLock calledLock = new ReentrantWrappedStampedLock(); - private IChunkGet chunkExisting; // The existing chunk (e.g. a clipboard, or the world, before changes) - private IChunkSet chunkSet; // The blocks to be set to the chunkExisting + private volatile IChunkGet chunkExisting; // The existing chunk (e.g. a clipboard, or the world, before changes) + private volatile IChunkSet chunkSet; // The blocks to be set to the chunkExisting private IBlockDelegate delegate; // delegate handles the abstraction of the chunk layers private IQueueExtent extent; // the parent queue extent which has this chunk private int chunkX; @@ -1042,13 +1042,12 @@ public class ChunkHolder> implements IQueueChunk { calledLock.lock(); final long stamp = calledLock.getStampChecked(); if (chunkSet != null && !chunkSet.isEmpty()) { + this.delegate = GET; chunkSet.setBitMask(bitMask); try { - return this.call(chunkSet.createCopy(), () -> { - this.delegate = NULL; - chunkSet = null; - calledLock.unlock(stamp); - }); + IChunkSet copy = chunkSet.createCopy(); + chunkSet = null; + return this.call(copy, () -> calledLock.unlock(stamp)); } catch (Throwable t) { calledLock.unlock(); throw t; From d961aa91bce8c44e921741a8e7d71d3fe3679006 Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 22 Jun 2023 11:24:03 +0100 Subject: [PATCH 094/161] fix: fix regex block masking (#2242) --- .../core/function/mask/BlockMaskBuilder.java | 374 +++++++----------- .../core/math/FastBitSet.java | 4 + .../world/block/FuzzyBlockState.java | 2 +- 3 files changed, 156 insertions(+), 224 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/BlockMaskBuilder.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/BlockMaskBuilder.java index 5bfeb766c..2471ff262 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/BlockMaskBuilder.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/BlockMaskBuilder.java @@ -20,12 +20,11 @@ import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypesCache; -import java.util.AbstractMap; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; -import java.util.HashSet; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; @@ -36,10 +35,12 @@ import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; -import java.util.function.BiPredicate; import java.util.function.Predicate; +import java.util.regex.Pattern; import java.util.stream.Collectors; +import static com.google.common.base.Preconditions.checkNotNull; + public class BlockMaskBuilder { private static final Operator GREATER = (a, b) -> a > b; @@ -63,58 +64,97 @@ public class BlockMaskBuilder { this.bitSets = bitSets; } - private boolean filterRegex(BlockType blockType, PropertyKey key, String regex) { + private boolean handleRegex(BlockType blockType, PropertyKey key, String regex, FuzzyStateAllowingBuilder builder) { Property property = blockType.getProperty(key); if (property == null) { return false; } - List values = property.getValues(); boolean result = false; + List values = property.getValues(); for (int i = 0; i < values.size(); i++) { - Object value = values.get(i); - if (!value.toString().matches(regex) && has(blockType, property, i)) { - filter(blockType, property, i); + if (values.get(i).toString().matches(regex)) { + builder.allow(property, i); result = true; } } return result; } - private boolean filterOperator(BlockType blockType, PropertyKey key, Operator operator, CharSequence value) { + private boolean handleOperator( + BlockType blockType, + PropertyKey key, + Operator operator, + CharSequence stringValue, + FuzzyStateAllowingBuilder builder + ) { Property property = blockType.getProperty(key); if (property == null) { return false; } - int index = property.getIndexFor(value); + int index = property.getIndexFor(stringValue); List values = property.getValues(); boolean result = false; for (int i = 0; i < values.size(); i++) { - if (!operator.test(index, i) && has(blockType, property, i)) { - filter(blockType, property, i); + if (operator.test(index, i)) { + builder.allow(property, i); result = true; } } return result; } - private boolean filterRegexOrOperator(BlockType type, PropertyKey key, Operator operator, CharSequence value) { - boolean result = false; - if (!type.hasProperty(key)) { - if (operator == EQUAL) { - result = bitSets[type.getInternalId()] != null; - remove(type); + private boolean handleRegexOrOperator( + BlockType type, + PropertyKey key, + Operator operator, + CharSequence value, + FuzzyStateAllowingBuilder builder + ) { + if (!type.hasProperty(key) && operator == EQUAL) { + return false; + } + if (value.length() == 0) { + return false; + } + if ((operator == EQUAL || operator == EQUAL_OR_NULL) && !StringMan.isAlphanumericUnd(value)) { + return handleRegex(type, key, value.toString(), builder); + } else { + return handleOperator(type, key, operator, value, builder); + } + } + + private void add(FuzzyStateAllowingBuilder builder) { + long[] states = bitSets[builder.getType().getInternalId()]; + if (states == ALL) { + bitSets[builder.getType().getInternalId()] = states = FastBitSet.create(builder.getType().getMaxStateId() + 1); + FastBitSet.unsetAll(states); + } + applyRecursive(0, builder.getType().getInternalId(), builder, states); + } + + private void applyRecursive( + int propertiesIndex, + int state, + FuzzyStateAllowingBuilder builder, + long[] states + ) { + AbstractProperty current = (AbstractProperty) builder.getType().getProperties().get(propertiesIndex); + List values = current.getValues(); + if (propertiesIndex + 1 < builder.getType().getProperties().size()) { + for (int i = 0; i < values.size(); i++) { + if (builder.allows(current) || builder.allows(current, i)) { + int newState = current.modifyIndex(state, i); + applyRecursive(propertiesIndex + 1, newState, builder, states); + } } } else { - if (value.length() == 0) { - return result; - } - if ((operator == EQUAL || operator == EQUAL_OR_NULL) && !StringMan.isAlphanumericUnd(value)) { - result = filterRegex(type, key, value.toString()); - } else { - result = filterOperator(type, key, operator, value); + for (int i = 0; i < values.size(); i++) { + if (builder.allows(current) || builder.allows(current, i)) { + int index = current.modifyIndex(state, i) >> BlockTypesCache.BIT_OFFSET; + FastBitSet.set(states, index); + } } } - return result; } public BlockMaskBuilder addRegex(final String input) throws InputParseException { @@ -130,26 +170,28 @@ public class BlockMaskBuilder { charSequence.setString(input); charSequence.setSubstring(0, propStart); - BlockType type = null; - List blockTypeList = null; + List blockTypeList; + List builders; if (StringMan.isAlphanumericUnd(charSequence)) { - type = BlockTypes.parse(charSequence.toString()); + BlockType type = BlockTypes.parse(charSequence.toString()); + blockTypeList = Collections.singletonList(type); + builders = Collections.singletonList(new FuzzyStateAllowingBuilder(type)); add(type); } else { String regex = charSequence.toString(); blockTypeList = new ArrayList<>(); - for (BlockType myType : BlockTypesCache.values) { - if (myType.getId().matches(regex)) { - blockTypeList.add(myType); - add(myType); + builders = new ArrayList<>(); + Pattern pattern = Pattern.compile("(minecraft:)?" + regex); + for (BlockType type : BlockTypesCache.values) { + if (pattern.matcher(type.getId()).find()) { + blockTypeList.add(type); + builders.add(new FuzzyStateAllowingBuilder(type)); + add(type); } } if (blockTypeList.isEmpty()) { throw new InputParseException(Caption.of("fawe.error.no-block-found", TextComponent.of(input))); } - if (blockTypeList.size() == 1) { - type = blockTypeList.get(0); - } } // Empty string charSequence.setSubstring(0, 0); @@ -169,11 +211,11 @@ public class BlockMaskBuilder { } case ']', ',' -> { charSequence.setSubstring(last, i); - if (key == null && PropertyKey.getByName(charSequence) == null) { + if (key == null && (key = PropertyKey.getByName(charSequence)) == null) { suggest( input, charSequence.toString(), - type != null ? Collections.singleton(type) : blockTypeList + blockTypeList ); } if (operator == null) { @@ -182,34 +224,20 @@ public class BlockMaskBuilder { () -> Arrays.asList("=", "~", "!", "<", ">", "<=", ">=") ); } - boolean filtered = false; - if (type != null) { - filtered = filterRegexOrOperator(type, key, operator, charSequence); - } else { - for (BlockType myType : blockTypeList) { - filtered |= filterRegexOrOperator(myType, key, operator, charSequence); + for (int index = 0; index < blockTypeList.size(); index++) { + if (!handleRegexOrOperator( + blockTypeList.get(index), + key, + operator, + charSequence, + builders.get(index) + )) { + // If we cannot find a matching property for all to mask, do not mask the block + blockTypeList.remove(index); + builders.remove(index); + index--; } } - if (!filtered) { - String value = charSequence.toString(); - final PropertyKey fKey = key; - Collection types = type != null ? Collections.singleton(type) : blockTypeList; - throw new SuggestInputParseException(Caption.of("fawe.error.no-value-for-input", input), () -> { - HashSet values = new HashSet<>(); - types.stream().filter(t -> t.hasProperty(fKey)).forEach(t -> { - Property p = t.getProperty(fKey); - for (int j = 0; j < p.getValues().size(); j++) { - if (has(t, p, j)) { - String o = p.getValues().get(j).toString(); - if (o.startsWith(value)) { - values.add(o); - } - } - } - }); - return new ArrayList<>(values); - }); - } // Reset state key = null; operator = null; @@ -235,7 +263,7 @@ public class BlockMaskBuilder { suggest( input, charSequence.toString(), - type != null ? Collections.singleton(type) : blockTypeList + blockTypeList ); } } @@ -245,13 +273,18 @@ public class BlockMaskBuilder { } } } + for (FuzzyStateAllowingBuilder builder : builders) { + if (builder.allows()) { + add(builder); + } + } } else { if (StringMan.isAlphanumericUnd(input)) { add(BlockTypes.parse(input)); } else { boolean success = false; for (BlockType myType : BlockTypesCache.values) { - if (myType.getId().matches(input)) { + if (myType.getId().matches("(minecraft:)?" + input)) { add(myType); success = true; } @@ -275,16 +308,6 @@ public class BlockMaskBuilder { return this; } - private boolean has(BlockType type, Property property, int index) { - AbstractProperty prop = (AbstractProperty) property; - long[] states = bitSets[type.getInternalId()]; - if (states == null) { - return false; - } - int localI = index << prop.getBitOffset() >> BlockTypesCache.BIT_OFFSET; - return (states == ALL || FastBitSet.get(states, localI)); - } - private void suggest(String input, String property, Collection finalTypes) throws InputParseException { throw new SuggestInputParseException(Caption.of("worldedit.error.parser.unknown-property", property, input), () -> { Set keys = PropertyKeySet.empty(); @@ -381,42 +404,6 @@ public class BlockMaskBuilder { return this; } - @SuppressWarnings({"unchecked", "rawtypes"}) - public BlockMaskBuilder filter( - Predicate typePredicate, - BiPredicate, T>> allowed - ) { - for (int i = 0; i < bitSets.length; i++) { - long[] states = bitSets[i]; - if (states == null) { - continue; - } - BlockType type = BlockTypes.get(i); - if (!typePredicate.test(type)) { - bitSets[i] = null; - continue; - } - List> properties = (List>) type.getProperties(); - for (AbstractProperty prop : properties) { - List values = prop.getValues(); - for (int j = 0; j < values.size(); j++) { - int localI = j << prop.getBitOffset() >> BlockTypesCache.BIT_OFFSET; - if (states == ALL || FastBitSet.get(states, localI)) { - if (!allowed.test(type, new AbstractMap.SimpleEntry(prop, values.get(j)))) { - if (states == ALL) { - bitSets[i] = states = FastBitSet.create(type.getMaxStateId() + 1); - FastBitSet.setAll(states); - } - FastBitSet.clear(states, localI); - reset(false); - } - } - } - } - } - return this; - } - public BlockMaskBuilder add(BlockType type) { bitSets[type.getInternalId()] = ALL; return this; @@ -478,117 +465,6 @@ public class BlockMaskBuilder { return this; } - @SuppressWarnings({"unchecked", "rawtypes"}) - public BlockMaskBuilder addAll( - Predicate typePredicate, - BiPredicate, ?>> propPredicate - ) { - for (int i = 0; i < bitSets.length; i++) { - long[] states = bitSets[i]; - if (states == ALL) { - continue; - } - BlockType type = BlockTypes.get(i); - if (!typePredicate.test(type)) { - continue; - } - for (AbstractProperty prop : (List>) type.getProperties()) { - List values = prop.getValues(); - for (int j = 0; j < values.size(); j++) { - int localI = j << prop.getBitOffset() >> BlockTypesCache.BIT_OFFSET; - if (states == null || !FastBitSet.get(states, localI)) { - if (propPredicate.test(type, new AbstractMap.SimpleEntry(prop, values.get(j)))) { - if (states == null) { - bitSets[i] = states = FastBitSet.create(type.getMaxStateId() + 1); - } - FastBitSet.set(states, localI); - reset(false); - } - } - } - } - } - return this; - } - - public BlockMaskBuilder add(BlockType type, Property property, int index) { - AbstractProperty prop = (AbstractProperty) property; - long[] states = bitSets[type.getInternalId()]; - if (states == ALL) { - return this; - } - - List values = property.getValues(); - int localI = index << prop.getBitOffset() >> BlockTypesCache.BIT_OFFSET; - if (states == null || !FastBitSet.get(states, localI)) { - if (states == null) { - bitSets[type.getInternalId()] = states = FastBitSet.create(type.getMaxStateId() + 1); - } - set(type, states, property, index); - reset(false); - } - return this; - } - - public BlockMaskBuilder filter(BlockType type, Property property, int index) { - AbstractProperty prop = (AbstractProperty) property; - long[] states = bitSets[type.getInternalId()]; - if (states == null) { - return this; - } - List values = property.getValues(); - int localI = index << prop.getBitOffset() >> BlockTypesCache.BIT_OFFSET; - if (states == ALL || FastBitSet.get(states, localI)) { - if (states == ALL) { - bitSets[type.getInternalId()] = states = FastBitSet.create(type.getMaxStateId() + 1); - FastBitSet.setAll(states); - } - clear(type, states, property, index); - reset(false); - } - return this; - } - - private void applyRecursive(List properties, int propertiesIndex, int state, long[] states, boolean set) { - AbstractProperty current = (AbstractProperty) properties.get(propertiesIndex); - List values = current.getValues(); - if (propertiesIndex + 1 < properties.size()) { - for (int i = 0; i < values.size(); i++) { - int newState = current.modifyIndex(state, i); - applyRecursive(properties, propertiesIndex + 1, newState, states, set); - } - } else { - for (int i = 0; i < values.size(); i++) { - int index = current.modifyIndex(state, i) >> BlockTypesCache.BIT_OFFSET; - if (set) { - FastBitSet.set(states, index); - } else { - FastBitSet.clear(states, index); - } - } - } - } - - private void set(BlockType type, long[] bitSet, Property property, int index) { - FastBitSet.set(bitSet, index); - if (type.getProperties().size() > 1) { - ArrayList properties = new ArrayList<>(type.getProperties()); - properties.remove(property); - int state = ((AbstractProperty) property).modifyIndex(type.getInternalId(), index); - applyRecursive(properties, 0, state, bitSet, true); - } - } - - private void clear(BlockType type, long[] bitSet, Property property, int index) { - FastBitSet.clear(bitSet, index); - if (type.getProperties().size() > 1) { - ArrayList properties = new ArrayList<>(type.getProperties()); - properties.remove(property); - int state = ((AbstractProperty) property).modifyIndex(type.getInternalId(), index); - applyRecursive(properties, 0, state, bitSet, false); - } - } - public BlockMaskBuilder optimize() { if (!optimizedStates) { for (int i = 0; i < bitSets.length; i++) { @@ -667,4 +543,56 @@ public class BlockMaskBuilder { } + private static class FuzzyStateAllowingBuilder { + + private final BlockType type; + private final Map, List> masked = new HashMap<>(); + + private FuzzyStateAllowingBuilder(BlockType type) { + this.type = type; + } + + private BlockType getType() { + return this.type; + } + + private List> getMaskedProperties() { + return masked + .entrySet() + .stream() + .filter(e -> !e.getValue().isEmpty()) + .map(Map.Entry::getKey) + .collect(Collectors.toList()); + } + + private void allow(Property property, int index) { + checkNotNull(property); + if (!type.hasProperty(property.getKey())) { + throw new IllegalArgumentException(String.format( + "Property %s cannot be applied to block type %s", + property.getName(), + type.getId() + )); + } + masked.computeIfAbsent(property, k -> new ArrayList<>()).add(index); + } + + private boolean allows() { + //noinspection SimplifyStreamApiCallChains - Marginally faster like this + return !masked.isEmpty() && !masked.values().stream().anyMatch(List::isEmpty); + } + + private boolean allows(Property property) { + return !masked.containsKey(property); + } + + private boolean allows(Property property, int index) { + if (!masked.containsKey(property)) { + return true; + } + return masked.get(property).contains(index); + } + + } + } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/FastBitSet.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/FastBitSet.java index 92754b669..fa7199d83 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/FastBitSet.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/math/FastBitSet.java @@ -69,6 +69,10 @@ public class FastBitSet { Arrays.fill(bits, -1L); } + public static void unsetAll(long[] bits) { + Arrays.fill(bits, 0); + } + public static void and(long[] bits, final long[] other) { final int end = Math.min(other.length, bits.length); for (int i = 0; i < end; ++i) { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java index ee4ab12ad..b32fee41f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/FuzzyBlockState.java @@ -182,7 +182,7 @@ public class FuzzyBlockState extends BlockState { checkNotNull(property); checkNotNull(value); checkNotNull(type, "The type must be set before the properties!"); - type.getProperty(property.getName()); // Verify the property is valid for this type + checkNotNull(type.getProperty(property.getName())); // Verify the property is valid for this type values.put(property, value); return this; } From 9f0a0dbd355bf5497744bfcf023f69c0c224cba7 Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 22 Jun 2023 20:32:54 +0100 Subject: [PATCH 095/161] fix: ensure mask is initialised upon visiting a point in BreadthFirstSearch (#2314) fix: ensure mask is initialised upon visiting a point in BreadFirstSearch --- .../com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java | 1 + 1 file changed, 1 insertion(+) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java index c1b36ef6b..7f3e5da63 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/visitor/BreadthFirstSearch.java @@ -229,6 +229,7 @@ public abstract class BreadthFirstSearch implements Operation { */ public void visit(BlockVector3 position) { if (!visited.contains(position)) { + isVisitable(position, position); // Ignore this, just to initialize mask on this point queue.add(position); visited.add(position); } From c0037aa0835a1b3a87eeff10e86345e39e343fba Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Fri, 23 Jun 2023 14:56:47 +0200 Subject: [PATCH 096/161] [ci skip] Remove unsupported versions from template --- .github/ISSUE_TEMPLATE/bug_report.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 22993216e..3b9cf1767 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -29,10 +29,6 @@ body: options: - '1.20' - '1.19.4' - - '1.19.3' - - '1.19.2' - - '1.19.1' - - '1.19' - '1.18.2' - '1.17.1' - '1.16.5' From 05d5ad161a00deb8d42fcd1776b95e0de06f30e4 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Fri, 23 Jun 2023 21:57:51 +0100 Subject: [PATCH 097/161] chore: add obnoxious error message if using p2 v7 with FAWE main branch --- .../java/com/fastasyncworldedit/bukkit/FaweBukkit.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java index e4f66dea3..34ed78be2 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java @@ -320,6 +320,15 @@ public class FaweBukkit implements IFawe, Listener { if (PlotSquared.get().getVersion().version[0] == 6) { WEManager.weManager().addManager(new com.fastasyncworldedit.bukkit.regions.plotsquared.PlotSquaredFeature()); LOGGER.info("Plugin 'PlotSquared' v6 found. Using it now."); + } else if (PlotSquared.get().getVersion().version[0] == 7) { + WEManager.weManager().addManager(new com.fastasyncworldedit.bukkit.regions.plotsquared.PlotSquaredFeature()); + LOGGER.error("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + LOGGER.error("!! !!"); + LOGGER.error("!! ERROR: PlotSquared v7 found. This FAWE version does not support PlotSquared V7 !!"); + LOGGER.error("!! Follow the instructions when notified of v7 release candidates the and use FAWE from !!"); + LOGGER.error("!! https://ci.athion.net/job/FastAsyncWorldEdit-Pull-Requests/view/change-requests/job/PR-2075/ !!"); + LOGGER.error("!! !!"); + LOGGER.error("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); } else { LOGGER.error("Incompatible version of PlotSquared found. Please use PlotSquared v6."); LOGGER.info("https://www.spigotmc.org/resources/77506/"); From 924805af8fc5b7d6a111b92ebdbadb6fdbc07958 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sun, 25 Jun 2023 13:52:13 +0100 Subject: [PATCH 098/161] fix: fix obnoxious error message if using p2 v7 with FAWE main branch --- .../src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java index 34ed78be2..c2c9923e7 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java @@ -325,7 +325,7 @@ public class FaweBukkit implements IFawe, Listener { LOGGER.error("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); LOGGER.error("!! !!"); LOGGER.error("!! ERROR: PlotSquared v7 found. This FAWE version does not support PlotSquared V7 !!"); - LOGGER.error("!! Follow the instructions when notified of v7 release candidates the and use FAWE from !!"); + LOGGER.error("!! Follow the instructions when notified of v7 release candidates and use FAWE from !!"); LOGGER.error("!! https://ci.athion.net/job/FastAsyncWorldEdit-Pull-Requests/view/change-requests/job/PR-2075/ !!"); LOGGER.error("!! !!"); LOGGER.error("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); From 97ee71bbd08dc93005a125f0723e562dcd41861f Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Tue, 27 Jun 2023 13:56:30 +0200 Subject: [PATCH 099/161] Update settings name in queue.target_size warning --- .../src/main/java/com/fastasyncworldedit/core/Fawe.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java index 8f4818f2f..eb7eaf8ce 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java @@ -356,8 +356,8 @@ public class Fawe { ); if (Settings.settings().QUEUE.TARGET_SIZE < 4 * Settings.settings().QUEUE.PARALLEL_THREADS) { LOGGER.error( - "queue.target_size is {}, and queue.parallel_threads is {}. It is HIGHLY recommended that queue" + - ".target_size be at least four times queue.parallel_threads or greater.", + "queue.target-size is {}, and queue.parallel_threads is {}. It is HIGHLY recommended that queue" + + ".target-size be at least four times queue.parallel-threads or greater.", Settings.settings().QUEUE.TARGET_SIZE, Settings.settings().QUEUE.PARALLEL_THREADS ); From 476ba4ab418648ed6d5f3a91bba6f9c78d5dede2 Mon Sep 17 00:00:00 2001 From: Jordan Date: Tue, 27 Jun 2023 17:36:54 +0100 Subject: [PATCH 100/161] refactor: efficiency improvements to some editsession methods (#2304) --- .../java/com/sk89q/worldedit/EditSession.java | 273 +++++++++++------- 1 file changed, 172 insertions(+), 101 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index 1b405fe75..f8a08148b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -2161,10 +2161,12 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { final int ceilRadiusX = (int) Math.ceil(radiusX); final int ceilRadiusZ = (int) Math.ceil(radiusZ); - double xSqr; - double zSqr; - double distanceSq; + double xSqr, zSqr, distanceSq; + double xn, zn; + double dx2, dz2; double nextXn = 0; + double nextZn, nextMinZn; + int xx, x_x, zz, z_z, yy; if (thickness != 0) { double nextMinXn = 0; @@ -2172,19 +2174,18 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { final double minInvRadiusZ = 1 / (radiusZ - thickness); forX: for (int x = 0; x <= ceilRadiusX; ++x) { - final double xn = nextXn; - double dx2 = nextMinXn * nextMinXn; + xn = nextXn; + dx2 = nextMinXn * nextMinXn; nextXn = (x + 1) * invRadiusX; nextMinXn = (x + 1) * minInvRadiusX; - double nextZn = 0; - double nextMinZn = 0; + nextZn = 0; + nextMinZn = 0; xSqr = xn * xn; + xx = px + x; + x_x = px - x; forZ: for (int z = 0; z <= ceilRadiusZ; ++z) { - final double zn = nextZn; - double dz2 = nextMinZn * nextMinZn; - nextZn = (z + 1) * invRadiusZ; - nextMinZn = (z + 1) * minInvRadiusZ; + zn = nextZn; zSqr = zn * zn; distanceSq = xSqr + zSqr; if (distanceSq > 1) { @@ -2193,16 +2194,23 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } break forZ; } + dz2 = nextMinZn * nextMinZn; + nextZn = (z + 1) * invRadiusZ; + nextMinZn = (z + 1) * minInvRadiusZ; if ((dz2 + nextMinXn * nextMinXn <= 1) && (nextMinZn * nextMinZn + dx2 <= 1)) { continue; } + zz = pz + z; + z_z = pz - z; + for (int y = 0; y < height; ++y) { - this.setBlock(mutableBlockVector3.setComponents(px + x, py + y, pz + z), block); - this.setBlock(mutableBlockVector3.setComponents(px - x, py + y, pz + z), block); - this.setBlock(mutableBlockVector3.setComponents(px + x, py + y, pz - z), block); - this.setBlock(mutableBlockVector3.setComponents(px - x, py + y, pz - z), block); + yy = py + y; + this.setBlock(xx, yy, zz, block); + this.setBlock(x_x, yy, zz, block); + this.setBlock(xx, yy, z_z, block); + this.setBlock(x_x, yy, z_z, block); } } } @@ -2210,14 +2218,17 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { //FAWE end forX: for (int x = 0; x <= ceilRadiusX; ++x) { - final double xn = nextXn; + xn = nextXn; nextXn = (x + 1) * invRadiusX; - double nextZn = 0; + nextZn = 0; xSqr = xn * xn; + // FAWE start + xx = px + x; + x_x = px - x; + //FAWE end forZ: for (int z = 0; z <= ceilRadiusZ; ++z) { - final double zn = nextZn; - nextZn = (z + 1) * invRadiusZ; + zn = nextZn; zSqr = zn * zn; distanceSq = xSqr + zSqr; if (distanceSq > 1) { @@ -2227,18 +2238,27 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { break forZ; } + // FAWE start + nextZn = (z + 1) * invRadiusZ; + //FAWE end if (!filled) { if ((zSqr + nextXn * nextXn <= 1) && (nextZn * nextZn + xSqr <= 1)) { continue; } } + //FAWE start + zz = pz + z; + z_z = pz - z; + //FAWE end + for (int y = 0; y < height; ++y) { - //FAWE start - mutable - this.setBlock(mutableBlockVector3.setComponents(px + x, py + y, pz + z), block); - this.setBlock(mutableBlockVector3.setComponents(px - x, py + y, pz + z), block); - this.setBlock(mutableBlockVector3.setComponents(px + x, py + y, pz - z), block); - this.setBlock(mutableBlockVector3.setComponents(px - x, py + y, pz - z), block); + //FAWE start + yy = py + y; + this.setBlock(xx, yy, zz, block); + this.setBlock(x_x, yy, zz, block); + this.setBlock(xx, yy, z_z, block); + this.setBlock(x_x, yy, z_z, block); //FAWE end } } @@ -2293,7 +2313,6 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { int px = pos.getBlockX(); int py = pos.getBlockY(); int pz = pos.getBlockZ(); - MutableBlockVector3 mutable = new MutableBlockVector3(); final int ceilRadiusX = (int) Math.ceil(radiusX); final int ceilRadiusY = (int) Math.ceil(radiusY); @@ -2301,31 +2320,43 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { double threshold = 0.5; + double dx, dy, dz, dxy, dxz, dyz, dxyz; + int xx, x_x, yy, y_y, zz, z_z; + double xnx, yny, znz; double nextXn = 0; - double dx; - double dy; - double dz; - double dxy; - double dxyz; + double nextYn, nextZn; + double nextXnSq, nextYnSq, nextZnSq; + double xn, yn, zn; forX: for (int x = 0; x <= ceilRadiusX; ++x) { - final double xn = nextXn; + xn = nextXn; dx = xn * xn; nextXn = (x + 1) * invRadiusX; - double nextYn = 0; + nextXnSq = nextXn * nextXn; + nextYn = 0; + xx = px + x; + x_x = px - x; + xnx = x * nx; forY: for (int y = 0; y <= ceilRadiusY; ++y) { - final double yn = nextYn; + yn = nextYn; dy = yn * yn; dxy = dx + dy; nextYn = (y + 1) * invRadiusY; - double nextZn = 0; + nextYnSq = nextYn * nextYn; + nextZn = 0; + yy = py + y; + y_y = py - y; + yny = y * ny; forZ: for (int z = 0; z <= ceilRadiusZ; ++z) { - final double zn = nextZn; + zn = nextZn; dz = zn * zn; dxyz = dxy + dz; + dxz = dx + dz; + dyz = dy + dz; nextZn = (z + 1) * invRadiusZ; + nextZnSq = nextZn * nextZn; if (dxyz > 1) { if (z == 0) { if (y == 0) { @@ -2336,34 +2367,37 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { break forZ; } if (!filled) { - if (nextXn * nextXn + dy + dz <= 1 && nextYn * nextYn + dx + dz <= 1 && nextZn * nextZn + dx + dy <= 1) { + if (nextXnSq + dyz <= 1 && nextYnSq + dxz <= 1 && nextZnSq + dxy <= 1) { continue; } } + zz = pz + z; + z_z = pz - z; + znz = z * nz; - if (Math.abs((x) * nx + (y) * ny + (z) * nz) < threshold) { - setBlock(mutable.setComponents(px + x, py + y, pz + z), block); + if (Math.abs(xnx + yny + znz) < threshold) { + setBlock(xx, yy, zz, block); } - if (Math.abs((-x) * nx + (y) * ny + (z) * nz) < threshold) { - setBlock(mutable.setComponents(px - x, py + y, pz + z), block); + if (Math.abs(-xnx + yny + znz) < threshold) { + setBlock(x_x, yy, zz, block); } - if (Math.abs((x) * nx + (-y) * ny + (z) * nz) < threshold) { - setBlock(mutable.setComponents(px + x, py - y, pz + z), block); + if (Math.abs(xnx - yny + znz) < threshold) { + setBlock(xx, y_y, zz, block); } - if (Math.abs((x) * nx + (y) * ny + (-z) * nz) < threshold) { - setBlock(mutable.setComponents(px + x, py + y, pz - z), block); + if (Math.abs(xnx + yny - znz) < threshold) { + setBlock(xx, yy, z_z, block); } - if (Math.abs((-x) * nx + (-y) * ny + (z) * nz) < threshold) { - setBlock(mutable.setComponents(px - x, py - y, pz + z), block); + if (Math.abs(-xnx - yny + znz) < threshold) { + setBlock(x_x, y_y, zz, block); } - if (Math.abs((x) * nx + (-y) * ny + (-z) * nz) < threshold) { - setBlock(mutable.setComponents(px + x, py - y, pz - z), block); + if (Math.abs(xnx - yny - znz) < threshold) { + setBlock(xx, y_y, z_z, block); } - if (Math.abs((-x) * nx + (y) * ny + (-z) * nz) < threshold) { - setBlock(mutable.setComponents(px - x, py + y, pz - z), block); + if (Math.abs(-xnx + yny - znz) < threshold) { + setBlock(x_x, yy, z_z, block); } - if (Math.abs((-x) * nx + (-y) * ny + (-z) * nz) < threshold) { - setBlock(mutable.setComponents(px - x, py - y, pz - z), block); + if (Math.abs(-xnx - yny - znz) < threshold) { + setBlock(x_x, y_y, z_z, block); } } } @@ -2418,29 +2452,38 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { final int ceilRadiusZ = (int) Math.ceil(radiusZ); //FAWE start - int yy; - //FAWE end - double nextXn = 0; + double nextYn, nextZn; + double nextXnSq, nextYnSq, nextZnSq; + double xn, yn, zn, dx, dy, dz; + double dxy, dxz, dyz, dxyz; + int xx, x_x, yy, zz, z_z; + forX: for (int x = 0; x <= ceilRadiusX; ++x) { - final double xn = nextXn; - double dx = xn * xn; + xn = nextXn; + dx = xn * xn; nextXn = (x + 1) * invRadiusX; - double nextZn = 0; + nextXnSq = nextXn * nextXn; + xx = px + x; + x_x = px - x; + nextZn = 0; forZ: for (int z = 0; z <= ceilRadiusZ; ++z) { - final double zn = nextZn; - double dz = zn * zn; - double dxz = dx + dz; + zn = nextZn; + dz = zn * zn; + dxz = dx + dz; nextZn = (z + 1) * invRadiusZ; - double nextYn = 0; + nextZnSq = nextZn * nextZn; + zz = pz + z; + z_z = pz - z; + nextYn = 0; forY: for (int y = 0; y <= ceilRadiusY; ++y) { - final double yn = nextYn; - double dy = yn * yn; - double dxyz = dxz + dy; + yn = nextYn; + dy = yn * yn; + dxyz = dxz + dy; nextYn = (y + 1) * invRadiusY; if (dxyz > 1) { @@ -2453,40 +2496,45 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { break forY; } + nextYnSq = nextYn * nextYn; + dxy = dx + dy; + dyz = dy + dz; + if (!filled) { - if (nextXn * nextXn + dy + dz <= 1 && nextYn * nextYn + dx + dz <= 1 && nextZn * nextZn + dx + dy <= 1) { + if (nextXnSq + dyz <= 1 && nextYnSq + dxz <= 1 && nextZnSq + dxy <= 1) { continue; } } //FAWE start yy = py + y; if (yy <= maxY) { - this.setBlock(px + x, py + y, pz + z, block); + this.setBlock(xx, yy, zz, block); if (x != 0) { - this.setBlock(px - x, py + y, pz + z, block); + this.setBlock(x_x, yy, zz, block); } if (z != 0) { - this.setBlock(px + x, py + y, pz - z, block); + this.setBlock(xx, yy, z_z, block); if (x != 0) { - this.setBlock(px - x, py + y, pz - z, block); + this.setBlock(x_x, yy, z_z, block); } } } if (y != 0 && (yy = py - y) >= minY) { - this.setBlock(px + x, yy, pz + z, block); + this.setBlock(xx, yy, zz, block); if (x != 0) { - this.setBlock(px - x, yy, pz + z, block); + this.setBlock(x_x, yy, zz, block); } if (z != 0) { - this.setBlock(px + x, yy, pz - z, block); + this.setBlock(xx, yy, z_z, block); if (x != 0) { - this.setBlock(px - x, yy, pz - z, block); + this.setBlock(x_x, yy, z_z, block); } } } } } } + //FAWE end return changes; //FAWE end @@ -2509,17 +2557,22 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { int bz = position.getZ(); int height = size; + int yy, xx, x_x, zz, z_z; for (int y = 0; y <= height; ++y) { size--; + yy = y + by; for (int x = 0; x <= size; ++x) { + xx = bx + x; + x_x = bx - x; for (int z = 0; z <= size; ++z) { - + zz = bz + z; + z_z = bz - z; if ((filled && z <= size && x <= size) || z == size || x == size) { - setBlock(x + bx, y + by, z + bz, block); - setBlock(-x + bx, y + by, z + bz, block); - setBlock(x + bx, y + by, -z + bz, block); - setBlock(-x + bx, y + by, -z + bz, block); + setBlock(xx, yy, zz, block); + setBlock(x_x, yy, zz, block); + setBlock(xx, yy, z_z, block); + setBlock(x_x, yy, z_z, block); } } } @@ -3774,19 +3827,28 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { int radiusSqr = (int) (size * size); int sizeInt = (int) size * 2; + int xx, yy, zz; + double distance; + double noise; + if (sphericity == 1) { + double nx, ny, nz; + double d1, d2; for (int x = -sizeInt; x <= sizeInt; x++) { - double nx = seedX + x * distort; - double d1 = x * x * modX; + nx = seedX + x * distort; + d1 = x * x * modX; + xx = px + x; for (int y = -sizeInt; y <= sizeInt; y++) { - double d2 = d1 + y * y * modY; - double ny = seedY + y * distort; + d2 = d1 + y * y * modY; + ny = seedY + y * distort; + yy = py + y; for (int z = -sizeInt; z <= sizeInt; z++) { - double nz = seedZ + z * distort; - double distance = d2 + z * z * modZ; - double noise = amplitude * SimplexNoise.noise(nx, ny, nz); + nz = seedZ + z * distort; + distance = d2 + z * z * modZ; + zz = pz + z; + noise = amplitude * SimplexNoise.noise(nx, ny, nz); if (distance + distance * noise < radiusSqr) { - setBlock(px + x, py + y, pz + z, pattern); + setBlock(xx, yy, zz, pattern); } } } @@ -3803,39 +3865,48 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { MutableVector3 mutable = new MutableVector3(); double roughness = 1 - sphericity; + int x; + int y; + int z; + double xScaled; + double yScaled; + double zScaled; + double manDist; + double distSqr; for (int xr = -sizeInt; xr <= sizeInt; xr++) { + xx = px + xr; for (int yr = -sizeInt; yr <= sizeInt; yr++) { + yy = py + yr; for (int zr = -sizeInt; zr <= sizeInt; zr++) { + zz = pz + zr; // pt == mutable as it's a MutableVector3 // so it must be set each time - mutable.mutX(xr); - mutable.mutY(yr); - mutable.mutZ(zr); + mutable.setComponents(xr, yr, zr); Vector3 pt = transform.apply(mutable); - int x = MathMan.roundInt(pt.getX()); - int y = MathMan.roundInt(pt.getY()); - int z = MathMan.roundInt(pt.getZ()); + x = MathMan.roundInt(pt.getX()); + y = MathMan.roundInt(pt.getY()); + z = MathMan.roundInt(pt.getZ()); - double xScaled = Math.abs(x) * modX; - double yScaled = Math.abs(y) * modY; - double zScaled = Math.abs(z) * modZ; - double manDist = xScaled + yScaled + zScaled; - double distSqr = x * x * modX + z * z * modZ + y * y * modY; + xScaled = Math.abs(x) * modX; + yScaled = Math.abs(y) * modY; + zScaled = Math.abs(z) * modZ; + manDist = xScaled + yScaled + zScaled; + distSqr = x * x * modX + z * z * modZ + y * y * modY; - double distance = Math.sqrt(distSqr) * sphericity + MathMan.max( + distance = Math.sqrt(distSqr) * sphericity + MathMan.max( manDist, xScaled * manScaleX, yScaled * manScaleY, zScaled * manScaleZ ) * roughness; - double noise = amplitude * SimplexNoise.noise( + noise = amplitude * SimplexNoise.noise( seedX + x * distort, seedZ + z * distort, seedZ + z * distort ); if (distance + distance * noise < r) { - setBlock(px + xr, py + yr, pz + zr, pattern); + setBlock(xx, yy, zz, pattern); } } } From 0554b31f1195c7561564ef066058ecf2f6d73e80 Mon Sep 17 00:00:00 2001 From: Jordan Date: Tue, 27 Jun 2023 17:37:09 +0100 Subject: [PATCH 101/161] feat: implement removal of entities if they would be in a block after the edit (#2311) - Includes some refactoring to EditSessionBuilder to prevent doubling-up of processors that are also extents - Better ordering of the EditSessionBuilder process/extent code to match where extents actually end up in the stack - Fixes #1941 --- .../core/configuration/Settings.java | 7 +- .../EntityInBlockRemovingProcessor.java | 57 ++++++++++++ .../core/extent/processor/ProcessorScope.java | 3 +- .../sk89q/worldedit/EditSessionBuilder.java | 88 +++++++++++-------- .../function/entity/ExtentEntityCopy.java | 12 +-- 5 files changed, 115 insertions(+), 52 deletions(-) create mode 100644 worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EntityInBlockRemovingProcessor.java diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java index 90ed792fa..a8d28d048 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java @@ -622,10 +622,11 @@ public class Settings extends Config { public boolean PERSISTENT_BRUSHES = true; @Comment({ - "[SAFE] Keep entities that are positioned in non-air blocks when editing an area", - "Might cause client-side FPS lag in some situations" + "[SAFE] Keep entities that are positioned in non-air blocks when editing an area (default: true)", + " - Might cause client-side FPS lag in some situations", + " - Requires fast-placement to be true" }) - public boolean KEEP_ENTITIES_IN_BLOCKS = false; + public boolean KEEP_ENTITIES_IN_BLOCKS = true; @Comment({ "[SAFE] Attempt to remove entities from the world if they were not present in the expected chunk (default: true)", diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EntityInBlockRemovingProcessor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EntityInBlockRemovingProcessor.java new file mode 100644 index 000000000..0a8839409 --- /dev/null +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EntityInBlockRemovingProcessor.java @@ -0,0 +1,57 @@ +package com.fastasyncworldedit.core.extent.processor; + +import com.fastasyncworldedit.core.queue.IBatchProcessor; +import com.fastasyncworldedit.core.queue.IChunk; +import com.fastasyncworldedit.core.queue.IChunkGet; +import com.fastasyncworldedit.core.queue.IChunkSet; +import com.sk89q.jnbt.CompoundTag; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.world.block.BlockTypes; +import org.jetbrains.annotations.Nullable; + +/** + * Processor that removes existing entities that would not be in air after the edit + * + * @since TODO + */ +public class EntityInBlockRemovingProcessor implements IBatchProcessor { + + @Override + public IChunkSet processSet(final IChunk chunk, final IChunkGet get, final IChunkSet set) { + for (CompoundTag tag : get.getEntities()) { + // Empty tags for seemingly non-existent entities can exist? + if (tag.getList("Pos").size() == 0) { + continue; + } + BlockVector3 pos = tag.getEntityPosition().toBlockPoint(); + int x = pos.getX() & 15; + int y = pos.getY(); + int z = pos.getZ() & 15; + if (!set.hasSection(y >> 4)) { + continue; + } + if (set.getBlock(x, y, z).getBlockType() != BlockTypes.__RESERVED__ && !set + .getBlock(x, y, z) + .getBlockType() + .getMaterial() + .isAir()) { + set.removeEntity(tag.getUUID()); + } + } + return set; + } + + @Nullable + @Override + public Extent construct(final Extent child) { + throw new UnsupportedOperationException("Processing only"); + } + + @Override + public ProcessorScope getScope() { + // After block removal but before history + return ProcessorScope.CUSTOM; + } + +} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/ProcessorScope.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/ProcessorScope.java index e3f09e0a3..503351fb7 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/ProcessorScope.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/ProcessorScope.java @@ -7,7 +7,8 @@ package com.fastasyncworldedit.core.extent.processor; * - CHANGING_BLOCKS (processors that may ADD or CHANGE blocks being set) * - REMOVING_BLOCKS (processors that may ADD, CHANGE or REMOVE blocks being set) * - CUSTOM (processors that do not specify a SCOPE) - * - READING_SET_BLOCKS (processors that do not alter blocks at all, and read the blocks that are actually going to set, e.g. history processors) + * - READING_SET_BLOCKS (processors that do not alter blocks at all, and read the blocks that are actually going to set, e.g. + * history processors). There is no guarantee that changes made here will be stored in history. */ public enum ProcessorScope { ADDING_BLOCKS(0), diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java index ea27f03b5..e5c53a45b 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java @@ -32,6 +32,7 @@ import com.fastasyncworldedit.core.extent.NullExtent; import com.fastasyncworldedit.core.extent.SingleRegionExtent; import com.fastasyncworldedit.core.extent.SlowExtent; import com.fastasyncworldedit.core.extent.StripNBTExtent; +import com.fastasyncworldedit.core.extent.processor.EntityInBlockRemovingProcessor; import com.fastasyncworldedit.core.extent.processor.heightmap.HeightmapProcessor; import com.fastasyncworldedit.core.extent.processor.lighting.NullRelighter; import com.fastasyncworldedit.core.extent.processor.lighting.RelightMode; @@ -543,25 +544,6 @@ public final class EditSessionBuilder { } } } - FaweRegionExtent regionExtent = null; - if (disallowedRegions != null) { // Always use MultiRegionExtent if we have blacklist regions - regionExtent = new MultiRegionExtent(this.extent, this.limit, allowedRegions, disallowedRegions); - } else if (allowedRegions == null) { - allowedRegions = new Region[]{RegionWrapper.GLOBAL()}; - } else { - if (allowedRegions.length == 0) { - regionExtent = new NullExtent(this.extent, FaweCache.NO_REGION); - } else { - if (allowedRegions.length == 1) { - regionExtent = new SingleRegionExtent(this.extent, this.limit, allowedRegions[0]); - } else { - regionExtent = new MultiRegionExtent(this.extent, this.limit, allowedRegions, null); - } - } - } - if (placeChunks && regionExtent != null) { - queue.addProcessor(regionExtent); - } // There's no need to do the below (and it'll also just be a pain to implement) if we're not placing chunks if (placeChunks) { if (((relightMode != null && relightMode != RelightMode.NONE) || (relightMode == null && Settings.settings().LIGHTING.MODE > 0))) { @@ -571,6 +553,11 @@ public final class EditSessionBuilder { queue.addProcessor(new RelightProcessor(relighter)); } queue.addProcessor(new HeightmapProcessor(world.getMinY(), world.getMaxY())); + + if (!Settings.settings().EXPERIMENTAL.KEEP_ENTITIES_IN_BLOCKS) { + queue.addProcessor(new EntityInBlockRemovingProcessor()); + } + IBatchProcessor platformProcessor = WorldEdit .getInstance() .getPlatformManager() @@ -590,24 +577,13 @@ public final class EditSessionBuilder { } else { relighter = NullRelighter.INSTANCE; } - Consumer onErrorMessage; - if (getActor() != null) { - onErrorMessage = c -> getActor().print(Caption.of("fawe.error.occurred-continuing", c)); - } else { - onErrorMessage = c -> { - }; - } - if (limit != null && !limit.isUnlimited() && regionExtent != null) { - this.extent = new LimitExtent(regionExtent, limit, onErrorMessage); - } else if (limit != null && !limit.isUnlimited()) { - this.extent = new LimitExtent(this.extent, limit, onErrorMessage); - } else if (regionExtent != null) { - this.extent = regionExtent; - } if (this.limit != null && this.limit.STRIP_NBT != null && !this.limit.STRIP_NBT.isEmpty()) { - this.extent = new StripNBTExtent(this.extent, this.limit.STRIP_NBT); + StripNBTExtent ext = new StripNBTExtent(this.extent, this.limit.STRIP_NBT); if (placeChunks) { - queue.addProcessor((IBatchProcessor) this.extent); + queue.addProcessor(ext); + } + if (!placeChunks || !combineStages) { + this.extent = ext; } } if (this.limit != null && !this.limit.isUnlimited()) { @@ -620,12 +596,50 @@ public final class EditSessionBuilder { } Set> remaps = this.limit.REMAP_PROPERTIES; if (!limitBlocks.isEmpty() || (remaps != null && !remaps.isEmpty())) { - this.extent = new DisallowedBlocksExtent(this.extent, limitBlocks, remaps); + DisallowedBlocksExtent ext = new DisallowedBlocksExtent(this.extent, limitBlocks, remaps); if (placeChunks) { - queue.addProcessor((IBatchProcessor) this.extent); + queue.addProcessor(ext); + } + if (!placeChunks || !combineStages) { + this.extent = ext; } } } + + FaweRegionExtent regionExtent = null; + if (disallowedRegions != null) { // Always use MultiRegionExtent if we have blacklist regions + regionExtent = new MultiRegionExtent(this.extent, this.limit, allowedRegions, disallowedRegions); + } else if (allowedRegions == null) { + allowedRegions = new Region[]{RegionWrapper.GLOBAL()}; + } else { + if (allowedRegions.length == 0) { + regionExtent = new NullExtent(this.extent, FaweCache.NO_REGION); + } else { + if (allowedRegions.length == 1) { + regionExtent = new SingleRegionExtent(this.extent, this.limit, allowedRegions[0]); + } else { + regionExtent = new MultiRegionExtent(this.extent, this.limit, allowedRegions, null); + } + } + } + if (regionExtent != null) { + if (placeChunks) { + queue.addProcessor(regionExtent); + } + if (!placeChunks || !combineStages) { + this.extent = regionExtent; + } + } + Consumer onErrorMessage; + if (getActor() != null) { + onErrorMessage = c -> getActor().print(Caption.of("fawe.error.occurred-continuing", c)); + } else { + onErrorMessage = c -> { + }; + } + if (limit != null && !limit.isUnlimited()) { + this.extent = new LimitExtent(this.extent, limit, onErrorMessage); + } this.extent = wrapExtent(this.extent, eventBus, event, EditSession.Stage.BEFORE_HISTORY); } return this; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java index 88f151e28..7a034d7bd 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/entity/ExtentEntityCopy.java @@ -160,17 +160,7 @@ public class ExtentEntityCopy implements EntityFunction { // Remove if (isRemoving() && success) { //FAWE start - UUID uuid = null; - if (tag.containsKey("UUID")) { - int[] arr = tag.getIntArray("UUID"); - uuid = new UUID((long) arr[0] << 32 | (arr[1] & 0xFFFFFFFFL), (long) arr[2] << 32 | (arr[3] & 0xFFFFFFFFL)); - } else if (tag.containsKey("UUIDMost")) { - uuid = new UUID(tag.getLong("UUIDMost"), tag.getLong("UUIDLeast")); - } else if (tag.containsKey("WorldUUIDMost")) { - uuid = new UUID(tag.getLong("WorldUUIDMost"), tag.getLong("WorldUUIDLeast")); - } else if (tag.containsKey("PersistentIDMSB")) { - uuid = new UUID(tag.getLong("PersistentIDMSB"), tag.getLong("PersistentIDLSB")); - } + UUID uuid = entity.getState().getNbtData().getUUID(); if (uuid != null) { if (source != null) { source.removeEntity( From 24325d91ba6a5b75ef730fc15695664444169eb0 Mon Sep 17 00:00:00 2001 From: Jordan Date: Wed, 28 Jun 2023 09:24:20 +0100 Subject: [PATCH 102/161] feat: improve (region) fawe mask handling (#2312) * feat: improve fawe mask handling - Actually cache masks, even if the player has left the region - Fix P2 isValid test for single plots - Fixes #1946 * Fix incorrect delegated method --- .../fastasyncworldedit/bukkit/FaweBukkit.java | 2 +- .../regions/GriefPreventionFeature.java | 3 - .../bukkit/regions/ResidenceFeature.java | 8 +- .../plotsquared/PlotSquaredFeature.java | 75 ++++++++++++------- .../core/regions/FaweMask.java | 20 +++++ .../core/regions/FaweMaskManager.java | 10 ++- .../core/util/WEManager.java | 68 ++++++++--------- 7 files changed, 112 insertions(+), 74 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java index c2c9923e7..46bf125c5 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java @@ -225,7 +225,7 @@ public class FaweBukkit implements IFawe, Listener { final Plugin residencePlugin = Bukkit.getServer().getPluginManager().getPlugin("Residence"); if (residencePlugin != null && residencePlugin.isEnabled()) { try { - managers.add(new ResidenceFeature(residencePlugin, this)); + managers.add(new ResidenceFeature(residencePlugin)); LOGGER.info("Attempting to use plugin 'Residence'"); } catch (Throwable ignored) { } diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/GriefPreventionFeature.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/GriefPreventionFeature.java index e7fd9ad3a..9f302d057 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/GriefPreventionFeature.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/GriefPreventionFeature.java @@ -2,10 +2,7 @@ package com.fastasyncworldedit.bukkit.regions; import com.fastasyncworldedit.core.regions.FaweMask; import com.fastasyncworldedit.core.util.TaskManager; -import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.bukkit.BukkitWorld; -import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.CuboidRegion; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/ResidenceFeature.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/ResidenceFeature.java index d72769176..a7c13cef5 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/ResidenceFeature.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/ResidenceFeature.java @@ -3,7 +3,6 @@ package com.fastasyncworldedit.bukkit.regions; import com.bekvon.bukkit.residence.Residence; import com.bekvon.bukkit.residence.protection.ClaimedResidence; import com.bekvon.bukkit.residence.protection.CuboidArea; -import com.fastasyncworldedit.bukkit.FaweBukkit; import com.fastasyncworldedit.core.regions.FaweMask; import com.fastasyncworldedit.core.util.TaskManager; import com.sk89q.worldedit.bukkit.BukkitAdapter; @@ -19,13 +18,8 @@ public class ResidenceFeature extends BukkitMaskManager implements Listener { private static final Logger LOGGER = LogManagerCompat.getLogger(); - private final FaweBukkit plugin; - private final Plugin residence; - - public ResidenceFeature(final Plugin residencePlugin, final FaweBukkit p3) { + public ResidenceFeature(final Plugin residencePlugin) { super(residencePlugin.getName()); - this.residence = residencePlugin; - this.plugin = p3; LOGGER.info("Plugin 'Residence' found. Using it now."); } diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java index cd6f5ae22..46ba12f68 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java @@ -67,28 +67,32 @@ public class PlotSquaredFeature extends FaweMaskManager { * @param plot the {@link Plot} * @param type the {@link MaskType} * @return {@code true} if the player is the plot owner, trusted, has the permission fawe.plotsquared.member - * or fawe.plotsquared.admin and the NoWorldeditFlag is not set; otherwise {@code false} + * or fawe.plotsquared.admin and the NoWorldeditFlag is not set; otherwise {@code false} */ - public boolean isAllowed(Player player, Plot plot, MaskType type) { + public boolean isAllowed(Player player, Plot plot, MaskType type, boolean notify) { if (plot == null) { return false; } UUID uid = player.getUniqueId(); if (plot.getFlag(NoWorldeditFlag.class)) { - player.print(Caption.of( - "fawe.cancel.reason.no.region.reason", - Caption.of("fawe.cancel.reason.no.region.plot.noworldeditflag") - )); + if (notify) { + player.print(Caption.of( + "fawe.cancel.reason.no.region.reason", + Caption.of("fawe.cancel.reason.no.region.plot.noworldeditflag") + )); + } return false; } if (plot.isOwner(uid) || player.hasPermission("fawe.plotsquared.admin")) { return true; } if (type != MaskType.MEMBER) { - player.print(Caption.of( - "fawe.cancel.reason.no.region.reason", - Caption.of("fawe.cancel.reason.no.region.plot.owner.only") - )); + if (notify) { + player.print(Caption.of( + "fawe.cancel.reason.no.region.reason", + Caption.of("fawe.cancel.reason.no.region.plot.owner.only") + )); + } return false; } if (plot.getTrusted().contains(uid) || plot.getTrusted().contains(DBFunc.EVERYONE)) { @@ -96,26 +100,32 @@ public class PlotSquaredFeature extends FaweMaskManager { } if (plot.getMembers().contains(uid) || plot.getMembers().contains(DBFunc.EVERYONE)) { if (!player.hasPermission("fawe.plotsquared.member")) { - player.print(Caption.of( - "fawe.cancel.reason.no.region.reason", - Caption.of("fawe.error.no-perm", "fawe.plotsquared.member") - )); + if (notify) { + player.print(Caption.of( + "fawe.cancel.reason.no.region.reason", + Caption.of("fawe.error.no-perm", "fawe.plotsquared.member") + )); + } return false; } if (!plot.getOwners().isEmpty() && plot.getOwners().stream().anyMatch(this::playerOnline)) { return true; } else { - player.print(Caption.of( - "fawe.cancel.reason.no.region.reason", - Caption.of("fawe.cancel.reason.no.region.plot.owner.offline") - )); + if (notify) { + player.print(Caption.of( + "fawe.cancel.reason.no.region.reason", + Caption.of("fawe.cancel.reason.no.region.plot.owner.offline") + )); + } return false; } } - player.print(Caption.of( - "fawe.cancel.reason.no.region.reason", - Caption.of("fawe.cancel.reason.no.region.not.added") - )); + if (notify) { + player.print(Caption.of( + "fawe.cancel.reason.no.region.reason", + Caption.of("fawe.cancel.reason.no.region.not.added") + )); + } return false; } @@ -128,14 +138,19 @@ public class PlotSquaredFeature extends FaweMaskManager { } @Override - public FaweMask getMask(Player player, MaskType type, boolean isWhitelist) { + public FaweMask getMask(final Player player, final MaskType type, final boolean isWhitelist) { + return getMask(player, type, isWhitelist, true); + } + + @Override + public FaweMask getMask(Player player, MaskType type, boolean isWhitelist, boolean notify) { final PlotPlayer pp = PlotPlayer.from(BukkitAdapter.adapt(player)); if (pp == null) { return null; } final Set regions; Plot plot = pp.getCurrentPlot(); - if (isAllowed(player, plot, type)) { + if (isAllowed(player, plot, type, notify)) { regions = plot.getRegions(); } else { plot = null; @@ -184,19 +199,23 @@ public class PlotSquaredFeature extends FaweMaskManager { private final Plot plot; private final WeakReference> connectedPlots; + private final boolean singlePlot; private PlotSquaredMask(Region region, Plot plot) { super(region); this.plot = plot; - connectedPlots = new WeakReference<>(plot.getConnectedPlots()); + Set connected = plot.getConnectedPlots(); + connectedPlots = new WeakReference<>(connected); + singlePlot = connected.size() == 1; } @Override - public boolean isValid(Player player, MaskType type) { - if (!connectedPlots.refersTo(plot.getConnectedPlots()) || (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot))) { + public boolean isValid(Player player, MaskType type, boolean notify) { + if ((!connectedPlots.refersTo(plot.getConnectedPlots()) && !singlePlot) || (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone( + plot))) { return false; } - return isAllowed(player, plot, type); + return isAllowed(player, plot, type, notify); } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMask.java index 907769f51..4ea8c2c06 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMask.java @@ -17,10 +17,30 @@ public class FaweMask implements IDelegateRegion { return region; } + /** + * Test if the mask is still valid + * + * @param player player to test + * @param type type of mask + * @return if still valid + */ public boolean isValid(Player player, FaweMaskManager.MaskType type) { return false; } + /** + * Test if the mask is still valid + * + * @param player player to test + * @param type type of mask + * @param notify if the player should be notified + * @return if still valid + * @since TODO + */ + public boolean isValid(Player player, FaweMaskManager.MaskType type, boolean notify) { + return isValid(player, type); + } + @Override public Region clone() { throw new UnsupportedOperationException("Clone not supported"); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMaskManager.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMaskManager.java index 60c6e6be9..c52cc17e7 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMaskManager.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMaskManager.java @@ -1,7 +1,6 @@ package com.fastasyncworldedit.core.regions; import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.regions.filter.RegionFilter; import com.sk89q.worldedit.entity.Player; import java.util.Locale; @@ -28,6 +27,15 @@ public abstract class FaweMaskManager { */ public abstract FaweMask getMask(final Player player, MaskType type, boolean isWhitelist); + /** + * Get a {@link FaweMask} for the given player and {@link MaskType}. If isWhitelist is false, will return a "blacklist" mask. + * + * @since TODO + */ + public FaweMask getMask(final Player player, MaskType type, boolean isWhitelist, boolean notify) { + return getMask(player, type, isWhitelist); + } + public boolean isExclusive() { return Settings.settings().REGION_RESTRICTIONS_OPTIONS.EXCLUSIVE_MANAGERS.contains(this.key); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/WEManager.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/WEManager.java index 439b486e3..17b7882f2 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/WEManager.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/WEManager.java @@ -108,27 +108,22 @@ public class WEManager { } player.setMeta("lastMaskWorld", world); Set masks = player.getMeta("lastMask"); - Set backupRegions = new HashSet<>(); Set regions = new HashSet<>(); - if (masks == null || !isWhitelist) { masks = new HashSet<>(); } else { synchronized (masks) { boolean removed = false; + boolean inMask = false; if (!masks.isEmpty()) { Iterator iterator = masks.iterator(); while (iterator.hasNext()) { FaweMask mask = iterator.next(); - if (mask.isValid(player, type)) { + if (mask.isValid(player, type, false)) { Region region = mask.getRegion(); - if (region.contains(loc.toBlockPoint())) { - regions.add(region); - } else { - removed = true; - backupRegions.add(region); - } + inMask |= region.contains(loc.toBlockPoint()); + regions.add(region); } else { if (Settings.settings().ENABLED_COMPONENTS.DEBUG) { player.printDebug(Caption.of("fawe.error.region-mask-invalid", mask.getClass().getSimpleName())); @@ -138,39 +133,44 @@ public class WEManager { } } } - if (!removed) { + if (!removed && inMask) { return regions.toArray(new Region[0]); } - masks.clear(); } } - for (FaweMaskManager manager : managers) { - if (player.hasPermission("fawe." + manager.getKey())) { - try { - if (manager.isExclusive() && !masks.isEmpty()) { - continue; - } - final FaweMask mask = manager.getMask(player, FaweMaskManager.MaskType.getDefaultMaskType(), isWhitelist); - if (mask != null) { - regions.add(mask.getRegion()); - masks.add(mask); - if (manager.isExclusive()) { - break; + synchronized (masks) { + for (FaweMaskManager manager : managers) { + if (player.hasPermission("fawe." + manager.getKey())) { + try { + if (manager.isExclusive() && !masks.isEmpty()) { + continue; } + final FaweMask mask = manager.getMask( + player, + FaweMaskManager.MaskType.getDefaultMaskType(), + isWhitelist, + masks.isEmpty() + ); + if (mask != null) { + regions.add(mask.getRegion()); + masks.add(mask); + if (manager.isExclusive()) { + break; + } + } + } catch (Throwable e) { + e.printStackTrace(); } - } catch (Throwable e) { - e.printStackTrace(); + } else { + player.printError(TextComponent.of("Missing permission " + "fawe." + manager.getKey())); } - } else { - player.printError(TextComponent.of("Missing permission " + "fawe." + manager.getKey())); } - } - if (isWhitelist) { - regions.addAll(backupRegions); - if (!masks.isEmpty()) { - player.setMeta("lastMask", masks); - } else { - player.deleteMeta("lastMask"); + if (isWhitelist) { + if (!masks.isEmpty()) { + player.setMeta("lastMask", masks); + } else { + player.deleteMeta("lastMask"); + } } } return regions.toArray(new Region[0]); From 770bb0087a46c1c0fdc8743b8ce61bce1cb2ab50 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Thu, 29 Jun 2023 12:23:26 +0200 Subject: [PATCH 103/161] Drop support for minor 1.19 versions (#2316) * Drop support for minor 1.19 versions * More work --- .github/ISSUE_TEMPLATE/bug_report.yml | 1 + build.gradle.kts | 4 +- buildSrc/src/main/kotlin/CommonJavaConfig.kt | 2 +- settings.gradle.kts | 2 +- .../adapters/adapter-1_19/build.gradle.kts | 16 - .../ext/fawe/v1_19_R1/PaperweightAdapter.java | 1009 ------ .../v1_19_R1/PaperweightDataConverters.java | 2955 ----------------- .../fawe/v1_19_R1/PaperweightFakePlayer.java | 99 - .../PaperweightWorldNativeAccess.java | 210 -- .../v1_19_R1/PaperweightBlockMaterial.java | 189 -- .../fawe/v1_19_R1/PaperweightFaweAdapter.java | 701 ---- .../PaperweightFaweWorldNativeAccess.java | 286 -- .../fawe/v1_19_R1/PaperweightGetBlocks.java | 1164 ------- .../v1_19_R1/PaperweightGetBlocks_Copy.java | 248 -- .../v1_19_R1/PaperweightMapChunkUtil.java | 35 - .../v1_19_R1/PaperweightPlatformAdapter.java | 703 ---- .../v1_19_R1/PaperweightPostProcessor.java | 175 - .../PaperweightStarlightRelighter.java | 205 -- .../PaperweightStarlightRelighterFactory.java | 28 - .../nbt/PaperweightLazyCompoundTag.java | 161 - .../fawe/v1_19_R1/regen/PaperweightRegen.java | 564 ---- .../adapters/adapter-1_19_3/build.gradle.kts | 17 - .../ext/fawe/v1_19_R2/PaperweightAdapter.java | 1029 ------ .../v1_19_R2/PaperweightDataConverters.java | 2800 ---------------- .../fawe/v1_19_R2/PaperweightFakePlayer.java | 93 - .../PaperweightWorldNativeAccess.java | 180 - .../v1_19_R2/PaperweightBlockMaterial.java | 189 -- .../fawe/v1_19_R2/PaperweightFaweAdapter.java | 706 ---- .../PaperweightFaweWorldNativeAccess.java | 286 -- .../fawe/v1_19_R2/PaperweightGetBlocks.java | 1166 ------- .../v1_19_R2/PaperweightGetBlocks_Copy.java | 248 -- .../v1_19_R2/PaperweightMapChunkUtil.java | 34 - .../v1_19_R2/PaperweightPlatformAdapter.java | 700 ---- .../v1_19_R2/PaperweightPostProcessor.java | 175 - .../PaperweightStarlightRelighter.java | 205 -- .../PaperweightStarlightRelighterFactory.java | 28 - .../nbt/PaperweightLazyCompoundTag.java | 161 - .../fawe/v1_19_R2/regen/PaperweightRegen.java | 594 ---- .../adapters/adapter-1_20/build.gradle.kts | 2 +- worldedit-bukkit/build.gradle.kts | 2 +- 40 files changed, 7 insertions(+), 17365 deletions(-) delete mode 100644 worldedit-bukkit/adapters/adapter-1_19/build.gradle.kts delete mode 100644 worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R1/PaperweightAdapter.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R1/PaperweightDataConverters.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R1/PaperweightFakePlayer.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R1/PaperweightWorldNativeAccess.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightBlockMaterial.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightFaweAdapter.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightFaweWorldNativeAccess.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks_Copy.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightMapChunkUtil.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightPlatformAdapter.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightPostProcessor.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightStarlightRelighter.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightStarlightRelighterFactory.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/nbt/PaperweightLazyCompoundTag.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/regen/PaperweightRegen.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19_3/build.gradle.kts delete mode 100644 worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R2/PaperweightAdapter.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R2/PaperweightDataConverters.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R2/PaperweightFakePlayer.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R2/PaperweightWorldNativeAccess.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightBlockMaterial.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightFaweAdapter.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightFaweWorldNativeAccess.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks_Copy.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightMapChunkUtil.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightPlatformAdapter.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightPostProcessor.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightStarlightRelighter.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightStarlightRelighterFactory.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/nbt/PaperweightLazyCompoundTag.java delete mode 100644 worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/regen/PaperweightRegen.java diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 3b9cf1767..83d9f52d8 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -27,6 +27,7 @@ body: description: Which server version version you using? If your server version is not listed, it is not supported. Update to a supported version first. multiple: false options: + - '1.20.1' - '1.20' - '1.19.4' - '1.18.2' diff --git a/build.gradle.kts b/build.gradle.kts index f1d4bb80e..642d6d09b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -83,7 +83,7 @@ allprojects { } applyCommonConfiguration() -val supportedVersions = listOf("1.16.5", "1.17", "1.17.1", "1.18.2", "1.19", "1.19.1", "1.19.2", "1.19.3", "1.19.4", "1.20") +val supportedVersions = listOf("1.16.5", "1.17.1", "1.18.2", "1.19.4", "1.20", "1.20.1") tasks { supportedVersions.forEach { @@ -97,7 +97,7 @@ tasks { } } runServer { - minecraftVersion("1.19.3") + minecraftVersion("1.20.1") pluginJars(*project(":worldedit-bukkit").getTasksByName("shadowJar", false).map { (it as Jar).archiveFile } .toTypedArray()) diff --git a/buildSrc/src/main/kotlin/CommonJavaConfig.kt b/buildSrc/src/main/kotlin/CommonJavaConfig.kt index 06a587525..8542fe252 100644 --- a/buildSrc/src/main/kotlin/CommonJavaConfig.kt +++ b/buildSrc/src/main/kotlin/CommonJavaConfig.kt @@ -64,7 +64,7 @@ fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, banSlf4j: Boolean "https://www.antlr.org/api/Java/", "https://docs.enginehub.org/javadoc/org.enginehub.piston/core/0.5.7/", "https://docs.enginehub.org/javadoc/org.enginehub.piston/default-impl/0.5.7/", - "https://jd.papermc.io/paper/1.19/", + "https://jd.papermc.io/paper/1.20/", "https://intellectualsites.github.io/fastasyncworldedit-javadocs/worldedit-core/" ) docTitle = "${rootProject.name}-${project.description}" + " " + "${rootProject.version}" diff --git a/settings.gradle.kts b/settings.gradle.kts index 8e8ebe625..05439cd10 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,7 +2,7 @@ rootProject.name = "FastAsyncWorldEdit" include("worldedit-libs") -listOf("legacy", "1_17_1", "1_18_2", "1_19", "1_19_3","1_19_4", "1_20").forEach { +listOf("legacy", "1_17_1", "1_18_2", "1_19_4", "1_20").forEach { include("worldedit-bukkit:adapters:adapter-$it") } diff --git a/worldedit-bukkit/adapters/adapter-1_19/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_19/build.gradle.kts deleted file mode 100644 index cfb2cfe03..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19/build.gradle.kts +++ /dev/null @@ -1,16 +0,0 @@ -import io.papermc.paperweight.userdev.PaperweightUserDependenciesExtension - -plugins { - java -} - -applyPaperweightAdapterConfiguration() - -repositories { - gradlePluginPortal() -} - -dependencies { - the().paperDevBundle("1.19.2-R0.1-20221206.184705-189") - compileOnly("io.papermc:paperlib") -} diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R1/PaperweightAdapter.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R1/PaperweightAdapter.java deleted file mode 100644 index 1e8ed0c56..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R1/PaperweightAdapter.java +++ /dev/null @@ -1,1009 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_19_R1; - -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import com.google.common.util.concurrent.Futures; -import com.mojang.datafixers.util.Either; -import com.mojang.serialization.Lifecycle; -import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseItem; -import com.sk89q.worldedit.blocks.BaseItemStack; -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; -import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; -import com.sk89q.worldedit.bukkit.adapter.Refraction; -import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1.PaperweightFaweAdapter; -import com.sk89q.worldedit.entity.BaseEntity; -import com.sk89q.worldedit.extension.platform.Watchdog; -import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.internal.Constants; -import com.sk89q.worldedit.internal.block.BlockStateIdAccess; -import com.sk89q.worldedit.internal.wna.WorldNativeAccess; -import com.sk89q.worldedit.math.BlockVector2; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.registry.state.BooleanProperty; -import com.sk89q.worldedit.registry.state.DirectionalProperty; -import com.sk89q.worldedit.registry.state.EnumProperty; -import com.sk89q.worldedit.registry.state.IntegerProperty; -import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.util.Direction; -import com.sk89q.worldedit.util.SideEffect; -import com.sk89q.worldedit.util.concurrency.LazyReference; -import com.sk89q.worldedit.util.formatting.text.Component; -import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; -import com.sk89q.worldedit.util.io.file.SafeFiles; -import com.sk89q.worldedit.util.nbt.BinaryTag; -import com.sk89q.worldedit.util.nbt.ByteArrayBinaryTag; -import com.sk89q.worldedit.util.nbt.ByteBinaryTag; -import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; -import com.sk89q.worldedit.util.nbt.DoubleBinaryTag; -import com.sk89q.worldedit.util.nbt.EndBinaryTag; -import com.sk89q.worldedit.util.nbt.FloatBinaryTag; -import com.sk89q.worldedit.util.nbt.IntArrayBinaryTag; -import com.sk89q.worldedit.util.nbt.IntBinaryTag; -import com.sk89q.worldedit.util.nbt.ListBinaryTag; -import com.sk89q.worldedit.util.nbt.LongArrayBinaryTag; -import com.sk89q.worldedit.util.nbt.LongBinaryTag; -import com.sk89q.worldedit.util.nbt.ShortBinaryTag; -import com.sk89q.worldedit.util.nbt.StringBinaryTag; -import com.sk89q.worldedit.world.DataFixer; -import com.sk89q.worldedit.world.RegenOptions; -import com.sk89q.worldedit.world.biome.BiomeType; -import com.sk89q.worldedit.world.biome.BiomeTypes; -import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockStateHolder; -import com.sk89q.worldedit.world.block.BlockType; -import com.sk89q.worldedit.world.block.BlockTypes; -import com.sk89q.worldedit.world.item.ItemType; -import net.minecraft.Util; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Registry; -import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; -import net.minecraft.network.protocol.game.ClientboundEntityEventPacket; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.dedicated.DedicatedServer; -import net.minecraft.server.level.ChunkHolder; -import net.minecraft.server.level.ServerChunkCache; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.progress.ChunkProgressListener; -import net.minecraft.util.StringRepresentable; -import net.minecraft.util.thread.BlockableEventLoop; -import net.minecraft.world.Clearable; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.context.UseOnContext; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.LevelSettings; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.entity.StructureBlockEntity; -import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.DirectionProperty; -import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkStatus; -import net.minecraft.world.level.chunk.LevelChunk; -import net.minecraft.world.level.dimension.LevelStem; -import net.minecraft.world.level.levelgen.WorldGenSettings; -import net.minecraft.world.level.storage.LevelStorageSource; -import net.minecraft.world.level.storage.PrimaryLevelData; -import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.Vec3; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.World.Environment; -import org.bukkit.block.data.BlockData; -import org.bukkit.craftbukkit.v1_19_R1.CraftServer; -import org.bukkit.craftbukkit.v1_19_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_19_R1.block.data.CraftBlockData; -import org.bukkit.craftbukkit.v1_19_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack; -import org.bukkit.craftbukkit.v1_19_R1.util.CraftMagicNumbers; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; -import org.bukkit.generator.ChunkGenerator; -import org.spigotmc.SpigotConfig; -import org.spigotmc.WatchdogThread; - -import javax.annotation.Nullable; -import java.lang.ref.WeakReference; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Objects; -import java.util.OptionalInt; -import java.util.OptionalLong; -import java.util.Set; -import java.util.TreeMap; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.concurrent.ForkJoinPool; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.stream.Collectors; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; - -public final class PaperweightAdapter implements BukkitImplAdapter { - - private final Logger LOGGER = Logger.getLogger(getClass().getCanonicalName()); - - private final Field worldsField; - private final Method getChunkFutureMainThreadMethod; - private final Field mainThreadProcessorField; - private final Watchdog watchdog; - - // ------------------------------------------------------------------------ - // Code that may break between versions of Minecraft - // ------------------------------------------------------------------------ - - public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException { - // A simple test - CraftServer.class.cast(Bukkit.getServer()); - - int dataVersion = CraftMagicNumbers.INSTANCE.getDataVersion(); - if (dataVersion != 3105 && dataVersion != 3117 && dataVersion != 3120) { - throw new UnsupportedClassVersionError("Not 1.19, 1.19.1 or 1.19.2!"); - } - - worldsField = CraftServer.class.getDeclaredField("worlds"); - worldsField.setAccessible(true); - - getChunkFutureMainThreadMethod = ServerChunkCache.class.getDeclaredMethod( - Refraction.pickName("getChunkFutureMainThread", "c"), - int.class, int.class, ChunkStatus.class, boolean.class - ); - getChunkFutureMainThreadMethod.setAccessible(true); - - mainThreadProcessorField = ServerChunkCache.class.getDeclaredField( - Refraction.pickName("mainThreadProcessor", "g") - ); - mainThreadProcessorField.setAccessible(true); - - new PaperweightDataConverters(CraftMagicNumbers.INSTANCE.getDataVersion(), this).buildUnoptimized(); - - Watchdog watchdog; - try { - Class.forName("org.spigotmc.WatchdogThread"); - watchdog = new SpigotWatchdog(); - } catch (ClassNotFoundException | NoSuchFieldException e) { - try { - watchdog = new MojangWatchdog(((CraftServer) Bukkit.getServer()).getServer()); - } catch (NoSuchFieldException ex) { - watchdog = null; - } - } - this.watchdog = watchdog; - - try { - Class.forName("org.spigotmc.SpigotConfig"); - SpigotConfig.config.set("world-settings.faweregentempworld.verbose", false); - } catch (ClassNotFoundException ignored) { - } - } - - @Override - public DataFixer getDataFixer() { - return PaperweightDataConverters.INSTANCE; - } - - /** - * Read the given NBT data into the given tile entity. - * - * @param tileEntity the tile entity - * @param tag the tag - */ - static void readTagIntoTileEntity(net.minecraft.nbt.CompoundTag tag, BlockEntity tileEntity) { - tileEntity.load(tag); - tileEntity.setChanged(); - } - - /** - * Get the ID string of the given entity. - * - * @param entity the entity - * @return the entity ID - */ - private static String getEntityId(Entity entity) { - return EntityType.getKey(entity.getType()).toString(); - } - - /** - * Create an entity using the given entity ID. - * - * @param id the entity ID - * @param world the world - * @return an entity or null - */ - @Nullable - private static Entity createEntityFromId(String id, net.minecraft.world.level.Level world) { - return EntityType.byString(id).map(t -> t.create(world)).orElse(null); - } - - /** - * Write the given NBT data into the given entity. - * - * @param entity the entity - * @param tag the tag - */ - private static void readTagIntoEntity(net.minecraft.nbt.CompoundTag tag, Entity entity) { - entity.load(tag); - } - - /** - * Write the entity's NBT data to the given tag. - * - * @param entity the entity - * @param tag the tag - */ - private static void readEntityIntoTag(Entity entity, net.minecraft.nbt.CompoundTag tag) { - entity.save(tag); - } - - private static Block getBlockFromType(BlockType blockType) { - return Registry.BLOCK.get(ResourceLocation.tryParse(blockType.getId())); - } - - private static Item getItemFromType(ItemType itemType) { - return Registry.ITEM.get(ResourceLocation.tryParse(itemType.getId())); - } - - @Override - public OptionalInt getInternalBlockStateId(BlockData data) { - net.minecraft.world.level.block.state.BlockState state = ((CraftBlockData) data).getState(); - int combinedId = Block.getId(state); - return combinedId == 0 && state.getBlock() != Blocks.AIR ? OptionalInt.empty() : OptionalInt.of(combinedId); - } - - @Override - public OptionalInt getInternalBlockStateId(BlockState state) { - Block mcBlock = getBlockFromType(state.getBlockType()); - net.minecraft.world.level.block.state.BlockState newState = mcBlock.defaultBlockState(); - Map, Object> states = state.getStates(); - newState = applyProperties(mcBlock.getStateDefinition(), newState, states); - final int combinedId = Block.getId(newState); - return combinedId == 0 && state.getBlockType() != BlockTypes.AIR ? OptionalInt.empty() : OptionalInt.of(combinedId); - } - - @Override - public BlockState getBlock(Location location) { - checkNotNull(location); - - CraftWorld craftWorld = ((CraftWorld) location.getWorld()); - int x = location.getBlockX(); - int y = location.getBlockY(); - int z = location.getBlockZ(); - - final ServerLevel handle = craftWorld.getHandle(); - LevelChunk chunk = handle.getChunk(x >> 4, z >> 4); - final BlockPos blockPos = new BlockPos(x, y, z); - final CraftBlockData blockData = chunk.getBlockState(blockPos).createCraftBlockData(); - BlockState state = BukkitAdapter.adapt(blockData); - if (state == null) { - org.bukkit.block.Block bukkitBlock = location.getBlock(); - state = BukkitAdapter.adapt(bukkitBlock.getBlockData()); - } - - return state; - } - - @Override - public BaseBlock getFullBlock(Location location) { - BlockState state = getBlock(location); - - CraftWorld craftWorld = ((CraftWorld) location.getWorld()); - int x = location.getBlockX(); - int y = location.getBlockY(); - int z = location.getBlockZ(); - - final ServerLevel handle = craftWorld.getHandle(); - LevelChunk chunk = handle.getChunk(x >> 4, z >> 4); - final BlockPos blockPos = new BlockPos(x, y, z); - - // Read the NBT data - BlockEntity te = chunk.getBlockEntity(blockPos); - if (te != null) { - net.minecraft.nbt.CompoundTag tag = te.saveWithId(); - //FAWE start - BinaryTag - return state.toBaseBlock((CompoundBinaryTag) toNativeBinary(tag)); - //FAWE end - } - - return state.toBaseBlock(); - } - - @Override - public WorldNativeAccess createWorldNativeAccess(org.bukkit.World world) { - return new PaperweightWorldNativeAccess( - this, - new WeakReference<>(((CraftWorld) world).getHandle()) - ); - } - - private static net.minecraft.core.Direction adapt(Direction face) { - switch (face) { - case NORTH: - return net.minecraft.core.Direction.NORTH; - case SOUTH: - return net.minecraft.core.Direction.SOUTH; - case WEST: - return net.minecraft.core.Direction.WEST; - case EAST: - return net.minecraft.core.Direction.EAST; - case DOWN: - return net.minecraft.core.Direction.DOWN; - case UP: - default: - return net.minecraft.core.Direction.UP; - } - } - - @SuppressWarnings({"rawtypes", "unchecked"}) - private net.minecraft.world.level.block.state.BlockState applyProperties( - StateDefinition stateContainer, - net.minecraft.world.level.block.state.BlockState newState, - Map, Object> states - ) { - for (Map.Entry, Object> state : states.entrySet()) { - net.minecraft.world.level.block.state.properties.Property property = - stateContainer.getProperty(state.getKey().getName()); - Comparable value = (Comparable) state.getValue(); - // we may need to adapt this value, depending on the source prop - if (property instanceof DirectionProperty) { - Direction dir = (Direction) value; - value = adapt(dir); - } else if (property instanceof net.minecraft.world.level.block.state.properties.EnumProperty) { - String enumName = (String) value; - value = ((net.minecraft.world.level.block.state.properties.EnumProperty) property) - .getValue(enumName).orElseThrow(() -> - new IllegalStateException( - "Enum property " + property.getName() + " does not contain " + enumName - ) - ); - } - - newState = newState.setValue( - (net.minecraft.world.level.block.state.properties.Property) property, - (Comparable) value - ); - } - return newState; - } - - @Override - public BaseEntity getEntity(org.bukkit.entity.Entity entity) { - checkNotNull(entity); - - CraftEntity craftEntity = ((CraftEntity) entity); - Entity mcEntity = craftEntity.getHandle(); - - String id = getEntityId(mcEntity); - - net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag(); - readEntityIntoTag(mcEntity, tag); - //FAWE start - BinaryTag - return new BaseEntity( - com.sk89q.worldedit.world.entity.EntityTypes.get(id), - LazyReference.from(() -> (CompoundBinaryTag) toNativeBinary(tag)) - ); - //FAWE end - } - - @Nullable - @Override - public org.bukkit.entity.Entity createEntity(Location location, BaseEntity state) { - checkNotNull(location); - checkNotNull(state); - - CraftWorld craftWorld = ((CraftWorld) location.getWorld()); - ServerLevel worldServer = craftWorld.getHandle(); - - Entity createdEntity = createEntityFromId(state.getType().getId(), craftWorld.getHandle()); - - if (createdEntity != null) { - CompoundBinaryTag nativeTag = state.getNbt(); - if (nativeTag != null) { - net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) fromNativeBinary(nativeTag); - for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) { - tag.remove(name); - } - readTagIntoEntity(tag, createdEntity); - } - - createdEntity.absMoveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - - worldServer.addFreshEntity(createdEntity, SpawnReason.CUSTOM); - return createdEntity.getBukkitEntity(); - } else { - return null; - } - } - - @Override - public Component getRichBlockName(BlockType blockType) { - return TranslatableComponent.of(getBlockFromType(blockType).getDescriptionId()); - } - - @Override - public Component getRichItemName(ItemType itemType) { - return TranslatableComponent.of(getItemFromType(itemType).getDescriptionId()); - } - - @Override - public Component getRichItemName(BaseItemStack itemStack) { - return TranslatableComponent.of(CraftItemStack.asNMSCopy(BukkitAdapter.adapt(itemStack)).getDescriptionId()); - } - - @SuppressWarnings({"unchecked", "rawtypes"}) - private static final LoadingCache> PROPERTY_CACHE = CacheBuilder.newBuilder().build(new CacheLoader>() { - @Override - public Property load(net.minecraft.world.level.block.state.properties.Property state) throws Exception { - if (state instanceof net.minecraft.world.level.block.state.properties.BooleanProperty) { - return new BooleanProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues())); - } else if (state instanceof DirectionProperty) { - return new DirectionalProperty(state.getName(), - (List) state.getPossibleValues().stream().map(e -> Direction.valueOf(((StringRepresentable) e).getSerializedName().toUpperCase(Locale.ROOT))).collect(Collectors.toList())); - } else if (state instanceof net.minecraft.world.level.block.state.properties.EnumProperty) { - return new EnumProperty(state.getName(), - (List) state.getPossibleValues().stream().map(e -> ((StringRepresentable) e).getSerializedName()).collect(Collectors.toList())); - } else if (state instanceof net.minecraft.world.level.block.state.properties.IntegerProperty) { - return new IntegerProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues())); - } else { - throw new IllegalArgumentException("WorldEdit needs an update to support " + state.getClass().getSimpleName()); - } - } - }); - - @SuppressWarnings({ "rawtypes" }) - @Override - public Map> getProperties(BlockType blockType) { - Map> properties = new TreeMap<>(); - Block block = getBlockFromType(blockType); - StateDefinition blockStateList = - block.getStateDefinition(); - for (net.minecraft.world.level.block.state.properties.Property state : blockStateList.getProperties()) { - Property property = PROPERTY_CACHE.getUnchecked(state); - properties.put(property.getName(), property); - } - return properties; - } - - @Override - public void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData) { - ((CraftPlayer) player).getHandle().connection.send(ClientboundBlockEntityDataPacket.create( - new StructureBlockEntity( - new BlockPos(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()), - Blocks.STRUCTURE_BLOCK.defaultBlockState() - ), - __ -> (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData) - )); - } - - @Override - public void sendFakeOP(Player player) { - ((CraftPlayer) player).getHandle().connection.send(new ClientboundEntityEventPacket( - ((CraftPlayer) player).getHandle(), (byte) 28 - )); - } - - @Override - public org.bukkit.inventory.ItemStack adapt(BaseItemStack item) { - ItemStack stack = new ItemStack(Registry.ITEM.get(ResourceLocation.tryParse(item.getType().getId())), item.getAmount()); - stack.setTag(((net.minecraft.nbt.CompoundTag) fromNative(item.getNbtData()))); - return CraftItemStack.asCraftMirror(stack); - } - - @Override - public BaseItemStack adapt(org.bukkit.inventory.ItemStack itemStack) { - final ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - final BaseItemStack weStack = new BaseItemStack(BukkitAdapter.asItemType(itemStack.getType()), itemStack.getAmount()); - weStack.setNbt(((CompoundBinaryTag) toNativeBinary(nmsStack.getTag()))); - return weStack; - } - - private final LoadingCache fakePlayers - = CacheBuilder.newBuilder().weakKeys().softValues().build(CacheLoader.from(PaperweightFakePlayer::new)); - - @Override - public boolean simulateItemUse(org.bukkit.World world, BlockVector3 position, BaseItem item, Direction face) { - CraftWorld craftWorld = (CraftWorld) world; - ServerLevel worldServer = craftWorld.getHandle(); - ItemStack stack = CraftItemStack.asNMSCopy(BukkitAdapter.adapt(item instanceof BaseItemStack - ? ((BaseItemStack) item) : new BaseItemStack(item.getType(), item.getNbtData(), 1))); - stack.setTag((net.minecraft.nbt.CompoundTag) fromNative(item.getNbtData())); - - PaperweightFakePlayer fakePlayer; - try { - fakePlayer = fakePlayers.get(worldServer); - } catch (ExecutionException ignored) { - return false; - } - fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, stack); - fakePlayer.absMoveTo(position.getBlockX(), position.getBlockY(), position.getBlockZ(), - (float) face.toVector().toYaw(), (float) face.toVector().toPitch() - ); - - final BlockPos blockPos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); - final Vec3 blockVec = Vec3.atLowerCornerOf(blockPos); - final net.minecraft.core.Direction enumFacing = adapt(face); - BlockHitResult rayTrace = new BlockHitResult(blockVec, enumFacing, blockPos, false); - UseOnContext context = new UseOnContext(fakePlayer, InteractionHand.MAIN_HAND, rayTrace); - InteractionResult result = stack.useOn(context, InteractionHand.MAIN_HAND); - if (result != InteractionResult.SUCCESS) { - if (worldServer - .getBlockState(blockPos) - .use(worldServer, fakePlayer, InteractionHand.MAIN_HAND, rayTrace) - .consumesAction()) { - result = InteractionResult.SUCCESS; - } else { - result = stack.getItem().use(worldServer, fakePlayer, InteractionHand.MAIN_HAND).getResult(); - } - } - - return result == InteractionResult.SUCCESS; - } - - @Override - public boolean canPlaceAt(org.bukkit.World world, BlockVector3 position, BlockState blockState) { - int internalId = BlockStateIdAccess.getBlockStateId(blockState); - net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId); - return blockData.canSurvive( - ((CraftWorld) world).getHandle(), - new BlockPos(position.getX(), position.getY(), position.getZ()) - ); - } - - @Override - public boolean regenerate(org.bukkit.World bukkitWorld, Region region, Extent extent, RegenOptions options) { - try { - doRegen(bukkitWorld, region, extent, options); - } catch (Exception e) { - throw new IllegalStateException("Regen failed.", e); - } - - return true; - } - - private void doRegen(org.bukkit.World bukkitWorld, Region region, Extent extent, RegenOptions options) throws Exception { - Environment env = bukkitWorld.getEnvironment(); - ChunkGenerator gen = bukkitWorld.getGenerator(); - - Path tempDir = Files.createTempDirectory("FastAsyncWorldEditWorldGen"); - LevelStorageSource levelStorage = LevelStorageSource.createDefault(tempDir); - ResourceKey worldDimKey = getWorldDimKey(env); - try (LevelStorageSource.LevelStorageAccess session = levelStorage.createAccess("faweregentempworld", worldDimKey)) { - ServerLevel originalWorld = ((CraftWorld) bukkitWorld).getHandle(); - PrimaryLevelData levelProperties = (PrimaryLevelData) originalWorld.getServer() - .getWorldData().overworldData(); - WorldGenSettings originalOpts = levelProperties.worldGenSettings(); - - long seed = options.getSeed().orElse(originalWorld.getSeed()); - WorldGenSettings newOpts = options.getSeed().isPresent() - ? originalOpts.withSeed(levelProperties.isHardcore(), OptionalLong.of(seed)) - : originalOpts; - - LevelSettings newWorldSettings = new LevelSettings( - "faweregentempworld", - levelProperties.settings.gameType(), - levelProperties.settings.hardcore(), - levelProperties.settings.difficulty(), - levelProperties.settings.allowCommands(), - levelProperties.settings.gameRules(), - levelProperties.settings.getDataPackConfig() - ); - PrimaryLevelData newWorldData = new PrimaryLevelData(newWorldSettings, newOpts, Lifecycle.stable()); - - ServerLevel freshWorld = new ServerLevel( - originalWorld.getServer(), - originalWorld.getServer().executor, - session, newWorldData, - originalWorld.dimension(), - new LevelStem( - originalWorld.dimensionTypeRegistration(), - newOpts.dimensions().get(worldDimKey).generator() - ), - new NoOpWorldLoadListener(), - originalWorld.isDebug(), - seed, - ImmutableList.of(), - false, - env, - gen, - bukkitWorld.getBiomeProvider() - ); - try { - regenForWorld(region, extent, freshWorld, options); - } finally { - freshWorld.getChunkSource().close(false); - } - } finally { - try { - @SuppressWarnings("unchecked") - Map map = (Map) worldsField.get(Bukkit.getServer()); - map.remove("faweregentempworld"); - } catch (IllegalAccessException ignored) { - } - SafeFiles.tryHardToDeleteDir(tempDir); - } - } - - private BiomeType adapt(ServerLevel serverWorld, Biome origBiome) { - ResourceLocation key = serverWorld.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY).getKey(origBiome); - if (key == null) { - return null; - } - return BiomeTypes.get(key.toString()); - } - - @SuppressWarnings("unchecked") - private void regenForWorld(Region region, Extent extent, ServerLevel serverWorld, RegenOptions options) throws - WorldEditException { - List> chunkLoadings = submitChunkLoadTasks(region, serverWorld); - BlockableEventLoop executor; - try { - executor = (BlockableEventLoop) mainThreadProcessorField.get(serverWorld.getChunkSource()); - } catch (IllegalAccessException e) { - throw new IllegalStateException("Couldn't get executor for chunk loading.", e); - } - executor.managedBlock(() -> { - // bail out early if a future fails - if (chunkLoadings.stream().anyMatch(ftr -> - ftr.isDone() && Futures.getUnchecked(ftr) == null - )) { - return false; - } - return chunkLoadings.stream().allMatch(CompletableFuture::isDone); - }); - Map chunks = new HashMap<>(); - for (CompletableFuture future : chunkLoadings) { - @Nullable - ChunkAccess chunk = future.getNow(null); - checkState(chunk != null, "Failed to generate a chunk, regen failed."); - chunks.put(chunk.getPos(), chunk); - } - - for (BlockVector3 vec : region) { - BlockPos pos = new BlockPos(vec.getBlockX(), vec.getBlockY(), vec.getBlockZ()); - ChunkAccess chunk = chunks.get(new ChunkPos(pos)); - final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(pos); - BlockStateHolder state = ((PaperweightFaweAdapter) WorldEditPlugin - .getInstance() - .getBukkitImplAdapter()).adapt(blockData); - Objects.requireNonNull(state); - BlockEntity blockEntity = chunk.getBlockEntity(pos); - if (blockEntity != null) { - net.minecraft.nbt.CompoundTag tag = blockEntity.saveWithId(); - //FAWE start - BinaryTag - state = state.toBaseBlock(((CompoundBinaryTag) toNativeBinary(tag))); - //FAWE end - } - extent.setBlock(vec, state.toBaseBlock()); - if (options.shouldRegenBiomes()) { - Biome origBiome = chunk.getNoiseBiome(vec.getX(), vec.getY(), vec.getZ()).value(); - BiomeType adaptedBiome = adapt(serverWorld, origBiome); - if (adaptedBiome != null) { - extent.setBiome(vec, adaptedBiome); - } - } - } - } - - @SuppressWarnings("unchecked") - private List> submitChunkLoadTasks(Region region, ServerLevel serverWorld) { - ServerChunkCache chunkManager = serverWorld.getChunkSource(); - List> chunkLoadings = new ArrayList<>(); - // Pre-gen all the chunks - for (BlockVector2 chunk : region.getChunks()) { - try { - chunkLoadings.add( - ((CompletableFuture>) - getChunkFutureMainThreadMethod.invoke(chunkManager, chunk.getX(), chunk.getZ(), ChunkStatus.FEATURES, true)) - .thenApply(either -> either.left().orElse(null)) - ); - } catch (IllegalAccessException | InvocationTargetException e) { - throw new IllegalStateException("Couldn't load chunk for regen.", e); - } - } - return chunkLoadings; - } - - private ResourceKey getWorldDimKey(Environment env) { - switch (env) { - case NETHER: - return LevelStem.NETHER; - case THE_END: - return LevelStem.END; - case NORMAL: - default: - return LevelStem.OVERWORLD; - } - } - - private static final Set SUPPORTED_SIDE_EFFECTS = Sets.immutableEnumSet( - SideEffect.NEIGHBORS, - SideEffect.LIGHTING, - SideEffect.VALIDATION, - SideEffect.ENTITY_AI, - SideEffect.EVENTS, - SideEffect.UPDATE - ); - - @Override - public Set getSupportedSideEffects() { - return SUPPORTED_SIDE_EFFECTS; - } - - @Override - public boolean clearContainerBlockContents(org.bukkit.World world, BlockVector3 pt) { - ServerLevel originalWorld = ((CraftWorld) world).getHandle(); - - BlockEntity entity = originalWorld.getBlockEntity(new BlockPos(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ())); - if (entity instanceof Clearable) { - ((Clearable) entity).clearContent(); - return true; - } - return false; - } - - // ------------------------------------------------------------------------ - // Code that is less likely to break - // ------------------------------------------------------------------------ - - /** - * Converts from a non-native NMS NBT structure to a native WorldEdit NBT - * structure. - * - * @param foreign non-native NMS NBT structure - * @return native WorldEdit NBT structure - */ - //FAWE start - BinaryTag - @Override - public BinaryTag toNativeBinary(net.minecraft.nbt.Tag foreign) { - if (foreign == null) { - return null; - } - if (foreign instanceof net.minecraft.nbt.CompoundTag) { - Map values = new HashMap<>(); - Set foreignKeys = ((net.minecraft.nbt.CompoundTag) foreign).getAllKeys(); - - for (String str : foreignKeys) { - net.minecraft.nbt.Tag base = ((net.minecraft.nbt.CompoundTag) foreign).get(str); - values.put(str, toNativeBinary(base)); - } - return CompoundBinaryTag.from(values); - } else if (foreign instanceof net.minecraft.nbt.ByteTag) { - return ByteBinaryTag.of(((net.minecraft.nbt.ByteTag) foreign).getAsByte()); - } else if (foreign instanceof net.minecraft.nbt.ByteArrayTag) { - return ByteArrayBinaryTag.of(((net.minecraft.nbt.ByteArrayTag) foreign).getAsByteArray()); - } else if (foreign instanceof net.minecraft.nbt.DoubleTag) { - return DoubleBinaryTag.of(((net.minecraft.nbt.DoubleTag) foreign).getAsDouble()); - } else if (foreign instanceof net.minecraft.nbt.FloatTag) { - return FloatBinaryTag.of(((net.minecraft.nbt.FloatTag) foreign).getAsFloat()); - } else if (foreign instanceof net.minecraft.nbt.IntTag) { - return IntBinaryTag.of(((net.minecraft.nbt.IntTag) foreign).getAsInt()); - } else if (foreign instanceof net.minecraft.nbt.IntArrayTag) { - return IntArrayBinaryTag.of(((net.minecraft.nbt.IntArrayTag) foreign).getAsIntArray()); - } else if (foreign instanceof net.minecraft.nbt.LongArrayTag) { - return LongArrayBinaryTag.of(((net.minecraft.nbt.LongArrayTag) foreign).getAsLongArray()); - } else if (foreign instanceof net.minecraft.nbt.ListTag) { - try { - return toNativeList((net.minecraft.nbt.ListTag) foreign); - } catch (Throwable e) { - LOGGER.log(Level.WARNING, "Failed to convert net.minecraft.nbt.ListTag", e); - return ListBinaryTag.empty(); - } - } else if (foreign instanceof net.minecraft.nbt.LongTag) { - return LongBinaryTag.of(((net.minecraft.nbt.LongTag) foreign).getAsLong()); - } else if (foreign instanceof net.minecraft.nbt.ShortTag) { - return ShortBinaryTag.of(((net.minecraft.nbt.ShortTag) foreign).getAsShort()); - } else if (foreign instanceof net.minecraft.nbt.StringTag) { - return StringBinaryTag.of(foreign.getAsString()); - } else if (foreign instanceof net.minecraft.nbt.EndTag) { - return EndBinaryTag.get(); - } else { - throw new IllegalArgumentException("Don't know how to make native " + foreign.getClass().getCanonicalName()); - } - } - - /** - * Convert a foreign NBT list tag into a native WorldEdit one. - * - * @param foreign the foreign tag - * @return the converted tag - * @throws SecurityException on error - * @throws IllegalArgumentException on error - */ - private ListBinaryTag toNativeList(net.minecraft.nbt.ListTag foreign) throws SecurityException, IllegalArgumentException { - ListBinaryTag.Builder values = ListBinaryTag.builder(); - - for (net.minecraft.nbt.Tag tag : foreign) { - values.add(toNativeBinary(tag)); - } - - return values.build(); - } - - /** - * Converts a WorldEdit-native NBT structure to a NMS structure. - * - * @param foreign structure to convert - * @return non-native structure - */ - @Override - public net.minecraft.nbt.Tag fromNativeBinary(BinaryTag foreign) { - if (foreign == null) { - return null; - } - if (foreign instanceof CompoundBinaryTag) { - net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag(); - for (String key : ((CompoundBinaryTag) foreign).keySet()) { - tag.put(key, fromNativeBinary(((CompoundBinaryTag) foreign).get(key))); - } - return tag; - } else if (foreign instanceof ByteBinaryTag) { - return net.minecraft.nbt.ByteTag.valueOf(((ByteBinaryTag) foreign).value()); - } else if (foreign instanceof ByteArrayBinaryTag) { - return new net.minecraft.nbt.ByteArrayTag(((ByteArrayBinaryTag) foreign).value()); - } else if (foreign instanceof DoubleBinaryTag) { - return net.minecraft.nbt.DoubleTag.valueOf(((DoubleBinaryTag) foreign).value()); - } else if (foreign instanceof FloatBinaryTag) { - return net.minecraft.nbt.FloatTag.valueOf(((FloatBinaryTag) foreign).value()); - } else if (foreign instanceof IntBinaryTag) { - return net.minecraft.nbt.IntTag.valueOf(((IntBinaryTag) foreign).value()); - } else if (foreign instanceof IntArrayBinaryTag) { - return new net.minecraft.nbt.IntArrayTag(((IntArrayBinaryTag) foreign).value()); - } else if (foreign instanceof LongArrayBinaryTag) { - return new net.minecraft.nbt.LongArrayTag(((LongArrayBinaryTag) foreign).value()); - } else if (foreign instanceof ListBinaryTag) { - net.minecraft.nbt.ListTag tag = new net.minecraft.nbt.ListTag(); - ListBinaryTag foreignList = (ListBinaryTag) foreign; - for (BinaryTag t : foreignList) { - tag.add(fromNativeBinary(t)); - } - return tag; - } else if (foreign instanceof LongBinaryTag) { - return net.minecraft.nbt.LongTag.valueOf(((LongBinaryTag) foreign).value()); - } else if (foreign instanceof ShortBinaryTag) { - return net.minecraft.nbt.ShortTag.valueOf(((ShortBinaryTag) foreign).value()); - } else if (foreign instanceof StringBinaryTag) { - return net.minecraft.nbt.StringTag.valueOf(((StringBinaryTag) foreign).value()); - } else if (foreign instanceof EndBinaryTag) { - return net.minecraft.nbt.EndTag.INSTANCE; - } else { - throw new IllegalArgumentException("Don't know how to make NMS " + foreign.getClass().getCanonicalName()); - } - } - //FAWE end - - @Override - public boolean supportsWatchdog() { - return watchdog != null; - } - - @Override - public void tickWatchdog() { - watchdog.tick(); - } - - private class SpigotWatchdog implements Watchdog { - - private final Field instanceField; - private final Field lastTickField; - - SpigotWatchdog() throws NoSuchFieldException { - Field instanceField = WatchdogThread.class.getDeclaredField("instance"); - instanceField.setAccessible(true); - this.instanceField = instanceField; - - Field lastTickField = WatchdogThread.class.getDeclaredField("lastTick"); - lastTickField.setAccessible(true); - this.lastTickField = lastTickField; - } - - @Override - public void tick() { - try { - WatchdogThread instance = (WatchdogThread) this.instanceField.get(null); - if ((long) lastTickField.get(instance) != 0) { - WatchdogThread.tick(); - } - } catch (IllegalAccessException e) { - LOGGER.log(Level.WARNING, "Failed to tick watchdog", e); - } - } - - } - - private static class MojangWatchdog implements Watchdog { - - private final DedicatedServer server; - private final Field tickField; - - MojangWatchdog(DedicatedServer server) throws NoSuchFieldException { - this.server = server; - Field tickField = MinecraftServer.class.getDeclaredField( - Refraction.pickName("nextTickTime", "ag") - ); - if (tickField.getType() != long.class) { - throw new IllegalStateException("nextTickTime is not a long field, mapping is likely incorrect"); - } - tickField.setAccessible(true); - this.tickField = tickField; - } - - @Override - public void tick() { - try { - tickField.set(server, Util.getMillis()); - } catch (IllegalAccessException ignored) { - } - } - - } - - private static class NoOpWorldLoadListener implements ChunkProgressListener { - - @Override - public void updateSpawnPos(ChunkPos spawnPos) { - } - - @Override - public void onStatusChange(ChunkPos pos, @Nullable ChunkStatus status) { - } - - @Override - public void start() { - } - - @Override - public void stop() { - } - - @Override - public void setChunkRadius(int radius) { - } - - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R1/PaperweightDataConverters.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R1/PaperweightDataConverters.java deleted file mode 100644 index c9d8928bb..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R1/PaperweightDataConverters.java +++ /dev/null @@ -1,2955 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_19_R1; - -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; -import com.mojang.datafixers.DSL.TypeReference; -import com.mojang.datafixers.DataFixer; -import com.mojang.datafixers.DataFixerBuilder; -import com.mojang.datafixers.schemas.Schema; -import com.mojang.serialization.Dynamic; -import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; -import net.minecraft.core.Direction; -import net.minecraft.nbt.NbtOps; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.GsonHelper; -import net.minecraft.util.StringUtil; -import net.minecraft.util.datafix.DataFixers; -import net.minecraft.util.datafix.fixes.References; -import net.minecraft.world.item.DyeColor; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import javax.annotation.Nullable; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Random; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.Executor; -import java.util.stream.Collectors; - -/** - * Handles converting all Pre 1.13.2 data using the Legacy DataFix System (ported to 1.13.2) - *

- * We register a DFU Fixer per Legacy Data Version and apply the fixes using legacy strategy - * which is safer, faster and cleaner code. - *

- * The pre DFU code did not fail when the Source version was unknown. - *

- * This class also provides util methods for converting compounds to wrap the update call to - * receive the source version in the compound - */ -@SuppressWarnings({"rawtypes", "unchecked"}) -class PaperweightDataConverters extends DataFixerBuilder implements com.sk89q.worldedit.world.DataFixer { - - //FAWE start - BinaryTag - @SuppressWarnings("unchecked") - @Override - public T fixUp(FixType type, T original, int srcVer) { - if (type == FixTypes.CHUNK) { - return (T) fixChunk((CompoundBinaryTag) original, srcVer); - } else if (type == FixTypes.BLOCK_ENTITY) { - return (T) fixBlockEntity((CompoundBinaryTag) original, srcVer); - } else if (type == FixTypes.ENTITY) { - return (T) fixEntity((CompoundBinaryTag) original, srcVer); - } else if (type == FixTypes.BLOCK_STATE) { - return (T) fixBlockState((String) original, srcVer); - } else if (type == FixTypes.ITEM_TYPE) { - return (T) fixItemType((String) original, srcVer); - } else if (type == FixTypes.BIOME) { - return (T) fixBiome((String) original, srcVer); - } - return original; - } - - private CompoundBinaryTag fixChunk(CompoundBinaryTag originalChunk, int srcVer) { - net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNativeBinary(originalChunk); - net.minecraft.nbt.CompoundTag fixed = convert(LegacyType.CHUNK, tag, srcVer); - return (CompoundBinaryTag) adapter.toNativeBinary(fixed); - } - - private CompoundBinaryTag fixBlockEntity(CompoundBinaryTag origTileEnt, int srcVer) { - net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNativeBinary(origTileEnt); - net.minecraft.nbt.CompoundTag fixed = convert(LegacyType.BLOCK_ENTITY, tag, srcVer); - return (CompoundBinaryTag) adapter.toNativeBinary(fixed); - } - - private CompoundBinaryTag fixEntity(CompoundBinaryTag origEnt, int srcVer) { - net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNativeBinary(origEnt); - net.minecraft.nbt.CompoundTag fixed = convert(LegacyType.ENTITY, tag, srcVer); - return (CompoundBinaryTag) adapter.toNativeBinary(fixed); - } - //FAWE end - - private String fixBlockState(String blockState, int srcVer) { - net.minecraft.nbt.CompoundTag stateNBT = stateToNBT(blockState); - Dynamic dynamic = new Dynamic<>(OPS_NBT, stateNBT); - net.minecraft.nbt.CompoundTag fixed = (net.minecraft.nbt.CompoundTag) INSTANCE.fixer.update( - References.BLOCK_STATE, - dynamic, - srcVer, - DATA_VERSION - ).getValue(); - return nbtToState(fixed); - } - - private String nbtToState(net.minecraft.nbt.CompoundTag tagCompound) { - StringBuilder sb = new StringBuilder(); - sb.append(tagCompound.getString("Name")); - if (tagCompound.contains("Properties", 10)) { - sb.append('['); - net.minecraft.nbt.CompoundTag props = tagCompound.getCompound("Properties"); - sb.append(props - .getAllKeys() - .stream() - .map(k -> k + "=" + props.getString(k).replace("\"", "")) - .collect(Collectors.joining(","))); - sb.append(']'); - } - return sb.toString(); - } - - private static net.minecraft.nbt.CompoundTag stateToNBT(String blockState) { - int propIdx = blockState.indexOf('['); - net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag(); - if (propIdx < 0) { - tag.putString("Name", blockState); - } else { - tag.putString("Name", blockState.substring(0, propIdx)); - net.minecraft.nbt.CompoundTag propTag = new net.minecraft.nbt.CompoundTag(); - String props = blockState.substring(propIdx + 1, blockState.length() - 1); - String[] propArr = props.split(","); - for (String pair : propArr) { - final String[] split = pair.split("="); - propTag.putString(split[0], split[1]); - } - tag.put("Properties", propTag); - } - return tag; - } - - private String fixBiome(String key, int srcVer) { - return fixName(key, srcVer, References.BIOME); - } - - private String fixItemType(String key, int srcVer) { - return fixName(key, srcVer, References.ITEM_NAME); - } - - private static String fixName(String key, int srcVer, TypeReference type) { - return INSTANCE.fixer.update(type, new Dynamic<>(OPS_NBT, net.minecraft.nbt.StringTag.valueOf(key)), srcVer, DATA_VERSION) - .getValue().getAsString(); - } - - private final PaperweightAdapter adapter; - - private static final NbtOps OPS_NBT = NbtOps.INSTANCE; - private static final int LEGACY_VERSION = 1343; - private static int DATA_VERSION; - static PaperweightDataConverters INSTANCE; - - private final Map> converters = new EnumMap<>(LegacyType.class); - private final Map> inspectors = new EnumMap<>(LegacyType.class); - - // Set on build - private DataFixer fixer; - private static final Map DFU_TO_LEGACY = new HashMap<>(); - - public enum LegacyType { - LEVEL(References.LEVEL), - PLAYER(References.PLAYER), - CHUNK(References.CHUNK), - BLOCK_ENTITY(References.BLOCK_ENTITY), - ENTITY(References.ENTITY), - ITEM_INSTANCE(References.ITEM_STACK), - OPTIONS(References.OPTIONS), - STRUCTURE(References.STRUCTURE); - - private final TypeReference type; - - LegacyType(TypeReference type) { - this.type = type; - DFU_TO_LEGACY.put(type.typeName(), this); - } - - public TypeReference getDFUType() { - return type; - } - } - - PaperweightDataConverters(int dataVersion, PaperweightAdapter adapter) { - super(dataVersion); - DATA_VERSION = dataVersion; - INSTANCE = this; - this.adapter = adapter; - registerConverters(); - registerInspectors(); - } - - - // Called after fixers are built and ready for FIXING - @Override - public DataFixer buildUnoptimized() { - return this.fixer = new WrappedDataFixer(DataFixers.getDataFixer()); - } - - @Override - public DataFixer buildOptimized(Executor executor) { - return buildUnoptimized(); - } - - @SuppressWarnings("unchecked") - private class WrappedDataFixer implements DataFixer { - - private final DataFixer realFixer; - - WrappedDataFixer(DataFixer realFixer) { - this.realFixer = realFixer; - } - - @Override - public Dynamic update(TypeReference type, Dynamic dynamic, int sourceVer, int targetVer) { - LegacyType legacyType = DFU_TO_LEGACY.get(type.typeName()); - if (sourceVer < LEGACY_VERSION && legacyType != null) { - net.minecraft.nbt.CompoundTag cmp = (net.minecraft.nbt.CompoundTag) dynamic.getValue(); - int desiredVersion = Math.min(targetVer, LEGACY_VERSION); - - cmp = convert(legacyType, cmp, sourceVer, desiredVersion); - sourceVer = desiredVersion; - dynamic = new Dynamic(OPS_NBT, cmp); - } - return realFixer.update(type, dynamic, sourceVer, targetVer); - } - - private net.minecraft.nbt.CompoundTag convert( - LegacyType type, - net.minecraft.nbt.CompoundTag cmp, - int sourceVer, - int desiredVersion - ) { - List converters = PaperweightDataConverters.this.converters.get(type); - if (converters != null && !converters.isEmpty()) { - for (DataConverter converter : converters) { - int dataVersion = converter.getDataVersion(); - if (dataVersion > sourceVer && dataVersion <= desiredVersion) { - cmp = converter.convert(cmp); - } - } - } - - List inspectors = PaperweightDataConverters.this.inspectors.get(type); - if (inspectors != null && !inspectors.isEmpty()) { - for (DataInspector inspector : inspectors) { - cmp = inspector.inspect(cmp, sourceVer, desiredVersion); - } - } - - return cmp; - } - - @Override - public Schema getSchema(int i) { - return realFixer.getSchema(i); - } - - } - - public static net.minecraft.nbt.CompoundTag convert(LegacyType type, net.minecraft.nbt.CompoundTag cmp) { - return convert(type.getDFUType(), cmp); - } - - public static net.minecraft.nbt.CompoundTag convert(LegacyType type, net.minecraft.nbt.CompoundTag cmp, int sourceVer) { - return convert(type.getDFUType(), cmp, sourceVer); - } - - public static net.minecraft.nbt.CompoundTag convert( - LegacyType type, - net.minecraft.nbt.CompoundTag cmp, - int sourceVer, - int targetVer - ) { - return convert(type.getDFUType(), cmp, sourceVer, targetVer); - } - - public static net.minecraft.nbt.CompoundTag convert(TypeReference type, net.minecraft.nbt.CompoundTag cmp) { - int i = cmp.contains("DataVersion", 99) ? cmp.getInt("DataVersion") : -1; - return convert(type, cmp, i); - } - - public static net.minecraft.nbt.CompoundTag convert(TypeReference type, net.minecraft.nbt.CompoundTag cmp, int sourceVer) { - return convert(type, cmp, sourceVer, DATA_VERSION); - } - - public static net.minecraft.nbt.CompoundTag convert( - TypeReference type, - net.minecraft.nbt.CompoundTag cmp, - int sourceVer, - int targetVer - ) { - if (sourceVer >= targetVer) { - return cmp; - } - return (net.minecraft.nbt.CompoundTag) INSTANCE.fixer - .update(type, new Dynamic<>(OPS_NBT, cmp), sourceVer, targetVer) - .getValue(); - } - - - public interface DataInspector { - - net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer); - - } - - public interface DataConverter { - - int getDataVersion(); - - net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp); - - } - - - private void registerInspector(LegacyType type, DataInspector inspector) { - this.inspectors.computeIfAbsent(type, k -> new ArrayList<>()).add(inspector); - } - - private void registerConverter(LegacyType type, DataConverter converter) { - int version = converter.getDataVersion(); - - List list = this.converters.computeIfAbsent(type, k -> new ArrayList<>()); - if (!list.isEmpty() && list.get(list.size() - 1).getDataVersion() > version) { - for (int j = 0; j < list.size(); ++j) { - if (list.get(j).getDataVersion() > version) { - list.add(j, converter); - break; - } - } - } else { - list.add(converter); - } - } - - private void registerInspectors() { - registerEntityItemList("EntityHorseDonkey", "SaddleItem", "Items"); - registerEntityItemList("EntityHorseMule", "Items"); - registerEntityItemList("EntityMinecartChest", "Items"); - registerEntityItemList("EntityMinecartHopper", "Items"); - registerEntityItemList("EntityVillager", "Inventory"); - registerEntityItemListEquipment("EntityArmorStand"); - registerEntityItemListEquipment("EntityBat"); - registerEntityItemListEquipment("EntityBlaze"); - registerEntityItemListEquipment("EntityCaveSpider"); - registerEntityItemListEquipment("EntityChicken"); - registerEntityItemListEquipment("EntityCow"); - registerEntityItemListEquipment("EntityCreeper"); - registerEntityItemListEquipment("EntityEnderDragon"); - registerEntityItemListEquipment("EntityEnderman"); - registerEntityItemListEquipment("EntityEndermite"); - registerEntityItemListEquipment("EntityEvoker"); - registerEntityItemListEquipment("EntityGhast"); - registerEntityItemListEquipment("EntityGiantZombie"); - registerEntityItemListEquipment("EntityGuardian"); - registerEntityItemListEquipment("EntityGuardianElder"); - registerEntityItemListEquipment("EntityHorse"); - registerEntityItemListEquipment("EntityHorseDonkey"); - registerEntityItemListEquipment("EntityHorseMule"); - registerEntityItemListEquipment("EntityHorseSkeleton"); - registerEntityItemListEquipment("EntityHorseZombie"); - registerEntityItemListEquipment("EntityIronGolem"); - registerEntityItemListEquipment("EntityMagmaCube"); - registerEntityItemListEquipment("EntityMushroomCow"); - registerEntityItemListEquipment("EntityOcelot"); - registerEntityItemListEquipment("EntityPig"); - registerEntityItemListEquipment("EntityPigZombie"); - registerEntityItemListEquipment("EntityRabbit"); - registerEntityItemListEquipment("EntitySheep"); - registerEntityItemListEquipment("EntityShulker"); - registerEntityItemListEquipment("EntitySilverfish"); - registerEntityItemListEquipment("EntitySkeleton"); - registerEntityItemListEquipment("EntitySkeletonStray"); - registerEntityItemListEquipment("EntitySkeletonWither"); - registerEntityItemListEquipment("EntitySlime"); - registerEntityItemListEquipment("EntitySnowman"); - registerEntityItemListEquipment("EntitySpider"); - registerEntityItemListEquipment("EntitySquid"); - registerEntityItemListEquipment("EntityVex"); - registerEntityItemListEquipment("EntityVillager"); - registerEntityItemListEquipment("EntityVindicator"); - registerEntityItemListEquipment("EntityWitch"); - registerEntityItemListEquipment("EntityWither"); - registerEntityItemListEquipment("EntityWolf"); - registerEntityItemListEquipment("EntityZombie"); - registerEntityItemListEquipment("EntityZombieHusk"); - registerEntityItemListEquipment("EntityZombieVillager"); - registerEntityItemSingle("EntityFireworks", "FireworksItem"); - registerEntityItemSingle("EntityHorse", "ArmorItem"); - registerEntityItemSingle("EntityHorse", "SaddleItem"); - registerEntityItemSingle("EntityHorseMule", "SaddleItem"); - registerEntityItemSingle("EntityHorseSkeleton", "SaddleItem"); - registerEntityItemSingle("EntityHorseZombie", "SaddleItem"); - registerEntityItemSingle("EntityItem", "Item"); - registerEntityItemSingle("EntityItemFrame", "Item"); - registerEntityItemSingle("EntityPotion", "Potion"); - - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItem("TileEntityRecordPlayer", "RecordItem")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityBrewingStand", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityChest", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityDispenser", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityDropper", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityFurnace", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityHopper", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityShulkerBox", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorMobSpawnerMobs()); - registerInspector(LegacyType.CHUNK, new DataInspectorChunks()); - registerInspector(LegacyType.ENTITY, new DataInspectorCommandBlock()); - registerInspector(LegacyType.ENTITY, new DataInspectorEntityPassengers()); - registerInspector(LegacyType.ENTITY, new DataInspectorMobSpawnerMinecart()); - registerInspector(LegacyType.ENTITY, new DataInspectorVillagers()); - registerInspector(LegacyType.ITEM_INSTANCE, new DataInspectorBlockEntity()); - registerInspector(LegacyType.ITEM_INSTANCE, new DataInspectorEntity()); - registerInspector(LegacyType.LEVEL, new DataInspectorLevelPlayer()); - registerInspector(LegacyType.PLAYER, new DataInspectorPlayer()); - registerInspector(LegacyType.PLAYER, new DataInspectorPlayerVehicle()); - registerInspector(LegacyType.STRUCTURE, new DataInspectorStructure()); - } - - private void registerConverters() { - registerConverter(LegacyType.ENTITY, new DataConverterEquipment()); - registerConverter(LegacyType.BLOCK_ENTITY, new DataConverterSignText()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterMaterialId()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterPotionId()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterSpawnEgg()); - registerConverter(LegacyType.ENTITY, new DataConverterMinecart()); - registerConverter(LegacyType.BLOCK_ENTITY, new DataConverterMobSpawner()); - registerConverter(LegacyType.ENTITY, new DataConverterUUID()); - registerConverter(LegacyType.ENTITY, new DataConverterHealth()); - registerConverter(LegacyType.ENTITY, new DataConverterSaddle()); - registerConverter(LegacyType.ENTITY, new DataConverterHanging()); - registerConverter(LegacyType.ENTITY, new DataConverterDropChances()); - registerConverter(LegacyType.ENTITY, new DataConverterRiding()); - registerConverter(LegacyType.ENTITY, new DataConverterArmorStand()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterBook()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterCookedFish()); - registerConverter(LegacyType.ENTITY, new DataConverterZombie()); - registerConverter(LegacyType.OPTIONS, new DataConverterVBO()); - registerConverter(LegacyType.ENTITY, new DataConverterGuardian()); - registerConverter(LegacyType.ENTITY, new DataConverterSkeleton()); - registerConverter(LegacyType.ENTITY, new DataConverterZombieType()); - registerConverter(LegacyType.ENTITY, new DataConverterHorse()); - registerConverter(LegacyType.BLOCK_ENTITY, new DataConverterTileEntity()); - registerConverter(LegacyType.ENTITY, new DataConverterEntity()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterBanner()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterPotionWater()); - registerConverter(LegacyType.ENTITY, new DataConverterShulker()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterShulkerBoxItem()); - registerConverter(LegacyType.BLOCK_ENTITY, new DataConverterShulkerBoxBlock()); - registerConverter(LegacyType.OPTIONS, new DataConverterLang()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterTotem()); - registerConverter(LegacyType.CHUNK, new DataConverterBedBlock()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterBedItem()); - } - - private void registerEntityItemList(String type, String... keys) { - registerInspector(LegacyType.ENTITY, new DataInspectorItemList(type, keys)); - } - - private void registerEntityItemSingle(String type, String key) { - registerInspector(LegacyType.ENTITY, new DataInspectorItem(type, key)); - } - - private void registerEntityItemListEquipment(String type) { - registerEntityItemList(type, "ArmorItems", "HandItems"); - } - - private static final Map OLD_ID_TO_KEY_MAP = new HashMap<>(); - - static { - final Map map = OLD_ID_TO_KEY_MAP; - map.put("EntityItem", new ResourceLocation("item")); - map.put("EntityExperienceOrb", new ResourceLocation("xp_orb")); - map.put("EntityAreaEffectCloud", new ResourceLocation("area_effect_cloud")); - map.put("EntityGuardianElder", new ResourceLocation("elder_guardian")); - map.put("EntitySkeletonWither", new ResourceLocation("wither_skeleton")); - map.put("EntitySkeletonStray", new ResourceLocation("stray")); - map.put("EntityEgg", new ResourceLocation("egg")); - map.put("EntityLeash", new ResourceLocation("leash_knot")); - map.put("EntityPainting", new ResourceLocation("painting")); - map.put("EntityTippedArrow", new ResourceLocation("arrow")); - map.put("EntitySnowball", new ResourceLocation("snowball")); - map.put("EntityLargeFireball", new ResourceLocation("fireball")); - map.put("EntitySmallFireball", new ResourceLocation("small_fireball")); - map.put("EntityEnderPearl", new ResourceLocation("ender_pearl")); - map.put("EntityEnderSignal", new ResourceLocation("eye_of_ender_signal")); - map.put("EntityPotion", new ResourceLocation("potion")); - map.put("EntityThrownExpBottle", new ResourceLocation("xp_bottle")); - map.put("EntityItemFrame", new ResourceLocation("item_frame")); - map.put("EntityWitherSkull", new ResourceLocation("wither_skull")); - map.put("EntityTNTPrimed", new ResourceLocation("tnt")); - map.put("EntityFallingBlock", new ResourceLocation("falling_block")); - map.put("EntityFireworks", new ResourceLocation("fireworks_rocket")); - map.put("EntityZombieHusk", new ResourceLocation("husk")); - map.put("EntitySpectralArrow", new ResourceLocation("spectral_arrow")); - map.put("EntityShulkerBullet", new ResourceLocation("shulker_bullet")); - map.put("EntityDragonFireball", new ResourceLocation("dragon_fireball")); - map.put("EntityZombieVillager", new ResourceLocation("zombie_villager")); - map.put("EntityHorseSkeleton", new ResourceLocation("skeleton_horse")); - map.put("EntityHorseZombie", new ResourceLocation("zombie_horse")); - map.put("EntityArmorStand", new ResourceLocation("armor_stand")); - map.put("EntityHorseDonkey", new ResourceLocation("donkey")); - map.put("EntityHorseMule", new ResourceLocation("mule")); - map.put("EntityEvokerFangs", new ResourceLocation("evocation_fangs")); - map.put("EntityEvoker", new ResourceLocation("evocation_illager")); - map.put("EntityVex", new ResourceLocation("vex")); - map.put("EntityVindicator", new ResourceLocation("vindication_illager")); - map.put("EntityIllagerIllusioner", new ResourceLocation("illusion_illager")); - map.put("EntityMinecartCommandBlock", new ResourceLocation("commandblock_minecart")); - map.put("EntityBoat", new ResourceLocation("boat")); - map.put("EntityMinecartRideable", new ResourceLocation("minecart")); - map.put("EntityMinecartChest", new ResourceLocation("chest_minecart")); - map.put("EntityMinecartFurnace", new ResourceLocation("furnace_minecart")); - map.put("EntityMinecartTNT", new ResourceLocation("tnt_minecart")); - map.put("EntityMinecartHopper", new ResourceLocation("hopper_minecart")); - map.put("EntityMinecartMobSpawner", new ResourceLocation("spawner_minecart")); - map.put("EntityCreeper", new ResourceLocation("creeper")); - map.put("EntitySkeleton", new ResourceLocation("skeleton")); - map.put("EntitySpider", new ResourceLocation("spider")); - map.put("EntityGiantZombie", new ResourceLocation("giant")); - map.put("EntityZombie", new ResourceLocation("zombie")); - map.put("EntitySlime", new ResourceLocation("slime")); - map.put("EntityGhast", new ResourceLocation("ghast")); - map.put("EntityPigZombie", new ResourceLocation("zombie_pigman")); - map.put("EntityEnderman", new ResourceLocation("enderman")); - map.put("EntityCaveSpider", new ResourceLocation("cave_spider")); - map.put("EntitySilverfish", new ResourceLocation("silverfish")); - map.put("EntityBlaze", new ResourceLocation("blaze")); - map.put("EntityMagmaCube", new ResourceLocation("magma_cube")); - map.put("EntityEnderDragon", new ResourceLocation("ender_dragon")); - map.put("EntityWither", new ResourceLocation("wither")); - map.put("EntityBat", new ResourceLocation("bat")); - map.put("EntityWitch", new ResourceLocation("witch")); - map.put("EntityEndermite", new ResourceLocation("endermite")); - map.put("EntityGuardian", new ResourceLocation("guardian")); - map.put("EntityShulker", new ResourceLocation("shulker")); - map.put("EntityPig", new ResourceLocation("pig")); - map.put("EntitySheep", new ResourceLocation("sheep")); - map.put("EntityCow", new ResourceLocation("cow")); - map.put("EntityChicken", new ResourceLocation("chicken")); - map.put("EntitySquid", new ResourceLocation("squid")); - map.put("EntityWolf", new ResourceLocation("wolf")); - map.put("EntityMushroomCow", new ResourceLocation("mooshroom")); - map.put("EntitySnowman", new ResourceLocation("snowman")); - map.put("EntityOcelot", new ResourceLocation("ocelot")); - map.put("EntityIronGolem", new ResourceLocation("villager_golem")); - map.put("EntityHorse", new ResourceLocation("horse")); - map.put("EntityRabbit", new ResourceLocation("rabbit")); - map.put("EntityPolarBear", new ResourceLocation("polar_bear")); - map.put("EntityLlama", new ResourceLocation("llama")); - map.put("EntityLlamaSpit", new ResourceLocation("llama_spit")); - map.put("EntityParrot", new ResourceLocation("parrot")); - map.put("EntityVillager", new ResourceLocation("villager")); - map.put("EntityEnderCrystal", new ResourceLocation("ender_crystal")); - map.put("TileEntityFurnace", new ResourceLocation("furnace")); - map.put("TileEntityChest", new ResourceLocation("chest")); - map.put("TileEntityEnderChest", new ResourceLocation("ender_chest")); - map.put("TileEntityRecordPlayer", new ResourceLocation("jukebox")); - map.put("TileEntityDispenser", new ResourceLocation("dispenser")); - map.put("TileEntityDropper", new ResourceLocation("dropper")); - map.put("TileEntitySign", new ResourceLocation("sign")); - map.put("TileEntityMobSpawner", new ResourceLocation("mob_spawner")); - map.put("TileEntityNote", new ResourceLocation("noteblock")); - map.put("TileEntityPiston", new ResourceLocation("piston")); - map.put("TileEntityBrewingStand", new ResourceLocation("brewing_stand")); - map.put("TileEntityEnchantTable", new ResourceLocation("enchanting_table")); - map.put("TileEntityEnderPortal", new ResourceLocation("end_portal")); - map.put("TileEntityBeacon", new ResourceLocation("beacon")); - map.put("TileEntitySkull", new ResourceLocation("skull")); - map.put("TileEntityLightDetector", new ResourceLocation("daylight_detector")); - map.put("TileEntityHopper", new ResourceLocation("hopper")); - map.put("TileEntityComparator", new ResourceLocation("comparator")); - map.put("TileEntityFlowerPot", new ResourceLocation("flower_pot")); - map.put("TileEntityBanner", new ResourceLocation("banner")); - map.put("TileEntityStructure", new ResourceLocation("structure_block")); - map.put("TileEntityEndGateway", new ResourceLocation("end_gateway")); - map.put("TileEntityCommand", new ResourceLocation("command_block")); - map.put("TileEntityShulkerBox", new ResourceLocation("shulker_box")); - map.put("TileEntityBed", new ResourceLocation("bed")); - } - - private static ResourceLocation getKey(String type) { - final ResourceLocation key = OLD_ID_TO_KEY_MAP.get(type); - if (key == null) { - throw new IllegalArgumentException("Unknown mapping for " + type); - } - return key; - } - - private static void convertCompound( - LegacyType type, - net.minecraft.nbt.CompoundTag cmp, - String key, - int sourceVer, - int targetVer - ) { - cmp.put(key, convert(type, cmp.getCompound(key), sourceVer, targetVer)); - } - - private static void convertItem(net.minecraft.nbt.CompoundTag nbttagcompound, String key, int sourceVer, int targetVer) { - if (nbttagcompound.contains(key, 10)) { - convertCompound(LegacyType.ITEM_INSTANCE, nbttagcompound, key, sourceVer, targetVer); - } - } - - private static void convertItems(net.minecraft.nbt.CompoundTag nbttagcompound, String key, int sourceVer, int targetVer) { - if (nbttagcompound.contains(key, 9)) { - net.minecraft.nbt.ListTag nbttaglist = nbttagcompound.getList(key, 10); - - for (int j = 0; j < nbttaglist.size(); ++j) { - nbttaglist.set(j, convert(LegacyType.ITEM_INSTANCE, nbttaglist.getCompound(j), sourceVer, targetVer)); - } - } - - } - - private static class DataConverterEquipment implements DataConverter { - - DataConverterEquipment() { - } - - public int getDataVersion() { - return 100; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - net.minecraft.nbt.ListTag nbttaglist = cmp.getList("Equipment", 10); - net.minecraft.nbt.ListTag nbttaglist1; - - if (!nbttaglist.isEmpty() && !cmp.contains("HandItems", 10)) { - nbttaglist1 = new net.minecraft.nbt.ListTag(); - nbttaglist1.add(nbttaglist.get(0)); - nbttaglist1.add(new net.minecraft.nbt.CompoundTag()); - cmp.put("HandItems", nbttaglist1); - } - - if (nbttaglist.size() > 1 && !cmp.contains("ArmorItem", 10)) { - nbttaglist1 = new net.minecraft.nbt.ListTag(); - nbttaglist1.add(nbttaglist.get(1)); - nbttaglist1.add(nbttaglist.get(2)); - nbttaglist1.add(nbttaglist.get(3)); - nbttaglist1.add(nbttaglist.get(4)); - cmp.put("ArmorItems", nbttaglist1); - } - - cmp.remove("Equipment"); - if (cmp.contains("DropChances", 9)) { - nbttaglist1 = cmp.getList("DropChances", 5); - net.minecraft.nbt.ListTag nbttaglist2; - - if (!cmp.contains("HandDropChances", 10)) { - nbttaglist2 = new net.minecraft.nbt.ListTag(); - nbttaglist2.add(net.minecraft.nbt.FloatTag.valueOf(nbttaglist1.getFloat(0))); - nbttaglist2.add(net.minecraft.nbt.FloatTag.valueOf(0.0F)); - cmp.put("HandDropChances", nbttaglist2); - } - - if (!cmp.contains("ArmorDropChances", 10)) { - nbttaglist2 = new net.minecraft.nbt.ListTag(); - nbttaglist2.add(net.minecraft.nbt.FloatTag.valueOf(nbttaglist1.getFloat(1))); - nbttaglist2.add(net.minecraft.nbt.FloatTag.valueOf(nbttaglist1.getFloat(2))); - nbttaglist2.add(net.minecraft.nbt.FloatTag.valueOf(nbttaglist1.getFloat(3))); - nbttaglist2.add(net.minecraft.nbt.FloatTag.valueOf(nbttaglist1.getFloat(4))); - cmp.put("ArmorDropChances", nbttaglist2); - } - - cmp.remove("DropChances"); - } - - return cmp; - } - - } - - private static class DataInspectorBlockEntity implements DataInspector { - - private static final Map b = Maps.newHashMap(); - private static final Map c = Maps.newHashMap(); - - DataInspectorBlockEntity() { - } - - @Nullable - private static String convertEntityId(int i, String s) { - String key = new ResourceLocation(s).toString(); - if (i < 515 && DataInspectorBlockEntity.b.containsKey(key)) { - return DataInspectorBlockEntity.b.get(key); - } else { - return DataInspectorBlockEntity.c.get(key); - } - } - - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (!cmp.contains("tag", 10)) { - return cmp; - } else { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); - - if (nbttagcompound1.contains("BlockEntityTag", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag"); - String s = cmp.getString("id"); - String s1 = convertEntityId(sourceVer, s); - boolean flag; - - if (s1 == null) { - // CraftBukkit - Remove unnecessary warning (occurs when deserializing a Shulker Box item) - // DataInspectorBlockEntity.a.warn("Unable to resolve BlockEntity for ItemInstance: {}", s); - flag = false; - } else { - flag = !nbttagcompound2.contains("id"); - nbttagcompound2.putString("id", s1); - } - - convert(LegacyType.BLOCK_ENTITY, nbttagcompound2, sourceVer, targetVer); - if (flag) { - nbttagcompound2.remove("id"); - } - } - - return cmp; - } - } - - static { - Map map = DataInspectorBlockEntity.b; - - map.put("minecraft:furnace", "Furnace"); - map.put("minecraft:lit_furnace", "Furnace"); - map.put("minecraft:chest", "Chest"); - map.put("minecraft:trapped_chest", "Chest"); - map.put("minecraft:ender_chest", "EnderChest"); - map.put("minecraft:jukebox", "RecordPlayer"); - map.put("minecraft:dispenser", "Trap"); - map.put("minecraft:dropper", "Dropper"); - map.put("minecraft:sign", "Sign"); - map.put("minecraft:mob_spawner", "MobSpawner"); - map.put("minecraft:noteblock", "Music"); - map.put("minecraft:brewing_stand", "Cauldron"); - map.put("minecraft:enhanting_table", "EnchantTable"); - map.put("minecraft:command_block", "CommandBlock"); - map.put("minecraft:beacon", "Beacon"); - map.put("minecraft:skull", "Skull"); - map.put("minecraft:daylight_detector", "DLDetector"); - map.put("minecraft:hopper", "Hopper"); - map.put("minecraft:banner", "Banner"); - map.put("minecraft:flower_pot", "FlowerPot"); - map.put("minecraft:repeating_command_block", "CommandBlock"); - map.put("minecraft:chain_command_block", "CommandBlock"); - map.put("minecraft:standing_sign", "Sign"); - map.put("minecraft:wall_sign", "Sign"); - map.put("minecraft:piston_head", "Piston"); - map.put("minecraft:daylight_detector_inverted", "DLDetector"); - map.put("minecraft:unpowered_comparator", "Comparator"); - map.put("minecraft:powered_comparator", "Comparator"); - map.put("minecraft:wall_banner", "Banner"); - map.put("minecraft:standing_banner", "Banner"); - map.put("minecraft:structure_block", "Structure"); - map.put("minecraft:end_portal", "Airportal"); - map.put("minecraft:end_gateway", "EndGateway"); - map.put("minecraft:shield", "Shield"); - map = DataInspectorBlockEntity.c; - map.put("minecraft:furnace", "minecraft:furnace"); - map.put("minecraft:lit_furnace", "minecraft:furnace"); - map.put("minecraft:chest", "minecraft:chest"); - map.put("minecraft:trapped_chest", "minecraft:chest"); - map.put("minecraft:ender_chest", "minecraft:enderchest"); - map.put("minecraft:jukebox", "minecraft:jukebox"); - map.put("minecraft:dispenser", "minecraft:dispenser"); - map.put("minecraft:dropper", "minecraft:dropper"); - map.put("minecraft:sign", "minecraft:sign"); - map.put("minecraft:mob_spawner", "minecraft:mob_spawner"); - map.put("minecraft:noteblock", "minecraft:noteblock"); - map.put("minecraft:brewing_stand", "minecraft:brewing_stand"); - map.put("minecraft:enhanting_table", "minecraft:enchanting_table"); - map.put("minecraft:command_block", "minecraft:command_block"); - map.put("minecraft:beacon", "minecraft:beacon"); - map.put("minecraft:skull", "minecraft:skull"); - map.put("minecraft:daylight_detector", "minecraft:daylight_detector"); - map.put("minecraft:hopper", "minecraft:hopper"); - map.put("minecraft:banner", "minecraft:banner"); - map.put("minecraft:flower_pot", "minecraft:flower_pot"); - map.put("minecraft:repeating_command_block", "minecraft:command_block"); - map.put("minecraft:chain_command_block", "minecraft:command_block"); - map.put("minecraft:shulker_box", "minecraft:shulker_box"); - map.put("minecraft:white_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:orange_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:magenta_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:light_blue_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:yellow_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:lime_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:pink_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:gray_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:silver_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:cyan_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:purple_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:blue_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:brown_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:green_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:red_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:black_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:bed", "minecraft:bed"); - map.put("minecraft:standing_sign", "minecraft:sign"); - map.put("minecraft:wall_sign", "minecraft:sign"); - map.put("minecraft:piston_head", "minecraft:piston"); - map.put("minecraft:daylight_detector_inverted", "minecraft:daylight_detector"); - map.put("minecraft:unpowered_comparator", "minecraft:comparator"); - map.put("minecraft:powered_comparator", "minecraft:comparator"); - map.put("minecraft:wall_banner", "minecraft:banner"); - map.put("minecraft:standing_banner", "minecraft:banner"); - map.put("minecraft:structure_block", "minecraft:structure_block"); - map.put("minecraft:end_portal", "minecraft:end_portal"); - map.put("minecraft:end_gateway", "minecraft:end_gateway"); - map.put("minecraft:shield", "minecraft:shield"); - } - } - - private static class DataInspectorEntity implements DataInspector { - - DataInspectorEntity() { - } - - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); - - if (nbttagcompound1.contains("EntityTag", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("EntityTag"); - String s = cmp.getString("id"); - String s1; - - if ("minecraft:armor_stand".equals(s)) { - s1 = sourceVer < 515 ? "ArmorStand" : "minecraft:armor_stand"; - } else { - if (!"minecraft:spawn_egg".equals(s)) { - return cmp; - } - - s1 = nbttagcompound2.getString("id"); - } - - boolean flag; - - flag = !nbttagcompound2.contains("id", 8); - nbttagcompound2.putString("id", s1); - - convert(LegacyType.ENTITY, nbttagcompound2, sourceVer, targetVer); - if (flag) { - nbttagcompound2.remove("id"); - } - } - - return cmp; - } - - } - - - private abstract static class DataInspectorTagged implements DataInspector { - - private final ResourceLocation key; - - DataInspectorTagged(String type) { - this.key = getKey(type); - } - - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (this.key.equals(new ResourceLocation(cmp.getString("id")))) { - cmp = this.inspectChecked(cmp, sourceVer, targetVer); - } - - return cmp; - } - - abstract net.minecraft.nbt.CompoundTag inspectChecked( - net.minecraft.nbt.CompoundTag nbttagcompound, - int sourceVer, - int targetVer - ); - - } - - private static class DataInspectorItemList extends DataInspectorTagged { - - private final String[] keys; - - DataInspectorItemList(String oclass, String... astring) { - super(oclass); - this.keys = astring; - } - - net.minecraft.nbt.CompoundTag inspectChecked(net.minecraft.nbt.CompoundTag nbttagcompound, int sourceVer, int targetVer) { - for (String s : this.keys) { - PaperweightDataConverters.convertItems(nbttagcompound, s, sourceVer, targetVer); - } - - return nbttagcompound; - } - - } - - private static class DataInspectorItem extends DataInspectorTagged { - - private final String[] keys; - - DataInspectorItem(String oclass, String... astring) { - super(oclass); - this.keys = astring; - } - - net.minecraft.nbt.CompoundTag inspectChecked(net.minecraft.nbt.CompoundTag nbttagcompound, int sourceVer, int targetVer) { - for (String key : this.keys) { - PaperweightDataConverters.convertItem(nbttagcompound, key, sourceVer, targetVer); - } - - return nbttagcompound; - } - - } - - private static class DataConverterMaterialId implements DataConverter { - - private static final String[] materials = new String[2268]; - - DataConverterMaterialId() { - } - - public int getDataVersion() { - return 102; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if (cmp.contains("id", 99)) { - short short0 = cmp.getShort("id"); - - if (short0 > 0 && short0 < materials.length && materials[short0] != null) { - cmp.putString("id", materials[short0]); - } - } - - return cmp; - } - - static { - materials[1] = "minecraft:stone"; - materials[2] = "minecraft:grass"; - materials[3] = "minecraft:dirt"; - materials[4] = "minecraft:cobblestone"; - materials[5] = "minecraft:planks"; - materials[6] = "minecraft:sapling"; - materials[7] = "minecraft:bedrock"; - materials[8] = "minecraft:flowing_water"; - materials[9] = "minecraft:water"; - materials[10] = "minecraft:flowing_lava"; - materials[11] = "minecraft:lava"; - materials[12] = "minecraft:sand"; - materials[13] = "minecraft:gravel"; - materials[14] = "minecraft:gold_ore"; - materials[15] = "minecraft:iron_ore"; - materials[16] = "minecraft:coal_ore"; - materials[17] = "minecraft:log"; - materials[18] = "minecraft:leaves"; - materials[19] = "minecraft:sponge"; - materials[20] = "minecraft:glass"; - materials[21] = "minecraft:lapis_ore"; - materials[22] = "minecraft:lapis_block"; - materials[23] = "minecraft:dispenser"; - materials[24] = "minecraft:sandstone"; - materials[25] = "minecraft:noteblock"; - materials[27] = "minecraft:golden_rail"; - materials[28] = "minecraft:detector_rail"; - materials[29] = "minecraft:sticky_piston"; - materials[30] = "minecraft:web"; - materials[31] = "minecraft:tallgrass"; - materials[32] = "minecraft:deadbush"; - materials[33] = "minecraft:piston"; - materials[35] = "minecraft:wool"; - materials[37] = "minecraft:yellow_flower"; - materials[38] = "minecraft:red_flower"; - materials[39] = "minecraft:brown_mushroom"; - materials[40] = "minecraft:red_mushroom"; - materials[41] = "minecraft:gold_block"; - materials[42] = "minecraft:iron_block"; - materials[43] = "minecraft:double_stone_slab"; - materials[44] = "minecraft:stone_slab"; - materials[45] = "minecraft:brick_block"; - materials[46] = "minecraft:tnt"; - materials[47] = "minecraft:bookshelf"; - materials[48] = "minecraft:mossy_cobblestone"; - materials[49] = "minecraft:obsidian"; - materials[50] = "minecraft:torch"; - materials[51] = "minecraft:fire"; - materials[52] = "minecraft:mob_spawner"; - materials[53] = "minecraft:oak_stairs"; - materials[54] = "minecraft:chest"; - materials[56] = "minecraft:diamond_ore"; - materials[57] = "minecraft:diamond_block"; - materials[58] = "minecraft:crafting_table"; - materials[60] = "minecraft:farmland"; - materials[61] = "minecraft:furnace"; - materials[62] = "minecraft:lit_furnace"; - materials[65] = "minecraft:ladder"; - materials[66] = "minecraft:rail"; - materials[67] = "minecraft:stone_stairs"; - materials[69] = "minecraft:lever"; - materials[70] = "minecraft:stone_pressure_plate"; - materials[72] = "minecraft:wooden_pressure_plate"; - materials[73] = "minecraft:redstone_ore"; - materials[76] = "minecraft:redstone_torch"; - materials[77] = "minecraft:stone_button"; - materials[78] = "minecraft:snow_layer"; - materials[79] = "minecraft:ice"; - materials[80] = "minecraft:snow"; - materials[81] = "minecraft:cactus"; - materials[82] = "minecraft:clay"; - materials[84] = "minecraft:jukebox"; - materials[85] = "minecraft:fence"; - materials[86] = "minecraft:pumpkin"; - materials[87] = "minecraft:netherrack"; - materials[88] = "minecraft:soul_sand"; - materials[89] = "minecraft:glowstone"; - materials[90] = "minecraft:portal"; - materials[91] = "minecraft:lit_pumpkin"; - materials[95] = "minecraft:stained_glass"; - materials[96] = "minecraft:trapdoor"; - materials[97] = "minecraft:monster_egg"; - materials[98] = "minecraft:stonebrick"; - materials[99] = "minecraft:brown_mushroom_block"; - materials[100] = "minecraft:red_mushroom_block"; - materials[101] = "minecraft:iron_bars"; - materials[102] = "minecraft:glass_pane"; - materials[103] = "minecraft:melon_block"; - materials[106] = "minecraft:vine"; - materials[107] = "minecraft:fence_gate"; - materials[108] = "minecraft:brick_stairs"; - materials[109] = "minecraft:stone_brick_stairs"; - materials[110] = "minecraft:mycelium"; - materials[111] = "minecraft:waterlily"; - materials[112] = "minecraft:nether_brick"; - materials[113] = "minecraft:nether_brick_fence"; - materials[114] = "minecraft:nether_brick_stairs"; - materials[116] = "minecraft:enchanting_table"; - materials[119] = "minecraft:end_portal"; - materials[120] = "minecraft:end_portal_frame"; - materials[121] = "minecraft:end_stone"; - materials[122] = "minecraft:dragon_egg"; - materials[123] = "minecraft:redstone_lamp"; - materials[125] = "minecraft:double_wooden_slab"; - materials[126] = "minecraft:wooden_slab"; - materials[127] = "minecraft:cocoa"; - materials[128] = "minecraft:sandstone_stairs"; - materials[129] = "minecraft:emerald_ore"; - materials[130] = "minecraft:ender_chest"; - materials[131] = "minecraft:tripwire_hook"; - materials[133] = "minecraft:emerald_block"; - materials[134] = "minecraft:spruce_stairs"; - materials[135] = "minecraft:birch_stairs"; - materials[136] = "minecraft:jungle_stairs"; - materials[137] = "minecraft:command_block"; - materials[138] = "minecraft:beacon"; - materials[139] = "minecraft:cobblestone_wall"; - materials[141] = "minecraft:carrots"; - materials[142] = "minecraft:potatoes"; - materials[143] = "minecraft:wooden_button"; - materials[145] = "minecraft:anvil"; - materials[146] = "minecraft:trapped_chest"; - materials[147] = "minecraft:light_weighted_pressure_plate"; - materials[148] = "minecraft:heavy_weighted_pressure_plate"; - materials[151] = "minecraft:daylight_detector"; - materials[152] = "minecraft:redstone_block"; - materials[153] = "minecraft:quartz_ore"; - materials[154] = "minecraft:hopper"; - materials[155] = "minecraft:quartz_block"; - materials[156] = "minecraft:quartz_stairs"; - materials[157] = "minecraft:activator_rail"; - materials[158] = "minecraft:dropper"; - materials[159] = "minecraft:stained_hardened_clay"; - materials[160] = "minecraft:stained_glass_pane"; - materials[161] = "minecraft:leaves2"; - materials[162] = "minecraft:log2"; - materials[163] = "minecraft:acacia_stairs"; - materials[164] = "minecraft:dark_oak_stairs"; - materials[170] = "minecraft:hay_block"; - materials[171] = "minecraft:carpet"; - materials[172] = "minecraft:hardened_clay"; - materials[173] = "minecraft:coal_block"; - materials[174] = "minecraft:packed_ice"; - materials[175] = "minecraft:double_plant"; - materials[256] = "minecraft:iron_shovel"; - materials[257] = "minecraft:iron_pickaxe"; - materials[258] = "minecraft:iron_axe"; - materials[259] = "minecraft:flint_and_steel"; - materials[260] = "minecraft:apple"; - materials[261] = "minecraft:bow"; - materials[262] = "minecraft:arrow"; - materials[263] = "minecraft:coal"; - materials[264] = "minecraft:diamond"; - materials[265] = "minecraft:iron_ingot"; - materials[266] = "minecraft:gold_ingot"; - materials[267] = "minecraft:iron_sword"; - materials[268] = "minecraft:wooden_sword"; - materials[269] = "minecraft:wooden_shovel"; - materials[270] = "minecraft:wooden_pickaxe"; - materials[271] = "minecraft:wooden_axe"; - materials[272] = "minecraft:stone_sword"; - materials[273] = "minecraft:stone_shovel"; - materials[274] = "minecraft:stone_pickaxe"; - materials[275] = "minecraft:stone_axe"; - materials[276] = "minecraft:diamond_sword"; - materials[277] = "minecraft:diamond_shovel"; - materials[278] = "minecraft:diamond_pickaxe"; - materials[279] = "minecraft:diamond_axe"; - materials[280] = "minecraft:stick"; - materials[281] = "minecraft:bowl"; - materials[282] = "minecraft:mushroom_stew"; - materials[283] = "minecraft:golden_sword"; - materials[284] = "minecraft:golden_shovel"; - materials[285] = "minecraft:golden_pickaxe"; - materials[286] = "minecraft:golden_axe"; - materials[287] = "minecraft:string"; - materials[288] = "minecraft:feather"; - materials[289] = "minecraft:gunpowder"; - materials[290] = "minecraft:wooden_hoe"; - materials[291] = "minecraft:stone_hoe"; - materials[292] = "minecraft:iron_hoe"; - materials[293] = "minecraft:diamond_hoe"; - materials[294] = "minecraft:golden_hoe"; - materials[295] = "minecraft:wheat_seeds"; - materials[296] = "minecraft:wheat"; - materials[297] = "minecraft:bread"; - materials[298] = "minecraft:leather_helmet"; - materials[299] = "minecraft:leather_chestplate"; - materials[300] = "minecraft:leather_leggings"; - materials[301] = "minecraft:leather_boots"; - materials[302] = "minecraft:chainmail_helmet"; - materials[303] = "minecraft:chainmail_chestplate"; - materials[304] = "minecraft:chainmail_leggings"; - materials[305] = "minecraft:chainmail_boots"; - materials[306] = "minecraft:iron_helmet"; - materials[307] = "minecraft:iron_chestplate"; - materials[308] = "minecraft:iron_leggings"; - materials[309] = "minecraft:iron_boots"; - materials[310] = "minecraft:diamond_helmet"; - materials[311] = "minecraft:diamond_chestplate"; - materials[312] = "minecraft:diamond_leggings"; - materials[313] = "minecraft:diamond_boots"; - materials[314] = "minecraft:golden_helmet"; - materials[315] = "minecraft:golden_chestplate"; - materials[316] = "minecraft:golden_leggings"; - materials[317] = "minecraft:golden_boots"; - materials[318] = "minecraft:flint"; - materials[319] = "minecraft:porkchop"; - materials[320] = "minecraft:cooked_porkchop"; - materials[321] = "minecraft:painting"; - materials[322] = "minecraft:golden_apple"; - materials[323] = "minecraft:sign"; - materials[324] = "minecraft:wooden_door"; - materials[325] = "minecraft:bucket"; - materials[326] = "minecraft:water_bucket"; - materials[327] = "minecraft:lava_bucket"; - materials[328] = "minecraft:minecart"; - materials[329] = "minecraft:saddle"; - materials[330] = "minecraft:iron_door"; - materials[331] = "minecraft:redstone"; - materials[332] = "minecraft:snowball"; - materials[333] = "minecraft:boat"; - materials[334] = "minecraft:leather"; - materials[335] = "minecraft:milk_bucket"; - materials[336] = "minecraft:brick"; - materials[337] = "minecraft:clay_ball"; - materials[338] = "minecraft:reeds"; - materials[339] = "minecraft:paper"; - materials[340] = "minecraft:book"; - materials[341] = "minecraft:slime_ball"; - materials[342] = "minecraft:chest_minecart"; - materials[343] = "minecraft:furnace_minecart"; - materials[344] = "minecraft:egg"; - materials[345] = "minecraft:compass"; - materials[346] = "minecraft:fishing_rod"; - materials[347] = "minecraft:clock"; - materials[348] = "minecraft:glowstone_dust"; - materials[349] = "minecraft:fish"; - materials[350] = "minecraft:cooked_fish"; // Paper - cooked_fished -> cooked_fish - materials[351] = "minecraft:dye"; - materials[352] = "minecraft:bone"; - materials[353] = "minecraft:sugar"; - materials[354] = "minecraft:cake"; - materials[355] = "minecraft:bed"; - materials[356] = "minecraft:repeater"; - materials[357] = "minecraft:cookie"; - materials[358] = "minecraft:filled_map"; - materials[359] = "minecraft:shears"; - materials[360] = "minecraft:melon"; - materials[361] = "minecraft:pumpkin_seeds"; - materials[362] = "minecraft:melon_seeds"; - materials[363] = "minecraft:beef"; - materials[364] = "minecraft:cooked_beef"; - materials[365] = "minecraft:chicken"; - materials[366] = "minecraft:cooked_chicken"; - materials[367] = "minecraft:rotten_flesh"; - materials[368] = "minecraft:ender_pearl"; - materials[369] = "minecraft:blaze_rod"; - materials[370] = "minecraft:ghast_tear"; - materials[371] = "minecraft:gold_nugget"; - materials[372] = "minecraft:nether_wart"; - materials[373] = "minecraft:potion"; - materials[374] = "minecraft:glass_bottle"; - materials[375] = "minecraft:spider_eye"; - materials[376] = "minecraft:fermented_spider_eye"; - materials[377] = "minecraft:blaze_powder"; - materials[378] = "minecraft:magma_cream"; - materials[379] = "minecraft:brewing_stand"; - materials[380] = "minecraft:cauldron"; - materials[381] = "minecraft:ender_eye"; - materials[382] = "minecraft:speckled_melon"; - materials[383] = "minecraft:spawn_egg"; - materials[384] = "minecraft:experience_bottle"; - materials[385] = "minecraft:fire_charge"; - materials[386] = "minecraft:writable_book"; - materials[387] = "minecraft:written_book"; - materials[388] = "minecraft:emerald"; - materials[389] = "minecraft:item_frame"; - materials[390] = "minecraft:flower_pot"; - materials[391] = "minecraft:carrot"; - materials[392] = "minecraft:potato"; - materials[393] = "minecraft:baked_potato"; - materials[394] = "minecraft:poisonous_potato"; - materials[395] = "minecraft:map"; - materials[396] = "minecraft:golden_carrot"; - materials[397] = "minecraft:skull"; - materials[398] = "minecraft:carrot_on_a_stick"; - materials[399] = "minecraft:nether_star"; - materials[400] = "minecraft:pumpkin_pie"; - materials[401] = "minecraft:fireworks"; - materials[402] = "minecraft:firework_charge"; - materials[403] = "minecraft:enchanted_book"; - materials[404] = "minecraft:comparator"; - materials[405] = "minecraft:netherbrick"; - materials[406] = "minecraft:quartz"; - materials[407] = "minecraft:tnt_minecart"; - materials[408] = "minecraft:hopper_minecart"; - materials[417] = "minecraft:iron_horse_armor"; - materials[418] = "minecraft:golden_horse_armor"; - materials[419] = "minecraft:diamond_horse_armor"; - materials[420] = "minecraft:lead"; - materials[421] = "minecraft:name_tag"; - materials[422] = "minecraft:command_block_minecart"; - materials[2256] = "minecraft:record_13"; - materials[2257] = "minecraft:record_cat"; - materials[2258] = "minecraft:record_blocks"; - materials[2259] = "minecraft:record_chirp"; - materials[2260] = "minecraft:record_far"; - materials[2261] = "minecraft:record_mall"; - materials[2262] = "minecraft:record_mellohi"; - materials[2263] = "minecraft:record_stal"; - materials[2264] = "minecraft:record_strad"; - materials[2265] = "minecraft:record_ward"; - materials[2266] = "minecraft:record_11"; - materials[2267] = "minecraft:record_wait"; - // Paper start - materials[409] = "minecraft:prismarine_shard"; - materials[410] = "minecraft:prismarine_crystals"; - materials[411] = "minecraft:rabbit"; - materials[412] = "minecraft:cooked_rabbit"; - materials[413] = "minecraft:rabbit_stew"; - materials[414] = "minecraft:rabbit_foot"; - materials[415] = "minecraft:rabbit_hide"; - materials[416] = "minecraft:armor_stand"; - materials[423] = "minecraft:mutton"; - materials[424] = "minecraft:cooked_mutton"; - materials[425] = "minecraft:banner"; - materials[426] = "minecraft:end_crystal"; - materials[427] = "minecraft:spruce_door"; - materials[428] = "minecraft:birch_door"; - materials[429] = "minecraft:jungle_door"; - materials[430] = "minecraft:acacia_door"; - materials[431] = "minecraft:dark_oak_door"; - materials[432] = "minecraft:chorus_fruit"; - materials[433] = "minecraft:chorus_fruit_popped"; - materials[434] = "minecraft:beetroot"; - materials[435] = "minecraft:beetroot_seeds"; - materials[436] = "minecraft:beetroot_soup"; - materials[437] = "minecraft:dragon_breath"; - materials[438] = "minecraft:splash_potion"; - materials[439] = "minecraft:spectral_arrow"; - materials[440] = "minecraft:tipped_arrow"; - materials[441] = "minecraft:lingering_potion"; - materials[442] = "minecraft:shield"; - materials[443] = "minecraft:elytra"; - materials[444] = "minecraft:spruce_boat"; - materials[445] = "minecraft:birch_boat"; - materials[446] = "minecraft:jungle_boat"; - materials[447] = "minecraft:acacia_boat"; - materials[448] = "minecraft:dark_oak_boat"; - materials[449] = "minecraft:totem_of_undying"; - materials[450] = "minecraft:shulker_shell"; - materials[452] = "minecraft:iron_nugget"; - materials[453] = "minecraft:knowledge_book"; - // Paper end - } - } - - private static class DataConverterArmorStand implements DataConverter { - - DataConverterArmorStand() { - } - - public int getDataVersion() { - return 147; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("ArmorStand".equals(cmp.getString("id")) && cmp.getBoolean("Silent") && !cmp.getBoolean("Marker")) { - cmp.remove("Silent"); - } - - return cmp; - } - - } - - private static class DataConverterBanner implements DataConverter { - - DataConverterBanner() { - } - - public int getDataVersion() { - return 804; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("minecraft:banner".equals(cmp.getString("id")) && cmp.contains("tag", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); - - if (nbttagcompound1.contains("BlockEntityTag", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag"); - - if (nbttagcompound2.contains("Base", 99)) { - cmp.putShort("Damage", (short) (nbttagcompound2.getShort("Base") & 15)); - if (nbttagcompound1.contains("display", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound3 = nbttagcompound1.getCompound("display"); - - if (nbttagcompound3.contains("Lore", 9)) { - net.minecraft.nbt.ListTag nbttaglist = nbttagcompound3.getList("Lore", 8); - - if (nbttaglist.size() == 1 && "(+NBT)".equals(nbttaglist.getString(0))) { - return cmp; - } - } - } - - nbttagcompound2.remove("Base"); - if (nbttagcompound2.isEmpty()) { - nbttagcompound1.remove("BlockEntityTag"); - } - - if (nbttagcompound1.isEmpty()) { - cmp.remove("tag"); - } - } - } - } - - return cmp; - } - - } - - private static class DataConverterPotionId implements DataConverter { - - private static final String[] potions = new String[128]; - - DataConverterPotionId() { - } - - public int getDataVersion() { - return 102; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("minecraft:potion".equals(cmp.getString("id"))) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); - short short0 = cmp.getShort("Damage"); - - if (!nbttagcompound1.contains("Potion", 8)) { - String s = DataConverterPotionId.potions[short0 & 127]; - - nbttagcompound1.putString("Potion", s == null ? "minecraft:water" : s); - cmp.put("tag", nbttagcompound1); - if ((short0 & 16384) == 16384) { - cmp.putString("id", "minecraft:splash_potion"); - } - } - - if (short0 != 0) { - cmp.putShort("Damage", (short) 0); - } - } - - return cmp; - } - - static { - DataConverterPotionId.potions[0] = "minecraft:water"; - DataConverterPotionId.potions[1] = "minecraft:regeneration"; - DataConverterPotionId.potions[2] = "minecraft:swiftness"; - DataConverterPotionId.potions[3] = "minecraft:fire_resistance"; - DataConverterPotionId.potions[4] = "minecraft:poison"; - DataConverterPotionId.potions[5] = "minecraft:healing"; - DataConverterPotionId.potions[6] = "minecraft:night_vision"; - DataConverterPotionId.potions[7] = null; - DataConverterPotionId.potions[8] = "minecraft:weakness"; - DataConverterPotionId.potions[9] = "minecraft:strength"; - DataConverterPotionId.potions[10] = "minecraft:slowness"; - DataConverterPotionId.potions[11] = "minecraft:leaping"; - DataConverterPotionId.potions[12] = "minecraft:harming"; - DataConverterPotionId.potions[13] = "minecraft:water_breathing"; - DataConverterPotionId.potions[14] = "minecraft:invisibility"; - DataConverterPotionId.potions[15] = null; - DataConverterPotionId.potions[16] = "minecraft:awkward"; - DataConverterPotionId.potions[17] = "minecraft:regeneration"; - DataConverterPotionId.potions[18] = "minecraft:swiftness"; - DataConverterPotionId.potions[19] = "minecraft:fire_resistance"; - DataConverterPotionId.potions[20] = "minecraft:poison"; - DataConverterPotionId.potions[21] = "minecraft:healing"; - DataConverterPotionId.potions[22] = "minecraft:night_vision"; - DataConverterPotionId.potions[23] = null; - DataConverterPotionId.potions[24] = "minecraft:weakness"; - DataConverterPotionId.potions[25] = "minecraft:strength"; - DataConverterPotionId.potions[26] = "minecraft:slowness"; - DataConverterPotionId.potions[27] = "minecraft:leaping"; - DataConverterPotionId.potions[28] = "minecraft:harming"; - DataConverterPotionId.potions[29] = "minecraft:water_breathing"; - DataConverterPotionId.potions[30] = "minecraft:invisibility"; - DataConverterPotionId.potions[31] = null; - DataConverterPotionId.potions[32] = "minecraft:thick"; - DataConverterPotionId.potions[33] = "minecraft:strong_regeneration"; - DataConverterPotionId.potions[34] = "minecraft:strong_swiftness"; - DataConverterPotionId.potions[35] = "minecraft:fire_resistance"; - DataConverterPotionId.potions[36] = "minecraft:strong_poison"; - DataConverterPotionId.potions[37] = "minecraft:strong_healing"; - DataConverterPotionId.potions[38] = "minecraft:night_vision"; - DataConverterPotionId.potions[39] = null; - DataConverterPotionId.potions[40] = "minecraft:weakness"; - DataConverterPotionId.potions[41] = "minecraft:strong_strength"; - DataConverterPotionId.potions[42] = "minecraft:slowness"; - DataConverterPotionId.potions[43] = "minecraft:strong_leaping"; - DataConverterPotionId.potions[44] = "minecraft:strong_harming"; - DataConverterPotionId.potions[45] = "minecraft:water_breathing"; - DataConverterPotionId.potions[46] = "minecraft:invisibility"; - DataConverterPotionId.potions[47] = null; - DataConverterPotionId.potions[48] = null; - DataConverterPotionId.potions[49] = "minecraft:strong_regeneration"; - DataConverterPotionId.potions[50] = "minecraft:strong_swiftness"; - DataConverterPotionId.potions[51] = "minecraft:fire_resistance"; - DataConverterPotionId.potions[52] = "minecraft:strong_poison"; - DataConverterPotionId.potions[53] = "minecraft:strong_healing"; - DataConverterPotionId.potions[54] = "minecraft:night_vision"; - DataConverterPotionId.potions[55] = null; - DataConverterPotionId.potions[56] = "minecraft:weakness"; - DataConverterPotionId.potions[57] = "minecraft:strong_strength"; - DataConverterPotionId.potions[58] = "minecraft:slowness"; - DataConverterPotionId.potions[59] = "minecraft:strong_leaping"; - DataConverterPotionId.potions[60] = "minecraft:strong_harming"; - DataConverterPotionId.potions[61] = "minecraft:water_breathing"; - DataConverterPotionId.potions[62] = "minecraft:invisibility"; - DataConverterPotionId.potions[63] = null; - DataConverterPotionId.potions[64] = "minecraft:mundane"; - DataConverterPotionId.potions[65] = "minecraft:long_regeneration"; - DataConverterPotionId.potions[66] = "minecraft:long_swiftness"; - DataConverterPotionId.potions[67] = "minecraft:long_fire_resistance"; - DataConverterPotionId.potions[68] = "minecraft:long_poison"; - DataConverterPotionId.potions[69] = "minecraft:healing"; - DataConverterPotionId.potions[70] = "minecraft:long_night_vision"; - DataConverterPotionId.potions[71] = null; - DataConverterPotionId.potions[72] = "minecraft:long_weakness"; - DataConverterPotionId.potions[73] = "minecraft:long_strength"; - DataConverterPotionId.potions[74] = "minecraft:long_slowness"; - DataConverterPotionId.potions[75] = "minecraft:long_leaping"; - DataConverterPotionId.potions[76] = "minecraft:harming"; - DataConverterPotionId.potions[77] = "minecraft:long_water_breathing"; - DataConverterPotionId.potions[78] = "minecraft:long_invisibility"; - DataConverterPotionId.potions[79] = null; - DataConverterPotionId.potions[80] = "minecraft:awkward"; - DataConverterPotionId.potions[81] = "minecraft:long_regeneration"; - DataConverterPotionId.potions[82] = "minecraft:long_swiftness"; - DataConverterPotionId.potions[83] = "minecraft:long_fire_resistance"; - DataConverterPotionId.potions[84] = "minecraft:long_poison"; - DataConverterPotionId.potions[85] = "minecraft:healing"; - DataConverterPotionId.potions[86] = "minecraft:long_night_vision"; - DataConverterPotionId.potions[87] = null; - DataConverterPotionId.potions[88] = "minecraft:long_weakness"; - DataConverterPotionId.potions[89] = "minecraft:long_strength"; - DataConverterPotionId.potions[90] = "minecraft:long_slowness"; - DataConverterPotionId.potions[91] = "minecraft:long_leaping"; - DataConverterPotionId.potions[92] = "minecraft:harming"; - DataConverterPotionId.potions[93] = "minecraft:long_water_breathing"; - DataConverterPotionId.potions[94] = "minecraft:long_invisibility"; - DataConverterPotionId.potions[95] = null; - DataConverterPotionId.potions[96] = "minecraft:thick"; - DataConverterPotionId.potions[97] = "minecraft:regeneration"; - DataConverterPotionId.potions[98] = "minecraft:swiftness"; - DataConverterPotionId.potions[99] = "minecraft:long_fire_resistance"; - DataConverterPotionId.potions[100] = "minecraft:poison"; - DataConverterPotionId.potions[101] = "minecraft:strong_healing"; - DataConverterPotionId.potions[102] = "minecraft:long_night_vision"; - DataConverterPotionId.potions[103] = null; - DataConverterPotionId.potions[104] = "minecraft:long_weakness"; - DataConverterPotionId.potions[105] = "minecraft:strength"; - DataConverterPotionId.potions[106] = "minecraft:long_slowness"; - DataConverterPotionId.potions[107] = "minecraft:leaping"; - DataConverterPotionId.potions[108] = "minecraft:strong_harming"; - DataConverterPotionId.potions[109] = "minecraft:long_water_breathing"; - DataConverterPotionId.potions[110] = "minecraft:long_invisibility"; - DataConverterPotionId.potions[111] = null; - DataConverterPotionId.potions[112] = null; - DataConverterPotionId.potions[113] = "minecraft:regeneration"; - DataConverterPotionId.potions[114] = "minecraft:swiftness"; - DataConverterPotionId.potions[115] = "minecraft:long_fire_resistance"; - DataConverterPotionId.potions[116] = "minecraft:poison"; - DataConverterPotionId.potions[117] = "minecraft:strong_healing"; - DataConverterPotionId.potions[118] = "minecraft:long_night_vision"; - DataConverterPotionId.potions[119] = null; - DataConverterPotionId.potions[120] = "minecraft:long_weakness"; - DataConverterPotionId.potions[121] = "minecraft:strength"; - DataConverterPotionId.potions[122] = "minecraft:long_slowness"; - DataConverterPotionId.potions[123] = "minecraft:leaping"; - DataConverterPotionId.potions[124] = "minecraft:strong_harming"; - DataConverterPotionId.potions[125] = "minecraft:long_water_breathing"; - DataConverterPotionId.potions[126] = "minecraft:long_invisibility"; - DataConverterPotionId.potions[127] = null; - } - } - - private static class DataConverterSpawnEgg implements DataConverter { - - private static final String[] eggs = new String[256]; - - DataConverterSpawnEgg() { - } - - public int getDataVersion() { - return 105; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("minecraft:spawn_egg".equals(cmp.getString("id"))) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); - net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("EntityTag"); - short short0 = cmp.getShort("Damage"); - - if (!nbttagcompound2.contains("id", 8)) { - String s = DataConverterSpawnEgg.eggs[short0 & 255]; - - if (s != null) { - nbttagcompound2.putString("id", s); - nbttagcompound1.put("EntityTag", nbttagcompound2); - cmp.put("tag", nbttagcompound1); - } - } - - if (short0 != 0) { - cmp.putShort("Damage", (short) 0); - } - } - - return cmp; - } - - static { - - DataConverterSpawnEgg.eggs[1] = "Item"; - DataConverterSpawnEgg.eggs[2] = "XPOrb"; - DataConverterSpawnEgg.eggs[7] = "ThrownEgg"; - DataConverterSpawnEgg.eggs[8] = "LeashKnot"; - DataConverterSpawnEgg.eggs[9] = "Painting"; - DataConverterSpawnEgg.eggs[10] = "Arrow"; - DataConverterSpawnEgg.eggs[11] = "Snowball"; - DataConverterSpawnEgg.eggs[12] = "Fireball"; - DataConverterSpawnEgg.eggs[13] = "SmallFireball"; - DataConverterSpawnEgg.eggs[14] = "ThrownEnderpearl"; - DataConverterSpawnEgg.eggs[15] = "EyeOfEnderSignal"; - DataConverterSpawnEgg.eggs[16] = "ThrownPotion"; - DataConverterSpawnEgg.eggs[17] = "ThrownExpBottle"; - DataConverterSpawnEgg.eggs[18] = "ItemFrame"; - DataConverterSpawnEgg.eggs[19] = "WitherSkull"; - DataConverterSpawnEgg.eggs[20] = "PrimedTnt"; - DataConverterSpawnEgg.eggs[21] = "FallingSand"; - DataConverterSpawnEgg.eggs[22] = "FireworksRocketEntity"; - DataConverterSpawnEgg.eggs[23] = "TippedArrow"; - DataConverterSpawnEgg.eggs[24] = "SpectralArrow"; - DataConverterSpawnEgg.eggs[25] = "ShulkerBullet"; - DataConverterSpawnEgg.eggs[26] = "DragonFireball"; - DataConverterSpawnEgg.eggs[30] = "ArmorStand"; - DataConverterSpawnEgg.eggs[41] = "Boat"; - DataConverterSpawnEgg.eggs[42] = "MinecartRideable"; - DataConverterSpawnEgg.eggs[43] = "MinecartChest"; - DataConverterSpawnEgg.eggs[44] = "MinecartFurnace"; - DataConverterSpawnEgg.eggs[45] = "MinecartTNT"; - DataConverterSpawnEgg.eggs[46] = "MinecartHopper"; - DataConverterSpawnEgg.eggs[47] = "MinecartSpawner"; - DataConverterSpawnEgg.eggs[40] = "MinecartCommandBlock"; - DataConverterSpawnEgg.eggs[48] = "Mob"; - DataConverterSpawnEgg.eggs[49] = "Monster"; - DataConverterSpawnEgg.eggs[50] = "Creeper"; - DataConverterSpawnEgg.eggs[51] = "Skeleton"; - DataConverterSpawnEgg.eggs[52] = "Spider"; - DataConverterSpawnEgg.eggs[53] = "Giant"; - DataConverterSpawnEgg.eggs[54] = "Zombie"; - DataConverterSpawnEgg.eggs[55] = "Slime"; - DataConverterSpawnEgg.eggs[56] = "Ghast"; - DataConverterSpawnEgg.eggs[57] = "PigZombie"; - DataConverterSpawnEgg.eggs[58] = "Enderman"; - DataConverterSpawnEgg.eggs[59] = "CaveSpider"; - DataConverterSpawnEgg.eggs[60] = "Silverfish"; - DataConverterSpawnEgg.eggs[61] = "Blaze"; - DataConverterSpawnEgg.eggs[62] = "LavaSlime"; - DataConverterSpawnEgg.eggs[63] = "EnderDragon"; - DataConverterSpawnEgg.eggs[64] = "WitherBoss"; - DataConverterSpawnEgg.eggs[65] = "Bat"; - DataConverterSpawnEgg.eggs[66] = "Witch"; - DataConverterSpawnEgg.eggs[67] = "Endermite"; - DataConverterSpawnEgg.eggs[68] = "Guardian"; - DataConverterSpawnEgg.eggs[69] = "Shulker"; - DataConverterSpawnEgg.eggs[90] = "Pig"; - DataConverterSpawnEgg.eggs[91] = "Sheep"; - DataConverterSpawnEgg.eggs[92] = "Cow"; - DataConverterSpawnEgg.eggs[93] = "Chicken"; - DataConverterSpawnEgg.eggs[94] = "Squid"; - DataConverterSpawnEgg.eggs[95] = "Wolf"; - DataConverterSpawnEgg.eggs[96] = "MushroomCow"; - DataConverterSpawnEgg.eggs[97] = "SnowMan"; - DataConverterSpawnEgg.eggs[98] = "Ozelot"; - DataConverterSpawnEgg.eggs[99] = "VillagerGolem"; - DataConverterSpawnEgg.eggs[100] = "EntityHorse"; - DataConverterSpawnEgg.eggs[101] = "Rabbit"; - DataConverterSpawnEgg.eggs[120] = "Villager"; - DataConverterSpawnEgg.eggs[200] = "EnderCrystal"; - } - } - - private static class DataConverterMinecart implements DataConverter { - - private static final List a = Lists.newArrayList( - "MinecartRideable", - "MinecartChest", - "MinecartFurnace", - "MinecartTNT", - "MinecartSpawner", - "MinecartHopper", - "MinecartCommandBlock" - ); - - DataConverterMinecart() { - } - - public int getDataVersion() { - return 106; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("Minecart".equals(cmp.getString("id"))) { - String s = "MinecartRideable"; - int i = cmp.getInt("Type"); - - if (i > 0 && i < DataConverterMinecart.a.size()) { - s = DataConverterMinecart.a.get(i); - } - - cmp.putString("id", s); - cmp.remove("Type"); - } - - return cmp; - } - - } - - private static class DataConverterMobSpawner implements DataConverter { - - DataConverterMobSpawner() { - } - - public int getDataVersion() { - return 107; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if (!"MobSpawner".equals(cmp.getString("id"))) { - return cmp; - } else { - if (cmp.contains("EntityId", 8)) { - String s = cmp.getString("EntityId"); - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("SpawnData"); - - nbttagcompound1.putString("id", s.isEmpty() ? "Pig" : s); - cmp.put("SpawnData", nbttagcompound1); - cmp.remove("EntityId"); - } - - if (cmp.contains("SpawnPotentials", 9)) { - net.minecraft.nbt.ListTag nbttaglist = cmp.getList("SpawnPotentials", 10); - - for (int i = 0; i < nbttaglist.size(); ++i) { - net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttaglist.getCompound(i); - - if (nbttagcompound2.contains("Type", 8)) { - net.minecraft.nbt.CompoundTag nbttagcompound3 = nbttagcompound2.getCompound("Properties"); - - nbttagcompound3.putString("id", nbttagcompound2.getString("Type")); - nbttagcompound2.put("Entity", nbttagcompound3); - nbttagcompound2.remove("Type"); - nbttagcompound2.remove("Properties"); - } - } - } - - return cmp; - } - } - - } - - private static class DataConverterUUID implements DataConverter { - - DataConverterUUID() { - } - - public int getDataVersion() { - return 108; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if (cmp.contains("UUID", 8)) { - cmp.putUUID("UUID", UUID.fromString(cmp.getString("UUID"))); - } - - return cmp; - } - - } - - private static class DataConverterHealth implements DataConverter { - - private static final Set a = Sets.newHashSet( - "ArmorStand", - "Bat", - "Blaze", - "CaveSpider", - "Chicken", - "Cow", - "Creeper", - "EnderDragon", - "Enderman", - "Endermite", - "EntityHorse", - "Ghast", - "Giant", - "Guardian", - "LavaSlime", - "MushroomCow", - "Ozelot", - "Pig", - "PigZombie", - "Rabbit", - "Sheep", - "Shulker", - "Silverfish", - "Skeleton", - "Slime", - "SnowMan", - "Spider", - "Squid", - "Villager", - "VillagerGolem", - "Witch", - "WitherBoss", - "Wolf", - "Zombie" - ); - - DataConverterHealth() { - } - - public int getDataVersion() { - return 109; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if (DataConverterHealth.a.contains(cmp.getString("id"))) { - float f; - - if (cmp.contains("HealF", 99)) { - f = cmp.getFloat("HealF"); - cmp.remove("HealF"); - } else { - if (!cmp.contains("Health", 99)) { - return cmp; - } - - f = cmp.getFloat("Health"); - } - - cmp.putFloat("Health", f); - } - - return cmp; - } - - } - - private static class DataConverterSaddle implements DataConverter { - - DataConverterSaddle() { - } - - public int getDataVersion() { - return 110; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("EntityHorse".equals(cmp.getString("id")) && !cmp.contains("SaddleItem", 10) && cmp.getBoolean("Saddle")) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = new net.minecraft.nbt.CompoundTag(); - - nbttagcompound1.putString("id", "minecraft:saddle"); - nbttagcompound1.putByte("Count", (byte) 1); - nbttagcompound1.putShort("Damage", (short) 0); - cmp.put("SaddleItem", nbttagcompound1); - cmp.remove("Saddle"); - } - - return cmp; - } - - } - - private static class DataConverterHanging implements DataConverter { - - DataConverterHanging() { - } - - public int getDataVersion() { - return 111; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - String s = cmp.getString("id"); - boolean flag = "Painting".equals(s); - boolean flag1 = "ItemFrame".equals(s); - - if ((flag || flag1) && !cmp.contains("Facing", 99)) { - Direction enumdirection; - - if (cmp.contains("Direction", 99)) { - enumdirection = Direction.from2DDataValue(cmp.getByte("Direction")); - cmp.putInt("TileX", cmp.getInt("TileX") + enumdirection.getStepX()); - cmp.putInt("TileY", cmp.getInt("TileY") + enumdirection.getStepY()); - cmp.putInt("TileZ", cmp.getInt("TileZ") + enumdirection.getStepZ()); - cmp.remove("Direction"); - if (flag1 && cmp.contains("ItemRotation", 99)) { - cmp.putByte("ItemRotation", (byte) (cmp.getByte("ItemRotation") * 2)); - } - } else { - enumdirection = Direction.from2DDataValue(cmp.getByte("Dir")); - cmp.remove("Dir"); - } - - cmp.putByte("Facing", (byte) enumdirection.get2DDataValue()); - } - - return cmp; - } - - } - - private static class DataConverterDropChances implements DataConverter { - - DataConverterDropChances() { - } - - public int getDataVersion() { - return 113; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - net.minecraft.nbt.ListTag nbttaglist; - - if (cmp.contains("HandDropChances", 9)) { - nbttaglist = cmp.getList("HandDropChances", 5); - if (nbttaglist.size() == 2 && nbttaglist.getFloat(0) == 0.0F && nbttaglist.getFloat(1) == 0.0F) { - cmp.remove("HandDropChances"); - } - } - - if (cmp.contains("ArmorDropChances", 9)) { - nbttaglist = cmp.getList("ArmorDropChances", 5); - if (nbttaglist.size() == 4 && nbttaglist.getFloat(0) == 0.0F && nbttaglist.getFloat(1) == 0.0F && nbttaglist.getFloat( - 2) == 0.0F && nbttaglist.getFloat(3) == 0.0F) { - cmp.remove("ArmorDropChances"); - } - } - - return cmp; - } - - } - - private static class DataConverterRiding implements DataConverter { - - DataConverterRiding() { - } - - public int getDataVersion() { - return 135; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - while (cmp.contains("Riding", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = this.b(cmp); - - this.convert(cmp, nbttagcompound1); - cmp = nbttagcompound1; - } - - return cmp; - } - - protected void convert(net.minecraft.nbt.CompoundTag nbttagcompound, net.minecraft.nbt.CompoundTag nbttagcompound1) { - net.minecraft.nbt.ListTag nbttaglist = new net.minecraft.nbt.ListTag(); - - nbttaglist.add(nbttagcompound); - nbttagcompound1.put("Passengers", nbttaglist); - } - - protected net.minecraft.nbt.CompoundTag b(net.minecraft.nbt.CompoundTag nbttagcompound) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = nbttagcompound.getCompound("Riding"); - - nbttagcompound.remove("Riding"); - return nbttagcompound1; - } - - } - - private static class DataConverterBook implements DataConverter { - - DataConverterBook() { - } - - public int getDataVersion() { - return 165; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("minecraft:written_book".equals(cmp.getString("id"))) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); - - if (nbttagcompound1.contains("pages", 9)) { - net.minecraft.nbt.ListTag nbttaglist = nbttagcompound1.getList("pages", 8); - - for (int i = 0; i < nbttaglist.size(); ++i) { - String s = nbttaglist.getString(i); - Component object = null; - - if (!"null".equals(s) && !StringUtil.isNullOrEmpty(s)) { - if ((s.charAt(0) != 34 || s.charAt(s.length() - 1) != 34) && (s.charAt(0) != 123 || s.charAt(s.length() - 1) != 125)) { - object = Component.literal(s); - } else { - try { - object = GsonHelper.fromJson(DataConverterSignText.a, s, Component.class, true); - if (object == null) { - object = Component.literal(""); - } - } catch (JsonParseException ignored) { - } - - if (object == null) { - try { - object = Component.Serializer.fromJson(s); - } catch (JsonParseException ignored) { - } - } - - if (object == null) { - try { - object = Component.Serializer.fromJsonLenient(s); - } catch (JsonParseException ignored) { - } - } - - if (object == null) { - object = Component.literal(s); - } - } - } else { - object = Component.literal(""); - } - - nbttaglist.set(i, net.minecraft.nbt.StringTag.valueOf(Component.Serializer.toJson(object))); - } - - nbttagcompound1.put("pages", nbttaglist); - } - } - - return cmp; - } - - } - - private static class DataConverterCookedFish implements DataConverter { - - private static final ResourceLocation a = new ResourceLocation("cooked_fished"); - - DataConverterCookedFish() { - } - - public int getDataVersion() { - return 502; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if (cmp.contains("id", 8) && DataConverterCookedFish.a.equals(new ResourceLocation(cmp.getString("id")))) { - cmp.putString("id", "minecraft:cooked_fish"); - } - - return cmp; - } - - } - - private static class DataConverterZombie implements DataConverter { - - private static final Random a = new Random(); - - DataConverterZombie() { - } - - public int getDataVersion() { - return 502; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("Zombie".equals(cmp.getString("id")) && cmp.getBoolean("IsVillager")) { - if (!cmp.contains("ZombieType", 99)) { - int i = -1; - - if (cmp.contains("VillagerProfession", 99)) { - try { - i = this.convert(cmp.getInt("VillagerProfession")); - } catch (RuntimeException runtimeexception) { - ; - } - } - - if (i == -1) { - i = this.convert(DataConverterZombie.a.nextInt(6)); - } - - cmp.putInt("ZombieType", i); - } - - cmp.remove("IsVillager"); - } - - return cmp; - } - - private int convert(int i) { - return i >= 0 && i < 6 ? i : -1; - } - - } - - private static class DataConverterVBO implements DataConverter { - - DataConverterVBO() { - } - - public int getDataVersion() { - return 505; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - cmp.putString("useVbo", "true"); - return cmp; - } - - } - - private static class DataConverterGuardian implements DataConverter { - - DataConverterGuardian() { - } - - public int getDataVersion() { - return 700; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("Guardian".equals(cmp.getString("id"))) { - if (cmp.getBoolean("Elder")) { - cmp.putString("id", "ElderGuardian"); - } - - cmp.remove("Elder"); - } - - return cmp; - } - - } - - private static class DataConverterSkeleton implements DataConverter { - - DataConverterSkeleton() { - } - - public int getDataVersion() { - return 701; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - String s = cmp.getString("id"); - - if ("Skeleton".equals(s)) { - int i = cmp.getInt("SkeletonType"); - - if (i == 1) { - cmp.putString("id", "WitherSkeleton"); - } else if (i == 2) { - cmp.putString("id", "Stray"); - } - - cmp.remove("SkeletonType"); - } - - return cmp; - } - - } - - private static class DataConverterZombieType implements DataConverter { - - DataConverterZombieType() { - } - - public int getDataVersion() { - return 702; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("Zombie".equals(cmp.getString("id"))) { - int i = cmp.getInt("ZombieType"); - - switch (i) { - case 0: - default: - break; - - case 1: - case 2: - case 3: - case 4: - case 5: - cmp.putString("id", "ZombieVillager"); - cmp.putInt("Profession", i - 1); - break; - - case 6: - cmp.putString("id", "Husk"); - } - - cmp.remove("ZombieType"); - } - - return cmp; - } - - } - - private static class DataConverterHorse implements DataConverter { - - DataConverterHorse() { - } - - public int getDataVersion() { - return 703; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("EntityHorse".equals(cmp.getString("id"))) { - int i = cmp.getInt("Type"); - - switch (i) { - case 0: - default: - cmp.putString("id", "Horse"); - break; - - case 1: - cmp.putString("id", "Donkey"); - break; - - case 2: - cmp.putString("id", "Mule"); - break; - - case 3: - cmp.putString("id", "ZombieHorse"); - break; - - case 4: - cmp.putString("id", "SkeletonHorse"); - } - - cmp.remove("Type"); - } - - return cmp; - } - - } - - private static class DataConverterTileEntity implements DataConverter { - - private static final Map a = Maps.newHashMap(); - - DataConverterTileEntity() { - } - - public int getDataVersion() { - return 704; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - String s = DataConverterTileEntity.a.get(cmp.getString("id")); - - if (s != null) { - cmp.putString("id", s); - } - - return cmp; - } - - static { - DataConverterTileEntity.a.put("Airportal", "minecraft:end_portal"); - DataConverterTileEntity.a.put("Banner", "minecraft:banner"); - DataConverterTileEntity.a.put("Beacon", "minecraft:beacon"); - DataConverterTileEntity.a.put("Cauldron", "minecraft:brewing_stand"); - DataConverterTileEntity.a.put("Chest", "minecraft:chest"); - DataConverterTileEntity.a.put("Comparator", "minecraft:comparator"); - DataConverterTileEntity.a.put("Control", "minecraft:command_block"); - DataConverterTileEntity.a.put("DLDetector", "minecraft:daylight_detector"); - DataConverterTileEntity.a.put("Dropper", "minecraft:dropper"); - DataConverterTileEntity.a.put("EnchantTable", "minecraft:enchanting_table"); - DataConverterTileEntity.a.put("EndGateway", "minecraft:end_gateway"); - DataConverterTileEntity.a.put("EnderChest", "minecraft:ender_chest"); - DataConverterTileEntity.a.put("FlowerPot", "minecraft:flower_pot"); - DataConverterTileEntity.a.put("Furnace", "minecraft:furnace"); - DataConverterTileEntity.a.put("Hopper", "minecraft:hopper"); - DataConverterTileEntity.a.put("MobSpawner", "minecraft:mob_spawner"); - DataConverterTileEntity.a.put("Music", "minecraft:noteblock"); - DataConverterTileEntity.a.put("Piston", "minecraft:piston"); - DataConverterTileEntity.a.put("RecordPlayer", "minecraft:jukebox"); - DataConverterTileEntity.a.put("Sign", "minecraft:sign"); - DataConverterTileEntity.a.put("Skull", "minecraft:skull"); - DataConverterTileEntity.a.put("Structure", "minecraft:structure_block"); - DataConverterTileEntity.a.put("Trap", "minecraft:dispenser"); - } - } - - private static class DataConverterEntity implements DataConverter { - - private static final Map a = Maps.newHashMap(); - - DataConverterEntity() { - } - - public int getDataVersion() { - return 704; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - String s = DataConverterEntity.a.get(cmp.getString("id")); - - if (s != null) { - cmp.putString("id", s); - } - - return cmp; - } - - static { - DataConverterEntity.a.put("AreaEffectCloud", "minecraft:area_effect_cloud"); - DataConverterEntity.a.put("ArmorStand", "minecraft:armor_stand"); - DataConverterEntity.a.put("Arrow", "minecraft:arrow"); - DataConverterEntity.a.put("Bat", "minecraft:bat"); - DataConverterEntity.a.put("Blaze", "minecraft:blaze"); - DataConverterEntity.a.put("Boat", "minecraft:boat"); - DataConverterEntity.a.put("CaveSpider", "minecraft:cave_spider"); - DataConverterEntity.a.put("Chicken", "minecraft:chicken"); - DataConverterEntity.a.put("Cow", "minecraft:cow"); - DataConverterEntity.a.put("Creeper", "minecraft:creeper"); - DataConverterEntity.a.put("Donkey", "minecraft:donkey"); - DataConverterEntity.a.put("DragonFireball", "minecraft:dragon_fireball"); - DataConverterEntity.a.put("ElderGuardian", "minecraft:elder_guardian"); - DataConverterEntity.a.put("EnderCrystal", "minecraft:ender_crystal"); - DataConverterEntity.a.put("EnderDragon", "minecraft:ender_dragon"); - DataConverterEntity.a.put("Enderman", "minecraft:enderman"); - DataConverterEntity.a.put("Endermite", "minecraft:endermite"); - DataConverterEntity.a.put("EyeOfEnderSignal", "minecraft:eye_of_ender_signal"); - DataConverterEntity.a.put("FallingSand", "minecraft:falling_block"); - DataConverterEntity.a.put("Fireball", "minecraft:fireball"); - DataConverterEntity.a.put("FireworksRocketEntity", "minecraft:fireworks_rocket"); - DataConverterEntity.a.put("Ghast", "minecraft:ghast"); - DataConverterEntity.a.put("Giant", "minecraft:giant"); - DataConverterEntity.a.put("Guardian", "minecraft:guardian"); - DataConverterEntity.a.put("Horse", "minecraft:horse"); - DataConverterEntity.a.put("Husk", "minecraft:husk"); - DataConverterEntity.a.put("Item", "minecraft:item"); - DataConverterEntity.a.put("ItemFrame", "minecraft:item_frame"); - DataConverterEntity.a.put("LavaSlime", "minecraft:magma_cube"); - DataConverterEntity.a.put("LeashKnot", "minecraft:leash_knot"); - DataConverterEntity.a.put("MinecartChest", "minecraft:chest_minecart"); - DataConverterEntity.a.put("MinecartCommandBlock", "minecraft:commandblock_minecart"); - DataConverterEntity.a.put("MinecartFurnace", "minecraft:furnace_minecart"); - DataConverterEntity.a.put("MinecartHopper", "minecraft:hopper_minecart"); - DataConverterEntity.a.put("MinecartRideable", "minecraft:minecart"); - DataConverterEntity.a.put("MinecartSpawner", "minecraft:spawner_minecart"); - DataConverterEntity.a.put("MinecartTNT", "minecraft:tnt_minecart"); - DataConverterEntity.a.put("Mule", "minecraft:mule"); - DataConverterEntity.a.put("MushroomCow", "minecraft:mooshroom"); - DataConverterEntity.a.put("Ozelot", "minecraft:ocelot"); - DataConverterEntity.a.put("Painting", "minecraft:painting"); - DataConverterEntity.a.put("Pig", "minecraft:pig"); - DataConverterEntity.a.put("PigZombie", "minecraft:zombie_pigman"); - DataConverterEntity.a.put("PolarBear", "minecraft:polar_bear"); - DataConverterEntity.a.put("PrimedTnt", "minecraft:tnt"); - DataConverterEntity.a.put("Rabbit", "minecraft:rabbit"); - DataConverterEntity.a.put("Sheep", "minecraft:sheep"); - DataConverterEntity.a.put("Shulker", "minecraft:shulker"); - DataConverterEntity.a.put("ShulkerBullet", "minecraft:shulker_bullet"); - DataConverterEntity.a.put("Silverfish", "minecraft:silverfish"); - DataConverterEntity.a.put("Skeleton", "minecraft:skeleton"); - DataConverterEntity.a.put("SkeletonHorse", "minecraft:skeleton_horse"); - DataConverterEntity.a.put("Slime", "minecraft:slime"); - DataConverterEntity.a.put("SmallFireball", "minecraft:small_fireball"); - DataConverterEntity.a.put("SnowMan", "minecraft:snowman"); - DataConverterEntity.a.put("Snowball", "minecraft:snowball"); - DataConverterEntity.a.put("SpectralArrow", "minecraft:spectral_arrow"); - DataConverterEntity.a.put("Spider", "minecraft:spider"); - DataConverterEntity.a.put("Squid", "minecraft:squid"); - DataConverterEntity.a.put("Stray", "minecraft:stray"); - DataConverterEntity.a.put("ThrownEgg", "minecraft:egg"); - DataConverterEntity.a.put("ThrownEnderpearl", "minecraft:ender_pearl"); - DataConverterEntity.a.put("ThrownExpBottle", "minecraft:xp_bottle"); - DataConverterEntity.a.put("ThrownPotion", "minecraft:potion"); - DataConverterEntity.a.put("Villager", "minecraft:villager"); - DataConverterEntity.a.put("VillagerGolem", "minecraft:villager_golem"); - DataConverterEntity.a.put("Witch", "minecraft:witch"); - DataConverterEntity.a.put("WitherBoss", "minecraft:wither"); - DataConverterEntity.a.put("WitherSkeleton", "minecraft:wither_skeleton"); - DataConverterEntity.a.put("WitherSkull", "minecraft:wither_skull"); - DataConverterEntity.a.put("Wolf", "minecraft:wolf"); - DataConverterEntity.a.put("XPOrb", "minecraft:xp_orb"); - DataConverterEntity.a.put("Zombie", "minecraft:zombie"); - DataConverterEntity.a.put("ZombieHorse", "minecraft:zombie_horse"); - DataConverterEntity.a.put("ZombieVillager", "minecraft:zombie_villager"); - } - } - - private static class DataConverterPotionWater implements DataConverter { - - DataConverterPotionWater() { - } - - public int getDataVersion() { - return 806; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - String s = cmp.getString("id"); - - if ("minecraft:potion".equals(s) || "minecraft:splash_potion".equals(s) || "minecraft:lingering_potion".equals(s) || "minecraft:tipped_arrow".equals( - s)) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); - - if (!nbttagcompound1.contains("Potion", 8)) { - nbttagcompound1.putString("Potion", "minecraft:water"); - } - - if (!cmp.contains("tag", 10)) { - cmp.put("tag", nbttagcompound1); - } - } - - return cmp; - } - - } - - private static class DataConverterShulker implements DataConverter { - - DataConverterShulker() { - } - - public int getDataVersion() { - return 808; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("minecraft:shulker".equals(cmp.getString("id")) && !cmp.contains("Color", 99)) { - cmp.putByte("Color", (byte) 10); - } - - return cmp; - } - - } - - private static class DataConverterShulkerBoxItem implements DataConverter { - - public static final String[] a = new String[]{"minecraft:white_shulker_box", "minecraft:orange_shulker_box", "minecraft:magenta_shulker_box", "minecraft:light_blue_shulker_box", "minecraft:yellow_shulker_box", "minecraft:lime_shulker_box", "minecraft:pink_shulker_box", "minecraft:gray_shulker_box", "minecraft:silver_shulker_box", "minecraft:cyan_shulker_box", "minecraft:purple_shulker_box", "minecraft:blue_shulker_box", "minecraft:brown_shulker_box", "minecraft:green_shulker_box", "minecraft:red_shulker_box", "minecraft:black_shulker_box"}; - - DataConverterShulkerBoxItem() { - } - - public int getDataVersion() { - return 813; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("minecraft:shulker_box".equals(cmp.getString("id")) && cmp.contains("tag", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); - - if (nbttagcompound1.contains("BlockEntityTag", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag"); - - if (nbttagcompound2.getList("Items", 10).isEmpty()) { - nbttagcompound2.remove("Items"); - } - - int i = nbttagcompound2.getInt("Color"); - - nbttagcompound2.remove("Color"); - if (nbttagcompound2.isEmpty()) { - nbttagcompound1.remove("BlockEntityTag"); - } - - if (nbttagcompound1.isEmpty()) { - cmp.remove("tag"); - } - - cmp.putString("id", DataConverterShulkerBoxItem.a[i % 16]); - } - } - - return cmp; - } - - } - - private static class DataConverterShulkerBoxBlock implements DataConverter { - - DataConverterShulkerBoxBlock() { - } - - public int getDataVersion() { - return 813; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("minecraft:shulker".equals(cmp.getString("id"))) { - cmp.remove("Color"); - } - - return cmp; - } - - } - - private static class DataConverterLang implements DataConverter { - - DataConverterLang() { - } - - public int getDataVersion() { - return 816; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if (cmp.contains("lang", 8)) { - cmp.putString("lang", cmp.getString("lang").toLowerCase(Locale.ROOT)); - } - - return cmp; - } - - } - - private static class DataConverterTotem implements DataConverter { - - DataConverterTotem() { - } - - public int getDataVersion() { - return 820; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("minecraft:totem".equals(cmp.getString("id"))) { - cmp.putString("id", "minecraft:totem_of_undying"); - } - - return cmp; - } - - } - - private static class DataConverterBedBlock implements DataConverter { - - private static final Logger a = LogManager.getLogger(PaperweightDataConverters.class); - - DataConverterBedBlock() { - } - - public int getDataVersion() { - return 1125; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - try { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("Level"); - int i = nbttagcompound1.getInt("xPos"); - int j = nbttagcompound1.getInt("zPos"); - net.minecraft.nbt.ListTag nbttaglist = nbttagcompound1.getList("TileEntities", 10); - net.minecraft.nbt.ListTag nbttaglist1 = nbttagcompound1.getList("Sections", 10); - - for (int k = 0; k < nbttaglist1.size(); ++k) { - net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttaglist1.getCompound(k); - byte b0 = nbttagcompound2.getByte("Y"); - byte[] abyte = nbttagcompound2.getByteArray("Blocks"); - - for (int l = 0; l < abyte.length; ++l) { - if (416 == (abyte[l] & 255) << 4) { - int i1 = l & 15; - int j1 = l >> 8 & 15; - int k1 = l >> 4 & 15; - net.minecraft.nbt.CompoundTag nbttagcompound3 = new net.minecraft.nbt.CompoundTag(); - - nbttagcompound3.putString("id", "bed"); - nbttagcompound3.putInt("x", i1 + (i << 4)); - nbttagcompound3.putInt("y", j1 + (b0 << 4)); - nbttagcompound3.putInt("z", k1 + (j << 4)); - nbttaglist.add(nbttagcompound3); - } - } - } - } catch (Exception exception) { - DataConverterBedBlock.a.warn("Unable to datafix Bed blocks, level format may be missing tags."); - } - - return cmp; - } - - } - - private static class DataConverterBedItem implements DataConverter { - - DataConverterBedItem() { - } - - public int getDataVersion() { - return 1125; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("minecraft:bed".equals(cmp.getString("id")) && cmp.getShort("Damage") == 0) { - cmp.putShort("Damage", (short) DyeColor.RED.getId()); - } - - return cmp; - } - - } - - private static class DataConverterSignText implements DataConverter { - - public static final Gson a = new GsonBuilder().registerTypeAdapter(Component.class, new JsonDeserializer() { - MutableComponent a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws - JsonParseException { - if (jsonelement.isJsonPrimitive()) { - return Component.literal(jsonelement.getAsString()); - } else if (jsonelement.isJsonArray()) { - JsonArray jsonarray = jsonelement.getAsJsonArray(); - MutableComponent ichatbasecomponent = null; - - for (final JsonElement jsonelement1 : jsonarray) { - MutableComponent ichatbasecomponent1 = this.a( - jsonelement1, - jsonelement1.getClass(), - jsondeserializationcontext - ); - - if (ichatbasecomponent == null) { - ichatbasecomponent = ichatbasecomponent1; - } else { - ichatbasecomponent.append(ichatbasecomponent1); - } - } - - return ichatbasecomponent; - } else { - throw new JsonParseException("Don't know how to turn " + jsonelement + " into a Component"); - } - } - - public Object deserialize( - JsonElement jsonelement, - Type type, - JsonDeserializationContext jsondeserializationcontext - ) throws JsonParseException { - return this.a(jsonelement, type, jsondeserializationcontext); - } - }).create(); - - DataConverterSignText() { - } - - public int getDataVersion() { - return 101; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("Sign".equals(cmp.getString("id"))) { - this.convert(cmp, "Text1"); - this.convert(cmp, "Text2"); - this.convert(cmp, "Text3"); - this.convert(cmp, "Text4"); - } - - return cmp; - } - - private void convert(net.minecraft.nbt.CompoundTag nbttagcompound, String s) { - String s1 = nbttagcompound.getString(s); - Component object = null; - - if (!"null".equals(s1) && !StringUtil.isNullOrEmpty(s1)) { - if ((s1.charAt(0) != 34 || s1.charAt(s1.length() - 1) != 34) && (s1.charAt(0) != 123 || s1.charAt(s1.length() - 1) != 125)) { - object = Component.literal(s1); - } else { - try { - object = GsonHelper.fromJson(DataConverterSignText.a, s1, Component.class, true); - if (object == null) { - object = Component.literal(""); - } - } catch (JsonParseException ignored) { - } - - if (object == null) { - try { - object = Component.Serializer.fromJson(s1); - } catch (JsonParseException ignored) { - } - } - - if (object == null) { - try { - object = Component.Serializer.fromJsonLenient(s1); - } catch (JsonParseException ignored) { - } - } - - if (object == null) { - object = Component.literal(s1); - } - } - } else { - object = Component.literal(""); - } - - nbttagcompound.putString(s, Component.Serializer.toJson(object)); - } - - } - - private static class DataInspectorPlayerVehicle implements DataInspector { - - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (cmp.contains("RootVehicle", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("RootVehicle"); - - if (nbttagcompound1.contains("Entity", 10)) { - convertCompound(LegacyType.ENTITY, nbttagcompound1, "Entity", sourceVer, targetVer); - } - } - - return cmp; - } - - } - - private static class DataInspectorLevelPlayer implements DataInspector { - - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (cmp.contains("Player", 10)) { - convertCompound(LegacyType.PLAYER, cmp, "Player", sourceVer, targetVer); - } - - return cmp; - } - - } - - private static class DataInspectorStructure implements DataInspector { - - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - net.minecraft.nbt.ListTag nbttaglist; - int j; - net.minecraft.nbt.CompoundTag nbttagcompound1; - - if (cmp.contains("entities", 9)) { - nbttaglist = cmp.getList("entities", 10); - - for (j = 0; j < nbttaglist.size(); ++j) { - nbttagcompound1 = (net.minecraft.nbt.CompoundTag) nbttaglist.get(j); - if (nbttagcompound1.contains("nbt", 10)) { - convertCompound(LegacyType.ENTITY, nbttagcompound1, "nbt", sourceVer, targetVer); - } - } - } - - if (cmp.contains("blocks", 9)) { - nbttaglist = cmp.getList("blocks", 10); - - for (j = 0; j < nbttaglist.size(); ++j) { - nbttagcompound1 = (net.minecraft.nbt.CompoundTag) nbttaglist.get(j); - if (nbttagcompound1.contains("nbt", 10)) { - convertCompound(LegacyType.BLOCK_ENTITY, nbttagcompound1, "nbt", sourceVer, targetVer); - } - } - } - - return cmp; - } - - } - - private static class DataInspectorChunks implements DataInspector { - - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (cmp.contains("Level", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("Level"); - net.minecraft.nbt.ListTag nbttaglist; - int j; - - if (nbttagcompound1.contains("Entities", 9)) { - nbttaglist = nbttagcompound1.getList("Entities", 10); - - for (j = 0; j < nbttaglist.size(); ++j) { - nbttaglist.set( - j, - convert( - LegacyType.ENTITY, - (net.minecraft.nbt.CompoundTag) nbttaglist.get(j), - sourceVer, - targetVer - ) - ); - } - } - - if (nbttagcompound1.contains("TileEntities", 9)) { - nbttaglist = nbttagcompound1.getList("TileEntities", 10); - - for (j = 0; j < nbttaglist.size(); ++j) { - nbttaglist.set( - j, - convert( - LegacyType.BLOCK_ENTITY, - (net.minecraft.nbt.CompoundTag) nbttaglist.get(j), - sourceVer, - targetVer - ) - ); - } - } - } - - return cmp; - } - - } - - private static class DataInspectorEntityPassengers implements DataInspector { - - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (cmp.contains("Passengers", 9)) { - net.minecraft.nbt.ListTag nbttaglist = cmp.getList("Passengers", 10); - - for (int j = 0; j < nbttaglist.size(); ++j) { - nbttaglist.set(j, convert(LegacyType.ENTITY, nbttaglist.getCompound(j), sourceVer, targetVer)); - } - } - - return cmp; - } - - } - - private static class DataInspectorPlayer implements DataInspector { - - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - convertItems(cmp, "Inventory", sourceVer, targetVer); - convertItems(cmp, "EnderItems", sourceVer, targetVer); - if (cmp.contains("ShoulderEntityLeft", 10)) { - convertCompound(LegacyType.ENTITY, cmp, "ShoulderEntityLeft", sourceVer, targetVer); - } - - if (cmp.contains("ShoulderEntityRight", 10)) { - convertCompound(LegacyType.ENTITY, cmp, "ShoulderEntityRight", sourceVer, targetVer); - } - - return cmp; - } - - } - - private static class DataInspectorVillagers implements DataInspector { - - ResourceLocation entityVillager = getKey("EntityVillager"); - - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (entityVillager.equals(new ResourceLocation(cmp.getString("id"))) && cmp.contains("Offers", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("Offers"); - - if (nbttagcompound1.contains("Recipes", 9)) { - net.minecraft.nbt.ListTag nbttaglist = nbttagcompound1.getList("Recipes", 10); - - for (int j = 0; j < nbttaglist.size(); ++j) { - net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttaglist.getCompound(j); - - convertItem(nbttagcompound2, "buy", sourceVer, targetVer); - convertItem(nbttagcompound2, "buyB", sourceVer, targetVer); - convertItem(nbttagcompound2, "sell", sourceVer, targetVer); - nbttaglist.set(j, nbttagcompound2); - } - } - } - - return cmp; - } - - } - - private static class DataInspectorMobSpawnerMinecart implements DataInspector { - - ResourceLocation entityMinecartMobSpawner = getKey("EntityMinecartMobSpawner"); - ResourceLocation tileEntityMobSpawner = getKey("TileEntityMobSpawner"); - - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - String s = cmp.getString("id"); - if (entityMinecartMobSpawner.equals(new ResourceLocation(s))) { - cmp.putString("id", tileEntityMobSpawner.toString()); - convert(LegacyType.BLOCK_ENTITY, cmp, sourceVer, targetVer); - cmp.putString("id", s); - } - - return cmp; - } - - } - - private static class DataInspectorMobSpawnerMobs implements DataInspector { - - ResourceLocation tileEntityMobSpawner = getKey("TileEntityMobSpawner"); - - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (tileEntityMobSpawner.equals(new ResourceLocation(cmp.getString("id")))) { - if (cmp.contains("SpawnPotentials", 9)) { - net.minecraft.nbt.ListTag nbttaglist = cmp.getList("SpawnPotentials", 10); - - for (int j = 0; j < nbttaglist.size(); ++j) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = nbttaglist.getCompound(j); - - convertCompound(LegacyType.ENTITY, nbttagcompound1, "Entity", sourceVer, targetVer); - } - } - - convertCompound(LegacyType.ENTITY, cmp, "SpawnData", sourceVer, targetVer); - } - - return cmp; - } - - } - - private static class DataInspectorCommandBlock implements DataInspector { - - ResourceLocation tileEntityCommand = getKey("TileEntityCommand"); - - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (tileEntityCommand.equals(new ResourceLocation(cmp.getString("id")))) { - cmp.putString("id", "Control"); - convert(LegacyType.BLOCK_ENTITY, cmp, sourceVer, targetVer); - cmp.putString("id", "MinecartCommandBlock"); - } - - return cmp; - } - - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R1/PaperweightFakePlayer.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R1/PaperweightFakePlayer.java deleted file mode 100644 index 43964319c..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R1/PaperweightFakePlayer.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_19_R1; - -import com.mojang.authlib.GameProfile; -import net.minecraft.network.chat.ChatType; -import net.minecraft.network.chat.Component; -import net.minecraft.network.protocol.game.ServerboundClientInformationPacket; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.stats.Stat; -import net.minecraft.world.MenuProvider; -import net.minecraft.world.damagesource.DamageSource; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.block.entity.SignBlockEntity; -import net.minecraft.world.phys.Vec3; -import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; - -import java.util.OptionalInt; -import java.util.UUID; - -class PaperweightFakePlayer extends ServerPlayer { - - private static final GameProfile FAKE_WORLDEDIT_PROFILE = new GameProfile( - UUID.nameUUIDFromBytes("worldedit".getBytes()), - "[WorldEdit]" - ); - private static final Vec3 ORIGIN = new Vec3(0.0D, 0.0D, 0.0D); - - PaperweightFakePlayer(ServerLevel world) { - super(world.getServer(), world, FAKE_WORLDEDIT_PROFILE, null); - } - - @Override - public Vec3 position() { - return ORIGIN; - } - - @Override - public void tick() { - } - - @Override - public void die(DamageSource damagesource) { - } - - @Override - public Entity changeDimension(ServerLevel worldserver, TeleportCause cause) { - return this; - } - - @Override - public OptionalInt openMenu(MenuProvider factory) { - return OptionalInt.empty(); - } - - @Override - public void updateOptions(ServerboundClientInformationPacket packet) { - } - - @Override - public void displayClientMessage(Component message, boolean actionBar) { - } - - @Override - public void awardStat(Stat stat, int amount) { - } - - @Override - public void awardStat(Stat stat) { - } - - @Override - public boolean isInvulnerableTo(DamageSource damageSource) { - return true; - } - - @Override - public void openTextEdit(SignBlockEntity sign) { - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R1/PaperweightWorldNativeAccess.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R1/PaperweightWorldNativeAccess.java deleted file mode 100644 index 3f748bb9d..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R1/PaperweightWorldNativeAccess.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_19_R1; - -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.internal.block.BlockStateIdAccess; -import com.sk89q.worldedit.internal.wna.WorldNativeAccess; -import com.sk89q.worldedit.util.SideEffect; -import com.sk89q.worldedit.util.SideEffectSet; -import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; -import com.sk89q.worldedit.world.block.BlockState; -import net.minecraft.core.BlockPos; -import net.minecraft.server.level.ChunkHolder; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.chunk.LevelChunk; -import org.bukkit.craftbukkit.v1_19_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_19_R1.block.data.CraftBlockData; -import org.bukkit.event.block.BlockPhysicsEvent; - -import javax.annotation.Nullable; -import java.lang.ref.WeakReference; -import java.util.Objects; - -public class PaperweightWorldNativeAccess implements - WorldNativeAccess { - - private static final int UPDATE = 1; - private static final int NOTIFY = 2; - - private final PaperweightAdapter adapter; - private final WeakReference world; - private SideEffectSet sideEffectSet; - - public PaperweightWorldNativeAccess(PaperweightAdapter adapter, WeakReference world) { - this.adapter = adapter; - this.world = world; - } - - private ServerLevel getWorld() { - return Objects.requireNonNull(world.get(), "The reference to the world was lost"); - } - - @Override - public void setCurrentSideEffectSet(SideEffectSet sideEffectSet) { - this.sideEffectSet = sideEffectSet; - } - - @Override - public LevelChunk getChunk(int x, int z) { - return getWorld().getChunk(x, z); - } - - @Override - public net.minecraft.world.level.block.state.BlockState toNative(BlockState state) { - int stateId = BlockStateIdAccess.getBlockStateId(state); - return BlockStateIdAccess.isValidInternalId(stateId) - ? Block.stateById(stateId) - : ((CraftBlockData) BukkitAdapter.adapt(state)).getState(); - } - - @Override - public net.minecraft.world.level.block.state.BlockState getBlockState(LevelChunk chunk, BlockPos position) { - return chunk.getBlockState(position); - } - - @Nullable - @Override - public net.minecraft.world.level.block.state.BlockState setBlockState( - LevelChunk chunk, - BlockPos position, - net.minecraft.world.level.block.state.BlockState state - ) { - return chunk.setBlockState(position, state, false, this.sideEffectSet.shouldApply(SideEffect.UPDATE)); - } - - @Override - public net.minecraft.world.level.block.state.BlockState getValidBlockForPosition( - net.minecraft.world.level.block.state.BlockState block, - BlockPos position - ) { - return Block.updateFromNeighbourShapes(block, getWorld(), position); - } - - @Override - public BlockPos getPosition(int x, int y, int z) { - return new BlockPos(x, y, z); - } - - @Override - public void updateLightingForBlock(BlockPos position) { - getWorld().getChunkSource().getLightEngine().checkBlock(position); - } - - @Override - public boolean updateTileEntity(final BlockPos position, final CompoundBinaryTag tag) { - return false; - } - - @Override - public void notifyBlockUpdate( - LevelChunk chunk, - BlockPos position, - net.minecraft.world.level.block.state.BlockState oldState, - net.minecraft.world.level.block.state.BlockState newState - ) { - if (chunk.getSections()[getWorld().getSectionIndex(position.getY())] != null) { - getWorld().sendBlockUpdated(position, oldState, newState, UPDATE | NOTIFY); - } - } - - @Override - public boolean isChunkTicking(LevelChunk chunk) { - return chunk.getFullStatus().isOrAfter(ChunkHolder.FullChunkStatus.TICKING); - } - - @Override - public void markBlockChanged(LevelChunk chunk, BlockPos position) { - if (chunk.getSections()[getWorld().getSectionIndex(position.getY())] != null) { - getWorld().getChunkSource().blockChanged(position); - } - } - - @Override - public void notifyNeighbors( - BlockPos pos, - net.minecraft.world.level.block.state.BlockState oldState, - net.minecraft.world.level.block.state.BlockState newState - ) { - ServerLevel world = getWorld(); - if (sideEffectSet.shouldApply(SideEffect.EVENTS)) { - world.updateNeighborsAt(pos, oldState.getBlock()); - } else { - // When we don't want events, manually run the physics without them. - Block block = oldState.getBlock(); - fireNeighborChanged(pos, world, block, pos.west()); - fireNeighborChanged(pos, world, block, pos.east()); - fireNeighborChanged(pos, world, block, pos.below()); - fireNeighborChanged(pos, world, block, pos.above()); - fireNeighborChanged(pos, world, block, pos.north()); - fireNeighborChanged(pos, world, block, pos.south()); - } - if (newState.hasAnalogOutputSignal()) { - world.updateNeighbourForOutputSignal(pos, newState.getBlock()); - } - } - - @SuppressWarnings("deprecation") - private void fireNeighborChanged(BlockPos pos, ServerLevel world, Block block, BlockPos neighborPos) { - world.getBlockState(neighborPos).neighborChanged(world, neighborPos, block, pos, false); - } - - @Override - public void updateNeighbors( - BlockPos pos, - net.minecraft.world.level.block.state.BlockState oldState, - net.minecraft.world.level.block.state.BlockState newState, - int recursionLimit - ) { - ServerLevel world = getWorld(); - // a == updateNeighbors - // b == updateDiagonalNeighbors - oldState.updateIndirectNeighbourShapes(world, pos, NOTIFY, recursionLimit); - if (sideEffectSet.shouldApply(SideEffect.EVENTS)) { - CraftWorld craftWorld = world.getWorld(); - BlockPhysicsEvent event = new BlockPhysicsEvent( - craftWorld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()), - CraftBlockData.fromData(newState) - ); - world.getCraftServer().getPluginManager().callEvent(event); - if (event.isCancelled()) { - return; - } - } - newState.updateNeighbourShapes(world, pos, NOTIFY, recursionLimit); - newState.updateIndirectNeighbourShapes(world, pos, NOTIFY, recursionLimit); - } - - @Override - public void onBlockStateChange( - BlockPos pos, - net.minecraft.world.level.block.state.BlockState oldState, - net.minecraft.world.level.block.state.BlockState newState - ) { - getWorld().onBlockStateChange(pos, oldState, newState); - } - - @Override - public void flush() { - - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightBlockMaterial.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightBlockMaterial.java deleted file mode 100644 index 812cd4e24..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightBlockMaterial.java +++ /dev/null @@ -1,189 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1; - -import com.google.common.base.Suppliers; -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.util.ReflectionUtil; -import com.sk89q.worldedit.bukkit.adapter.Refraction; -import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1.nbt.PaperweightLazyCompoundTag; -import com.sk89q.worldedit.world.registry.BlockMaterial; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.EmptyBlockGetter; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.EntityBlock; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockBehaviour; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; -import net.minecraft.world.level.material.PushReaction; -import org.bukkit.craftbukkit.v1_19_R1.block.data.CraftBlockData; - -public class PaperweightBlockMaterial implements BlockMaterial { - - private final Block block; - private final BlockState blockState; - private final Material material; - private final boolean isTranslucent; - private final CraftBlockData craftBlockData; - private final org.bukkit.Material craftMaterial; - private final int opacity; - private final CompoundTag tile; - - public PaperweightBlockMaterial(Block block) { - this(block, block.defaultBlockState()); - } - - public PaperweightBlockMaterial(Block block, BlockState blockState) { - this.block = block; - this.blockState = blockState; - this.material = blockState.getMaterial(); - this.craftBlockData = CraftBlockData.fromData(blockState); - this.craftMaterial = craftBlockData.getMaterial(); - BlockBehaviour.Properties blockInfo = ReflectionUtil.getField(BlockBehaviour.class, block, Refraction.pickName( - "properties", "aO")); - this.isTranslucent = !(boolean) ReflectionUtil.getField(BlockBehaviour.Properties.class, blockInfo, - Refraction.pickName("canOcclude", "n") - ); - opacity = blockState.getLightBlock(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); - BlockEntity tileEntity = !(block instanceof EntityBlock) ? null : ((EntityBlock) block).newBlockEntity( - BlockPos.ZERO, - blockState - ); - tile = tileEntity == null - ? null - : new PaperweightLazyCompoundTag(Suppliers.memoize(tileEntity::saveWithId)); - } - - public Block getBlock() { - return block; - } - - public BlockState getState() { - return blockState; - } - - public CraftBlockData getCraftBlockData() { - return craftBlockData; - } - - public Material getMaterial() { - return material; - } - - @Override - public boolean isAir() { - return blockState.isAir(); - } - - @Override - public boolean isFullCube() { - return craftMaterial.isOccluding(); - } - - @Override - public boolean isOpaque() { - return material.isSolidBlocking(); - } - - @Override - public boolean isPowerSource() { - return blockState.isSignalSource(); - } - - @Override - public boolean isLiquid() { - return material.isLiquid(); - } - - @Override - public boolean isSolid() { - return material.isSolid(); - } - - @Override - public float getHardness() { - return craftBlockData.getState().destroySpeed; - } - - @Override - public float getResistance() { - return block.getExplosionResistance(); - } - - @Override - public float getSlipperiness() { - return block.getFriction(); - } - - @Override - public int getLightValue() { - return blockState.getLightEmission(); - } - - @Override - public int getLightOpacity() { - return opacity; - } - - @Override - public boolean isFragileWhenPushed() { - return material.getPushReaction() == PushReaction.DESTROY; - } - - @Override - public boolean isUnpushable() { - return material.getPushReaction() == PushReaction.BLOCK; - } - - @Override - public boolean isTicksRandomly() { - return block.isRandomlyTicking(blockState); - } - - @Override - public boolean isMovementBlocker() { - return material.isSolid(); - } - - @Override - public boolean isBurnable() { - return material.isFlammable(); - } - - @Override - public boolean isToolRequired() { - // Removed in 1.16.1, this is not present in higher versions - return false; - } - - @Override - public boolean isReplacedDuringPlacement() { - return material.isReplaceable(); - } - - @Override - public boolean isTranslucent() { - return isTranslucent; - } - - @Override - public boolean hasContainer() { - return block instanceof EntityBlock; - } - - @Override - public boolean isTile() { - return block instanceof EntityBlock; - } - - @Override - public CompoundTag getDefaultTile() { - return tile; - } - - @Override - public int getMapColor() { - // rgb field - return material.getColor().col; - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightFaweAdapter.java deleted file mode 100644 index b9aa9cf7f..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightFaweAdapter.java +++ /dev/null @@ -1,701 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1; - -import com.fastasyncworldedit.bukkit.adapter.CachedBukkitAdapter; -import com.fastasyncworldedit.bukkit.adapter.IDelegateBukkitImplAdapter; -import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory; -import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.entity.LazyBaseEntity; -import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory; -import com.fastasyncworldedit.core.queue.IBatchProcessor; -import com.fastasyncworldedit.core.queue.IChunkGet; -import com.fastasyncworldedit.core.queue.implementation.packet.ChunkPacket; -import com.fastasyncworldedit.core.util.NbtUtils; -import com.fastasyncworldedit.core.util.TaskManager; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.blocks.BaseItemStack; -import com.sk89q.worldedit.blocks.TileEntityBlock; -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.bukkit.BukkitWorld; -import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; -import com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_19_R1.PaperweightAdapter; -import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1.nbt.PaperweightLazyCompoundTag; -import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1.regen.PaperweightRegen; -import com.sk89q.worldedit.entity.BaseEntity; -import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.internal.block.BlockStateIdAccess; -import com.sk89q.worldedit.internal.util.LogManagerCompat; -import com.sk89q.worldedit.internal.wna.WorldNativeAccess; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.registry.state.BooleanProperty; -import com.sk89q.worldedit.registry.state.DirectionalProperty; -import com.sk89q.worldedit.registry.state.EnumProperty; -import com.sk89q.worldedit.registry.state.IntegerProperty; -import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.util.Direction; -import com.sk89q.worldedit.util.SideEffect; -import com.sk89q.worldedit.util.SideEffectSet; -import com.sk89q.worldedit.util.TreeGenerator; -import com.sk89q.worldedit.util.formatting.text.Component; -import com.sk89q.worldedit.util.nbt.BinaryTag; -import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; -import com.sk89q.worldedit.util.nbt.StringBinaryTag; -import com.sk89q.worldedit.world.RegenOptions; -import com.sk89q.worldedit.world.biome.BiomeType; -import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockStateHolder; -import com.sk89q.worldedit.world.block.BlockType; -import com.sk89q.worldedit.world.block.BlockTypes; -import com.sk89q.worldedit.world.block.BlockTypesCache; -import com.sk89q.worldedit.world.entity.EntityType; -import com.sk89q.worldedit.world.item.ItemType; -import com.sk89q.worldedit.world.registry.BlockMaterial; -import io.papermc.lib.PaperLib; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Registry; -import net.minecraft.core.WritableRegistry; -import net.minecraft.nbt.IntTag; -import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ChunkHolder; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.util.StringRepresentable; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.properties.BlockStateProperties; -import net.minecraft.world.level.block.state.properties.DirectionProperty; -import net.minecraft.world.level.chunk.LevelChunk; -import net.minecraft.world.level.chunk.LevelChunkSection; -import org.apache.logging.log4j.Logger; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.NamespacedKey; -import org.bukkit.TreeType; -import org.bukkit.block.data.BlockData; -import org.bukkit.craftbukkit.v1_19_R1.CraftChunk; -import org.bukkit.craftbukkit.v1_19_R1.CraftServer; -import org.bukkit.craftbukkit.v1_19_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_19_R1.block.CraftBlockState; -import org.bukkit.craftbukkit.v1_19_R1.block.data.CraftBlockData; -import org.bukkit.craftbukkit.v1_19_R1.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_19_R1.inventory.CraftItemStack; -import org.bukkit.craftbukkit.v1_19_R1.util.CraftNamespacedKey; -import org.bukkit.entity.Player; - -import javax.annotation.Nullable; -import java.lang.ref.WeakReference; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Objects; -import java.util.OptionalInt; -import java.util.Set; -import java.util.function.Supplier; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public final class PaperweightFaweAdapter extends CachedBukkitAdapter implements - IDelegateBukkitImplAdapter { - - private static final Logger LOGGER = LogManagerCompat.getLogger(); - private static Method CHUNK_HOLDER_WAS_ACCESSIBLE_SINCE_LAST_SAVE; - - static { - try { - CHUNK_HOLDER_WAS_ACCESSIBLE_SINCE_LAST_SAVE = ChunkHolder.class.getDeclaredMethod("wasAccessibleSinceLastSave"); - } catch (NoSuchMethodException ignored) { // may not be present in newer paper versions - } - } - - private final PaperweightAdapter parent; - // ------------------------------------------------------------------------ - // Code that may break between versions of Minecraft - // ------------------------------------------------------------------------ - private final PaperweightMapChunkUtil mapUtil = new PaperweightMapChunkUtil(); - private char[] ibdToStateOrdinal = null; - private int[] ordinalToIbdID = null; - private boolean initialised = false; - private Map>> allBlockProperties = null; - - public PaperweightFaweAdapter() throws NoSuchFieldException, NoSuchMethodException { - this.parent = new PaperweightAdapter(); - } - - @Nullable - private static String getEntityId(Entity entity) { - ResourceLocation resourceLocation = net.minecraft.world.entity.EntityType.getKey(entity.getType()); - return resourceLocation == null ? null : resourceLocation.toString(); - } - - private static void readEntityIntoTag(Entity entity, net.minecraft.nbt.CompoundTag compoundTag) { - entity.save(compoundTag); - } - - @Override - public BukkitImplAdapter getParent() { - return parent; - } - - private synchronized boolean init() { - if (ibdToStateOrdinal != null && ibdToStateOrdinal[1] != 0) { - return false; - } - ibdToStateOrdinal = new char[BlockTypesCache.states.length]; // size - ordinalToIbdID = new int[ibdToStateOrdinal.length]; // size - for (int i = 0; i < ibdToStateOrdinal.length; i++) { - BlockState blockState = BlockTypesCache.states[i]; - PaperweightBlockMaterial material = (PaperweightBlockMaterial) blockState.getMaterial(); - int id = Block.BLOCK_STATE_REGISTRY.getId(material.getState()); - char ordinal = blockState.getOrdinalChar(); - ibdToStateOrdinal[id] = ordinal; - ordinalToIbdID[ordinal] = id; - } - Map>> properties = new HashMap<>(); - try { - for (Field field : BlockStateProperties.class.getDeclaredFields()) { - Object obj = field.get(null); - if (!(obj instanceof net.minecraft.world.level.block.state.properties.Property state)) { - continue; - } - Property property; - if (state instanceof net.minecraft.world.level.block.state.properties.BooleanProperty) { - property = new BooleanProperty( - state.getName(), - (List) ImmutableList.copyOf(state.getPossibleValues()) - ); - } else if (state instanceof DirectionProperty) { - property = new DirectionalProperty( - state.getName(), - state - .getPossibleValues() - .stream() - .map(e -> Direction.valueOf(((StringRepresentable) e).getSerializedName().toUpperCase())) - .collect(Collectors.toList()) - ); - } else if (state instanceof net.minecraft.world.level.block.state.properties.EnumProperty) { - property = new EnumProperty( - state.getName(), - state - .getPossibleValues() - .stream() - .map(e -> ((StringRepresentable) e).getSerializedName()) - .collect(Collectors.toList()) - ); - } else if (state instanceof net.minecraft.world.level.block.state.properties.IntegerProperty) { - property = new IntegerProperty( - state.getName(), - (List) ImmutableList.copyOf(state.getPossibleValues()) - ); - } else { - throw new IllegalArgumentException("FastAsyncWorldEdit needs an update to support " + state - .getClass() - .getSimpleName()); - } - properties.compute(property.getName().toLowerCase(Locale.ROOT), (k, v) -> { - if (v == null) { - v = new ArrayList<>(Collections.singletonList(property)); - } else { - v.add(property); - } - return v; - }); - } - } catch (IllegalAccessException e) { - e.printStackTrace(); - } finally { - allBlockProperties = ImmutableMap.copyOf(properties); - } - initialised = true; - return true; - } - - @Override - public BlockMaterial getMaterial(BlockType blockType) { - Block block = getBlock(blockType); - return new PaperweightBlockMaterial(block); - } - - @Override - public synchronized BlockMaterial getMaterial(BlockState state) { - net.minecraft.world.level.block.state.BlockState blockState = ((CraftBlockData) Bukkit.createBlockData(state.getAsString())).getState(); - return new PaperweightBlockMaterial(blockState.getBlock(), blockState); - } - - public Block getBlock(BlockType blockType) { - return Registry.BLOCK.get(new ResourceLocation(blockType.getNamespace(), blockType.getResource())); - } - - @Deprecated - @Override - public BlockState getBlock(Location location) { - Preconditions.checkNotNull(location); - - CraftWorld craftWorld = ((CraftWorld) location.getWorld()); - int x = location.getBlockX(); - int y = location.getBlockY(); - int z = location.getBlockZ(); - final ServerLevel handle = craftWorld.getHandle(); - LevelChunk chunk = handle.getChunk(x >> 4, z >> 4); - final BlockPos blockPos = new BlockPos(x, y, z); - final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(blockPos); - BlockState state = adapt(blockData); - if (state == null) { - org.bukkit.block.Block bukkitBlock = location.getBlock(); - state = BukkitAdapter.adapt(bukkitBlock.getBlockData()); - } - return state; - } - - @Override - public BaseBlock getFullBlock(final Location location) { - Preconditions.checkNotNull(location); - - CraftWorld craftWorld = ((CraftWorld) location.getWorld()); - int x = location.getBlockX(); - int y = location.getBlockY(); - int z = location.getBlockZ(); - - final ServerLevel handle = craftWorld.getHandle(); - LevelChunk chunk = handle.getChunk(x >> 4, z >> 4); - final BlockPos blockPos = new BlockPos(x, y, z); - final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(blockPos); - BlockState state = adapt(blockData); - if (state == null) { - org.bukkit.block.Block bukkitBlock = location.getBlock(); - state = BukkitAdapter.adapt(bukkitBlock.getBlockData()); - } - if (state.getBlockType().getMaterial().hasContainer()) { - - // Read the NBT data - BlockEntity blockEntity = chunk.getBlockEntity(blockPos, LevelChunk.EntityCreationType.CHECK); - if (blockEntity != null) { - net.minecraft.nbt.CompoundTag tag = blockEntity.saveWithId(); - return state.toBaseBlock((CompoundBinaryTag) toNativeBinary(tag)); - } - } - - return state.toBaseBlock(); - } - - @Override - public Set getSupportedSideEffects() { - return SideEffectSet.defaults().getSideEffectsToApply(); - } - - public boolean setBlock(org.bukkit.Chunk chunk, int x, int y, int z, BlockStateHolder state, boolean update) { - CraftChunk craftChunk = (CraftChunk) chunk; - LevelChunk levelChunk = craftChunk.getHandle(); - Level level = levelChunk.getLevel(); - - BlockPos blockPos = new BlockPos(x, y, z); - net.minecraft.world.level.block.state.BlockState blockState = ((PaperweightBlockMaterial) state.getMaterial()).getState(); - LevelChunkSection[] levelChunkSections = levelChunk.getSections(); - int y4 = y >> 4; - LevelChunkSection section = levelChunkSections[y4]; - - net.minecraft.world.level.block.state.BlockState existing; - if (section == null) { - existing = ((PaperweightBlockMaterial) BlockTypes.AIR.getDefaultState().getMaterial()).getState(); - } else { - existing = section.getBlockState(x & 15, y & 15, z & 15); - } - - levelChunk.removeBlockEntity(blockPos); // Force delete the old tile entity - - CompoundBinaryTag compoundTag = state instanceof BaseBlock ? state.getNbt() : null; - if (compoundTag != null || existing instanceof TileEntityBlock) { - level.setBlock(blockPos, blockState, 0); - // remove tile - if (compoundTag != null) { - // We will assume that the tile entity was created for us, - // though we do not do this on the Forge version - BlockEntity blockEntity = level.getBlockEntity(blockPos); - if (blockEntity != null) { - net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) fromNativeBinary(compoundTag); - tag.put("x", IntTag.valueOf(x)); - tag.put("y", IntTag.valueOf(y)); - tag.put("z", IntTag.valueOf(z)); - blockEntity.load(tag); // readTagIntoTileEntity - load data - } - } - } else { - if (existing == blockState) { - return true; - } - levelChunk.setBlockState(blockPos, blockState, false); - } - if (update) { - level.getMinecraftWorld().sendBlockUpdated(blockPos, existing, blockState, 0); - } - return true; - } - - @Override - public WorldNativeAccess createWorldNativeAccess(org.bukkit.World world) { - return new PaperweightFaweWorldNativeAccess( - this, - new WeakReference<>(((CraftWorld) world).getHandle()) - ); - } - - @Override - public BaseEntity getEntity(org.bukkit.entity.Entity entity) { - Preconditions.checkNotNull(entity); - - CraftEntity craftEntity = ((CraftEntity) entity); - Entity mcEntity = craftEntity.getHandle(); - - String id = getEntityId(mcEntity); - - if (id != null) { - EntityType type = com.sk89q.worldedit.world.entity.EntityTypes.get(id); - Supplier saveTag = () -> { - final net.minecraft.nbt.CompoundTag minecraftTag = new net.minecraft.nbt.CompoundTag(); - readEntityIntoTag(mcEntity, minecraftTag); - //add Id for AbstractChangeSet to work - final CompoundBinaryTag tag = (CompoundBinaryTag) toNativeBinary(minecraftTag); - final Map tags = NbtUtils.getCompoundBinaryTagValues(tag); - tags.put("Id", StringBinaryTag.of(id)); - return CompoundBinaryTag.from(tags); - }; - return new LazyBaseEntity(type, saveTag); - } else { - return null; - } - } - - @Override - public Component getRichBlockName(BlockType blockType) { - return parent.getRichBlockName(blockType); - } - - @Override - public Component getRichItemName(ItemType itemType) { - return parent.getRichItemName(itemType); - } - - @Override - public Component getRichItemName(BaseItemStack itemStack) { - return parent.getRichItemName(itemStack); - } - - @Override - public OptionalInt getInternalBlockStateId(BlockState state) { - PaperweightBlockMaterial material = (PaperweightBlockMaterial) state.getMaterial(); - net.minecraft.world.level.block.state.BlockState mcState = material.getCraftBlockData().getState(); - return OptionalInt.of(Block.BLOCK_STATE_REGISTRY.getId(mcState)); - } - - @Override - public BlockState adapt(BlockData blockData) { - CraftBlockData cbd = ((CraftBlockData) blockData); - net.minecraft.world.level.block.state.BlockState ibd = cbd.getState(); - return adapt(ibd); - } - - public BlockState adapt(net.minecraft.world.level.block.state.BlockState blockState) { - return BlockTypesCache.states[adaptToChar(blockState)]; - } - - public char adaptToChar(net.minecraft.world.level.block.state.BlockState blockState) { - int id = Block.BLOCK_STATE_REGISTRY.getId(blockState); - if (initialised) { - return ibdToStateOrdinal[id]; - } - synchronized (this) { - if (initialised) { - return ibdToStateOrdinal[id]; - } - try { - init(); - return ibdToStateOrdinal[id]; - } catch (ArrayIndexOutOfBoundsException e1) { - LOGGER.error("Attempted to convert {} with ID {} to char. ibdToStateOrdinal length: {}. Defaulting to air!", - blockState.getBlock(), Block.BLOCK_STATE_REGISTRY.getId(blockState), ibdToStateOrdinal.length, e1 - ); - return BlockTypesCache.ReservedIDs.AIR; - } - } - } - - public char ibdIDToOrdinal(int id) { - if (initialised) { - return ibdToStateOrdinal[id]; - } - synchronized (this) { - if (initialised) { - return ibdToStateOrdinal[id]; - } - init(); - return ibdToStateOrdinal[id]; - } - } - - @Override - public char[] getIbdToStateOrdinal() { - if (initialised) { - return ibdToStateOrdinal; - } - synchronized (this) { - if (initialised) { - return ibdToStateOrdinal; - } - init(); - return ibdToStateOrdinal; - } - } - - public int ordinalToIbdID(char ordinal) { - if (initialised) { - return ordinalToIbdID[ordinal]; - } - synchronized (this) { - if (initialised) { - return ordinalToIbdID[ordinal]; - } - init(); - return ordinalToIbdID[ordinal]; - } - } - - @Override - public int[] getOrdinalToIbdID() { - if (initialised) { - return ordinalToIbdID; - } - synchronized (this) { - if (initialised) { - return ordinalToIbdID; - } - init(); - return ordinalToIbdID; - } - } - - @Override - public > BlockData adapt(B state) { - PaperweightBlockMaterial material = (PaperweightBlockMaterial) state.getMaterial(); - return material.getCraftBlockData(); - } - - @Override - public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket chunkPacket) { - ServerLevel nmsWorld = ((CraftWorld) world).getHandle(); - ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ()); - if (map != null && wasAccessibleSinceLastSave(map)) { - boolean flag = false; - // PlayerChunk.d players = map.players; - Stream stream = /*players.a(new ChunkCoordIntPair(packet.getChunkX(), packet.getChunkZ()), flag) - */ Stream.empty(); - - ServerPlayer checkPlayer = player == null ? null : ((CraftPlayer) player).getHandle(); - stream.filter(entityPlayer -> checkPlayer == null || entityPlayer == checkPlayer) - .forEach(entityPlayer -> { - synchronized (chunkPacket) { - ClientboundLevelChunkWithLightPacket nmsPacket = (ClientboundLevelChunkWithLightPacket) chunkPacket.getNativePacket(); - if (nmsPacket == null) { - nmsPacket = mapUtil.create(this, chunkPacket); - chunkPacket.setNativePacket(nmsPacket); - } - try { - FaweCache.INSTANCE.CHUNK_FLAG.get().set(true); - entityPlayer.connection.send(nmsPacket); - } finally { - FaweCache.INSTANCE.CHUNK_FLAG.get().set(false); - } - } - }); - } - } - - @Override - public Map> getProperties(BlockType blockType) { - return getParent().getProperties(blockType); - } - - @Override - public boolean canPlaceAt(org.bukkit.World world, BlockVector3 blockVector3, BlockState blockState) { - int internalId = BlockStateIdAccess.getBlockStateId(blockState); - net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId); - return blockState1.hasPostProcess( - ((CraftWorld) world).getHandle(), - new BlockPos(blockVector3.getX(), blockVector3.getY(), blockVector3.getZ()) - ); - } - - @Override - public org.bukkit.inventory.ItemStack adapt(BaseItemStack baseItemStack) { - ItemStack stack = new ItemStack( - Registry.ITEM.get(ResourceLocation.tryParse(baseItemStack.getType().getId())), - baseItemStack.getAmount() - ); - stack.setTag(((net.minecraft.nbt.CompoundTag) fromNative(baseItemStack.getNbtData()))); - return CraftItemStack.asCraftMirror(stack); - } - - @Override - public boolean generateTree( - TreeGenerator.TreeType treeType, EditSession editSession, BlockVector3 blockVector3, - org.bukkit.World bukkitWorld - ) { - TreeType bukkitType = BukkitWorld.toBukkitTreeType(treeType); - if (bukkitType == TreeType.CHORUS_PLANT) { - blockVector3 = blockVector3.add( - 0, - 1, - 0 - ); // bukkit skips the feature gen which does this offset normally, so we have to add it back - } - ServerLevel serverLevel = ((CraftWorld) bukkitWorld).getHandle(); - final BlockVector3 finalBlockVector = blockVector3; - // Sync to main thread to ensure no clashes occur - Map placed = TaskManager.taskManager().sync(() -> { - serverLevel.captureTreeGeneration = true; - serverLevel.captureBlockStates = true; - try { - if (!bukkitWorld.generateTree(BukkitAdapter.adapt(bukkitWorld, finalBlockVector), bukkitType)) { - return null; - } - return ImmutableMap.copyOf(serverLevel.capturedBlockStates); - } finally { - serverLevel.captureBlockStates = false; - serverLevel.captureTreeGeneration = false; - serverLevel.capturedBlockStates.clear(); - } - }); - if (placed == null || placed.isEmpty()) { - return false; - } - for (CraftBlockState craftBlockState : placed.values()) { - if (craftBlockState == null || craftBlockState.getType() == Material.AIR) { - continue; - } - editSession.setBlock(craftBlockState.getX(), craftBlockState.getY(), craftBlockState.getZ(), - BukkitAdapter.adapt(((org.bukkit.block.BlockState) craftBlockState).getBlockData()) - ); - } - return true; - } - - @Override - public BaseItemStack adapt(org.bukkit.inventory.ItemStack itemStack) { - final ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - final BaseItemStack weStack = new BaseItemStack(BukkitAdapter.asItemType(itemStack.getType()), itemStack.getAmount()); - weStack.setNbt(((CompoundBinaryTag) toNativeBinary(nmsStack.getTag()))); - return weStack; - } - - @Override - public Tag toNative(net.minecraft.nbt.Tag foreign) { - return parent.toNative(foreign); - } - - @Override - public net.minecraft.nbt.Tag fromNative(Tag foreign) { - if (foreign instanceof PaperweightLazyCompoundTag) { - return ((PaperweightLazyCompoundTag) foreign).get(); - } - return parent.fromNative(foreign); - } - - @Override - public boolean regenerate(org.bukkit.World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception { - return new PaperweightRegen(bukkitWorld, region, target, options).regenerate(); - } - - @Override - public IChunkGet get(org.bukkit.World world, int chunkX, int chunkZ) { - return new PaperweightGetBlocks(world, chunkX, chunkZ); - } - - @Override - public int getInternalBiomeId(BiomeType biomeType) { - final Registry registry = MinecraftServer - .getServer() - .registryAccess() - .ownedRegistryOrThrow(Registry.BIOME_REGISTRY); - ResourceLocation resourceLocation = ResourceLocation.tryParse(biomeType.getId()); - Biome biome = registry.get(resourceLocation); - return registry.getId(biome); - } - - @Override - public Iterable getRegisteredBiomes() { - WritableRegistry biomeRegistry = (WritableRegistry) ((CraftServer) Bukkit.getServer()) - .getServer() - .registryAccess() - .ownedRegistryOrThrow( - Registry.BIOME_REGISTRY); - List keys = biomeRegistry.stream() - .map(biomeRegistry::getKey).filter(Objects::nonNull).toList(); - List namespacedKeys = new ArrayList<>(); - for (ResourceLocation key : keys) { - try { - namespacedKeys.add(CraftNamespacedKey.fromMinecraft(key)); - } catch (IllegalArgumentException e) { - LOGGER.error("Error converting biome key {}", key.toString(), e); - } - } - return namespacedKeys; - } - - @Override - public RelighterFactory getRelighterFactory() { - if (PaperLib.isPaper()) { - return new PaperweightStarlightRelighterFactory(); - } else { - return new NMSRelighterFactory(); - } - } - - @Override - public Map>> getAllProperties() { - if (initialised) { - return allBlockProperties; - } - synchronized (this) { - if (initialised) { - return allBlockProperties; - } - init(); - return allBlockProperties; - } - } - - @Override - public IBatchProcessor getTickingPostProcessor() { - return new PaperweightPostProcessor(); - } - - private boolean wasAccessibleSinceLastSave(ChunkHolder holder) { - if (!PaperLib.isPaper() || !PaperweightPlatformAdapter.POST_CHUNK_REWRITE) { - try { - return (boolean) CHUNK_HOLDER_WAS_ACCESSIBLE_SINCE_LAST_SAVE.invoke(holder); - } catch (IllegalAccessException | InvocationTargetException ignored) { - // fall-through - } - } - // Papers new chunk system has no related replacement - therefor we assume true. - return true; - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightFaweWorldNativeAccess.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightFaweWorldNativeAccess.java deleted file mode 100644 index 0e7f6ea0c..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightFaweWorldNativeAccess.java +++ /dev/null @@ -1,286 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1; - -import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.math.IntPair; -import com.fastasyncworldedit.core.util.TaskManager; -import com.fastasyncworldedit.core.util.task.RunnableVal; -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.internal.block.BlockStateIdAccess; -import com.sk89q.worldedit.internal.wna.WorldNativeAccess; -import com.sk89q.worldedit.util.SideEffect; -import com.sk89q.worldedit.util.SideEffectSet; -import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; -import com.sk89q.worldedit.world.block.BlockState; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ChunkHolder; -import net.minecraft.server.level.ServerChunkCache; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.chunk.LevelChunk; -import org.bukkit.craftbukkit.v1_19_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_19_R1.block.data.CraftBlockData; -import org.bukkit.event.block.BlockPhysicsEvent; - -import javax.annotation.Nullable; -import java.lang.ref.WeakReference; -import java.util.Collections; -import java.util.HashSet; -import java.util.Objects; -import java.util.Set; -import java.util.concurrent.atomic.AtomicInteger; - -public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess { - - private static final int UPDATE = 1; - private static final int NOTIFY = 2; - private static final Direction[] NEIGHBOUR_ORDER = { - Direction.EAST, - Direction.WEST, - Direction.DOWN, - Direction.UP, - Direction.NORTH, - Direction.SOUTH - }; - private final PaperweightFaweAdapter paperweightFaweAdapter; - private final WeakReference level; - private final AtomicInteger lastTick; - private final Set cachedChanges = new HashSet<>(); - private final Set cachedChunksToSend = new HashSet<>(); - private SideEffectSet sideEffectSet; - - public PaperweightFaweWorldNativeAccess(PaperweightFaweAdapter paperweightFaweAdapter, WeakReference level) { - this.paperweightFaweAdapter = paperweightFaweAdapter; - this.level = level; - // Use the actual tick as minecraft-defined so we don't try to force blocks into the world when the server's already lagging. - // - With the caveat that we don't want to have too many cached changed (1024) so we'd flush those at 1024 anyway. - this.lastTick = new AtomicInteger(MinecraftServer.currentTick); - } - - private Level getLevel() { - return Objects.requireNonNull(level.get(), "The reference to the world was lost"); - } - - @Override - public void setCurrentSideEffectSet(SideEffectSet sideEffectSet) { - this.sideEffectSet = sideEffectSet; - } - - @Override - public LevelChunk getChunk(int x, int z) { - return getLevel().getChunk(x, z); - } - - @Override - public net.minecraft.world.level.block.state.BlockState toNative(BlockState blockState) { - int stateId = paperweightFaweAdapter.ordinalToIbdID(blockState.getOrdinalChar()); - return BlockStateIdAccess.isValidInternalId(stateId) - ? Block.stateById(stateId) - : ((CraftBlockData) BukkitAdapter.adapt(blockState)).getState(); - } - - @Override - public net.minecraft.world.level.block.state.BlockState getBlockState(LevelChunk levelChunk, BlockPos blockPos) { - return levelChunk.getBlockState(blockPos); - } - - @Nullable - @Override - public synchronized net.minecraft.world.level.block.state.BlockState setBlockState( - LevelChunk levelChunk, BlockPos blockPos, - net.minecraft.world.level.block.state.BlockState blockState - ) { - int currentTick = MinecraftServer.currentTick; - if (Fawe.isMainThread()) { - return levelChunk.setBlockState(blockPos, blockState, - this.sideEffectSet != null && this.sideEffectSet.shouldApply(SideEffect.UPDATE) - ); - } - // Since FAWE is.. Async we need to do it on the main thread (wooooo.. :( ) - cachedChanges.add(new CachedChange(levelChunk, blockPos, blockState)); - cachedChunksToSend.add(new IntPair(levelChunk.bukkitChunk.getX(), levelChunk.bukkitChunk.getZ())); - boolean nextTick = lastTick.get() > currentTick; - if (nextTick || cachedChanges.size() >= 1024) { - if (nextTick) { - lastTick.set(currentTick); - } - flushAsync(nextTick); - } - return blockState; - } - - @Override - public net.minecraft.world.level.block.state.BlockState getValidBlockForPosition( - net.minecraft.world.level.block.state.BlockState blockState, - BlockPos blockPos - ) { - return Block.updateFromNeighbourShapes(blockState, getLevel(), blockPos); - } - - @Override - public BlockPos getPosition(int x, int y, int z) { - return new BlockPos(x, y, z); - } - - @Override - public void updateLightingForBlock(BlockPos blockPos) { - getLevel().getChunkSource().getLightEngine().checkBlock(blockPos); - } - - @Override - public boolean updateTileEntity(BlockPos blockPos, CompoundBinaryTag tag) { - // We will assume that the tile entity was created for us, - // though we do not do this on the other versions - BlockEntity blockEntity = getLevel().getBlockEntity(blockPos); - if (blockEntity == null) { - return false; - } - net.minecraft.nbt.Tag nativeTag = paperweightFaweAdapter.fromNativeBinary(tag); - blockEntity.load((CompoundTag) nativeTag); - return true; - } - - @Override - public void notifyBlockUpdate( - LevelChunk levelChunk, BlockPos blockPos, - net.minecraft.world.level.block.state.BlockState oldState, - net.minecraft.world.level.block.state.BlockState newState - ) { - if (levelChunk.getSections()[level.get().getSectionIndex(blockPos.getY())] != null) { - getLevel().sendBlockUpdated(blockPos, oldState, newState, UPDATE | NOTIFY); - } - } - - @Override - public boolean isChunkTicking(LevelChunk levelChunk) { - return levelChunk.getFullStatus().isOrAfter(ChunkHolder.FullChunkStatus.TICKING); - } - - @Override - public void markBlockChanged(LevelChunk levelChunk, BlockPos blockPos) { - if (levelChunk.getSections()[level.get().getSectionIndex(blockPos.getY())] != null) { - ((ServerChunkCache) getLevel().getChunkSource()).blockChanged(blockPos); - } - } - - @Override - public void notifyNeighbors( - BlockPos blockPos, - net.minecraft.world.level.block.state.BlockState oldState, - net.minecraft.world.level.block.state.BlockState newState - ) { - Level level = getLevel(); - if (sideEffectSet.shouldApply(SideEffect.EVENTS)) { - level.blockUpdated(blockPos, oldState.getBlock()); - } else { - // When we don't want events, manually run the physics without them. - // Un-nest neighbour updating - for (Direction direction : NEIGHBOUR_ORDER) { - BlockPos shifted = blockPos.relative(direction); - level.getBlockState(shifted).neighborChanged(level, shifted, oldState.getBlock(), blockPos, false); - } - } - if (newState.hasAnalogOutputSignal()) { - level.updateNeighbourForOutputSignal(blockPos, newState.getBlock()); - } - } - - @Override - public void updateNeighbors( - BlockPos blockPos, - net.minecraft.world.level.block.state.BlockState oldState, - net.minecraft.world.level.block.state.BlockState newState, - int recursionLimit - ) { - Level level = getLevel(); - // a == updateNeighbors - // b == updateDiagonalNeighbors - oldState.updateIndirectNeighbourShapes(level, blockPos, NOTIFY, recursionLimit); - if (sideEffectSet.shouldApply(SideEffect.EVENTS)) { - CraftWorld craftWorld = level.getWorld(); - if (craftWorld != null) { - BlockPhysicsEvent event = new BlockPhysicsEvent( - craftWorld.getBlockAt(blockPos.getX(), blockPos.getY(), blockPos.getZ()), - CraftBlockData.fromData(newState) - ); - level.getCraftServer().getPluginManager().callEvent(event); - if (event.isCancelled()) { - return; - } - } - } - newState.triggerEvent(level, blockPos, NOTIFY, recursionLimit); - newState.updateIndirectNeighbourShapes(level, blockPos, NOTIFY, recursionLimit); - } - - @Override - public void onBlockStateChange( - BlockPos blockPos, - net.minecraft.world.level.block.state.BlockState oldState, - net.minecraft.world.level.block.state.BlockState newState - ) { - getLevel().onBlockStateChange(blockPos, oldState, newState); - } - - private synchronized void flushAsync(final boolean sendChunks) { - final Set changes = Set.copyOf(cachedChanges); - cachedChanges.clear(); - final Set toSend; - if (sendChunks) { - toSend = Set.copyOf(cachedChunksToSend); - cachedChunksToSend.clear(); - } else { - toSend = Collections.emptySet(); - } - RunnableVal runnableVal = new RunnableVal<>() { - @Override - public void run(Object value) { - changes.forEach(cc -> cc.levelChunk.setBlockState(cc.blockPos, cc.blockState, - sideEffectSet != null && sideEffectSet.shouldApply(SideEffect.UPDATE) - )); - if (!sendChunks) { - return; - } - for (IntPair chunk : toSend) { - PaperweightPlatformAdapter.sendChunk(getLevel().getWorld().getHandle(), chunk.x(), chunk.z(), false); - } - } - }; - TaskManager.taskManager().async(() -> TaskManager.taskManager().sync(runnableVal)); - } - - @Override - public synchronized void flush() { - RunnableVal runnableVal = new RunnableVal<>() { - @Override - public void run(Object value) { - cachedChanges.forEach(cc -> cc.levelChunk.setBlockState(cc.blockPos, cc.blockState, - sideEffectSet != null && sideEffectSet.shouldApply(SideEffect.UPDATE) - )); - for (IntPair chunk : cachedChunksToSend) { - PaperweightPlatformAdapter.sendChunk(getLevel().getWorld().getHandle(), chunk.x(), chunk.z(), false); - } - } - }; - if (Fawe.isMainThread()) { - runnableVal.run(); - } else { - TaskManager.taskManager().sync(runnableVal); - } - cachedChanges.clear(); - cachedChunksToSend.clear(); - } - - private record CachedChange( - LevelChunk levelChunk, - BlockPos blockPos, - net.minecraft.world.level.block.state.BlockState blockState - ) { - - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java deleted file mode 100644 index 6466ea828..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks.java +++ /dev/null @@ -1,1164 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1; - -import com.fastasyncworldedit.bukkit.adapter.BukkitGetBlocks; -import com.fastasyncworldedit.bukkit.adapter.DelegateSemaphore; -import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; -import com.fastasyncworldedit.core.math.BitArrayUnstretched; -import com.fastasyncworldedit.core.queue.IChunkGet; -import com.fastasyncworldedit.core.queue.IChunkSet; -import com.fastasyncworldedit.core.queue.implementation.QueueHandler; -import com.fastasyncworldedit.core.queue.implementation.blocks.CharGetBlocks; -import com.fastasyncworldedit.core.util.MathMan; -import com.fastasyncworldedit.core.util.collection.AdaptedMap; -import com.google.common.base.Suppliers; -import com.sk89q.jnbt.CompoundTag; -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.WorldEditPlugin; -import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1.nbt.PaperweightLazyCompoundTag; -import com.sk89q.worldedit.internal.Constants; -import com.sk89q.worldedit.internal.util.LogManagerCompat; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.biome.BiomeType; -import com.sk89q.worldedit.world.biome.BiomeTypes; -import com.sk89q.worldedit.world.block.BlockTypesCache; -import io.papermc.lib.PaperLib; -import io.papermc.paper.event.block.BeaconDeactivatedEvent; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Holder; -import net.minecraft.core.IdMap; -import net.minecraft.core.Registry; -import net.minecraft.core.SectionPos; -import net.minecraft.nbt.IntTag; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.util.BitStorage; -import net.minecraft.util.ZeroBitStorage; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.level.LightLayer; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.block.entity.BeaconBlockEntity; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.chunk.DataLayer; -import net.minecraft.world.level.chunk.HashMapPalette; -import net.minecraft.world.level.chunk.LevelChunk; -import net.minecraft.world.level.chunk.LevelChunkSection; -import net.minecraft.world.level.chunk.LinearPalette; -import net.minecraft.world.level.chunk.Palette; -import net.minecraft.world.level.chunk.PalettedContainer; -import net.minecraft.world.level.chunk.PalettedContainerRO; -import net.minecraft.world.level.levelgen.Heightmap; -import net.minecraft.world.level.lighting.LevelLightEngine; -import org.apache.logging.log4j.Logger; -import org.bukkit.World; -import org.bukkit.craftbukkit.v1_19_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_19_R1.block.CraftBlock; -import org.bukkit.event.entity.CreatureSpawnEvent; - -import javax.annotation.Nonnull; -import java.util.AbstractSet; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.Callable; -import java.util.concurrent.Future; -import java.util.concurrent.Semaphore; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.function.Function; -import java.util.stream.Collectors; - -public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBlocks { - - private static final Logger LOGGER = LogManagerCompat.getLogger(); - - private static final Function posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ()); - private static final Function nmsTile2We = - tileEntity -> new PaperweightLazyCompoundTag(Suppliers.memoize(tileEntity::saveWithId)); - private final PaperweightFaweAdapter adapter = ((PaperweightFaweAdapter) WorldEditPlugin - .getInstance() - .getBukkitImplAdapter()); - private final ReadWriteLock sectionLock = new ReentrantReadWriteLock(); - private final ServerLevel serverLevel; - private final int chunkX; - private final int chunkZ; - private final int minHeight; - private final int maxHeight; - private final int minSectionPosition; - private final int maxSectionPosition; - private final Registry biomeRegistry; - private final IdMap> biomeHolderIdMap; - private LevelChunkSection[] sections; - private LevelChunk levelChunk; - private DataLayer[] blockLight; - private DataLayer[] skyLight; - private boolean createCopy = false; - private PaperweightGetBlocks_Copy copy = null; - private boolean forceLoadSections = true; - private boolean lightUpdate = false; - - public PaperweightGetBlocks(World world, int chunkX, int chunkZ) { - this(((CraftWorld) world).getHandle(), chunkX, chunkZ); - } - - public PaperweightGetBlocks(ServerLevel serverLevel, int chunkX, int chunkZ) { - super(serverLevel.getMinBuildHeight() >> 4, (serverLevel.getMaxBuildHeight() - 1) >> 4); - this.serverLevel = serverLevel; - this.chunkX = chunkX; - this.chunkZ = chunkZ; - this.minHeight = serverLevel.getMinBuildHeight(); - this.maxHeight = serverLevel.getMaxBuildHeight() - 1; // Minecraft max limit is exclusive. - this.minSectionPosition = minHeight >> 4; - this.maxSectionPosition = maxHeight >> 4; - this.skyLight = new DataLayer[getSectionCount()]; - this.blockLight = new DataLayer[getSectionCount()]; - this.biomeRegistry = serverLevel.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY); - this.biomeHolderIdMap = biomeRegistry.asHolderIdMap(); - } - - public int getChunkX() { - return chunkX; - } - - public int getChunkZ() { - return chunkZ; - } - - @Override - public boolean isCreateCopy() { - return createCopy; - } - - @Override - public void setCreateCopy(boolean createCopy) { - this.createCopy = createCopy; - } - - @Override - public IChunkGet getCopy() { - return copy; - } - - @Override - public void setLightingToGet(char[][] light, int minSectionPosition, int maxSectionPosition) { - if (light != null) { - lightUpdate = true; - try { - fillLightNibble(light, LightLayer.BLOCK, minSectionPosition, maxSectionPosition); - } catch (Throwable e) { - e.printStackTrace(); - } - } - } - - @Override - public void setSkyLightingToGet(char[][] light, int minSectionPosition, int maxSectionPosition) { - if (light != null) { - lightUpdate = true; - try { - fillLightNibble(light, LightLayer.SKY, minSectionPosition, maxSectionPosition); - } catch (Throwable e) { - e.printStackTrace(); - } - } - } - - @Override - public void setHeightmapToGet(HeightMapType type, int[] data) { - // height + 1 to match server internal - BitArrayUnstretched bitArray = new BitArrayUnstretched(MathMan.log2nlz(getChunk().getHeight() + 1), 256); - bitArray.fromRaw(data); - Heightmap.Types nativeType = Heightmap.Types.valueOf(type.name()); - Heightmap heightMap = getChunk().heightmaps.get(nativeType); - heightMap.setRawData(getChunk(), nativeType, bitArray.getData()); - } - - @Override - public int getMaxY() { - return maxHeight; - } - - @Override - public int getMinY() { - return minHeight; - } - - @Override - public BiomeType getBiomeType(int x, int y, int z) { - LevelChunkSection section = getSections(false)[(y >> 4) - getMinSectionPosition()]; - Holder biomes = section.getNoiseBiome(x >> 2, (y & 15) >> 2, z >> 2); - return PaperweightPlatformAdapter.adapt(biomes, serverLevel); - } - - @Override - public void removeSectionLighting(int layer, boolean sky) { - SectionPos sectionPos = SectionPos.of(getChunk().getPos(), layer); - DataLayer dataLayer = serverLevel.getChunkSource().getLightEngine().getLayerListener(LightLayer.BLOCK).getDataLayerData( - sectionPos); - if (dataLayer != null) { - lightUpdate = true; - synchronized (dataLayer) { - byte[] bytes = dataLayer.getData(); - Arrays.fill(bytes, (byte) 0); - } - } - if (sky) { - SectionPos sectionPos1 = SectionPos.of(getChunk().getPos(), layer); - DataLayer dataLayer1 = serverLevel - .getChunkSource() - .getLightEngine() - .getLayerListener(LightLayer.SKY) - .getDataLayerData(sectionPos1); - if (dataLayer1 != null) { - lightUpdate = true; - synchronized (dataLayer1) { - byte[] bytes = dataLayer1.getData(); - Arrays.fill(bytes, (byte) 0); - } - } - } - } - - @Override - public CompoundTag getTile(int x, int y, int z) { - BlockEntity blockEntity = getChunk().getBlockEntity(new BlockPos((x & 15) + ( - chunkX << 4), y, (z & 15) + ( - chunkZ << 4))); - if (blockEntity == null) { - return null; - } - return new PaperweightLazyCompoundTag(Suppliers.memoize(blockEntity::saveWithId)); - } - - @Override - public Map getTiles() { - Map nmsTiles = getChunk().getBlockEntities(); - if (nmsTiles.isEmpty()) { - return Collections.emptyMap(); - } - return AdaptedMap.immutable(nmsTiles, posNms2We, nmsTile2We); - } - - @Override - public int getSkyLight(int x, int y, int z) { - int layer = y >> 4; - int alayer = layer - getMinSectionPosition(); - if (skyLight[alayer] == null) { - SectionPos sectionPos = SectionPos.of(getChunk().getPos(), layer); - DataLayer dataLayer = - serverLevel.getChunkSource().getLightEngine().getLayerListener(LightLayer.SKY).getDataLayerData(sectionPos); - // If the server hasn't generated the section's NibbleArray yet, it will be null - if (dataLayer == null) { - byte[] LAYER_COUNT = new byte[2048]; - // Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway. - Arrays.fill(LAYER_COUNT, (byte) 15); - dataLayer = new DataLayer(LAYER_COUNT); - ((LevelLightEngine) serverLevel.getChunkSource().getLightEngine()).queueSectionData( - LightLayer.BLOCK, - sectionPos, - dataLayer, - true - ); - } - skyLight[alayer] = dataLayer; - } - return skyLight[alayer].get(x & 15, y & 15, z & 15); - } - - @Override - public int getEmittedLight(int x, int y, int z) { - int layer = y >> 4; - int alayer = layer - getMinSectionPosition(); - if (blockLight[alayer] == null) { - serverLevel.getRawBrightness(new BlockPos(1, 1, 1), 5); - SectionPos sectionPos = SectionPos.of(getChunk().getPos(), layer); - DataLayer dataLayer = serverLevel - .getChunkSource() - .getLightEngine() - .getLayerListener(LightLayer.BLOCK) - .getDataLayerData(sectionPos); - // If the server hasn't generated the section's DataLayer yet, it will be null - if (dataLayer == null) { - byte[] LAYER_COUNT = new byte[2048]; - // Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway. - Arrays.fill(LAYER_COUNT, (byte) 15); - dataLayer = new DataLayer(LAYER_COUNT); - ((LevelLightEngine) serverLevel.getChunkSource().getLightEngine()).queueSectionData(LightLayer.BLOCK, sectionPos, - dataLayer, true - ); - } - blockLight[alayer] = dataLayer; - } - return blockLight[alayer].get(x & 15, y & 15, z & 15); - } - - @Override - public int[] getHeightMap(HeightMapType type) { - long[] longArray = getChunk().heightmaps.get(Heightmap.Types.valueOf(type.name())).getRawData(); - BitArrayUnstretched bitArray = new BitArrayUnstretched(9, 256, longArray); - return bitArray.toRaw(new int[256]); - } - - @Override - public CompoundTag getEntity(UUID uuid) { - Entity entity = serverLevel.getEntity(uuid); - if (entity != null) { - org.bukkit.entity.Entity bukkitEnt = entity.getBukkitEntity(); - return BukkitAdapter.adapt(bukkitEnt).getState().getNbtData(); - } - for (CompoundTag tag : getEntities()) { - if (uuid.equals(tag.getUUID())) { - return tag; - } - } - return null; - } - - @Override - public Set getEntities() { - List entities = PaperweightPlatformAdapter.getEntities(getChunk()); - 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 CompoundTag getTag)) { - return false; - } - UUID getUUID = getTag.getUUID(); - for (Entity entity : entities) { - UUID uuid = entity.getUUID(); - if (uuid.equals(getUUID)) { - return true; - } - } - return false; - } - - @Nonnull - @Override - public Iterator iterator() { - Iterable result = entities.stream().map(input -> { - net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag(); - input.save(tag); - return (CompoundTag) adapter.toNative(tag); - }).collect(Collectors.toList()); - return result.iterator(); - } - }; - } - - private void removeEntity(Entity entity) { - entity.discard(); - } - - public LevelChunk ensureLoaded(ServerLevel nmsWorld, int chunkX, int chunkZ) { - return PaperweightPlatformAdapter.ensureLoaded(nmsWorld, chunkX, chunkZ); - } - - @Override - @SuppressWarnings("rawtypes") - public synchronized > T call(IChunkSet set, Runnable finalizer) { - forceLoadSections = false; - copy = createCopy ? new PaperweightGetBlocks_Copy(levelChunk) : null; - try { - ServerLevel nmsWorld = serverLevel; - LevelChunk nmsChunk = ensureLoaded(nmsWorld, chunkX, chunkZ); - - // Remove existing tiles. Create a copy so that we can remove blocks - Map chunkTiles = new HashMap<>(nmsChunk.getBlockEntities()); - List beacons = null; - if (!chunkTiles.isEmpty()) { - for (Map.Entry entry : chunkTiles.entrySet()) { - final BlockPos pos = entry.getKey(); - final int lx = pos.getX() & 15; - final int ly = pos.getY(); - final int lz = pos.getZ() & 15; - final int layer = ly >> 4; - if (!set.hasSection(layer)) { - continue; - } - - int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); - if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) { - BlockEntity tile = entry.getValue(); - if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { - if (beacons == null) { - beacons = new ArrayList<>(); - } - beacons.add(tile); - PaperweightPlatformAdapter.removeBeacon(tile, nmsChunk); - continue; - } - nmsChunk.removeBlockEntity(tile.getBlockPos()); - if (createCopy) { - copy.storeTile(tile); - } - } - } - } - final BiomeType[][] biomes = set.getBiomes(); - - int bitMask = 0; - synchronized (nmsChunk) { - LevelChunkSection[] levelChunkSections = nmsChunk.getSections(); - - for (int layerNo = getMinSectionPosition(); layerNo <= getMaxSectionPosition(); layerNo++) { - - int getSectionIndex = layerNo - getMinSectionPosition(); - int setSectionIndex = layerNo - set.getMinSectionPosition(); - - if (!set.hasSection(layerNo)) { - // No blocks, but might be biomes present. Handle this lazily. - if (biomes == null) { - continue; - } - if (layerNo < set.getMinSectionPosition() || layerNo > set.getMaxSectionPosition()) { - continue; - } - if (biomes[setSectionIndex] != null) { - synchronized (super.sectionLocks[getSectionIndex]) { - LevelChunkSection existingSection = levelChunkSections[getSectionIndex]; - if (createCopy && existingSection != null) { - copy.storeBiomes(getSectionIndex, existingSection.getBiomes()); - } - - if (existingSection == null) { - PalettedContainer> biomeData = PaperweightPlatformAdapter.getBiomePalettedContainer( - biomes[setSectionIndex], - biomeHolderIdMap - ); - LevelChunkSection newSection = PaperweightPlatformAdapter.newChunkSection( - layerNo, - new char[4096], - adapter, - biomeRegistry, - biomeData - ); - if (PaperweightPlatformAdapter.setSectionAtomic( - levelChunkSections, - null, - newSection, - getSectionIndex - )) { - updateGet(nmsChunk, levelChunkSections, newSection, new char[4096], getSectionIndex); - continue; - } else { - existingSection = levelChunkSections[getSectionIndex]; - if (existingSection == null) { - LOGGER.error("Skipping invalid null section. chunk: {}, {} layer: {}", chunkX, chunkZ, - getSectionIndex - ); - continue; - } - } - } else { - setBiomesToPalettedContainer(biomes, setSectionIndex, existingSection.getBiomes()); - } - } - } - continue; - } - - bitMask |= 1 << getSectionIndex; - - char[] setArr = set.load(layerNo); - - // synchronise on internal section to avoid circular locking with a continuing edit if the chunk was - // submitted to keep loaded internal chunks to queue target size. - synchronized (super.sectionLocks[getSectionIndex]) { - - LevelChunkSection newSection; - LevelChunkSection existingSection = levelChunkSections[getSectionIndex]; - // Don't attempt to tick section whilst we're editing - if (existingSection != null) { - PaperweightPlatformAdapter.clearCounts(existingSection); - if (PaperLib.isPaper()) { - existingSection.tickingList.clear(); - } - } - - if (createCopy) { - char[] tmpLoad = loadPrivately(layerNo); - char[] copyArr = new char[4096]; - System.arraycopy(tmpLoad, 0, copyArr, 0, 4096); - copy.storeSection(getSectionIndex, copyArr); - if (biomes != null && existingSection != null) { - copy.storeBiomes(getSectionIndex, existingSection.getBiomes()); - } - } - - if (existingSection == null) { - PalettedContainer> biomeData = biomes == null ? new PalettedContainer<>( - biomeHolderIdMap, - biomeHolderIdMap.byIdOrThrow(WorldEditPlugin - .getInstance() - .getBukkitImplAdapter() - .getInternalBiomeId( - BiomeTypes.PLAINS)), - PalettedContainer.Strategy.SECTION_BIOMES, - null - ) : PaperweightPlatformAdapter.getBiomePalettedContainer(biomes[setSectionIndex], biomeHolderIdMap); - newSection = PaperweightPlatformAdapter.newChunkSection( - layerNo, - setArr, - adapter, - biomeRegistry, - biomeData - ); - if (PaperweightPlatformAdapter.setSectionAtomic( - levelChunkSections, - null, - newSection, - getSectionIndex - )) { - updateGet(nmsChunk, levelChunkSections, newSection, setArr, getSectionIndex); - continue; - } else { - existingSection = levelChunkSections[getSectionIndex]; - if (existingSection == null) { - LOGGER.error("Skipping invalid null section. chunk: {}, {} layer: {}", chunkX, chunkZ, - getSectionIndex - ); - continue; - } - } - } - - //ensure that the server doesn't try to tick the chunksection while we're editing it. (Again) - PaperweightPlatformAdapter.clearCounts(existingSection); - if (PaperLib.isPaper()) { - existingSection.tickingList.clear(); - } - DelegateSemaphore lock = PaperweightPlatformAdapter.applyLock(existingSection); - - // Synchronize to prevent further acquisitions - synchronized (lock) { - lock.acquire(); // Wait until we have the lock - lock.release(); - try { - sectionLock.writeLock().lock(); - if (this.getChunk() != nmsChunk) { - this.levelChunk = nmsChunk; - this.sections = null; - this.reset(); - } else if (existingSection != getSections(false)[getSectionIndex]) { - this.sections[getSectionIndex] = existingSection; - this.reset(); - } else if (!Arrays.equals( - update(getSectionIndex, new char[4096], true), - loadPrivately(layerNo) - )) { - this.reset(layerNo); - /*} else if (lock.isModified()) { - this.reset(layerNo);*/ - } - } finally { - sectionLock.writeLock().unlock(); - } - - PalettedContainer> biomeData = setBiomesToPalettedContainer( - biomes, - setSectionIndex, - existingSection.getBiomes() - ); - - newSection = - PaperweightPlatformAdapter.newChunkSection( - layerNo, - this::loadPrivately, - setArr, - adapter, - biomeRegistry, - biomeData - ); - if (!PaperweightPlatformAdapter.setSectionAtomic( - levelChunkSections, - existingSection, - newSection, - getSectionIndex - )) { - LOGGER.error("Skipping invalid null section. chunk: {}, {} layer: {}", chunkX, chunkZ, - getSectionIndex - ); - } else { - updateGet(nmsChunk, levelChunkSections, newSection, setArr, getSectionIndex); - } - } - } - } - - Map heightMaps = set.getHeightMaps(); - for (Map.Entry entry : heightMaps.entrySet()) { - PaperweightGetBlocks.this.setHeightmapToGet(entry.getKey(), entry.getValue()); - } - PaperweightGetBlocks.this.setLightingToGet( - set.getLight(), - set.getMinSectionPosition(), - set.getMaxSectionPosition() - ); - PaperweightGetBlocks.this.setSkyLightingToGet( - set.getSkyLight(), - set.getMinSectionPosition(), - set.getMaxSectionPosition() - ); - - Runnable[] syncTasks = null; - - int bx = chunkX << 4; - int bz = chunkZ << 4; - - // Call beacon deactivate events here synchronously - // list will be null on spigot, so this is an implicit isPaper check - if (beacons != null && !beacons.isEmpty()) { - final List finalBeacons = beacons; - - syncTasks = new Runnable[4]; - - syncTasks[3] = () -> { - for (BlockEntity beacon : finalBeacons) { - BeaconBlockEntity.playSound(beacon.getLevel(), beacon.getBlockPos(), SoundEvents.BEACON_DEACTIVATE); - new BeaconDeactivatedEvent(CraftBlock.at(beacon.getLevel(), beacon.getBlockPos())).callEvent(); - } - }; - } - - Set entityRemoves = set.getEntityRemoves(); - if (entityRemoves != null && !entityRemoves.isEmpty()) { - if (syncTasks == null) { - syncTasks = new Runnable[3]; - } - - syncTasks[2] = () -> { - Set entitiesRemoved = new HashSet<>(); - final List entities = PaperweightPlatformAdapter.getEntities(nmsChunk); - - for (Entity entity : entities) { - UUID uuid = entity.getUUID(); - if (entityRemoves.contains(uuid)) { - if (createCopy) { - copy.storeEntity(entity); - } - removeEntity(entity); - entitiesRemoved.add(uuid); - entityRemoves.remove(uuid); - } - } - if (Settings.settings().EXPERIMENTAL.REMOVE_ENTITY_FROM_WORLD_ON_CHUNK_FAIL) { - for (UUID uuid : entityRemoves) { - Entity entity = nmsWorld.getEntities().get(uuid); - if (entity != null) { - removeEntity(entity); - } - } - } - // Only save entities that were actually removed to history - set.getEntityRemoves().clear(); - set.getEntityRemoves().addAll(entitiesRemoved); - }; - } - - Set entities = set.getEntities(); - if (entities != null && !entities.isEmpty()) { - if (syncTasks == null) { - syncTasks = new Runnable[2]; - } - - syncTasks[1] = () -> { - Iterator iterator = entities.iterator(); - while (iterator.hasNext()) { - final CompoundTag nativeTag = iterator.next(); - final Map entityTagMap = nativeTag.getValue(); - final StringTag idTag = (StringTag) entityTagMap.get("Id"); - final ListTag posTag = (ListTag) entityTagMap.get("Pos"); - final ListTag rotTag = (ListTag) entityTagMap.get("Rotation"); - if (idTag == null || posTag == null || rotTag == null) { - LOGGER.error("Unknown entity tag: {}", nativeTag); - continue; - } - final double x = posTag.getDouble(0); - final double y = posTag.getDouble(1); - final double z = posTag.getDouble(2); - final float yaw = rotTag.getFloat(0); - final float pitch = rotTag.getFloat(1); - final String id = idTag.getValue(); - - EntityType type = EntityType.byString(id).orElse(null); - if (type != null) { - Entity entity = type.create(nmsWorld); - if (entity != null) { - final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative( - nativeTag); - for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) { - tag.remove(name); - } - entity.load(tag); - entity.absMoveTo(x, y, z, yaw, pitch); - entity.setUUID(nativeTag.getUUID()); - if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) { - LOGGER.warn( - "Error creating entity of type `{}` in world `{}` at location `{},{},{}`", - id, - nmsWorld.getWorld().getName(), - x, - y, - z - ); - // Unsuccessful create should not be saved to history - iterator.remove(); - } - } - } - } - }; - } - - // set tiles - Map tiles = set.getTiles(); - if (tiles != null && !tiles.isEmpty()) { - if (syncTasks == null) { - syncTasks = new Runnable[1]; - } - - syncTasks[0] = () -> { - for (final Map.Entry entry : tiles.entrySet()) { - final CompoundTag nativeTag = entry.getValue(); - final BlockVector3 blockHash = entry.getKey(); - final int x = blockHash.getX() + bx; - final int y = blockHash.getY(); - final int z = blockHash.getZ() + bz; - final BlockPos pos = new BlockPos(x, y, z); - - synchronized (nmsWorld) { - BlockEntity tileEntity = nmsWorld.getBlockEntity(pos); - if (tileEntity == null || tileEntity.isRemoved()) { - nmsWorld.removeBlockEntity(pos); - tileEntity = nmsWorld.getBlockEntity(pos); - } - if (tileEntity != null) { - final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative( - nativeTag); - tag.put("x", IntTag.valueOf(x)); - tag.put("y", IntTag.valueOf(y)); - tag.put("z", IntTag.valueOf(z)); - tileEntity.load(tag); - } - } - } - }; - } - - Runnable callback; - if (bitMask == 0 && biomes == null && !lightUpdate) { - callback = null; - } else { - int finalMask = bitMask != 0 ? bitMask : lightUpdate ? set.getBitMask() : 0; - boolean finalLightUpdate = lightUpdate; - callback = () -> { - // Set Modified - nmsChunk.setLightCorrect(true); // Set Modified - nmsChunk.mustNotSave = false; - nmsChunk.setUnsaved(true); - // send to player - if (Settings.settings().LIGHTING.MODE == 0 || !Settings.settings().LIGHTING.DELAY_PACKET_SENDING) { - this.send(finalMask, finalLightUpdate); - } - if (finalizer != null) { - finalizer.run(); - } - }; - } - if (syncTasks != null) { - QueueHandler queueHandler = Fawe.instance().getQueueHandler(); - Runnable[] finalSyncTasks = syncTasks; - - // Chain the sync tasks and the callback - Callable chain = () -> { - try { - // Run the sync tasks - for (Runnable task : finalSyncTasks) { - if (task != null) { - task.run(); - } - } - if (callback == null) { - if (finalizer != null) { - finalizer.run(); - } - return null; - } else { - return queueHandler.async(callback, null); - } - } catch (Throwable e) { - e.printStackTrace(); - throw e; - } - }; - //noinspection unchecked - required at compile time - return (T) (Future) queueHandler.sync(chain); - } else { - if (callback == null) { - if (finalizer != null) { - finalizer.run(); - } - } else { - callback.run(); - } - } - } - return null; - } catch (Throwable e) { - e.printStackTrace(); - return null; - } finally { - forceLoadSections = true; - } - } - - private void updateGet( - LevelChunk nmsChunk, - LevelChunkSection[] chunkSections, - LevelChunkSection section, - char[] arr, - int layer - ) { - try { - sectionLock.writeLock().lock(); - if (this.getChunk() != nmsChunk) { - this.levelChunk = nmsChunk; - this.sections = new LevelChunkSection[chunkSections.length]; - System.arraycopy(chunkSections, 0, this.sections, 0, chunkSections.length); - this.reset(); - } - if (this.sections == null) { - this.sections = new LevelChunkSection[chunkSections.length]; - System.arraycopy(chunkSections, 0, this.sections, 0, chunkSections.length); - } - if (this.sections[layer] != section) { - // Not sure why it's funky, but it's what I did in commit fda7d00747abe97d7891b80ed8bb88d97e1c70d1 and I don't want to touch it >dords - this.sections[layer] = new LevelChunkSection[]{section}.clone()[0]; - } - } finally { - sectionLock.writeLock().unlock(); - } - this.blocks[layer] = arr; - } - - private char[] loadPrivately(int layer) { - layer -= getMinSectionPosition(); - if (super.sections[layer] != null) { - synchronized (super.sectionLocks[layer]) { - if (super.sections[layer].isFull() && super.blocks[layer] != null) { - char[] blocks = new char[4096]; - System.arraycopy(super.blocks[layer], 0, blocks, 0, 4096); - return blocks; - } - } - } - return PaperweightGetBlocks.this.update(layer, null, true); - } - - @Override - public synchronized void send(int mask, boolean lighting) { - PaperweightPlatformAdapter.sendChunk(serverLevel, chunkX, chunkZ, lighting); - } - - /** - * Update a given (nullable) data array to the current data stored in the server's chunk, associated with this - * {@link PaperweightPlatformAdapter} instance. Not synchronised to the {@link PaperweightPlatformAdapter} instance as synchronisation - * is handled where necessary in the method, and should otherwise be handled correctly by this method's caller. - * - * @param layer layer index (0 may denote a negative layer in the world, e.g. at y=-32) - * @param data array to be updated/filled with data or null - * @param aggressive if the cached section array should be re-acquired. - * @return the given array to be filled with data, or a new array if null is given. - */ - @Override - @SuppressWarnings("unchecked") - public char[] update(int layer, char[] data, boolean aggressive) { - LevelChunkSection section = getSections(aggressive)[layer]; - // Section is null, return empty array - if (section == null) { - data = new char[4096]; - Arrays.fill(data, (char) BlockTypesCache.ReservedIDs.AIR); - return data; - } - if (data != null && data.length != 4096) { - data = new char[4096]; - Arrays.fill(data, (char) BlockTypesCache.ReservedIDs.AIR); - } - if (data == null || data == FaweCache.INSTANCE.EMPTY_CHAR_4096) { - data = new char[4096]; - Arrays.fill(data, (char) BlockTypesCache.ReservedIDs.AIR); - } - Semaphore lock = PaperweightPlatformAdapter.applyLock(section); - synchronized (lock) { - // Efficiently convert ChunkSection to raw data - try { - lock.acquire(); - - final PalettedContainer blocks = section.getStates(); - final Object dataObject = PaperweightPlatformAdapter.fieldData.get(blocks); - final BitStorage bits = (BitStorage) PaperweightPlatformAdapter.fieldStorage.get(dataObject); - - if (bits instanceof ZeroBitStorage) { - Arrays.fill(data, adapter.adaptToChar(blocks.get(0, 0, 0))); // get(int) is only public on paper - return data; - } - - final Palette palette = (Palette) PaperweightPlatformAdapter.fieldPalette.get(dataObject); - - final int bitsPerEntry = bits.getBits(); - final long[] blockStates = bits.getRaw(); - - new BitArrayUnstretched(bitsPerEntry, 4096, blockStates).toRaw(data); - - int num_palette; - if (palette instanceof LinearPalette || palette instanceof HashMapPalette) { - num_palette = palette.getSize(); - } else { - // The section's palette is the global block palette. - for (int i = 0; i < 4096; i++) { - char paletteVal = data[i]; - char ordinal = adapter.ibdIDToOrdinal(paletteVal); - data[i] = ordinal; - } - return data; - } - - char[] paletteToOrdinal = FaweCache.INSTANCE.PALETTE_TO_BLOCK_CHAR.get(); - try { - if (num_palette != 1) { - for (int i = 0; i < num_palette; i++) { - char ordinal = ordinal(palette.valueFor(i), adapter); - paletteToOrdinal[i] = ordinal; - } - for (int i = 0; i < 4096; i++) { - char paletteVal = data[i]; - char val = paletteToOrdinal[paletteVal]; - if (val == Character.MAX_VALUE) { - val = ordinal(palette.valueFor(i), adapter); - paletteToOrdinal[i] = val; - } - data[i] = val; - } - } else { - char ordinal = ordinal(palette.valueFor(0), adapter); - Arrays.fill(data, ordinal); - } - } finally { - for (int i = 0; i < num_palette; i++) { - paletteToOrdinal[i] = Character.MAX_VALUE; - } - } - return data; - } catch (IllegalAccessException | InterruptedException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } finally { - lock.release(); - } - } - } - - private char ordinal(BlockState ibd, PaperweightFaweAdapter adapter) { - if (ibd == null) { - return BlockTypesCache.ReservedIDs.AIR; - } else { - return adapter.adaptToChar(ibd); - } - } - - public LevelChunkSection[] getSections(boolean force) { - force &= forceLoadSections; - sectionLock.readLock().lock(); - LevelChunkSection[] tmp = sections; - sectionLock.readLock().unlock(); - if (tmp == null || force) { - try { - sectionLock.writeLock().lock(); - tmp = sections; - if (tmp == null || force) { - LevelChunkSection[] chunkSections = getChunk().getSections(); - tmp = new LevelChunkSection[chunkSections.length]; - System.arraycopy(chunkSections, 0, tmp, 0, chunkSections.length); - sections = tmp; - } - } finally { - sectionLock.writeLock().unlock(); - } - } - return tmp; - } - - public LevelChunk getChunk() { - LevelChunk levelChunk = this.levelChunk; - if (levelChunk == null) { - synchronized (this) { - levelChunk = this.levelChunk; - if (levelChunk == null) { - this.levelChunk = levelChunk = ensureLoaded(this.serverLevel, chunkX, chunkZ); - } - } - } - return levelChunk; - } - - private void fillLightNibble(char[][] light, LightLayer lightLayer, int minSectionPosition, int maxSectionPosition) { - for (int Y = 0; Y <= maxSectionPosition - minSectionPosition; Y++) { - if (light[Y] == null) { - continue; - } - SectionPos sectionPos = SectionPos.of(levelChunk.getPos(), Y + minSectionPosition); - DataLayer dataLayer = serverLevel.getChunkSource().getLightEngine().getLayerListener(lightLayer).getDataLayerData( - sectionPos); - if (dataLayer == null) { - byte[] LAYER_COUNT = new byte[2048]; - Arrays.fill(LAYER_COUNT, lightLayer == LightLayer.SKY ? (byte) 15 : (byte) 0); - dataLayer = new DataLayer(LAYER_COUNT); - ((LevelLightEngine) serverLevel.getChunkSource().getLightEngine()).queueSectionData( - lightLayer, - sectionPos, - dataLayer, - true - ); - } - synchronized (dataLayer) { - for (int x = 0; x < 16; x++) { - for (int y = 0; y < 16; y++) { - for (int z = 0; z < 16; z++) { - int i = y << 8 | z << 4 | x; - if (light[Y][i] < 16) { - dataLayer.set(x, y, z, light[Y][i]); - } - } - } - } - } - } - } - - private PalettedContainer> setBiomesToPalettedContainer( - final BiomeType[][] biomes, - final int sectionIndex, - final PalettedContainerRO> data - ) { - PalettedContainer> biomeData; - if (data instanceof PalettedContainer> palettedContainer) { - biomeData = palettedContainer; - } else { - LOGGER.warn( - "Cannot correctly set biomes to world, existing biomes may be lost. Expected class " + - "type {} but got {}", - PalettedContainer.class.getSimpleName(), - data.getClass().getSimpleName() - ); - biomeData = data.recreate(); - } - BiomeType[] sectionBiomes; - if (biomes == null || (sectionBiomes = biomes[sectionIndex]) == null) { - return biomeData; - } - for (int y = 0, index = 0; y < 4; y++) { - for (int z = 0; z < 4; z++) { - for (int x = 0; x < 4; x++, index++) { - BiomeType biomeType = sectionBiomes[index]; - if (biomeType == null) { - continue; - } - biomeData.set( - x, - y, - z, - biomeHolderIdMap.byIdOrThrow(WorldEditPlugin - .getInstance() - .getBukkitImplAdapter() - .getInternalBiomeId(biomeType)) - ); - } - } - } - return biomeData; - } - - @Override - public boolean hasSection(int layer) { - layer -= getMinSectionPosition(); - return getSections(false)[layer] != null; - } - - @Override - @SuppressWarnings("unchecked") - public synchronized boolean trim(boolean aggressive) { - skyLight = new DataLayer[getSectionCount()]; - blockLight = new DataLayer[getSectionCount()]; - if (aggressive) { - sectionLock.writeLock().lock(); - sections = null; - levelChunk = null; - sectionLock.writeLock().unlock(); - return super.trim(true); - } else if (sections == null) { - // don't bother trimming if there are no sections stored. - return true; - } else { - for (int i = getMinSectionPosition(); i <= getMaxSectionPosition(); i++) { - int layer = i - getMinSectionPosition(); - if (!hasSection(i) || !super.sections[layer].isFull()) { - continue; - } - LevelChunkSection existing = getSections(true)[layer]; - try { - final PalettedContainer blocksExisting = existing.getStates(); - - final Object dataObject = PaperweightPlatformAdapter.fieldData.get(blocksExisting); - final Palette palette = (Palette) PaperweightPlatformAdapter.fieldPalette.get( - dataObject); - int paletteSize; - - if (palette instanceof LinearPalette || palette instanceof HashMapPalette) { - paletteSize = palette.getSize(); - } else { - super.trim(false, i); - continue; - } - if (paletteSize == 1) { - //If the cached palette size is 1 then no blocks can have been changed i.e. do not need to update these chunks. - continue; - } - super.trim(false, i); - } catch (IllegalAccessException ignored) { - super.trim(false, i); - } - } - return true; - } - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks_Copy.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks_Copy.java deleted file mode 100644 index c0b69ac80..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightGetBlocks_Copy.java +++ /dev/null @@ -1,248 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1; - -import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; -import com.fastasyncworldedit.core.queue.IBlocks; -import com.fastasyncworldedit.core.queue.IChunkGet; -import com.fastasyncworldedit.core.queue.IChunkSet; -import com.google.common.base.Suppliers; -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; -import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; -import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1.nbt.PaperweightLazyCompoundTag; -import com.sk89q.worldedit.internal.util.LogManagerCompat; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.biome.BiomeType; -import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockTypesCache; -import net.minecraft.core.Holder; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.chunk.LevelChunk; -import net.minecraft.world.level.chunk.PalettedContainer; -import net.minecraft.world.level.chunk.PalettedContainerRO; -import org.apache.logging.log4j.Logger; - -import javax.annotation.Nullable; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.Future; - -public class PaperweightGetBlocks_Copy implements IChunkGet { - - private static final Logger LOGGER = LogManagerCompat.getLogger(); - - private final Map tiles = new HashMap<>(); - private final Set entities = new HashSet<>(); - private final char[][] blocks; - private final int minHeight; - private final int maxHeight; - final ServerLevel serverLevel; - final LevelChunk levelChunk; - private PalettedContainer>[] biomes = null; - - protected PaperweightGetBlocks_Copy(LevelChunk levelChunk) { - this.levelChunk = levelChunk; - this.serverLevel = levelChunk.level; - this.minHeight = serverLevel.getMinBuildHeight(); - this.maxHeight = serverLevel.getMaxBuildHeight() - 1; // Minecraft max limit is exclusive. - this.blocks = new char[getSectionCount()][]; - } - - protected void storeTile(BlockEntity blockEntity) { - tiles.put( - BlockVector3.at( - blockEntity.getBlockPos().getX(), - blockEntity.getBlockPos().getY(), - blockEntity.getBlockPos().getZ() - ), - new PaperweightLazyCompoundTag(Suppliers.memoize(blockEntity::saveWithId)) - ); - } - - @Override - public Map getTiles() { - return tiles; - } - - @Override - @Nullable - public CompoundTag getTile(int x, int y, int z) { - return tiles.get(BlockVector3.at(x, y, z)); - } - - @SuppressWarnings({"unchecked", "rawtypes"}) - protected void storeEntity(Entity entity) { - BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); - net.minecraft.nbt.CompoundTag compoundTag = new net.minecraft.nbt.CompoundTag(); - entity.save(compoundTag); - entities.add((CompoundTag) adapter.toNative(compoundTag)); - } - - @Override - public Set getEntities() { - return this.entities; - } - - @Override - public CompoundTag getEntity(UUID uuid) { - for (CompoundTag tag : entities) { - if (uuid.equals(tag.getUUID())) { - return tag; - } - } - return null; - } - - @Override - public boolean isCreateCopy() { - return false; - } - - @Override - public void setCreateCopy(boolean createCopy) { - } - - @Override - public void setLightingToGet(char[][] lighting, int minSectionPosition, int maxSectionPosition) { - } - - @Override - public void setSkyLightingToGet(char[][] lighting, int minSectionPosition, int maxSectionPosition) { - } - - @Override - public void setHeightmapToGet(HeightMapType type, int[] data) { - } - - @Override - public int getMaxY() { - return maxHeight; - } - - @Override - public int getMinY() { - return minHeight; - } - - @Override - public int getMaxSectionPosition() { - return maxHeight >> 4; - } - - @Override - public int getMinSectionPosition() { - return minHeight >> 4; - } - - @Override - public BiomeType getBiomeType(int x, int y, int z) { - Holder biome = biomes[(y >> 4) - getMinSectionPosition()].get(x >> 2, (y & 15) >> 2, z >> 2); - return PaperweightPlatformAdapter.adapt(biome, serverLevel); - } - - @Override - public void removeSectionLighting(int layer, boolean sky) { - } - - @Override - public boolean trim(boolean aggressive, int layer) { - return false; - } - - @Override - public IBlocks reset() { - return null; - } - - @Override - public int getSectionCount() { - return serverLevel.getSectionsCount(); - } - - protected void storeSection(int layer, char[] data) { - blocks[layer] = data; - } - - protected void storeBiomes(int layer, PalettedContainerRO> biomeData) { - if (biomes == null) { - biomes = new PalettedContainer[getSectionCount()]; - } - if (biomeData instanceof PalettedContainer> palettedContainer) { - biomes[layer] = palettedContainer.copy(); - } else { - LOGGER.error( - "Cannot correctly save biomes to history. Expected class type {} but got {}", - PalettedContainer.class.getSimpleName(), - biomeData.getClass().getSimpleName() - ); - } - } - - @Override - public BaseBlock getFullBlock(int x, int y, int z) { - BlockState state = BlockTypesCache.states[get(x, y, z)]; - return state.toBaseBlock(this, x, y, z); - } - - @Override - public boolean hasSection(int layer) { - layer -= getMinSectionPosition(); - return blocks[layer] != null; - } - - @Override - public char[] load(int layer) { - layer -= getMinSectionPosition(); - return blocks[layer]; - } - - @Override - public char[] loadIfPresent(int layer) { - layer -= getMinSectionPosition(); - return blocks[layer]; - } - - @Override - public BlockState getBlock(int x, int y, int z) { - return BlockTypesCache.states[get(x, y, z)]; - } - - @Override - public int getSkyLight(int x, int y, int z) { - return 0; - } - - @Override - public int getEmittedLight(int x, int y, int z) { - return 0; - } - - @Override - public int[] getHeightMap(HeightMapType type) { - return new int[0]; - } - - @Override - public > T call(IChunkSet set, Runnable finalize) { - return null; - } - - public char get(int x, int y, int z) { - final int layer = (y >> 4) - getMinSectionPosition(); - final int index = (y & 15) << 8 | z << 4 | x; - return blocks[layer][index]; - } - - - @Override - public boolean trim(boolean aggressive) { - return false; - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightMapChunkUtil.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightMapChunkUtil.java deleted file mode 100644 index ead60b212..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightMapChunkUtil.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1; - -import com.fastasyncworldedit.bukkit.adapter.MapChunkUtil; -import com.sk89q.worldedit.bukkit.adapter.Refraction; -import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; - -import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; - -//TODO un-very-break-this -public class PaperweightMapChunkUtil extends MapChunkUtil { - - public PaperweightMapChunkUtil() throws NoSuchFieldException { - fieldX = ClientboundLevelChunkPacketData.class.getDeclaredField(Refraction.pickName("TWO_MEGABYTES", "a")); - fieldZ = ClientboundLevelChunkWithLightPacket.class.getDeclaredField(Refraction.pickName("x", "a")); - fieldBitMask = ClientboundLevelChunkWithLightPacket.class.getDeclaredField(Refraction.pickName("z", "b")); - fieldHeightMap = ClientboundLevelChunkPacketData.class.getDeclaredField(Refraction.pickName("heightmaps", "b")); - fieldChunkData = ClientboundLevelChunkWithLightPacket.class.getDeclaredField(Refraction.pickName("chunkData", "c")); - fieldBlockEntities = ClientboundLevelChunkPacketData.class.getDeclaredField(Refraction.pickName("buffer", "c")); - fieldFull = ClientboundLevelChunkPacketData.class.getDeclaredField(Refraction.pickName("blockEntitiesData", "d")); - fieldX.setAccessible(true); - fieldZ.setAccessible(true); - fieldBitMask.setAccessible(true); - fieldHeightMap.setAccessible(true); - fieldChunkData.setAccessible(true); - fieldBlockEntities.setAccessible(true); - fieldFull.setAccessible(true); - } - - @Override - public ClientboundLevelChunkWithLightPacket createPacket() { - // TODO ??? return new ClientboundLevelChunkPacket(); - throw new UnsupportedOperationException(); - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightPlatformAdapter.java deleted file mode 100644 index ae3d91027..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightPlatformAdapter.java +++ /dev/null @@ -1,703 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1; - -import com.destroystokyo.paper.util.maplist.EntityList; -import com.fastasyncworldedit.bukkit.adapter.CachedBukkitAdapter; -import com.fastasyncworldedit.bukkit.adapter.DelegateSemaphore; -import com.fastasyncworldedit.bukkit.adapter.NMSAdapter; -import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.math.BitArrayUnstretched; -import com.fastasyncworldedit.core.util.MathMan; -import com.fastasyncworldedit.core.util.ReflectionUtils; -import com.fastasyncworldedit.core.util.TaskManager; -import com.mojang.datafixers.util.Either; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; -import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; -import com.sk89q.worldedit.bukkit.adapter.Refraction; -import com.sk89q.worldedit.world.biome.BiomeType; -import com.sk89q.worldedit.world.biome.BiomeTypes; -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockTypesCache; -import io.papermc.lib.PaperLib; -import io.papermc.paper.world.ChunkEntitySlices; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Holder; -import net.minecraft.core.IdMap; -import net.minecraft.core.Registry; -import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; -import net.minecraft.server.level.ChunkHolder; -import net.minecraft.server.level.ChunkMap; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.server.level.TicketType; -import net.minecraft.util.BitStorage; -import net.minecraft.util.ExceptionCollector; -import net.minecraft.util.SimpleBitStorage; -import net.minecraft.util.ThreadingDetector; -import net.minecraft.util.Unit; -import net.minecraft.util.ZeroBitStorage; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.EntityBlock; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.chunk.GlobalPalette; -import net.minecraft.world.level.chunk.HashMapPalette; -import net.minecraft.world.level.chunk.LevelChunk; -import net.minecraft.world.level.chunk.LevelChunkSection; -import net.minecraft.world.level.chunk.LinearPalette; -import net.minecraft.world.level.chunk.Palette; -import net.minecraft.world.level.chunk.PalettedContainer; -import net.minecraft.world.level.chunk.SingleValuePalette; -import net.minecraft.world.level.entity.PersistentEntitySectionManager; -import net.minecraft.world.level.gameevent.GameEventDispatcher; -import net.minecraft.world.level.gameevent.GameEventListener; -import org.bukkit.craftbukkit.v1_19_R1.CraftChunk; -import sun.misc.Unsafe; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Parameter; -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Semaphore; -import java.util.function.Function; - -public final class PaperweightPlatformAdapter extends NMSAdapter { - - public static final Field fieldData; - - public static final Constructor dataConstructor; - - public static final Field fieldStorage; - public static final Field fieldPalette; - - private static final Field fieldTickingFluidCount; - private static final Field fieldTickingBlockCount; - private static final Field fieldNonEmptyBlockCount; - - private static final MethodHandle methodGetVisibleChunk; - - private static final int CHUNKSECTION_BASE; - private static final int CHUNKSECTION_SHIFT; - - private static final Field fieldThreadingDetector; - private static final long fieldThreadingDetectorOffset; - - private static final Field fieldLock; - private static final long fieldLockOffset; - - private static final MethodHandle methodRemoveGameEventListener; - private static final MethodHandle methodremoveTickingBlockEntity; - - private static final Field fieldRemove; - - static final boolean POST_CHUNK_REWRITE; - private static Method PAPER_CHUNK_GEN_ALL_ENTITIES; - private static Field LEVEL_CHUNK_ENTITIES; - private static Field SERVER_LEVEL_ENTITY_MANAGER; - - static { - try { - fieldData = PalettedContainer.class.getDeclaredField(Refraction.pickName("data", "d")); - fieldData.setAccessible(true); - - Class dataClazz = fieldData.getType(); - dataConstructor = dataClazz.getDeclaredConstructors()[0]; - dataConstructor.setAccessible(true); - - fieldStorage = dataClazz.getDeclaredField(Refraction.pickName("storage", "b")); - fieldStorage.setAccessible(true); - fieldPalette = dataClazz.getDeclaredField(Refraction.pickName("palette", "c")); - fieldPalette.setAccessible(true); - - fieldTickingFluidCount = LevelChunkSection.class.getDeclaredField(Refraction.pickName("tickingFluidCount", "h")); - fieldTickingFluidCount.setAccessible(true); - fieldTickingBlockCount = LevelChunkSection.class.getDeclaredField(Refraction.pickName("tickingBlockCount", "g")); - fieldTickingBlockCount.setAccessible(true); - fieldNonEmptyBlockCount = LevelChunkSection.class.getDeclaredField(Refraction.pickName("nonEmptyBlockCount", "f")); - fieldNonEmptyBlockCount.setAccessible(true); - - Method getVisibleChunkIfPresent = ChunkMap.class.getDeclaredMethod(Refraction.pickName( - "getVisibleChunkIfPresent", - "b" - ), long.class); - getVisibleChunkIfPresent.setAccessible(true); - methodGetVisibleChunk = MethodHandles.lookup().unreflect(getVisibleChunkIfPresent); - - Unsafe unsafe = ReflectionUtils.getUnsafe(); - if (!PaperLib.isPaper()) { - fieldThreadingDetector = PalettedContainer.class.getDeclaredField(Refraction.pickName("threadingDetector", "f")); - fieldThreadingDetectorOffset = unsafe.objectFieldOffset(fieldThreadingDetector); - - fieldLock = ThreadingDetector.class.getDeclaredField(Refraction.pickName("lock", "c")); - fieldLockOffset = unsafe.objectFieldOffset(fieldLock); - } else { - // in paper, the used methods are synchronized properly - fieldThreadingDetector = null; - fieldThreadingDetectorOffset = -1; - - fieldLock = null; - fieldLockOffset = -1; - } - - Method removeGameEventListener = LevelChunk.class.getDeclaredMethod( - Refraction.pickName("removeGameEventListener", "a"), - BlockEntity.class, - ServerLevel.class - ); - removeGameEventListener.setAccessible(true); - methodRemoveGameEventListener = MethodHandles.lookup().unreflect(removeGameEventListener); - - Method removeBlockEntityTicker = LevelChunk.class.getDeclaredMethod( - Refraction.pickName( - "removeBlockEntityTicker", - "l" - ), BlockPos.class - ); - removeBlockEntityTicker.setAccessible(true); - methodremoveTickingBlockEntity = MethodHandles.lookup().unreflect(removeBlockEntityTicker); - - fieldRemove = BlockEntity.class.getDeclaredField(Refraction.pickName("remove", "p")); - fieldRemove.setAccessible(true); - - CHUNKSECTION_BASE = unsafe.arrayBaseOffset(LevelChunkSection[].class); - int scale = unsafe.arrayIndexScale(LevelChunkSection[].class); - if ((scale & (scale - 1)) != 0) { - throw new Error("data type scale not a power of two"); - } - CHUNKSECTION_SHIFT = 31 - Integer.numberOfLeadingZeros(scale); - boolean chunkRewrite; - try { - ServerLevel.class.getDeclaredMethod("getEntityLookup"); - chunkRewrite = true; - PAPER_CHUNK_GEN_ALL_ENTITIES = ChunkEntitySlices.class.getDeclaredMethod("getAllEntities"); - PAPER_CHUNK_GEN_ALL_ENTITIES.setAccessible(true); - } catch (NoSuchMethodException ignored) { - chunkRewrite = false; - } - try { - // Paper - Pre-Chunk-Update - LEVEL_CHUNK_ENTITIES = LevelChunk.class.getDeclaredField("entities"); - LEVEL_CHUNK_ENTITIES.setAccessible(true); - } catch (NoSuchFieldException ignored) { - } - try { - // Non-Paper - SERVER_LEVEL_ENTITY_MANAGER = ServerLevel.class.getDeclaredField(Refraction.pickName("entityManager", "P")); - SERVER_LEVEL_ENTITY_MANAGER.setAccessible(true); - } catch (NoSuchFieldException ignored) { - } - POST_CHUNK_REWRITE = chunkRewrite; - } catch (RuntimeException e) { - throw e; - } catch (Throwable rethrow) { - rethrow.printStackTrace(); - throw new RuntimeException(rethrow); - } - } - - static boolean setSectionAtomic( - LevelChunkSection[] sections, - LevelChunkSection expected, - LevelChunkSection value, - int layer - ) { - long offset = ((long) layer << CHUNKSECTION_SHIFT) + CHUNKSECTION_BASE; - if (layer >= 0 && layer < sections.length) { - return ReflectionUtils.getUnsafe().compareAndSwapObject(sections, offset, expected, value); - } - return false; - } - - // There is no point in having a functional semaphore for paper servers. - private static final ThreadLocal SEMAPHORE_THREAD_LOCAL = - ThreadLocal.withInitial(() -> new DelegateSemaphore(1, null)); - - static DelegateSemaphore applyLock(LevelChunkSection section) { - if (PaperLib.isPaper()) { - return SEMAPHORE_THREAD_LOCAL.get(); - } - try { - synchronized (section) { - Unsafe unsafe = ReflectionUtils.getUnsafe(); - PalettedContainer blocks = section.getStates(); - ThreadingDetector currentThreadingDetector = (ThreadingDetector) unsafe.getObject( - blocks, - fieldThreadingDetectorOffset - ); - synchronized (currentThreadingDetector) { - Semaphore currentLock = (Semaphore) unsafe.getObject(currentThreadingDetector, fieldLockOffset); - if (currentLock instanceof DelegateSemaphore delegateSemaphore) { - return delegateSemaphore; - } - DelegateSemaphore newLock = new DelegateSemaphore(1, currentLock); - unsafe.putObject(currentThreadingDetector, fieldLockOffset, newLock); - return newLock; - } - } - } catch (Throwable e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } - - public static LevelChunk ensureLoaded(ServerLevel serverLevel, int chunkX, int chunkZ) { - if (!PaperLib.isPaper()) { - LevelChunk nmsChunk = serverLevel.getChunkSource().getChunk(chunkX, chunkZ, false); - if (nmsChunk != null) { - return nmsChunk; - } - if (Fawe.isMainThread()) { - return serverLevel.getChunk(chunkX, chunkZ); - } - } else { - LevelChunk nmsChunk = serverLevel.getChunkSource().getChunkAtIfCachedImmediately(chunkX, chunkZ); - if (nmsChunk != null) { - addTicket(serverLevel, chunkX, chunkZ); - return nmsChunk; - } - nmsChunk = serverLevel.getChunkSource().getChunkAtIfLoadedImmediately(chunkX, chunkZ); - if (nmsChunk != null) { - addTicket(serverLevel, chunkX, chunkZ); - return nmsChunk; - } - // Avoid "async" methods from the main thread. - if (Fawe.isMainThread()) { - return serverLevel.getChunk(chunkX, chunkZ); - } - CompletableFuture future = serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true); - try { - CraftChunk chunk = (CraftChunk) future.get(); - return chunk.getHandle(); - } catch (Throwable e) { - e.printStackTrace(); - } - } - return TaskManager.taskManager().sync(() -> serverLevel.getChunk(chunkX, chunkZ)); - } - - private static void addTicket(ServerLevel serverLevel, int chunkX, int chunkZ) { - // Ensure chunk is definitely loaded before applying a ticket - io.papermc.paper.util.MCUtil.MAIN_EXECUTOR.execute(() -> serverLevel - .getChunkSource() - .addRegionTicket(TicketType.PLUGIN, new ChunkPos(chunkX, chunkZ), 0, Unit.INSTANCE)); - } - - public static ChunkHolder getPlayerChunk(ServerLevel nmsWorld, final int chunkX, final int chunkZ) { - ChunkMap chunkMap = nmsWorld.getChunkSource().chunkMap; - try { - return (ChunkHolder) methodGetVisibleChunk.invoke(chunkMap, ChunkPos.asLong(chunkX, chunkZ)); - } catch (Throwable thr) { - throw new RuntimeException(thr); - } - } - - @SuppressWarnings("deprecation") - public static void sendChunk(ServerLevel nmsWorld, int chunkX, int chunkZ, boolean lighting) { - ChunkHolder chunkHolder = getPlayerChunk(nmsWorld, chunkX, chunkZ); - if (chunkHolder == null) { - return; - } - ChunkPos coordIntPair = new ChunkPos(chunkX, chunkZ); - LevelChunk levelChunk; - if (PaperLib.isPaper()) { - // getChunkAtIfLoadedImmediately is paper only - levelChunk = nmsWorld - .getChunkSource() - .getChunkAtIfLoadedImmediately(chunkX, chunkZ); - } else { - levelChunk = ((Optional) ((Either) chunkHolder - .getTickingChunkFuture() // method is not present with new paper chunk system - .getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left()) - .orElse(null); - } - if (levelChunk == null) { - return; - } - TaskManager.taskManager().task(() -> { - ClientboundLevelChunkWithLightPacket packet; - if (PaperLib.isPaper()) { - packet = new ClientboundLevelChunkWithLightPacket( - levelChunk, - nmsWorld.getChunkSource().getLightEngine(), - null, - null, - true, - false // last false is to not bother with x-ray - ); - } else { - // deprecated on paper - deprecation suppressed - packet = new ClientboundLevelChunkWithLightPacket( - levelChunk, - nmsWorld.getChunkSource().getLightEngine(), - null, - null, - true - ); - } - nearbyPlayers(nmsWorld, coordIntPair).forEach(p -> p.connection.send(packet)); - }); - } - - private static List nearbyPlayers(ServerLevel serverLevel, ChunkPos coordIntPair) { - return serverLevel.getChunkSource().chunkMap.getPlayers(coordIntPair, false); - } - - /* - NMS conversion - */ - public static LevelChunkSection newChunkSection( - final int layer, - final char[] blocks, - CachedBukkitAdapter adapter, - Registry biomeRegistry, - @Nullable PalettedContainer> biomes - ) { - return newChunkSection(layer, null, blocks, adapter, biomeRegistry, biomes); - } - - public static LevelChunkSection newChunkSection( - final int layer, - final Function get, - char[] set, - CachedBukkitAdapter adapter, - Registry biomeRegistry, - @Nullable PalettedContainer> biomes - ) { - if (set == null) { - return newChunkSection(layer, biomeRegistry, biomes); - } - final int[] blockToPalette = FaweCache.INSTANCE.BLOCK_TO_PALETTE.get(); - final int[] paletteToBlock = FaweCache.INSTANCE.PALETTE_TO_BLOCK.get(); - final long[] blockStates = FaweCache.INSTANCE.BLOCK_STATES.get(); - final int[] blocksCopy = FaweCache.INSTANCE.SECTION_BLOCKS.get(); - try { - int num_palette; - if (get == null) { - num_palette = createPalette(blockToPalette, paletteToBlock, blocksCopy, set, adapter, null); - } else { - num_palette = createPalette(layer, blockToPalette, paletteToBlock, blocksCopy, get, set, adapter, null); - } - - int bitsPerEntry = MathMan.log2nlz(num_palette - 1); - if (bitsPerEntry > 0 && bitsPerEntry < 5) { - bitsPerEntry = 4; - } else if (bitsPerEntry > 8) { - bitsPerEntry = MathMan.log2nlz(Block.BLOCK_STATE_REGISTRY.size() - 1); - } - - int bitsPerEntryNonZero = Math.max(bitsPerEntry, 1); // We do want to use zero sometimes - final int blocksPerLong = MathMan.floorZero((double) 64 / bitsPerEntryNonZero); - final int blockBitArrayEnd = MathMan.ceilZero((float) 4096 / blocksPerLong); - - if (num_palette == 1) { - for (int i = 0; i < blockBitArrayEnd; i++) { - blockStates[i] = 0; - } - } else { - final BitArrayUnstretched bitArray = new BitArrayUnstretched(bitsPerEntryNonZero, 4096, blockStates); - bitArray.fromRaw(blocksCopy); - } - - final long[] bits = Arrays.copyOfRange(blockStates, 0, blockBitArrayEnd); - final BitStorage nmsBits; - if (bitsPerEntry == 0) { - nmsBits = new ZeroBitStorage(4096); - } else { - nmsBits = new SimpleBitStorage(bitsPerEntry, 4096, bits); - } - List palette; - if (bitsPerEntry < 9) { - palette = new ArrayList<>(); - for (int i = 0; i < num_palette; i++) { - int ordinal = paletteToBlock[i]; - blockToPalette[ordinal] = Integer.MAX_VALUE; - final BlockState state = BlockTypesCache.states[ordinal]; - palette.add(((PaperweightBlockMaterial) state.getMaterial()).getState()); - } - } else { - palette = List.of(); - } - - // Create palette with data - @SuppressWarnings("deprecation") // constructor is deprecated on paper, but needed to keep compatibility with spigot - final PalettedContainer blockStatePalettedContainer = - new PalettedContainer<>( - Block.BLOCK_STATE_REGISTRY, - PalettedContainer.Strategy.SECTION_STATES, - PalettedContainer.Strategy.SECTION_STATES.getConfiguration(Block.BLOCK_STATE_REGISTRY, bitsPerEntry), - nmsBits, - palette - ); - if (biomes == null) { - IdMap> biomeHolderIdMap = biomeRegistry.asHolderIdMap(); - biomes = new PalettedContainer<>( - biomeHolderIdMap, - biomeHolderIdMap.byIdOrThrow(WorldEditPlugin - .getInstance() - .getBukkitImplAdapter() - .getInternalBiomeId( - BiomeTypes.PLAINS)), - PalettedContainer.Strategy.SECTION_BIOMES, - null - ); - } - - return new LevelChunkSection(layer, blockStatePalettedContainer, biomes); - } catch (final Throwable e) { - throw e; - } finally { - Arrays.fill(blockToPalette, Integer.MAX_VALUE); - Arrays.fill(paletteToBlock, Integer.MAX_VALUE); - Arrays.fill(blockStates, 0); - Arrays.fill(blocksCopy, 0); - } - } - - @SuppressWarnings("deprecation") // Only deprecated in paper - private static LevelChunkSection newChunkSection( - int layer, - Registry biomeRegistry, - @Nullable PalettedContainer> biomes - ) { - if (biomes == null) { - return new LevelChunkSection(layer, biomeRegistry); - } - PalettedContainer dataPaletteBlocks = new PalettedContainer<>( - Block.BLOCK_STATE_REGISTRY, - Blocks.AIR.defaultBlockState(), - PalettedContainer.Strategy.SECTION_STATES, - null - ); - return new LevelChunkSection(layer, dataPaletteBlocks, biomes); - } - - /** - * Create a new {@link PalettedContainer}. Should only be used if no biome container existed beforehand. - */ - public static PalettedContainer> getBiomePalettedContainer( - BiomeType[] biomes, - IdMap> biomeRegistry - ) { - if (biomes == null) { - return null; - } - BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); - // Don't stream this as typically will see 1-4 biomes; stream overhead is large for the small length - Map> palette = new HashMap<>(); - for (BiomeType biomeType : new LinkedList<>(Arrays.asList(biomes))) { - Holder biome; - if (biomeType == null) { - biome = biomeRegistry.byId(adapter.getInternalBiomeId(BiomeTypes.PLAINS)); - } else { - biome = biomeRegistry.byId(adapter.getInternalBiomeId(biomeType)); - } - palette.put(biomeType, biome); - } - int biomeCount = palette.size(); - int bitsPerEntry = MathMan.log2nlz(biomeCount - 1); - Object configuration = PalettedContainer.Strategy.SECTION_STATES.getConfiguration( - new FakeIdMapBiome(biomeCount), - bitsPerEntry - ); - if (bitsPerEntry > 3) { - bitsPerEntry = MathMan.log2nlz(biomeRegistry.size() - 1); - } - PalettedContainer> biomePalettedContainer = new PalettedContainer<>( - biomeRegistry, - biomeRegistry.byIdOrThrow(adapter.getInternalBiomeId(BiomeTypes.PLAINS)), - PalettedContainer.Strategy.SECTION_BIOMES, - null - ); - - final Palette> biomePalette; - if (bitsPerEntry == 0) { - biomePalette = new SingleValuePalette<>( - biomePalettedContainer.registry, - biomePalettedContainer, - new ArrayList<>(palette.values()) // Must be modifiable - ); - } else if (bitsPerEntry == 4) { - biomePalette = LinearPalette.create( - 4, - biomePalettedContainer.registry, - biomePalettedContainer, - new ArrayList<>(palette.values()) // Must be modifiable - ); - } else if (bitsPerEntry < 9) { - biomePalette = HashMapPalette.create( - bitsPerEntry, - biomePalettedContainer.registry, - biomePalettedContainer, - new ArrayList<>(palette.values()) // Must be modifiable - ); - } else { - biomePalette = GlobalPalette.create( - bitsPerEntry, - biomePalettedContainer.registry, - biomePalettedContainer, - null // unused - ); - } - - int bitsPerEntryNonZero = Math.max(bitsPerEntry, 1); // We do want to use zero sometimes - final int blocksPerLong = MathMan.floorZero((double) 64 / bitsPerEntryNonZero); - final int arrayLength = MathMan.ceilZero(64f / blocksPerLong); - - - BitStorage bitStorage = bitsPerEntry == 0 ? new ZeroBitStorage(64) : new SimpleBitStorage( - bitsPerEntry, - 64, - new long[arrayLength] - ); - - try { - Object data = dataConstructor.newInstance(configuration, bitStorage, biomePalette); - fieldData.set(biomePalettedContainer, data); - int index = 0; - for (int y = 0; y < 4; y++) { - for (int z = 0; z < 4; z++) { - for (int x = 0; x < 4; x++, index++) { - BiomeType biomeType = biomes[index]; - if (biomeType == null) { - continue; - } - Holder biome = biomeRegistry.byId(WorldEditPlugin - .getInstance() - .getBukkitImplAdapter() - .getInternalBiomeId(biomeType)); - if (biome == null) { - continue; - } - biomePalettedContainer.set(x, y, z, biome); - } - } - } - } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); - } - return biomePalettedContainer; - } - - public static void clearCounts(final LevelChunkSection section) throws IllegalAccessException { - fieldTickingFluidCount.setShort(section, (short) 0); - fieldTickingBlockCount.setShort(section, (short) 0); - } - - public static BiomeType adapt(Holder biome, LevelAccessor levelAccessor) { - final Registry biomeRegistry = levelAccessor.registryAccess().ownedRegistryOrThrow(Registry.BIOME_REGISTRY); - if (biomeRegistry.getKey(biome.value()) == null) { - return biomeRegistry.asHolderIdMap().getId(biome) == -1 ? BiomeTypes.OCEAN - : null; - } - return BiomeTypes.get(biome.unwrapKey().orElseThrow().location().toString()); - } - - static void removeBeacon(BlockEntity beacon, LevelChunk levelChunk) { - try { - if (levelChunk.loaded || levelChunk.level.isClientSide()) { - BlockEntity blockEntity = levelChunk.blockEntities.remove(beacon.getBlockPos()); - if (blockEntity != null) { - if (!levelChunk.level.isClientSide) { - methodRemoveGameEventListener.invoke(levelChunk, beacon, levelChunk.level); - } - fieldRemove.set(beacon, true); - } - } - methodremoveTickingBlockEntity.invoke(levelChunk, beacon.getBlockPos()); - } catch (Throwable throwable) { - throwable.printStackTrace(); - } - } - - static List getEntities(LevelChunk chunk) { - ExceptionCollector collector = new ExceptionCollector<>(); - if (PaperLib.isPaper()) { - if (POST_CHUNK_REWRITE) { - try { - //noinspection unchecked - return (List) PAPER_CHUNK_GEN_ALL_ENTITIES.invoke(chunk.level.getEntityLookup().getChunk(chunk.locX, chunk.locZ)); - } catch (IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException("Failed to lookup entities [POST_CHUNK_REWRITE=true]", e); - } - } - try { - EntityList entityList = (EntityList) LEVEL_CHUNK_ENTITIES.get(chunk); - return List.of(entityList.getRawData()); - } catch (IllegalAccessException e) { - collector.add(new RuntimeException("Failed to lookup entities [POST_CHUNK_REWRITE=false]", e)); - // fall through - } - } - try { - //noinspection unchecked - return ((PersistentEntitySectionManager) (SERVER_LEVEL_ENTITY_MANAGER.get(chunk.level))).getEntities(chunk.getPos()); - } catch (IllegalAccessException e) { - collector.add(new RuntimeException("Failed to lookup entities [PAPER=false]", e)); - } - collector.throwIfPresent(); - return List.of(); - } - - record FakeIdMapBlock(int size) implements IdMap { - - @Override - public int getId(final net.minecraft.world.level.block.state.BlockState entry) { - return 0; - } - - @Nullable - @Override - public net.minecraft.world.level.block.state.BlockState byId(final int index) { - return null; - } - - @Nonnull - @Override - public Iterator iterator() { - return Collections.emptyIterator(); - } - - } - - record FakeIdMapBiome(int size) implements IdMap { - - @Override - public int getId(final Biome entry) { - return 0; - } - - @Nullable - @Override - public Biome byId(final int index) { - return null; - } - - @Nonnull - @Override - public Iterator iterator() { - return Collections.emptyIterator(); - } - - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightPostProcessor.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightPostProcessor.java deleted file mode 100644 index 4bbf3baca..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightPostProcessor.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1; - -import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.extent.processor.ProcessorScope; -import com.fastasyncworldedit.core.queue.IBatchProcessor; -import com.fastasyncworldedit.core.queue.IChunk; -import com.fastasyncworldedit.core.queue.IChunkGet; -import com.fastasyncworldedit.core.queue.IChunkSet; -import com.fastasyncworldedit.core.registry.state.PropertyKey; -import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockTypes; -import com.sk89q.worldedit.world.block.BlockTypesCache; -import net.minecraft.core.BlockPos; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.material.Fluid; -import net.minecraft.world.level.material.Fluids; - -import javax.annotation.Nullable; - -public class PaperweightPostProcessor implements IBatchProcessor { - - @Override - public IChunkSet processSet(final IChunk chunk, final IChunkGet get, final IChunkSet set) { - return set; - } - - @SuppressWarnings("deprecation") - @Override - public void postProcess(final IChunk chunk, final IChunkGet iChunkGet, final IChunkSet iChunkSet) { - boolean tickFluid = Settings.settings().EXPERIMENTAL.ALLOW_TICK_FLUIDS; - // The PostProcessor shouldn't be added, but just in case - if (!tickFluid) { - return; - } - PaperweightGetBlocks_Copy getBlocks = (PaperweightGetBlocks_Copy) iChunkGet; - layer: - for (int layer = iChunkSet.getMinSectionPosition(); layer <= iChunkSet.getMaxSectionPosition(); layer++) { - char[] set = iChunkSet.loadIfPresent(layer); - if (set == null) { - // No edit means no need to process - continue; - } - char[] get = null; - for (int i = 0; i < 4096; i++) { - char ordinal = set[i]; - char replacedOrdinal = BlockTypesCache.ReservedIDs.__RESERVED__; - boolean fromGet = false; // Used for liquids - if (ordinal == BlockTypesCache.ReservedIDs.__RESERVED__) { - if (get == null) { - get = getBlocks.load(layer); - } - // If this is null, then it's because we're loading a layer in the range of 0->15, but blocks aren't - // actually being set - if (get == null) { - continue layer; - } - fromGet = true; - ordinal = replacedOrdinal = get[i]; - } - if (ordinal == BlockTypesCache.ReservedIDs.__RESERVED__) { - continue; - } else if (!fromGet) { // if fromGet, don't do the same again - if (get == null) { - get = getBlocks.load(layer); - } - replacedOrdinal = get[i]; - } - boolean ticking = BlockTypesCache.ticking[ordinal]; - boolean replacedWasTicking = BlockTypesCache.ticking[replacedOrdinal]; - boolean replacedWasLiquid = false; - BlockState replacedState = null; - if (!ticking) { - // If the block being replaced was not ticking, it cannot be a liquid - if (!replacedWasTicking) { - continue; - } - // If the block being replaced is not fluid, we do not need to worry - if (!(replacedWasLiquid = - (replacedState = BlockState.getFromOrdinal(replacedOrdinal)).getMaterial().isLiquid())) { - continue; - } - } - BlockState state = BlockState.getFromOrdinal(ordinal); - boolean liquid = state.getMaterial().isLiquid(); - int x = i & 15; - int y = (i >> 8) & 15; - int z = (i >> 4) & 15; - BlockPos position = new BlockPos((chunk.getX() << 4) + x, (layer << 4) + y, (chunk.getZ() << 4) + z); - if (liquid || replacedWasLiquid) { - if (liquid) { - addFluid(getBlocks.serverLevel, state, position); - continue; - } - // If the replaced fluid (is?) adjacent to water. Do not bother to check adjacent chunks(sections) as this - // may be time consuming. Chances are any fluid blocks in adjacent chunks are being replaced or will end up - // being ticked anyway. We only need it to be "hit" once. - if (!wasAdjacentToWater(get, set, i, x, y, z)) { - continue; - } - addFluid(getBlocks.serverLevel, replacedState, position); - } - } - } - } - - @Nullable - @Override - public Extent construct(final Extent child) { - throw new UnsupportedOperationException("Processing only"); - } - - @Override - public ProcessorScope getScope() { - return ProcessorScope.READING_SET_BLOCKS; - } - - private boolean wasAdjacentToWater(char[] get, char[] set, int i, int x, int y, int z) { - if (set == null || get == null) { - return false; - } - char ordinal; - char reserved = BlockTypesCache.ReservedIDs.__RESERVED__; - if (x > 0 && set[i - 1] != reserved) { - if (BlockTypesCache.ticking[(ordinal = get[i - 1])] && isFluid(ordinal)) { - return true; - } - } - if (x < 15 && set[i + 1] != reserved) { - if (BlockTypesCache.ticking[(ordinal = get[i + 1])] && isFluid(ordinal)) { - return true; - } - } - if (z > 0 && set[i - 16] != reserved) { - if (BlockTypesCache.ticking[(ordinal = get[i - 16])] && isFluid(ordinal)) { - return true; - } - } - if (z < 15 && set[i + 16] != reserved) { - if (BlockTypesCache.ticking[(ordinal = get[i + 16])] && isFluid(ordinal)) { - return true; - } - } - if (y > 0 && set[i - 256] != reserved) { - if (BlockTypesCache.ticking[(ordinal = get[i - 256])] && isFluid(ordinal)) { - return true; - } - } - if (y < 15 && set[i + 256] != reserved) { - return BlockTypesCache.ticking[(ordinal = get[i + 256])] && isFluid(ordinal); - } - return false; - } - - @SuppressWarnings("deprecation") - private boolean isFluid(char ordinal) { - return BlockState.getFromOrdinal(ordinal).getMaterial().isLiquid(); - } - - @SuppressWarnings("deprecation") - private void addFluid(final ServerLevel serverLevel, final BlockState replacedState, final BlockPos position) { - Fluid type; - if (replacedState.getBlockType() == BlockTypes.LAVA) { - type = (int) replacedState.getState(PropertyKey.LEVEL) == 0 ? Fluids.LAVA : Fluids.FLOWING_LAVA; - } else { - type = (int) replacedState.getState(PropertyKey.LEVEL) == 0 ? Fluids.WATER : Fluids.FLOWING_WATER; - } - serverLevel.scheduleTick( - position, - type, - type.getTickDelay(serverLevel) - ); - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightStarlightRelighter.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightStarlightRelighter.java deleted file mode 100644 index 8e1e763b1..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightStarlightRelighter.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1; - -import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.extent.processor.lighting.NMSRelighter; -import com.fastasyncworldedit.core.extent.processor.lighting.Relighter; -import com.fastasyncworldedit.core.queue.IQueueChunk; -import com.fastasyncworldedit.core.queue.IQueueExtent; -import com.fastasyncworldedit.core.util.MathMan; -import com.fastasyncworldedit.core.util.TaskManager; -import com.sk89q.worldedit.internal.util.LogManagerCompat; -import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; -import it.unimi.dsi.fastutil.longs.LongArraySet; -import it.unimi.dsi.fastutil.longs.LongIterator; -import it.unimi.dsi.fastutil.longs.LongSet; -import net.minecraft.server.level.ChunkMap; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.TicketType; -import net.minecraft.util.Unit; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.chunk.ChunkStatus; -import org.apache.logging.log4j.Logger; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.locks.ReentrantLock; -import java.util.function.Consumer; -import java.util.function.IntConsumer; - -public class PaperweightStarlightRelighter implements Relighter { - - private static final Logger LOGGER = LogManagerCompat.getLogger(); - private static final int CHUNKS_PER_BATCH = 1024; // 32 * 32 - private static final int CHUNKS_PER_BATCH_SQRT_LOG2 = 5; // for shifting - - private static final TicketType FAWE_TICKET = TicketType.create("fawe_ticket", (a, b) -> 0); - private static final int LIGHT_LEVEL = ChunkMap.MAX_VIEW_DISTANCE + ChunkStatus.getDistance(ChunkStatus.LIGHT); - - - private final ServerLevel serverLevel; - private final ReentrantLock lock = new ReentrantLock(); - private final Long2ObjectLinkedOpenHashMap regions = new Long2ObjectLinkedOpenHashMap<>(); - private final ReentrantLock areaLock = new ReentrantLock(); - private final NMSRelighter delegate; - - @SuppressWarnings("rawtypes") - public PaperweightStarlightRelighter(ServerLevel serverLevel, IQueueExtent queue) { - this.serverLevel = serverLevel; - this.delegate = new NMSRelighter(queue); - } - - @Override - public boolean addChunk(int cx, int cz, byte[] skipReason, int bitmask) { - areaLock.lock(); - try { - long key = MathMan.pairInt(cx >> CHUNKS_PER_BATCH_SQRT_LOG2, cz >> CHUNKS_PER_BATCH_SQRT_LOG2); - // TODO probably submit here already if chunks.size == CHUNKS_PER_BATCH? - LongSet chunks = this.regions.computeIfAbsent(key, k -> new LongArraySet(CHUNKS_PER_BATCH >> 2)); - chunks.add(ChunkPos.asLong(cx, cz)); - } finally { - areaLock.unlock(); - } - return true; - } - - @Override - public void addLightUpdate(int x, int y, int z) { - delegate.addLightUpdate(x, y, z); - } - - /* - * This method is called "recursively", iterating and removing elements - * from the regions linked map. This way, chunks are loaded in batches to avoid - * OOMEs. - */ - @Override - public void fixLightingSafe(boolean sky) { - this.areaLock.lock(); - try { - if (regions.isEmpty()) { - return; - } - LongSet first = regions.removeFirst(); - fixLighting(first, () -> fixLightingSafe(true)); - } finally { - this.areaLock.unlock(); - } - } - - /* - * Processes a set of chunks and runs an action afterwards. - * The action is run async, the chunks are partly processed on the main thread - * (as required by the server). - */ - private void fixLighting(LongSet chunks, Runnable andThen) { - // convert from long keys to ChunkPos - Set coords = new HashSet<>(); - LongIterator iterator = chunks.iterator(); - while (iterator.hasNext()) { - coords.add(new ChunkPos(iterator.nextLong())); - } - TaskManager.taskManager().task(() -> { - // trigger chunk load and apply ticket on main thread - List> futures = new ArrayList<>(); - for (ChunkPos pos : coords) { - futures.add(serverLevel.getWorld().getChunkAtAsync(pos.x, pos.z) - .thenAccept(c -> serverLevel.getChunkSource().addTicketAtLevel( - FAWE_TICKET, - pos, - LIGHT_LEVEL, - Unit.INSTANCE - )) - ); - } - // collect futures and trigger relight once all chunks are loaded - CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).thenAccept(v -> - invokeRelight( - coords, - c -> { - }, // no callback for single chunks required - i -> { - if (i != coords.size()) { - LOGGER.warn("Processed {} chunks instead of {}", i, coords.size()); - } - // post process chunks on main thread - TaskManager.taskManager().task(() -> postProcessChunks(coords)); - // call callback on our own threads - TaskManager.taskManager().async(andThen); - } - ) - ); - }); - } - - private void invokeRelight( - Set coords, - Consumer chunkCallback, - IntConsumer processCallback - ) { - try { - serverLevel.getChunkSource().getLightEngine().relight(coords, chunkCallback, processCallback); - } catch (Exception e) { - LOGGER.error("Error occurred on relighting", e); - } - } - - /* - * Allow the server to unload the chunks again. - * Also, if chunk packets are sent delayed, we need to do that here - */ - private void postProcessChunks(Set coords) { - boolean delay = Settings.settings().LIGHTING.DELAY_PACKET_SENDING; - for (ChunkPos pos : coords) { - int x = pos.x; - int z = pos.z; - if (delay) { // we still need to send the block changes of that chunk - PaperweightPlatformAdapter.sendChunk(serverLevel, x, z, false); - } - serverLevel.getChunkSource().removeTicketAtLevel(FAWE_TICKET, pos, LIGHT_LEVEL, Unit.INSTANCE); - } - } - - @Override - public void clear() { - - } - - @Override - public void removeLighting() { - this.delegate.removeLighting(); - } - - @Override - public void fixBlockLighting() { - fixLightingSafe(true); - } - - @Override - public void fixSkyLighting() { - fixLightingSafe(true); - } - - @Override - public boolean isEmpty() { - return true; - } - - @Override - public ReentrantLock getLock() { - return this.lock; - } - - @Override - public boolean isFinished() { - return false; - } - - @Override - public void close() throws Exception { - fixLightingSafe(true); - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightStarlightRelighterFactory.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightStarlightRelighterFactory.java deleted file mode 100644 index d7ff69151..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/PaperweightStarlightRelighterFactory.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1; - -import com.fastasyncworldedit.core.extent.processor.lighting.NullRelighter; -import com.fastasyncworldedit.core.extent.processor.lighting.RelightMode; -import com.fastasyncworldedit.core.extent.processor.lighting.Relighter; -import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory; -import com.fastasyncworldedit.core.queue.IQueueChunk; -import com.fastasyncworldedit.core.queue.IQueueExtent; -import com.sk89q.worldedit.world.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_19_R1.CraftWorld; - -import javax.annotation.Nonnull; - -public class PaperweightStarlightRelighterFactory implements RelighterFactory { - - @Override - public @Nonnull - @SuppressWarnings("rawtypes") - Relighter createRelighter(RelightMode relightMode, World world, IQueueExtent queue) { - org.bukkit.World w = Bukkit.getWorld(world.getName()); - if (w == null) { - return NullRelighter.INSTANCE; - } - return new PaperweightStarlightRelighter(((CraftWorld) w).getHandle(), queue); - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/nbt/PaperweightLazyCompoundTag.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/nbt/PaperweightLazyCompoundTag.java deleted file mode 100644 index ff9b73642..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/nbt/PaperweightLazyCompoundTag.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1.nbt; - -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.LazyCompoundTag; -import com.sk89q.jnbt.ListTag; -import com.sk89q.jnbt.StringTag; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; -import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; -import net.minecraft.nbt.NumericTag; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; - -public class PaperweightLazyCompoundTag extends LazyCompoundTag { - - private final Supplier compoundTagSupplier; - private CompoundTag compoundTag; - - public PaperweightLazyCompoundTag(Supplier compoundTagSupplier) { - super(new HashMap<>()); - this.compoundTagSupplier = compoundTagSupplier; - } - - public PaperweightLazyCompoundTag(net.minecraft.nbt.CompoundTag compoundTag) { - this(() -> compoundTag); - } - - public net.minecraft.nbt.CompoundTag get() { - return compoundTagSupplier.get(); - } - - @Override - @SuppressWarnings("unchecked") - public Map getValue() { - if (compoundTag == null) { - compoundTag = (CompoundTag) WorldEditPlugin.getInstance().getBukkitImplAdapter().toNative(compoundTagSupplier.get()); - } - return compoundTag.getValue(); - } - - @Override - public CompoundBinaryTag asBinaryTag() { - getValue(); - return compoundTag.asBinaryTag(); - } - - public boolean containsKey(String key) { - return compoundTagSupplier.get().contains(key); - } - - public byte[] getByteArray(String key) { - return compoundTagSupplier.get().getByteArray(key); - } - - public byte getByte(String key) { - return compoundTagSupplier.get().getByte(key); - } - - public double getDouble(String key) { - return compoundTagSupplier.get().getDouble(key); - } - - public double asDouble(String key) { - net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key); - if (tag instanceof NumericTag numTag) { - return numTag.getAsDouble(); - } - return 0; - } - - public float getFloat(String key) { - return compoundTagSupplier.get().getFloat(key); - } - - public int[] getIntArray(String key) { - return compoundTagSupplier.get().getIntArray(key); - } - - public int getInt(String key) { - return compoundTagSupplier.get().getInt(key); - } - - public int asInt(String key) { - net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key); - if (tag instanceof NumericTag numTag) { - return numTag.getAsInt(); - } - return 0; - } - - @SuppressWarnings("unchecked") - public List getList(String key) { - net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key); - if (tag instanceof net.minecraft.nbt.ListTag nbtList) { - ArrayList list = new ArrayList<>(); - for (net.minecraft.nbt.Tag elem : nbtList) { - if (elem instanceof net.minecraft.nbt.CompoundTag compoundTag) { - list.add(new PaperweightLazyCompoundTag(compoundTag)); - } else { - list.add(WorldEditPlugin.getInstance().getBukkitImplAdapter().toNative(elem)); - } - } - return list; - } - return Collections.emptyList(); - } - - @SuppressWarnings("unchecked") - public ListTag getListTag(String key) { - net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key); - if (tag instanceof net.minecraft.nbt.ListTag) { - return (ListTag) WorldEditPlugin.getInstance().getBukkitImplAdapter().toNative(tag); - } - return new ListTag(StringTag.class, Collections.emptyList()); - } - - @SuppressWarnings("unchecked") - public List getList(String key, Class listType) { - ListTag listTag = getListTag(key); - if (listTag.getType().equals(listType)) { - return (List) listTag.getValue(); - } else { - return Collections.emptyList(); - } - } - - public long[] getLongArray(String key) { - return compoundTagSupplier.get().getLongArray(key); - } - - public long getLong(String key) { - return compoundTagSupplier.get().getLong(key); - } - - public long asLong(String key) { - net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key); - if (tag instanceof NumericTag numTag) { - return numTag.getAsLong(); - } - return 0; - } - - public short getShort(String key) { - return compoundTagSupplier.get().getShort(key); - } - - public String getString(String key) { - return compoundTagSupplier.get().getString(key); - } - - @Override - public String toString() { - return compoundTagSupplier.get().toString(); - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/regen/PaperweightRegen.java b/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/regen/PaperweightRegen.java deleted file mode 100644 index ebe096996..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R1/regen/PaperweightRegen.java +++ /dev/null @@ -1,564 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1.regen; - -import com.fastasyncworldedit.bukkit.adapter.Regenerator; -import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.queue.IChunkCache; -import com.fastasyncworldedit.core.queue.IChunkGet; -import com.fastasyncworldedit.core.util.ReflectionUtils; -import com.fastasyncworldedit.core.util.TaskManager; -import com.google.common.collect.ImmutableList; -import com.mojang.datafixers.util.Either; -import com.mojang.serialization.Lifecycle; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; -import com.sk89q.worldedit.bukkit.adapter.Refraction; -import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1.PaperweightGetBlocks; -import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.internal.util.LogManagerCompat; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.util.io.file.SafeFiles; -import com.sk89q.worldedit.world.RegenOptions; -import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; -import net.minecraft.core.Holder; -import net.minecraft.core.Registry; -import net.minecraft.data.BuiltinRegistries; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.ResourceKey; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ChunkTaskPriorityQueueSorter.Message; -import net.minecraft.server.level.ServerChunkCache; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ThreadedLevelLightEngine; -import net.minecraft.server.level.progress.ChunkProgressListener; -import net.minecraft.util.thread.ProcessorHandle; -import net.minecraft.util.thread.ProcessorMailbox; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelHeightAccessor; -import net.minecraft.world.level.LevelSettings; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.biome.BiomeSource; -import net.minecraft.world.level.biome.FixedBiomeSource; -import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkGenerator; -import net.minecraft.world.level.chunk.ChunkStatus; -import net.minecraft.world.level.chunk.LevelChunk; -import net.minecraft.world.level.chunk.ProtoChunk; -import net.minecraft.world.level.chunk.UpgradeData; -import net.minecraft.world.level.dimension.LevelStem; -import net.minecraft.world.level.levelgen.FlatLevelSource; -import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator; -import net.minecraft.world.level.levelgen.NoiseGeneratorSettings; -import net.minecraft.world.level.levelgen.WorldGenSettings; -import net.minecraft.world.level.levelgen.blending.BlendingData; -import net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorSettings; -import net.minecraft.world.level.levelgen.structure.placement.ConcentricRingsStructurePlacement; -import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager; -import net.minecraft.world.level.storage.LevelStorageSource; -import net.minecraft.world.level.storage.PrimaryLevelData; -import org.apache.logging.log4j.Logger; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_19_R1.CraftServer; -import org.bukkit.craftbukkit.v1_19_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_19_R1.generator.CustomChunkGenerator; -import org.bukkit.generator.BiomeProvider; -import org.bukkit.generator.BlockPopulator; - -import javax.annotation.Nullable; -import java.io.IOException; -import java.lang.reflect.Field; -import java.nio.file.Path; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.OptionalLong; -import java.util.Random; -import java.util.concurrent.CompletableFuture; -import java.util.function.BooleanSupplier; -import java.util.function.Supplier; - -public class PaperweightRegen extends Regenerator { - - private static final Logger LOGGER = LogManagerCompat.getLogger(); - - private static final Field serverWorldsField; - private static final Field paperConfigField; - private static final Field flatBedrockField; - private static final Field generatorSettingFlatField; - private static final Field generatorSettingBaseSupplierField; - private static final Field delegateField; - private static final Field chunkSourceField; - private static final Field ringPositionsField; - private static final Field hasGeneratedPositionsField; - - //list of chunk stati in correct order without FULL - private static final Map chunkStati = new LinkedHashMap<>(); - - static { - chunkStati.put(ChunkStatus.EMPTY, Concurrency.FULL); // empty: radius -1, does nothing - chunkStati.put(ChunkStatus.STRUCTURE_STARTS, Concurrency.NONE); // structure starts: uses unsynchronized maps - chunkStati.put( - ChunkStatus.STRUCTURE_REFERENCES, - Concurrency.FULL - ); // structure refs: radius 8, but only writes to current chunk - chunkStati.put(ChunkStatus.BIOMES, Concurrency.FULL); // biomes: radius 0 - chunkStati.put(ChunkStatus.NOISE, Concurrency.RADIUS); // noise: radius 8 - chunkStati.put(ChunkStatus.SURFACE, Concurrency.NONE); // surface: radius 0, requires NONE - chunkStati.put(ChunkStatus.CARVERS, Concurrency.NONE); // carvers: radius 0, but RADIUS and FULL change results - chunkStati.put( - ChunkStatus.LIQUID_CARVERS, - Concurrency.NONE - ); // liquid carvers: radius 0, but RADIUS and FULL change results - chunkStati.put(ChunkStatus.FEATURES, Concurrency.NONE); // features: uses unsynchronized maps - chunkStati.put( - ChunkStatus.LIGHT, - Concurrency.FULL - ); // light: radius 1, but no writes to other chunks, only current chunk - chunkStati.put(ChunkStatus.SPAWN, Concurrency.FULL); // spawn: radius 0 - chunkStati.put(ChunkStatus.HEIGHTMAPS, Concurrency.FULL); // heightmaps: radius 0 - - try { - serverWorldsField = CraftServer.class.getDeclaredField("worlds"); - serverWorldsField.setAccessible(true); - - Field tmpPaperConfigField; - Field tmpFlatBedrockField; - try { //only present on paper - tmpPaperConfigField = Level.class.getDeclaredField("paperConfig"); - tmpPaperConfigField.setAccessible(true); - - tmpFlatBedrockField = tmpPaperConfigField.getType().getDeclaredField("generateFlatBedrock"); - tmpFlatBedrockField.setAccessible(true); - } catch (Exception e) { - tmpPaperConfigField = null; - tmpFlatBedrockField = null; - } - paperConfigField = tmpPaperConfigField; - flatBedrockField = tmpFlatBedrockField; - - generatorSettingBaseSupplierField = NoiseBasedChunkGenerator.class.getDeclaredField(Refraction.pickName( - "settings", "g")); - generatorSettingBaseSupplierField.setAccessible(true); - - generatorSettingFlatField = FlatLevelSource.class.getDeclaredField(Refraction.pickName("settings", "f")); - generatorSettingFlatField.setAccessible(true); - - delegateField = CustomChunkGenerator.class.getDeclaredField("delegate"); - delegateField.setAccessible(true); - - chunkSourceField = ServerLevel.class.getDeclaredField(Refraction.pickName("chunkSource", "L")); - chunkSourceField.setAccessible(true); - - ringPositionsField = ChunkGenerator.class.getDeclaredField(Refraction.pickName("ringPositions", "i")); - ringPositionsField.setAccessible(true); - - hasGeneratedPositionsField = ChunkGenerator.class.getDeclaredField(Refraction.pickName("hasGeneratedPositions", "j")); - hasGeneratedPositionsField.setAccessible(true); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - //runtime - private ServerLevel originalServerWorld; - private ServerChunkCache originalChunkProvider; - private ServerLevel freshWorld; - private ServerChunkCache freshChunkProvider; - private LevelStorageSource.LevelStorageAccess session; - private StructureTemplateManager structureTemplateManager; - private ThreadedLevelLightEngine threadedLevelLightEngine; - private ChunkGenerator chunkGenerator; - - private Path tempDir; - - private boolean generateFlatBedrock = false; - - public PaperweightRegen(org.bukkit.World originalBukkitWorld, Region region, Extent target, RegenOptions options) { - super(originalBukkitWorld, region, target, options); - } - - @Override - protected boolean prepare() { - this.originalServerWorld = ((CraftWorld) originalBukkitWorld).getHandle(); - originalChunkProvider = originalServerWorld.getChunkSource(); - if (!(originalChunkProvider instanceof ServerChunkCache)) { - return false; - } - - //flat bedrock? (only on paper) - if (paperConfigField != null) { - try { - generateFlatBedrock = flatBedrockField.getBoolean(paperConfigField.get(originalServerWorld)); - } catch (Exception ignored) { - } - } - - seed = options.getSeed().orElse(originalServerWorld.getSeed()); - chunkStati.forEach((s, c) -> super.chunkStati.put(new ChunkStatusWrap(s), c)); - - return true; - } - - @Override - @SuppressWarnings("unchecked") - protected boolean initNewWorld() throws Exception { - //world folder - tempDir = java.nio.file.Files.createTempDirectory("FastAsyncWorldEditWorldGen"); - - //prepare for world init (see upstream implementation for reference) - org.bukkit.World.Environment environment = originalBukkitWorld.getEnvironment(); - org.bukkit.generator.ChunkGenerator generator = originalBukkitWorld.getGenerator(); - LevelStorageSource levelStorageSource = LevelStorageSource.createDefault(tempDir); - ResourceKey levelStemResourceKey = getWorldDimKey(environment); - session = levelStorageSource.createAccess("faweregentempworld", levelStemResourceKey); - PrimaryLevelData originalWorldData = originalServerWorld.serverLevelData; - - MinecraftServer server = originalServerWorld.getCraftServer().getServer(); - WorldGenSettings originalOpts = originalWorldData.worldGenSettings(); - WorldGenSettings newOpts = options.getSeed().isPresent() - ? originalOpts.withSeed(originalWorldData.isHardcore(), OptionalLong.of(seed)) - : originalOpts; - LevelSettings newWorldSettings = new LevelSettings( - "faweregentempworld", - originalWorldData.settings.gameType(), - originalWorldData.settings.hardcore(), - originalWorldData.settings.difficulty(), - originalWorldData.settings.allowCommands(), - originalWorldData.settings.gameRules(), - originalWorldData.settings.getDataPackConfig() - ); - PrimaryLevelData newWorldData = new PrimaryLevelData(newWorldSettings, newOpts, Lifecycle.stable()); - - BiomeProvider biomeProvider = getBiomeProvider(); - - //init world - freshWorld = Fawe.instance().getQueueHandler().sync((Supplier) () -> new ServerLevel( - server, - server.executor, - session, - newWorldData, - originalServerWorld.dimension(), - newOpts.dimensions().getOrThrow(levelStemResourceKey), - new RegenNoOpWorldLoadListener(), - originalServerWorld.isDebug(), - seed, - ImmutableList.of(), - false, - environment, - generator, - biomeProvider - ) { - private final Holder singleBiome = options.hasBiomeType() ? BuiltinRegistries.BIOME.asHolderIdMap().byId( - WorldEditPlugin.getInstance().getBukkitImplAdapter().getInternalBiomeId(options.getBiomeType()) - ) : null; - - @Override - public void tick(BooleanSupplier shouldKeepTicking) { //no ticking - } - - @Override - public Holder getUncachedNoiseBiome(int biomeX, int biomeY, int biomeZ) { - if (options.hasBiomeType()) { - return singleBiome; - } - return PaperweightRegen.this.chunkGenerator.getBiomeSource().getNoiseBiome( - biomeX, biomeY, biomeZ, getChunkSource().randomState().sampler() - ); - } - }).get(); - freshWorld.noSave = true; - removeWorldFromWorldsMap(); - newWorldData.checkName(originalServerWorld.serverLevelData.getLevelName()); //rename to original world name - if (paperConfigField != null) { - paperConfigField.set(freshWorld, originalServerWorld.paperConfig()); - } - - ChunkGenerator originalGenerator = originalChunkProvider.getGenerator(); - if (originalGenerator instanceof FlatLevelSource flatLevelSource) { - FlatLevelGeneratorSettings generatorSettingFlat = flatLevelSource.settings(); - chunkGenerator = new FlatLevelSource(originalGenerator.structureSets, generatorSettingFlat); - } else if (originalGenerator instanceof NoiseBasedChunkGenerator noiseBasedChunkGenerator) { - Holder generatorSettingBaseSupplier = (Holder) generatorSettingBaseSupplierField.get( - originalGenerator); - BiomeSource biomeSource; - if (options.hasBiomeType()) { - biomeSource = new FixedBiomeSource(BuiltinRegistries.BIOME - .asHolderIdMap() - .byId(WorldEditPlugin.getInstance().getBukkitImplAdapter().getInternalBiomeId(options.getBiomeType()))); - } else { - biomeSource = originalGenerator.getBiomeSource(); - } - chunkGenerator = new NoiseBasedChunkGenerator(originalGenerator.structureSets, - noiseBasedChunkGenerator.noises, - biomeSource, - generatorSettingBaseSupplier - ); - } else if (originalGenerator instanceof CustomChunkGenerator customChunkGenerator) { - chunkGenerator = customChunkGenerator.getDelegate(); - } else { - LOGGER.error("Unsupported generator type {}", originalGenerator.getClass().getName()); - return false; - } - if (generator != null) { - chunkGenerator = new CustomChunkGenerator(freshWorld, chunkGenerator, generator); - generateConcurrent = generator.isParallelCapable(); - } - chunkGenerator.conf = freshWorld.spigotConfig; - - if (seed == originalOpts.seed() && !options.hasBiomeType()) { - // Optimisation for needless ring position calculation when the seed and biome is the same. - boolean hasGeneratedPositions = hasGeneratedPositionsField.getBoolean(originalGenerator); - if (hasGeneratedPositions) { - Map>> ringPositions = - (Map>>) ringPositionsField.get( - originalGenerator); - Map>> copy = new Object2ObjectArrayMap<>(ringPositions); - ringPositionsField.set(chunkGenerator, copy); - hasGeneratedPositionsField.setBoolean(chunkGenerator, true); - } - } - - freshChunkProvider = new ServerChunkCache( - freshWorld, - session, - server.getFixerUpper(), - server.getStructureManager(), - server.executor, - chunkGenerator, - freshWorld.spigotConfig.viewDistance, - freshWorld.spigotConfig.simulationDistance, - server.forceSynchronousWrites(), - new RegenNoOpWorldLoadListener(), - (chunkCoordIntPair, state) -> { - }, - () -> server.overworld().getDataStorage() - ) { - // redirect to LevelChunks created in #createChunks - @Override - public ChunkAccess getChunk(int x, int z, ChunkStatus chunkstatus, boolean create) { - ChunkAccess chunkAccess = getChunkAt(x, z); - if (chunkAccess == null && create) { - chunkAccess = createChunk(getProtoChunkAt(x, z)); - } - return chunkAccess; - } - }; - - ReflectionUtils.unsafeSet(chunkSourceField, freshWorld, freshChunkProvider); - //let's start then - structureTemplateManager = server.getStructureManager(); - threadedLevelLightEngine = new NoOpLightEngine(freshChunkProvider); - - return true; - } - - @Override - protected void cleanup() { - try { - session.close(); - } catch (Exception ignored) { - } - - //shutdown chunk provider - try { - Fawe.instance().getQueueHandler().sync(() -> { - try { - freshChunkProvider.close(false); - } catch (Exception e) { - throw new RuntimeException(e); - } - }); - } catch (Exception ignored) { - } - - //remove world from server - try { - Fawe.instance().getQueueHandler().sync(this::removeWorldFromWorldsMap); - } catch (Exception ignored) { - } - - //delete directory - try { - SafeFiles.tryHardToDeleteDir(tempDir); - } catch (Exception ignored) { - } - } - - @Override - protected ProtoChunk createProtoChunk(int x, int z) { - return new FastProtoChunk(new ChunkPos(x, z), UpgradeData.EMPTY, freshWorld, - this.freshWorld.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), null - ); - } - - @Override - protected LevelChunk createChunk(ProtoChunk protoChunk) { - return new LevelChunk( - freshWorld, - protoChunk, - null // we don't want to add entities - ); - } - - @Override - protected ChunkStatusWrap getFullChunkStatus() { - return new ChunkStatusWrap(ChunkStatus.FULL); - } - - @Override - protected List getBlockPopulators() { - return originalServerWorld.getWorld().getPopulators(); - } - - @Override - protected void populate(LevelChunk levelChunk, Random random, BlockPopulator blockPopulator) { - // BlockPopulator#populate has to be called synchronously for TileEntity access - TaskManager.taskManager().task(() -> blockPopulator.populate(freshWorld.getWorld(), random, levelChunk.getBukkitChunk())); - } - - @Override - protected IChunkCache initSourceQueueCache() { - return (chunkX, chunkZ) -> new PaperweightGetBlocks(freshWorld, chunkX, chunkZ) { - @Override - public LevelChunk ensureLoaded(ServerLevel nmsWorld, int x, int z) { - return getChunkAt(x, z); - } - }; - } - - //util - @SuppressWarnings("unchecked") - private void removeWorldFromWorldsMap() { - Fawe.instance().getQueueHandler().sync(() -> { - try { - Map map = (Map) serverWorldsField.get(Bukkit.getServer()); - map.remove("faweregentempworld"); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - }); - } - - private ResourceKey getWorldDimKey(org.bukkit.World.Environment env) { - return switch (env) { - case NETHER -> LevelStem.NETHER; - case THE_END -> LevelStem.END; - default -> LevelStem.OVERWORLD; - }; - } - - private static class RegenNoOpWorldLoadListener implements ChunkProgressListener { - - private RegenNoOpWorldLoadListener() { - } - - @Override - public void updateSpawnPos(ChunkPos spawnPos) { - } - - @Override - public void onStatusChange(ChunkPos pos, @Nullable ChunkStatus status) { - } - - @Override - public void start() { - - } - - @Override - public void stop() { - } - - // TODO Paper only(?) @Override - public void setChunkRadius(int radius) { - } - - } - - private class FastProtoChunk extends ProtoChunk { - - public FastProtoChunk( - final ChunkPos pos, - final UpgradeData upgradeData, - final LevelHeightAccessor world, - final Registry biomeRegistry, - @Nullable final BlendingData blendingData - ) { - super(pos, upgradeData, world, biomeRegistry, blendingData); - } - - // avoid warning on paper - - // compatibility with spigot - - public boolean generateFlatBedrock() { - return generateFlatBedrock; - } - - // no one will ever see the entities! - @Override - public List getEntities() { - return Collections.emptyList(); - } - - } - - protected class ChunkStatusWrap extends ChunkStatusWrapper { - - private final ChunkStatus chunkStatus; - - public ChunkStatusWrap(ChunkStatus chunkStatus) { - this.chunkStatus = chunkStatus; - } - - @Override - public int requiredNeighborChunkRadius() { - return chunkStatus.getRange(); - } - - @Override - public String name() { - return chunkStatus.getName(); - } - - @Override - public CompletableFuture processChunk(Long xz, List accessibleChunks) { - return chunkStatus.generate( - Runnable::run, // TODO revisit, we might profit from this somehow? - freshWorld, - chunkGenerator, - structureTemplateManager, - threadedLevelLightEngine, - c -> CompletableFuture.completedFuture(Either.left(c)), - accessibleChunks, - true - ); - } - - } - - /** - * A light engine that does nothing. As light is calculated after pasting anyway, we can avoid - * work this way. - */ - static class NoOpLightEngine extends ThreadedLevelLightEngine { - private static final ProcessorMailbox MAILBOX = ProcessorMailbox.create(task -> {}, "fawe-no-op"); - private static final ProcessorHandle> HANDLE = ProcessorHandle.of("fawe-no-op", m -> {}); - - public NoOpLightEngine(final ServerChunkCache chunkProvider) { - super(chunkProvider, chunkProvider.chunkMap, false, MAILBOX, HANDLE); - } - - @Override - public CompletableFuture retainData(final ChunkAccess chunk) { - return CompletableFuture.completedFuture(chunk); - } - - @Override - public CompletableFuture lightChunk(final ChunkAccess chunk, final boolean excludeBlocks) { - return CompletableFuture.completedFuture(chunk); - } - - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_19_3/build.gradle.kts deleted file mode 100644 index 4706a5752..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19_3/build.gradle.kts +++ /dev/null @@ -1,17 +0,0 @@ -import io.papermc.paperweight.userdev.PaperweightUserDependenciesExtension - -plugins { - java -} - -applyPaperweightAdapterConfiguration() - -repositories { - gradlePluginPortal() -} - -dependencies { - // https://papermc.io/repo/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/ - the().paperDevBundle("1.19.3-R0.1-20230312.180621-141") - compileOnly("io.papermc:paperlib") -} diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R2/PaperweightAdapter.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R2/PaperweightAdapter.java deleted file mode 100644 index ddaa2c6b4..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R2/PaperweightAdapter.java +++ /dev/null @@ -1,1029 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_19_R2; - -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Sets; -import com.google.common.util.concurrent.Futures; -import com.mojang.datafixers.util.Either; -import com.mojang.serialization.Lifecycle; -import com.sk89q.jnbt.ByteArrayTag; -import com.sk89q.jnbt.ByteTag; -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.DoubleTag; -import com.sk89q.jnbt.EndTag; -import com.sk89q.jnbt.FloatTag; -import com.sk89q.jnbt.IntArrayTag; -import com.sk89q.jnbt.IntTag; -import com.sk89q.jnbt.ListTag; -import com.sk89q.jnbt.LongArrayTag; -import com.sk89q.jnbt.LongTag; -import com.sk89q.jnbt.NBTConstants; -import com.sk89q.jnbt.ShortTag; -import com.sk89q.jnbt.StringTag; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseItem; -import com.sk89q.worldedit.blocks.BaseItemStack; -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; -import com.sk89q.worldedit.bukkit.adapter.Refraction; -import com.sk89q.worldedit.entity.BaseEntity; -import com.sk89q.worldedit.extension.platform.Watchdog; -import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.internal.Constants; -import com.sk89q.worldedit.internal.block.BlockStateIdAccess; -import com.sk89q.worldedit.internal.wna.WorldNativeAccess; -import com.sk89q.worldedit.math.BlockVector2; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.registry.state.BooleanProperty; -import com.sk89q.worldedit.registry.state.DirectionalProperty; -import com.sk89q.worldedit.registry.state.EnumProperty; -import com.sk89q.worldedit.registry.state.IntegerProperty; -import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.util.Direction; -import com.sk89q.worldedit.util.SideEffect; -import com.sk89q.worldedit.util.concurrency.LazyReference; -import com.sk89q.worldedit.util.formatting.text.Component; -import com.sk89q.worldedit.util.formatting.text.TranslatableComponent; -import com.sk89q.worldedit.util.io.file.SafeFiles; -import com.sk89q.worldedit.util.nbt.BinaryTag; -import com.sk89q.worldedit.util.nbt.ByteArrayBinaryTag; -import com.sk89q.worldedit.util.nbt.ByteBinaryTag; -import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; -import com.sk89q.worldedit.util.nbt.DoubleBinaryTag; -import com.sk89q.worldedit.util.nbt.EndBinaryTag; -import com.sk89q.worldedit.util.nbt.FloatBinaryTag; -import com.sk89q.worldedit.util.nbt.IntArrayBinaryTag; -import com.sk89q.worldedit.util.nbt.IntBinaryTag; -import com.sk89q.worldedit.util.nbt.ListBinaryTag; -import com.sk89q.worldedit.util.nbt.LongArrayBinaryTag; -import com.sk89q.worldedit.util.nbt.LongBinaryTag; -import com.sk89q.worldedit.util.nbt.ShortBinaryTag; -import com.sk89q.worldedit.util.nbt.StringBinaryTag; -import com.sk89q.worldedit.world.DataFixer; -import com.sk89q.worldedit.world.RegenOptions; -import com.sk89q.worldedit.world.biome.BiomeType; -import com.sk89q.worldedit.world.biome.BiomeTypes; -import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockStateHolder; -import com.sk89q.worldedit.world.block.BlockType; -import com.sk89q.worldedit.world.block.BlockTypes; -import com.sk89q.worldedit.world.item.ItemType; -import net.minecraft.Util; -import net.minecraft.core.BlockPos; -import net.minecraft.core.registries.Registries; -import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket; -import net.minecraft.network.protocol.game.ClientboundEntityEventPacket; -import net.minecraft.resources.ResourceKey; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.dedicated.DedicatedServer; -import net.minecraft.server.level.ChunkHolder; -import net.minecraft.server.level.ServerChunkCache; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.progress.ChunkProgressListener; -import net.minecraft.util.StringRepresentable; -import net.minecraft.util.thread.BlockableEventLoop; -import net.minecraft.world.Clearable; -import net.minecraft.world.InteractionHand; -import net.minecraft.world.InteractionResult; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.item.Item; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.context.UseOnContext; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.LevelSettings; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.entity.StructureBlockEntity; -import net.minecraft.world.level.block.state.StateDefinition; -import net.minecraft.world.level.block.state.properties.DirectionProperty; -import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkStatus; -import net.minecraft.world.level.chunk.LevelChunk; -import net.minecraft.world.level.dimension.LevelStem; -import net.minecraft.world.level.levelgen.WorldOptions; -import net.minecraft.world.level.storage.LevelStorageSource; -import net.minecraft.world.level.storage.PrimaryLevelData; -import net.minecraft.world.phys.BlockHitResult; -import net.minecraft.world.phys.Vec3; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.World.Environment; -import org.bukkit.block.data.BlockData; -import org.bukkit.craftbukkit.v1_19_R2.CraftServer; -import org.bukkit.craftbukkit.v1_19_R2.CraftWorld; -import org.bukkit.craftbukkit.v1_19_R2.block.data.CraftBlockData; -import org.bukkit.craftbukkit.v1_19_R2.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack; -import org.bukkit.craftbukkit.v1_19_R2.util.CraftMagicNumbers; -import org.bukkit.entity.Player; -import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; -import org.bukkit.generator.ChunkGenerator; -import org.spigotmc.SpigotConfig; -import org.spigotmc.WatchdogThread; - -import java.lang.ref.WeakReference; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Objects; -import java.util.OptionalInt; -import java.util.OptionalLong; -import java.util.Set; -import java.util.TreeMap; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; -import java.util.logging.Level; -import java.util.logging.Logger; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; - -public final class PaperweightAdapter implements BukkitImplAdapter { - - private final Logger LOGGER = Logger.getLogger(getClass().getCanonicalName()); - - private final Field serverWorldsField; - private final Method getChunkFutureMethod; - private final Field chunkProviderExecutorField; - private final Watchdog watchdog; - - // ------------------------------------------------------------------------ - // Code that may break between versions of Minecraft - // ------------------------------------------------------------------------ - - public PaperweightAdapter() throws NoSuchFieldException, NoSuchMethodException { - // A simple test - CraftServer.class.cast(Bukkit.getServer()); - - int dataVersion = CraftMagicNumbers.INSTANCE.getDataVersion(); - if (dataVersion != 3218) { - throw new UnsupportedClassVersionError("Not 1.19.3!"); - } - - serverWorldsField = CraftServer.class.getDeclaredField("worlds"); - serverWorldsField.setAccessible(true); - - getChunkFutureMethod = ServerChunkCache.class.getDeclaredMethod( - Refraction.pickName("getChunkFutureMainThread", "c"), - int.class, int.class, ChunkStatus.class, boolean.class - ); - getChunkFutureMethod.setAccessible(true); - - chunkProviderExecutorField = ServerChunkCache.class.getDeclaredField( - Refraction.pickName("mainThreadProcessor", "g") - ); - chunkProviderExecutorField.setAccessible(true); - - new PaperweightDataConverters(CraftMagicNumbers.INSTANCE.getDataVersion(), this).buildUnoptimized(); - - Watchdog watchdog; - try { - Class.forName("org.spigotmc.WatchdogThread"); - watchdog = new SpigotWatchdog(); - } catch (ClassNotFoundException | NoSuchFieldException e) { - try { - watchdog = new MojangWatchdog(((CraftServer) Bukkit.getServer()).getServer()); - } catch (NoSuchFieldException ex) { - watchdog = null; - } - } - this.watchdog = watchdog; - - try { - Class.forName("org.spigotmc.SpigotConfig"); - SpigotConfig.config.set("world-settings.faweregentempworld.verbose", false); - } catch (ClassNotFoundException ignored) { - } - } - - @Override - public DataFixer getDataFixer() { - return PaperweightDataConverters.INSTANCE; - } - - /** - * Read the given NBT data into the given tile entity. - * - * @param tileEntity the tile entity - * @param tag the tag - */ - static void readTagIntoTileEntity(net.minecraft.nbt.CompoundTag tag, BlockEntity tileEntity) { - tileEntity.load(tag); - tileEntity.setChanged(); - } - - /** - * Get the ID string of the given entity. - * - * @param entity the entity - * @return the entity ID - */ - private static String getEntityId(Entity entity) { - return EntityType.getKey(entity.getType()).toString(); - } - - /** - * Create an entity using the given entity ID. - * - * @param id the entity ID - * @param world the world - * @return an entity or null - */ - @Nullable - private static Entity createEntityFromId(String id, net.minecraft.world.level.Level world) { - return EntityType.byString(id).map(t -> t.create(world)).orElse(null); - } - - /** - * Write the given NBT data into the given entity. - * - * @param entity the entity - * @param tag the tag - */ - private static void readTagIntoEntity(net.minecraft.nbt.CompoundTag tag, Entity entity) { - entity.load(tag); - } - - /** - * Write the entity's NBT data to the given tag. - * - * @param entity the entity - * @param tag the tag - */ - private static void readEntityIntoTag(Entity entity, net.minecraft.nbt.CompoundTag tag) { - entity.save(tag); - } - - private static Block getBlockFromType(BlockType blockType) { - - return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.BLOCK).get(ResourceLocation.tryParse(blockType.getId())); - } - - private static Item getItemFromType(ItemType itemType) { - return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(itemType.getId())); - } - - @Override - public OptionalInt getInternalBlockStateId(BlockData data) { - net.minecraft.world.level.block.state.BlockState state = ((CraftBlockData) data).getState(); - int combinedId = Block.getId(state); - return combinedId == 0 && state.getBlock() != Blocks.AIR ? OptionalInt.empty() : OptionalInt.of(combinedId); - } - - @Override - public OptionalInt getInternalBlockStateId(BlockState state) { - Block mcBlock = getBlockFromType(state.getBlockType()); - net.minecraft.world.level.block.state.BlockState newState = mcBlock.defaultBlockState(); - Map, Object> states = state.getStates(); - newState = applyProperties(mcBlock.getStateDefinition(), newState, states); - final int combinedId = Block.getId(newState); - return combinedId == 0 && state.getBlockType() != BlockTypes.AIR ? OptionalInt.empty() : OptionalInt.of(combinedId); - } - - @Override - public BlockState getBlock(Location location) { - checkNotNull(location); - - CraftWorld craftWorld = ((CraftWorld) location.getWorld()); - int x = location.getBlockX(); - int y = location.getBlockY(); - int z = location.getBlockZ(); - - final ServerLevel handle = craftWorld.getHandle(); - LevelChunk chunk = handle.getChunk(x >> 4, z >> 4); - final BlockPos blockPos = new BlockPos(x, y, z); - final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(blockPos); - int internalId = Block.getId(blockData); - BlockState state = BlockStateIdAccess.getBlockStateById(internalId); - if (state == null) { - org.bukkit.block.Block bukkitBlock = location.getBlock(); - state = BukkitAdapter.adapt(bukkitBlock.getBlockData()); - } - - return state; - } - - @Override - public BaseBlock getFullBlock(Location location) { - BlockState state = getBlock(location); - - CraftWorld craftWorld = ((CraftWorld) location.getWorld()); - int x = location.getBlockX(); - int y = location.getBlockY(); - int z = location.getBlockZ(); - - final ServerLevel handle = craftWorld.getHandle(); - LevelChunk chunk = handle.getChunk(x >> 4, z >> 4); - final BlockPos blockPos = new BlockPos(x, y, z); - - // Read the NBT data - BlockEntity te = chunk.getBlockEntity(blockPos); - if (te != null) { - net.minecraft.nbt.CompoundTag tag = te.saveWithId(); - return state.toBaseBlock((CompoundBinaryTag) toNativeBinary(tag)); - } - - return state.toBaseBlock(); - } - - @Override - public WorldNativeAccess createWorldNativeAccess(org.bukkit.World world) { - return new PaperweightWorldNativeAccess(this, - new WeakReference<>(((CraftWorld) world).getHandle())); - } - - private static net.minecraft.core.Direction adapt(Direction face) { - switch (face) { - case NORTH: - return net.minecraft.core.Direction.NORTH; - case SOUTH: - return net.minecraft.core.Direction.SOUTH; - case WEST: - return net.minecraft.core.Direction.WEST; - case EAST: - return net.minecraft.core.Direction.EAST; - case DOWN: - return net.minecraft.core.Direction.DOWN; - case UP: - default: - return net.minecraft.core.Direction.UP; - } - } - - @SuppressWarnings({"rawtypes", "unchecked"}) - private net.minecraft.world.level.block.state.BlockState applyProperties( - StateDefinition stateContainer, - net.minecraft.world.level.block.state.BlockState newState, - Map, Object> states - ) { - for (Map.Entry, Object> state : states.entrySet()) { - net.minecraft.world.level.block.state.properties.Property property = - stateContainer.getProperty(state.getKey().getName()); - Comparable value = (Comparable) state.getValue(); - // we may need to adapt this value, depending on the source prop - if (property instanceof DirectionProperty) { - Direction dir = (Direction) value; - value = adapt(dir); - } else if (property instanceof net.minecraft.world.level.block.state.properties.EnumProperty) { - String enumName = (String) value; - value = ((net.minecraft.world.level.block.state.properties.EnumProperty) property) - .getValue(enumName).orElseThrow(() -> - new IllegalStateException( - "Enum property " + property.getName() + " does not contain " + enumName - ) - ); - } - - newState = newState.setValue( - (net.minecraft.world.level.block.state.properties.Property) property, - (Comparable) value - ); - } - return newState; - } - - @Override - public BaseEntity getEntity(org.bukkit.entity.Entity entity) { - checkNotNull(entity); - - CraftEntity craftEntity = ((CraftEntity) entity); - Entity mcEntity = craftEntity.getHandle(); - - // Do not allow creating of passenger entity snapshots, passengers are included in the vehicle entity - if (mcEntity.isPassenger()) { - return null; - } - - String id = getEntityId(mcEntity); - - net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag(); - readEntityIntoTag(mcEntity, tag); - return new BaseEntity( - com.sk89q.worldedit.world.entity.EntityTypes.get(id), - LazyReference.from(() -> (CompoundBinaryTag) toNativeBinary(tag)) - ); - } - - @Nullable - @Override - public org.bukkit.entity.Entity createEntity(Location location, BaseEntity state) { - checkNotNull(location); - checkNotNull(state); - - CraftWorld craftWorld = ((CraftWorld) location.getWorld()); - ServerLevel worldServer = craftWorld.getHandle(); - - Entity createdEntity = createEntityFromId(state.getType().getId(), craftWorld.getHandle()); - - if (createdEntity != null) { - CompoundBinaryTag nativeTag = state.getNbt(); - if (nativeTag != null) { - net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) fromNativeBinary(nativeTag); - for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) { - tag.remove(name); - } - readTagIntoEntity(tag, createdEntity); - } - - createdEntity.absMoveTo(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - - worldServer.addFreshEntity(createdEntity, SpawnReason.CUSTOM); - return createdEntity.getBukkitEntity(); - } else { - return null; - } - } - - // This removes all unwanted tags from the main entity and all its passengers - private void removeUnwantedEntityTagsRecursively(net.minecraft.nbt.CompoundTag tag) { - for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) { - tag.remove(name); - } - - // Adapted from net.minecraft.world.entity.EntityType#loadEntityRecursive - if (tag.contains("Passengers", NBTConstants.TYPE_LIST)) { - net.minecraft.nbt.ListTag nbttaglist = tag.getList("Passengers", NBTConstants.TYPE_COMPOUND); - - for (int i = 0; i < nbttaglist.size(); ++i) { - removeUnwantedEntityTagsRecursively(nbttaglist.getCompound(i)); - } - } - } - - @Override - public Component getRichBlockName(BlockType blockType) { - return TranslatableComponent.of(getBlockFromType(blockType).getDescriptionId()); - } - - @Override - public Component getRichItemName(ItemType itemType) { - return TranslatableComponent.of(getItemFromType(itemType).getDescriptionId()); - } - - @Override - public Component getRichItemName(BaseItemStack itemStack) { - return TranslatableComponent.of(CraftItemStack.asNMSCopy(BukkitAdapter.adapt(itemStack)).getDescriptionId()); - } - - @SuppressWarnings({ "unchecked", "rawtypes" }) - private static final LoadingCache> PROPERTY_CACHE = CacheBuilder.newBuilder().build(new CacheLoader>() { - @Override - public Property load(net.minecraft.world.level.block.state.properties.Property state) throws Exception { - if (state instanceof net.minecraft.world.level.block.state.properties.BooleanProperty) { - return new BooleanProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues())); - } else if (state instanceof DirectionProperty) { - return new DirectionalProperty(state.getName(), - (List) state.getPossibleValues().stream().map(e -> Direction.valueOf(((StringRepresentable) e).getSerializedName().toUpperCase(Locale.ROOT))).collect(Collectors.toList())); - } else if (state instanceof net.minecraft.world.level.block.state.properties.EnumProperty) { - return new EnumProperty(state.getName(), - (List) state.getPossibleValues().stream().map(e -> ((StringRepresentable) e).getSerializedName()).collect(Collectors.toList())); - } else if (state instanceof net.minecraft.world.level.block.state.properties.IntegerProperty) { - return new IntegerProperty(state.getName(), ImmutableList.copyOf(state.getPossibleValues())); - } else { - throw new IllegalArgumentException("WorldEdit needs an update to support " + state.getClass().getSimpleName()); - } - } - }); - - @SuppressWarnings({ "rawtypes" }) - @Override - public Map> getProperties(BlockType blockType) { - Map> properties = new TreeMap<>(); - Block block = getBlockFromType(blockType); - StateDefinition blockStateList = - block.getStateDefinition(); - for (net.minecraft.world.level.block.state.properties.Property state : blockStateList.getProperties()) { - Property property = PROPERTY_CACHE.getUnchecked(state); - properties.put(property.getName(), property); - } - return properties; - } - - @Override - public void sendFakeNBT(Player player, BlockVector3 pos, CompoundBinaryTag nbtData) { - ((CraftPlayer) player).getHandle().connection.send(ClientboundBlockEntityDataPacket.create( - new StructureBlockEntity( - new BlockPos(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()), - Blocks.STRUCTURE_BLOCK.defaultBlockState() - ), - __ -> (net.minecraft.nbt.CompoundTag) fromNativeBinary(nbtData) - )); - } - - @Override - public void sendFakeOP(Player player) { - ((CraftPlayer) player).getHandle().connection.send(new ClientboundEntityEventPacket( - ((CraftPlayer) player).getHandle(), (byte) 28 - )); - } - - @Override - public org.bukkit.inventory.ItemStack adapt(BaseItemStack item) { - ItemStack stack = new ItemStack( - DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM).get(ResourceLocation.tryParse(item.getType().getId())), - item.getAmount() - ); - stack.setTag(((net.minecraft.nbt.CompoundTag) fromNative(item.getNbtData()))); - return CraftItemStack.asCraftMirror(stack); - } - - @Override - public BaseItemStack adapt(org.bukkit.inventory.ItemStack itemStack) { - final ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - final BaseItemStack weStack = new BaseItemStack(BukkitAdapter.asItemType(itemStack.getType()), itemStack.getAmount()); - weStack.setNbt(((CompoundBinaryTag) toNativeBinary(nmsStack.getTag()))); - return weStack; - } - - private final LoadingCache fakePlayers - = CacheBuilder.newBuilder().weakKeys().softValues().build(CacheLoader.from(PaperweightFakePlayer::new)); - - @Override - public boolean simulateItemUse(org.bukkit.World world, BlockVector3 position, BaseItem item, Direction face) { - CraftWorld craftWorld = (CraftWorld) world; - ServerLevel worldServer = craftWorld.getHandle(); - ItemStack stack = CraftItemStack.asNMSCopy(BukkitAdapter.adapt(item instanceof BaseItemStack - ? ((BaseItemStack) item) : new BaseItemStack(item.getType(), item.getNbtData(), 1))); - stack.setTag((net.minecraft.nbt.CompoundTag) fromNative(item.getNbtData())); - - PaperweightFakePlayer fakePlayer; - try { - fakePlayer = fakePlayers.get(worldServer); - } catch (ExecutionException ignored) { - return false; - } - fakePlayer.setItemInHand(InteractionHand.MAIN_HAND, stack); - fakePlayer.absMoveTo(position.getBlockX(), position.getBlockY(), position.getBlockZ(), - (float) face.toVector().toYaw(), (float) face.toVector().toPitch()); - - final BlockPos blockPos = new BlockPos(position.getBlockX(), position.getBlockY(), position.getBlockZ()); - final Vec3 blockVec = Vec3.atLowerCornerOf(blockPos); - final net.minecraft.core.Direction enumFacing = adapt(face); - BlockHitResult rayTrace = new BlockHitResult(blockVec, enumFacing, blockPos, false); - UseOnContext context = new UseOnContext(fakePlayer, InteractionHand.MAIN_HAND, rayTrace); - InteractionResult result = stack.useOn(context, InteractionHand.MAIN_HAND); - if (result != InteractionResult.SUCCESS) { - if (worldServer.getBlockState(blockPos).use(worldServer, fakePlayer, InteractionHand.MAIN_HAND, rayTrace).consumesAction()) { - result = InteractionResult.SUCCESS; - } else { - result = stack.getItem().use(worldServer, fakePlayer, InteractionHand.MAIN_HAND).getResult(); - } - } - - return result == InteractionResult.SUCCESS; - } - - @Override - public boolean canPlaceAt(org.bukkit.World world, BlockVector3 position, BlockState blockState) { - int internalId = BlockStateIdAccess.getBlockStateId(blockState); - net.minecraft.world.level.block.state.BlockState blockData = Block.stateById(internalId); - return blockData.canSurvive(((CraftWorld) world).getHandle(), new BlockPos(position.getX(), position.getY(), position.getZ())); - } - - @Override - public boolean regenerate(org.bukkit.World bukkitWorld, Region region, Extent extent, RegenOptions options) { - try { - doRegen(bukkitWorld, region, extent, options); - } catch (Exception e) { - throw new IllegalStateException("Regen failed.", e); - } - - return true; - } - - private void doRegen(org.bukkit.World bukkitWorld, Region region, Extent extent, RegenOptions options) throws Exception { - Environment env = bukkitWorld.getEnvironment(); - ChunkGenerator gen = bukkitWorld.getGenerator(); - - Path tempDir = Files.createTempDirectory("WorldEditWorldGen"); - LevelStorageSource levelStorage = LevelStorageSource.createDefault(tempDir); - ResourceKey worldDimKey = getWorldDimKey(env); - try (LevelStorageSource.LevelStorageAccess session = levelStorage.createAccess("faweregentempworld", worldDimKey)) { - ServerLevel originalWorld = ((CraftWorld) bukkitWorld).getHandle(); - PrimaryLevelData levelProperties = (PrimaryLevelData) originalWorld.getServer() - .getWorldData().overworldData(); - WorldOptions originalOpts = levelProperties.worldGenOptions(); - - long seed = options.getSeed().orElse(originalWorld.getSeed()); - WorldOptions newOpts = options.getSeed().isPresent() - ? originalOpts.withSeed(OptionalLong.of(seed)) - : originalOpts; - - LevelSettings newWorldSettings = new LevelSettings( - "faweregentempworld", - levelProperties.settings.gameType(), - levelProperties.settings.hardcore(), - levelProperties.settings.difficulty(), - levelProperties.settings.allowCommands(), - levelProperties.settings.gameRules(), - levelProperties.settings.getDataConfiguration() - ); - - PrimaryLevelData.SpecialWorldProperty specialWorldProperty = - levelProperties.isFlatWorld() - ? PrimaryLevelData.SpecialWorldProperty.FLAT - : levelProperties.isDebugWorld() - ? PrimaryLevelData.SpecialWorldProperty.DEBUG - : PrimaryLevelData.SpecialWorldProperty.NONE; - - PrimaryLevelData newWorldData = new PrimaryLevelData(newWorldSettings, newOpts, specialWorldProperty, Lifecycle.stable()); - - ServerLevel freshWorld = new ServerLevel( - originalWorld.getServer(), - originalWorld.getServer().executor, - session, newWorldData, - originalWorld.dimension(), - new LevelStem( - originalWorld.dimensionTypeRegistration(), - originalWorld.getChunkSource().getGenerator() - ), - new NoOpWorldLoadListener(), - originalWorld.isDebug(), - seed, - ImmutableList.of(), - false, - env, - gen, - bukkitWorld.getBiomeProvider() - ); - try { - regenForWorld(region, extent, freshWorld, options); - } finally { - freshWorld.getChunkSource().close(false); - } - } finally { - try { - @SuppressWarnings("unchecked") - Map map = (Map) serverWorldsField.get(Bukkit.getServer()); - map.remove("faweregentempworld"); - } catch (IllegalAccessException ignored) { - } - SafeFiles.tryHardToDeleteDir(tempDir); - } - } - - private BiomeType adapt(ServerLevel serverWorld, Biome origBiome) { - ResourceLocation key = serverWorld.registryAccess().registryOrThrow(Registries.BIOME).getKey(origBiome); - if (key == null) { - return null; - } - return BiomeTypes.get(key.toString()); - } - - @SuppressWarnings("unchecked") - private void regenForWorld(Region region, Extent extent, ServerLevel serverWorld, RegenOptions options) throws WorldEditException { - List> chunkLoadings = submitChunkLoadTasks(region, serverWorld); - BlockableEventLoop executor; - try { - executor = (BlockableEventLoop) chunkProviderExecutorField.get(serverWorld.getChunkSource()); - } catch (IllegalAccessException e) { - throw new IllegalStateException("Couldn't get executor for chunk loading.", e); - } - executor.managedBlock(() -> { - // bail out early if a future fails - if (chunkLoadings.stream().anyMatch(ftr -> - ftr.isDone() && Futures.getUnchecked(ftr) == null - )) { - return false; - } - return chunkLoadings.stream().allMatch(CompletableFuture::isDone); - }); - Map chunks = new HashMap<>(); - for (CompletableFuture future : chunkLoadings) { - @Nullable - ChunkAccess chunk = future.getNow(null); - checkState(chunk != null, "Failed to generate a chunk, regen failed."); - chunks.put(chunk.getPos(), chunk); - } - - for (BlockVector3 vec : region) { - BlockPos pos = new BlockPos(vec.getBlockX(), vec.getBlockY(), vec.getBlockZ()); - ChunkAccess chunk = chunks.get(new ChunkPos(pos)); - final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(pos); - int internalId = Block.getId(blockData); - BlockStateHolder state = BlockStateIdAccess.getBlockStateById(internalId); - Objects.requireNonNull(state); - BlockEntity blockEntity = chunk.getBlockEntity(pos); - if (blockEntity != null) { - net.minecraft.nbt.CompoundTag tag = blockEntity.saveWithId(); - state = state.toBaseBlock(((CompoundBinaryTag) toNativeBinary(tag))); - } - extent.setBlock(vec, state.toBaseBlock()); - if (options.shouldRegenBiomes()) { - Biome origBiome = chunk.getNoiseBiome(vec.getX(), vec.getY(), vec.getZ()).value(); - BiomeType adaptedBiome = adapt(serverWorld, origBiome); - if (adaptedBiome != null) { - extent.setBiome(vec, adaptedBiome); - } - } - } - } - - @SuppressWarnings("unchecked") - private List> submitChunkLoadTasks(Region region, ServerLevel serverWorld) { - ServerChunkCache chunkManager = serverWorld.getChunkSource(); - List> chunkLoadings = new ArrayList<>(); - // Pre-gen all the chunks - for (BlockVector2 chunk : region.getChunks()) { - try { - //noinspection unchecked - chunkLoadings.add( - ((CompletableFuture>) - getChunkFutureMethod.invoke(chunkManager, chunk.getX(), chunk.getZ(), ChunkStatus.FEATURES, true)) - .thenApply(either -> either.left().orElse(null)) - ); - } catch (IllegalAccessException | InvocationTargetException e) { - throw new IllegalStateException("Couldn't load chunk for regen.", e); - } - } - return chunkLoadings; - } - - private ResourceKey getWorldDimKey(Environment env) { - switch (env) { - case NETHER: - return LevelStem.NETHER; - case THE_END: - return LevelStem.END; - case NORMAL: - default: - return LevelStem.OVERWORLD; - } - } - - private static final Set SUPPORTED_SIDE_EFFECTS = Sets.immutableEnumSet( - SideEffect.NEIGHBORS, - SideEffect.LIGHTING, - SideEffect.VALIDATION, - SideEffect.ENTITY_AI, - SideEffect.EVENTS, - SideEffect.UPDATE - ); - - @Override - public Set getSupportedSideEffects() { - return SUPPORTED_SIDE_EFFECTS; - } - - @Override - public boolean clearContainerBlockContents(org.bukkit.World world, BlockVector3 pt) { - ServerLevel originalWorld = ((CraftWorld) world).getHandle(); - - BlockEntity entity = originalWorld.getBlockEntity(new BlockPos(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ())); - if (entity instanceof Clearable) { - ((Clearable) entity).clearContent(); - return true; - } - return false; - } - - // ------------------------------------------------------------------------ - // Code that is less likely to break - // ------------------------------------------------------------------------ - - /** - * Converts from a non-native NMS NBT structure to a native WorldEdit NBT - * structure. - * - * @param foreign non-native NMS NBT structure - * @return native WorldEdit NBT structure - */ - @Override - public BinaryTag toNativeBinary(net.minecraft.nbt.Tag foreign) { - if (foreign == null) { - return null; - } - if (foreign instanceof net.minecraft.nbt.CompoundTag) { - Map values = new HashMap<>(); - Set foreignKeys = ((net.minecraft.nbt.CompoundTag) foreign).getAllKeys(); - - for (String str : foreignKeys) { - net.minecraft.nbt.Tag base = ((net.minecraft.nbt.CompoundTag) foreign).get(str); - values.put(str, toNativeBinary(base)); - } - return CompoundBinaryTag.from(values); - } else if (foreign instanceof net.minecraft.nbt.ByteTag) { - return ByteBinaryTag.of(((net.minecraft.nbt.ByteTag) foreign).getAsByte()); - } else if (foreign instanceof net.minecraft.nbt.ByteArrayTag) { - return ByteArrayBinaryTag.of(((net.minecraft.nbt.ByteArrayTag) foreign).getAsByteArray()); - } else if (foreign instanceof net.minecraft.nbt.DoubleTag) { - return DoubleBinaryTag.of(((net.minecraft.nbt.DoubleTag) foreign).getAsDouble()); - } else if (foreign instanceof net.minecraft.nbt.FloatTag) { - return FloatBinaryTag.of(((net.minecraft.nbt.FloatTag) foreign).getAsFloat()); - } else if (foreign instanceof net.minecraft.nbt.IntTag) { - return IntBinaryTag.of(((net.minecraft.nbt.IntTag) foreign).getAsInt()); - } else if (foreign instanceof net.minecraft.nbt.IntArrayTag) { - return IntArrayBinaryTag.of(((net.minecraft.nbt.IntArrayTag) foreign).getAsIntArray()); - } else if (foreign instanceof net.minecraft.nbt.LongArrayTag) { - return LongArrayBinaryTag.of(((net.minecraft.nbt.LongArrayTag) foreign).getAsLongArray()); - } else if (foreign instanceof net.minecraft.nbt.ListTag) { - try { - return toNativeList((net.minecraft.nbt.ListTag) foreign); - } catch (Throwable e) { - LOGGER.log(Level.WARNING, "Failed to convert net.minecraft.nbt.ListTag", e); - return ListBinaryTag.empty(); - } - } else if (foreign instanceof net.minecraft.nbt.LongTag) { - return LongBinaryTag.of(((net.minecraft.nbt.LongTag) foreign).getAsLong()); - } else if (foreign instanceof net.minecraft.nbt.ShortTag) { - return ShortBinaryTag.of(((net.minecraft.nbt.ShortTag) foreign).getAsShort()); - } else if (foreign instanceof net.minecraft.nbt.StringTag) { - return StringBinaryTag.of(foreign.getAsString()); - } else if (foreign instanceof net.minecraft.nbt.EndTag) { - return EndBinaryTag.get(); - } else { - throw new IllegalArgumentException("Don't know how to make native " + foreign.getClass().getCanonicalName()); - } - } - - /** - * Convert a foreign NBT list tag into a native WorldEdit one. - * - * @param foreign the foreign tag - * @return the converted tag - * @throws SecurityException on error - * @throws IllegalArgumentException on error - */ - private ListBinaryTag toNativeList(net.minecraft.nbt.ListTag foreign) throws SecurityException, IllegalArgumentException { - ListBinaryTag.Builder values = ListBinaryTag.builder(); - - for (net.minecraft.nbt.Tag tag : foreign) { - values.add(toNativeBinary(tag)); - } - - return values.build(); - } - - /** - * Converts a WorldEdit-native NBT structure to a NMS structure. - * - * @param foreign structure to convert - * @return non-native structure - */ - @Override - public net.minecraft.nbt.Tag fromNativeBinary(BinaryTag foreign) { - if (foreign == null) { - return null; - } - if (foreign instanceof CompoundBinaryTag) { - net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag(); - for (String key : ((CompoundBinaryTag) foreign).keySet()) { - tag.put(key, fromNativeBinary(((CompoundBinaryTag) foreign).get(key))); - } - return tag; - } else if (foreign instanceof ByteBinaryTag) { - return net.minecraft.nbt.ByteTag.valueOf(((ByteBinaryTag) foreign).value()); - } else if (foreign instanceof ByteArrayBinaryTag) { - return new net.minecraft.nbt.ByteArrayTag(((ByteArrayBinaryTag) foreign).value()); - } else if (foreign instanceof DoubleBinaryTag) { - return net.minecraft.nbt.DoubleTag.valueOf(((DoubleBinaryTag) foreign).value()); - } else if (foreign instanceof FloatBinaryTag) { - return net.minecraft.nbt.FloatTag.valueOf(((FloatBinaryTag) foreign).value()); - } else if (foreign instanceof IntBinaryTag) { - return net.minecraft.nbt.IntTag.valueOf(((IntBinaryTag) foreign).value()); - } else if (foreign instanceof IntArrayBinaryTag) { - return new net.minecraft.nbt.IntArrayTag(((IntArrayBinaryTag) foreign).value()); - } else if (foreign instanceof LongArrayBinaryTag) { - return new net.minecraft.nbt.LongArrayTag(((LongArrayBinaryTag) foreign).value()); - } else if (foreign instanceof ListBinaryTag) { - net.minecraft.nbt.ListTag tag = new net.minecraft.nbt.ListTag(); - ListBinaryTag foreignList = (ListBinaryTag) foreign; - for (BinaryTag t : foreignList) { - tag.add(fromNativeBinary(t)); - } - return tag; - } else if (foreign instanceof LongBinaryTag) { - return net.minecraft.nbt.LongTag.valueOf(((LongBinaryTag) foreign).value()); - } else if (foreign instanceof ShortBinaryTag) { - return net.minecraft.nbt.ShortTag.valueOf(((ShortBinaryTag) foreign).value()); - } else if (foreign instanceof StringBinaryTag) { - return net.minecraft.nbt.StringTag.valueOf(((StringBinaryTag) foreign).value()); - } else if (foreign instanceof EndBinaryTag) { - return net.minecraft.nbt.EndTag.INSTANCE; - } else { - throw new IllegalArgumentException("Don't know how to make NMS " + foreign.getClass().getCanonicalName()); - } - } - - @Override - public boolean supportsWatchdog() { - return watchdog != null; - } - - @Override - public void tickWatchdog() { - watchdog.tick(); - } - - private class SpigotWatchdog implements Watchdog { - private final Field instanceField; - private final Field lastTickField; - - SpigotWatchdog() throws NoSuchFieldException { - Field instanceField = WatchdogThread.class.getDeclaredField("instance"); - instanceField.setAccessible(true); - this.instanceField = instanceField; - - Field lastTickField = WatchdogThread.class.getDeclaredField("lastTick"); - lastTickField.setAccessible(true); - this.lastTickField = lastTickField; - } - - @Override - public void tick() { - try { - WatchdogThread instance = (WatchdogThread) this.instanceField.get(null); - if ((long) lastTickField.get(instance) != 0) { - WatchdogThread.tick(); - } - } catch (IllegalAccessException e) { - LOGGER.log(Level.WARNING, "Failed to tick watchdog", e); - } - } - } - - private static class MojangWatchdog implements Watchdog { - private final DedicatedServer server; - private final Field tickField; - - MojangWatchdog(DedicatedServer server) throws NoSuchFieldException { - this.server = server; - Field tickField = MinecraftServer.class.getDeclaredField( - Refraction.pickName("nextTickTime", "ag") - ); - if (tickField.getType() != long.class) { - throw new IllegalStateException("nextTickTime is not a long field, mapping is likely incorrect"); - } - tickField.setAccessible(true); - this.tickField = tickField; - } - - @Override - public void tick() { - try { - tickField.set(server, Util.getMillis()); - } catch (IllegalAccessException ignored) { - } - } - } - - private static class NoOpWorldLoadListener implements ChunkProgressListener { - @Override - public void updateSpawnPos(ChunkPos spawnPos) { - } - - @Override - public void onStatusChange(ChunkPos pos, @org.jetbrains.annotations.Nullable ChunkStatus status) { - } - - @Override - public void start() { - } - - @Override - public void stop() { - } - - @Override - public void setChunkRadius(int radius) { - } - } -} diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R2/PaperweightDataConverters.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R2/PaperweightDataConverters.java deleted file mode 100644 index 7e735efdb..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R2/PaperweightDataConverters.java +++ /dev/null @@ -1,2800 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_19_R2; - -import com.google.common.collect.Lists; -import com.google.common.collect.Maps; -import com.google.common.collect.Sets; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonArray; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; -import com.mojang.datafixers.DSL.TypeReference; -import com.mojang.datafixers.DataFixer; -import com.mojang.datafixers.DataFixerBuilder; -import com.mojang.datafixers.schemas.Schema; -import com.mojang.serialization.Dynamic; -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; -import net.minecraft.core.Direction; -import net.minecraft.nbt.NbtOps; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.GsonHelper; -import net.minecraft.util.StringUtil; -import net.minecraft.util.datafix.DataFixers; -import net.minecraft.util.datafix.fixes.References; -import net.minecraft.world.item.DyeColor; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.lang.reflect.Type; -import java.util.ArrayList; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Random; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.Executor; -import java.util.stream.Collectors; -import javax.annotation.Nullable; - -/** - * Handles converting all Pre 1.13.2 data using the Legacy DataFix System (ported to 1.13.2) - * - * We register a DFU Fixer per Legacy Data Version and apply the fixes using legacy strategy - * which is safer, faster and cleaner code. - * - * The pre DFU code did not fail when the Source version was unknown. - * - * This class also provides util methods for converting compounds to wrap the update call to - * receive the source version in the compound - */ -@SuppressWarnings({ "rawtypes", "unchecked" }) -class PaperweightDataConverters extends DataFixerBuilder implements com.sk89q.worldedit.world.DataFixer { - - //FAWE start - BinaryTag - @SuppressWarnings("unchecked") - @Override - public T fixUp(FixType type, T original, int srcVer) { - if (type == FixTypes.CHUNK) { - return (T) fixChunk((CompoundBinaryTag) original, srcVer); - } else if (type == FixTypes.BLOCK_ENTITY) { - return (T) fixBlockEntity((CompoundBinaryTag) original, srcVer); - } else if (type == FixTypes.ENTITY) { - return (T) fixEntity((CompoundBinaryTag) original, srcVer); - } else if (type == FixTypes.BLOCK_STATE) { - return (T) fixBlockState((String) original, srcVer); - } else if (type == FixTypes.ITEM_TYPE) { - return (T) fixItemType((String) original, srcVer); - } else if (type == FixTypes.BIOME) { - return (T) fixBiome((String) original, srcVer); - } - return original; - } - - private CompoundBinaryTag fixChunk(CompoundBinaryTag originalChunk, int srcVer) { - net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNativeBinary(originalChunk); - net.minecraft.nbt.CompoundTag fixed = convert(LegacyType.CHUNK, tag, srcVer); - return (CompoundBinaryTag) adapter.toNativeBinary(fixed); - } - - private CompoundBinaryTag fixBlockEntity(CompoundBinaryTag origTileEnt, int srcVer) { - net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNativeBinary(origTileEnt); - net.minecraft.nbt.CompoundTag fixed = convert(LegacyType.BLOCK_ENTITY, tag, srcVer); - return (CompoundBinaryTag) adapter.toNativeBinary(fixed); - } - - private CompoundBinaryTag fixEntity(CompoundBinaryTag origEnt, int srcVer) { - net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNativeBinary(origEnt); - net.minecraft.nbt.CompoundTag fixed = convert(LegacyType.ENTITY, tag, srcVer); - return (CompoundBinaryTag) adapter.toNativeBinary(fixed); - } - //FAWE end - - private String fixBlockState(String blockState, int srcVer) { - net.minecraft.nbt.CompoundTag stateNBT = stateToNBT(blockState); - Dynamic dynamic = new Dynamic<>(OPS_NBT, stateNBT); - net.minecraft.nbt.CompoundTag fixed = (net.minecraft.nbt.CompoundTag) INSTANCE.fixer.update(References.BLOCK_STATE, dynamic, srcVer, DATA_VERSION).getValue(); - return nbtToState(fixed); - } - - private String nbtToState(net.minecraft.nbt.CompoundTag tagCompound) { - StringBuilder sb = new StringBuilder(); - sb.append(tagCompound.getString("Name")); - if (tagCompound.contains("Properties", 10)) { - sb.append('['); - net.minecraft.nbt.CompoundTag props = tagCompound.getCompound("Properties"); - sb.append(props.getAllKeys().stream().map(k -> k + "=" + props.getString(k).replace("\"", "")).collect(Collectors.joining(","))); - sb.append(']'); - } - return sb.toString(); - } - - private static net.minecraft.nbt.CompoundTag stateToNBT(String blockState) { - int propIdx = blockState.indexOf('['); - net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag(); - if (propIdx < 0) { - tag.putString("Name", blockState); - } else { - tag.putString("Name", blockState.substring(0, propIdx)); - net.minecraft.nbt.CompoundTag propTag = new net.minecraft.nbt.CompoundTag(); - String props = blockState.substring(propIdx + 1, blockState.length() - 1); - String[] propArr = props.split(","); - for (String pair : propArr) { - final String[] split = pair.split("="); - propTag.putString(split[0], split[1]); - } - tag.put("Properties", propTag); - } - return tag; - } - - private String fixBiome(String key, int srcVer) { - return fixName(key, srcVer, References.BIOME); - } - - private String fixItemType(String key, int srcVer) { - return fixName(key, srcVer, References.ITEM_NAME); - } - - private static String fixName(String key, int srcVer, TypeReference type) { - return INSTANCE.fixer.update(type, new Dynamic<>(OPS_NBT, net.minecraft.nbt.StringTag.valueOf(key)), srcVer, DATA_VERSION) - .getValue().getAsString(); - } - - private final PaperweightAdapter adapter; - - private static final NbtOps OPS_NBT = NbtOps.INSTANCE; - private static final int LEGACY_VERSION = 1343; - private static int DATA_VERSION; - static PaperweightDataConverters INSTANCE; - - private final Map> converters = new EnumMap<>(LegacyType.class); - private final Map> inspectors = new EnumMap<>(LegacyType.class); - - // Set on build - private DataFixer fixer; - private static final Map DFU_TO_LEGACY = new HashMap<>(); - - public enum LegacyType { - LEVEL(References.LEVEL), - PLAYER(References.PLAYER), - CHUNK(References.CHUNK), - BLOCK_ENTITY(References.BLOCK_ENTITY), - ENTITY(References.ENTITY), - ITEM_INSTANCE(References.ITEM_STACK), - OPTIONS(References.OPTIONS), - STRUCTURE(References.STRUCTURE); - - private final TypeReference type; - - LegacyType(TypeReference type) { - this.type = type; - DFU_TO_LEGACY.put(type.typeName(), this); - } - - public TypeReference getDFUType() { - return type; - } - } - - PaperweightDataConverters(int dataVersion, PaperweightAdapter adapter) { - super(dataVersion); - DATA_VERSION = dataVersion; - INSTANCE = this; - this.adapter = adapter; - registerConverters(); - registerInspectors(); - } - - - // Called after fixers are built and ready for FIXING - @Override - public DataFixer buildUnoptimized() { - return this.fixer = new WrappedDataFixer(DataFixers.getDataFixer()); - } - - @Override - public DataFixer buildOptimized(Executor executor) { - return buildUnoptimized(); - } - - @SuppressWarnings("unchecked") - private class WrappedDataFixer implements DataFixer { - private final DataFixer realFixer; - - WrappedDataFixer(DataFixer realFixer) { - this.realFixer = realFixer; - } - - @Override - public Dynamic update(TypeReference type, Dynamic dynamic, int sourceVer, int targetVer) { - LegacyType legacyType = DFU_TO_LEGACY.get(type.typeName()); - if (sourceVer < LEGACY_VERSION && legacyType != null) { - net.minecraft.nbt.CompoundTag cmp = (net.minecraft.nbt.CompoundTag) dynamic.getValue(); - int desiredVersion = Math.min(targetVer, LEGACY_VERSION); - - cmp = convert(legacyType, cmp, sourceVer, desiredVersion); - sourceVer = desiredVersion; - dynamic = new Dynamic(OPS_NBT, cmp); - } - return realFixer.update(type, dynamic, sourceVer, targetVer); - } - - private net.minecraft.nbt.CompoundTag convert(LegacyType type, net.minecraft.nbt.CompoundTag cmp, int sourceVer, int desiredVersion) { - List converters = PaperweightDataConverters.this.converters.get(type); - if (converters != null && !converters.isEmpty()) { - for (DataConverter converter : converters) { - int dataVersion = converter.getDataVersion(); - if (dataVersion > sourceVer && dataVersion <= desiredVersion) { - cmp = converter.convert(cmp); - } - } - } - - List inspectors = PaperweightDataConverters.this.inspectors.get(type); - if (inspectors != null && !inspectors.isEmpty()) { - for (DataInspector inspector : inspectors) { - cmp = inspector.inspect(cmp, sourceVer, desiredVersion); - } - } - - return cmp; - } - - @Override - public Schema getSchema(int i) { - return realFixer.getSchema(i); - } - } - - public static net.minecraft.nbt.CompoundTag convert(LegacyType type, net.minecraft.nbt.CompoundTag cmp) { - return convert(type.getDFUType(), cmp); - } - - public static net.minecraft.nbt.CompoundTag convert(LegacyType type, net.minecraft.nbt.CompoundTag cmp, int sourceVer) { - return convert(type.getDFUType(), cmp, sourceVer); - } - - public static net.minecraft.nbt.CompoundTag convert(LegacyType type, net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - return convert(type.getDFUType(), cmp, sourceVer, targetVer); - } - - public static net.minecraft.nbt.CompoundTag convert(TypeReference type, net.minecraft.nbt.CompoundTag cmp) { - int i = cmp.contains("DataVersion", 99) ? cmp.getInt("DataVersion") : -1; - return convert(type, cmp, i); - } - - public static net.minecraft.nbt.CompoundTag convert(TypeReference type, net.minecraft.nbt.CompoundTag cmp, int sourceVer) { - return convert(type, cmp, sourceVer, DATA_VERSION); - } - - public static net.minecraft.nbt.CompoundTag convert(TypeReference type, net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (sourceVer >= targetVer) { - return cmp; - } - return (net.minecraft.nbt.CompoundTag) INSTANCE.fixer.update(type, new Dynamic<>(OPS_NBT, cmp), sourceVer, targetVer).getValue(); - } - - - public interface DataInspector { - net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer); - } - - public interface DataConverter { - - int getDataVersion(); - - net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp); - } - - - private void registerInspector(LegacyType type, DataInspector inspector) { - this.inspectors.computeIfAbsent(type, k -> new ArrayList<>()).add(inspector); - } - - private void registerConverter(LegacyType type, DataConverter converter) { - int version = converter.getDataVersion(); - - List list = this.converters.computeIfAbsent(type, k -> new ArrayList<>()); - if (!list.isEmpty() && list.get(list.size() - 1).getDataVersion() > version) { - for (int j = 0; j < list.size(); ++j) { - if (list.get(j).getDataVersion() > version) { - list.add(j, converter); - break; - } - } - } else { - list.add(converter); - } - } - - private void registerInspectors() { - registerEntityItemList("EntityHorseDonkey", "SaddleItem", "Items"); - registerEntityItemList("EntityHorseMule", "Items"); - registerEntityItemList("EntityMinecartChest", "Items"); - registerEntityItemList("EntityMinecartHopper", "Items"); - registerEntityItemList("EntityVillager", "Inventory"); - registerEntityItemListEquipment("EntityArmorStand"); - registerEntityItemListEquipment("EntityBat"); - registerEntityItemListEquipment("EntityBlaze"); - registerEntityItemListEquipment("EntityCaveSpider"); - registerEntityItemListEquipment("EntityChicken"); - registerEntityItemListEquipment("EntityCow"); - registerEntityItemListEquipment("EntityCreeper"); - registerEntityItemListEquipment("EntityEnderDragon"); - registerEntityItemListEquipment("EntityEnderman"); - registerEntityItemListEquipment("EntityEndermite"); - registerEntityItemListEquipment("EntityEvoker"); - registerEntityItemListEquipment("EntityGhast"); - registerEntityItemListEquipment("EntityGiantZombie"); - registerEntityItemListEquipment("EntityGuardian"); - registerEntityItemListEquipment("EntityGuardianElder"); - registerEntityItemListEquipment("EntityHorse"); - registerEntityItemListEquipment("EntityHorseDonkey"); - registerEntityItemListEquipment("EntityHorseMule"); - registerEntityItemListEquipment("EntityHorseSkeleton"); - registerEntityItemListEquipment("EntityHorseZombie"); - registerEntityItemListEquipment("EntityIronGolem"); - registerEntityItemListEquipment("EntityMagmaCube"); - registerEntityItemListEquipment("EntityMushroomCow"); - registerEntityItemListEquipment("EntityOcelot"); - registerEntityItemListEquipment("EntityPig"); - registerEntityItemListEquipment("EntityPigZombie"); - registerEntityItemListEquipment("EntityRabbit"); - registerEntityItemListEquipment("EntitySheep"); - registerEntityItemListEquipment("EntityShulker"); - registerEntityItemListEquipment("EntitySilverfish"); - registerEntityItemListEquipment("EntitySkeleton"); - registerEntityItemListEquipment("EntitySkeletonStray"); - registerEntityItemListEquipment("EntitySkeletonWither"); - registerEntityItemListEquipment("EntitySlime"); - registerEntityItemListEquipment("EntitySnowman"); - registerEntityItemListEquipment("EntitySpider"); - registerEntityItemListEquipment("EntitySquid"); - registerEntityItemListEquipment("EntityVex"); - registerEntityItemListEquipment("EntityVillager"); - registerEntityItemListEquipment("EntityVindicator"); - registerEntityItemListEquipment("EntityWitch"); - registerEntityItemListEquipment("EntityWither"); - registerEntityItemListEquipment("EntityWolf"); - registerEntityItemListEquipment("EntityZombie"); - registerEntityItemListEquipment("EntityZombieHusk"); - registerEntityItemListEquipment("EntityZombieVillager"); - registerEntityItemSingle("EntityFireworks", "FireworksItem"); - registerEntityItemSingle("EntityHorse", "ArmorItem"); - registerEntityItemSingle("EntityHorse", "SaddleItem"); - registerEntityItemSingle("EntityHorseMule", "SaddleItem"); - registerEntityItemSingle("EntityHorseSkeleton", "SaddleItem"); - registerEntityItemSingle("EntityHorseZombie", "SaddleItem"); - registerEntityItemSingle("EntityItem", "Item"); - registerEntityItemSingle("EntityItemFrame", "Item"); - registerEntityItemSingle("EntityPotion", "Potion"); - - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItem("TileEntityRecordPlayer", "RecordItem")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityBrewingStand", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityChest", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityDispenser", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityDropper", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityFurnace", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityHopper", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorItemList("TileEntityShulkerBox", "Items")); - registerInspector(LegacyType.BLOCK_ENTITY, new DataInspectorMobSpawnerMobs()); - registerInspector(LegacyType.CHUNK, new DataInspectorChunks()); - registerInspector(LegacyType.ENTITY, new DataInspectorCommandBlock()); - registerInspector(LegacyType.ENTITY, new DataInspectorEntityPassengers()); - registerInspector(LegacyType.ENTITY, new DataInspectorMobSpawnerMinecart()); - registerInspector(LegacyType.ENTITY, new DataInspectorVillagers()); - registerInspector(LegacyType.ITEM_INSTANCE, new DataInspectorBlockEntity()); - registerInspector(LegacyType.ITEM_INSTANCE, new DataInspectorEntity()); - registerInspector(LegacyType.LEVEL, new DataInspectorLevelPlayer()); - registerInspector(LegacyType.PLAYER, new DataInspectorPlayer()); - registerInspector(LegacyType.PLAYER, new DataInspectorPlayerVehicle()); - registerInspector(LegacyType.STRUCTURE, new DataInspectorStructure()); - } - - private void registerConverters() { - registerConverter(LegacyType.ENTITY, new DataConverterEquipment()); - registerConverter(LegacyType.BLOCK_ENTITY, new DataConverterSignText()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterMaterialId()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterPotionId()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterSpawnEgg()); - registerConverter(LegacyType.ENTITY, new DataConverterMinecart()); - registerConverter(LegacyType.BLOCK_ENTITY, new DataConverterMobSpawner()); - registerConverter(LegacyType.ENTITY, new DataConverterUUID()); - registerConverter(LegacyType.ENTITY, new DataConverterHealth()); - registerConverter(LegacyType.ENTITY, new DataConverterSaddle()); - registerConverter(LegacyType.ENTITY, new DataConverterHanging()); - registerConverter(LegacyType.ENTITY, new DataConverterDropChances()); - registerConverter(LegacyType.ENTITY, new DataConverterRiding()); - registerConverter(LegacyType.ENTITY, new DataConverterArmorStand()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterBook()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterCookedFish()); - registerConverter(LegacyType.ENTITY, new DataConverterZombie()); - registerConverter(LegacyType.OPTIONS, new DataConverterVBO()); - registerConverter(LegacyType.ENTITY, new DataConverterGuardian()); - registerConverter(LegacyType.ENTITY, new DataConverterSkeleton()); - registerConverter(LegacyType.ENTITY, new DataConverterZombieType()); - registerConverter(LegacyType.ENTITY, new DataConverterHorse()); - registerConverter(LegacyType.BLOCK_ENTITY, new DataConverterTileEntity()); - registerConverter(LegacyType.ENTITY, new DataConverterEntity()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterBanner()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterPotionWater()); - registerConverter(LegacyType.ENTITY, new DataConverterShulker()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterShulkerBoxItem()); - registerConverter(LegacyType.BLOCK_ENTITY, new DataConverterShulkerBoxBlock()); - registerConverter(LegacyType.OPTIONS, new DataConverterLang()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterTotem()); - registerConverter(LegacyType.CHUNK, new DataConverterBedBlock()); - registerConverter(LegacyType.ITEM_INSTANCE, new DataConverterBedItem()); - } - - private void registerEntityItemList(String type, String... keys) { - registerInspector(LegacyType.ENTITY, new DataInspectorItemList(type, keys)); - } - - private void registerEntityItemSingle(String type, String key) { - registerInspector(LegacyType.ENTITY, new DataInspectorItem(type, key)); - } - - private void registerEntityItemListEquipment(String type) { - registerEntityItemList(type, "ArmorItems", "HandItems"); - } - - private static final Map OLD_ID_TO_KEY_MAP = new HashMap<>(); - - static { - final Map map = OLD_ID_TO_KEY_MAP; - map.put("EntityItem", new ResourceLocation("item")); - map.put("EntityExperienceOrb", new ResourceLocation("xp_orb")); - map.put("EntityAreaEffectCloud", new ResourceLocation("area_effect_cloud")); - map.put("EntityGuardianElder", new ResourceLocation("elder_guardian")); - map.put("EntitySkeletonWither", new ResourceLocation("wither_skeleton")); - map.put("EntitySkeletonStray", new ResourceLocation("stray")); - map.put("EntityEgg", new ResourceLocation("egg")); - map.put("EntityLeash", new ResourceLocation("leash_knot")); - map.put("EntityPainting", new ResourceLocation("painting")); - map.put("EntityTippedArrow", new ResourceLocation("arrow")); - map.put("EntitySnowball", new ResourceLocation("snowball")); - map.put("EntityLargeFireball", new ResourceLocation("fireball")); - map.put("EntitySmallFireball", new ResourceLocation("small_fireball")); - map.put("EntityEnderPearl", new ResourceLocation("ender_pearl")); - map.put("EntityEnderSignal", new ResourceLocation("eye_of_ender_signal")); - map.put("EntityPotion", new ResourceLocation("potion")); - map.put("EntityThrownExpBottle", new ResourceLocation("xp_bottle")); - map.put("EntityItemFrame", new ResourceLocation("item_frame")); - map.put("EntityWitherSkull", new ResourceLocation("wither_skull")); - map.put("EntityTNTPrimed", new ResourceLocation("tnt")); - map.put("EntityFallingBlock", new ResourceLocation("falling_block")); - map.put("EntityFireworks", new ResourceLocation("fireworks_rocket")); - map.put("EntityZombieHusk", new ResourceLocation("husk")); - map.put("EntitySpectralArrow", new ResourceLocation("spectral_arrow")); - map.put("EntityShulkerBullet", new ResourceLocation("shulker_bullet")); - map.put("EntityDragonFireball", new ResourceLocation("dragon_fireball")); - map.put("EntityZombieVillager", new ResourceLocation("zombie_villager")); - map.put("EntityHorseSkeleton", new ResourceLocation("skeleton_horse")); - map.put("EntityHorseZombie", new ResourceLocation("zombie_horse")); - map.put("EntityArmorStand", new ResourceLocation("armor_stand")); - map.put("EntityHorseDonkey", new ResourceLocation("donkey")); - map.put("EntityHorseMule", new ResourceLocation("mule")); - map.put("EntityEvokerFangs", new ResourceLocation("evocation_fangs")); - map.put("EntityEvoker", new ResourceLocation("evocation_illager")); - map.put("EntityVex", new ResourceLocation("vex")); - map.put("EntityVindicator", new ResourceLocation("vindication_illager")); - map.put("EntityIllagerIllusioner", new ResourceLocation("illusion_illager")); - map.put("EntityMinecartCommandBlock", new ResourceLocation("commandblock_minecart")); - map.put("EntityBoat", new ResourceLocation("boat")); - map.put("EntityMinecartRideable", new ResourceLocation("minecart")); - map.put("EntityMinecartChest", new ResourceLocation("chest_minecart")); - map.put("EntityMinecartFurnace", new ResourceLocation("furnace_minecart")); - map.put("EntityMinecartTNT", new ResourceLocation("tnt_minecart")); - map.put("EntityMinecartHopper", new ResourceLocation("hopper_minecart")); - map.put("EntityMinecartMobSpawner", new ResourceLocation("spawner_minecart")); - map.put("EntityCreeper", new ResourceLocation("creeper")); - map.put("EntitySkeleton", new ResourceLocation("skeleton")); - map.put("EntitySpider", new ResourceLocation("spider")); - map.put("EntityGiantZombie", new ResourceLocation("giant")); - map.put("EntityZombie", new ResourceLocation("zombie")); - map.put("EntitySlime", new ResourceLocation("slime")); - map.put("EntityGhast", new ResourceLocation("ghast")); - map.put("EntityPigZombie", new ResourceLocation("zombie_pigman")); - map.put("EntityEnderman", new ResourceLocation("enderman")); - map.put("EntityCaveSpider", new ResourceLocation("cave_spider")); - map.put("EntitySilverfish", new ResourceLocation("silverfish")); - map.put("EntityBlaze", new ResourceLocation("blaze")); - map.put("EntityMagmaCube", new ResourceLocation("magma_cube")); - map.put("EntityEnderDragon", new ResourceLocation("ender_dragon")); - map.put("EntityWither", new ResourceLocation("wither")); - map.put("EntityBat", new ResourceLocation("bat")); - map.put("EntityWitch", new ResourceLocation("witch")); - map.put("EntityEndermite", new ResourceLocation("endermite")); - map.put("EntityGuardian", new ResourceLocation("guardian")); - map.put("EntityShulker", new ResourceLocation("shulker")); - map.put("EntityPig", new ResourceLocation("pig")); - map.put("EntitySheep", new ResourceLocation("sheep")); - map.put("EntityCow", new ResourceLocation("cow")); - map.put("EntityChicken", new ResourceLocation("chicken")); - map.put("EntitySquid", new ResourceLocation("squid")); - map.put("EntityWolf", new ResourceLocation("wolf")); - map.put("EntityMushroomCow", new ResourceLocation("mooshroom")); - map.put("EntitySnowman", new ResourceLocation("snowman")); - map.put("EntityOcelot", new ResourceLocation("ocelot")); - map.put("EntityIronGolem", new ResourceLocation("villager_golem")); - map.put("EntityHorse", new ResourceLocation("horse")); - map.put("EntityRabbit", new ResourceLocation("rabbit")); - map.put("EntityPolarBear", new ResourceLocation("polar_bear")); - map.put("EntityLlama", new ResourceLocation("llama")); - map.put("EntityLlamaSpit", new ResourceLocation("llama_spit")); - map.put("EntityParrot", new ResourceLocation("parrot")); - map.put("EntityVillager", new ResourceLocation("villager")); - map.put("EntityEnderCrystal", new ResourceLocation("ender_crystal")); - map.put("TileEntityFurnace", new ResourceLocation("furnace")); - map.put("TileEntityChest", new ResourceLocation("chest")); - map.put("TileEntityEnderChest", new ResourceLocation("ender_chest")); - map.put("TileEntityRecordPlayer", new ResourceLocation("jukebox")); - map.put("TileEntityDispenser", new ResourceLocation("dispenser")); - map.put("TileEntityDropper", new ResourceLocation("dropper")); - map.put("TileEntitySign", new ResourceLocation("sign")); - map.put("TileEntityMobSpawner", new ResourceLocation("mob_spawner")); - map.put("TileEntityNote", new ResourceLocation("noteblock")); - map.put("TileEntityPiston", new ResourceLocation("piston")); - map.put("TileEntityBrewingStand", new ResourceLocation("brewing_stand")); - map.put("TileEntityEnchantTable", new ResourceLocation("enchanting_table")); - map.put("TileEntityEnderPortal", new ResourceLocation("end_portal")); - map.put("TileEntityBeacon", new ResourceLocation("beacon")); - map.put("TileEntitySkull", new ResourceLocation("skull")); - map.put("TileEntityLightDetector", new ResourceLocation("daylight_detector")); - map.put("TileEntityHopper", new ResourceLocation("hopper")); - map.put("TileEntityComparator", new ResourceLocation("comparator")); - map.put("TileEntityFlowerPot", new ResourceLocation("flower_pot")); - map.put("TileEntityBanner", new ResourceLocation("banner")); - map.put("TileEntityStructure", new ResourceLocation("structure_block")); - map.put("TileEntityEndGateway", new ResourceLocation("end_gateway")); - map.put("TileEntityCommand", new ResourceLocation("command_block")); - map.put("TileEntityShulkerBox", new ResourceLocation("shulker_box")); - map.put("TileEntityBed", new ResourceLocation("bed")); - } - - private static ResourceLocation getKey(String type) { - final ResourceLocation key = OLD_ID_TO_KEY_MAP.get(type); - if (key == null) { - throw new IllegalArgumentException("Unknown mapping for " + type); - } - return key; - } - - private static void convertCompound(LegacyType type, net.minecraft.nbt.CompoundTag cmp, String key, int sourceVer, int targetVer) { - cmp.put(key, convert(type, cmp.getCompound(key), sourceVer, targetVer)); - } - - private static void convertItem(net.minecraft.nbt.CompoundTag nbttagcompound, String key, int sourceVer, int targetVer) { - if (nbttagcompound.contains(key, 10)) { - convertCompound(LegacyType.ITEM_INSTANCE, nbttagcompound, key, sourceVer, targetVer); - } - } - - private static void convertItems(net.minecraft.nbt.CompoundTag nbttagcompound, String key, int sourceVer, int targetVer) { - if (nbttagcompound.contains(key, 9)) { - net.minecraft.nbt.ListTag nbttaglist = nbttagcompound.getList(key, 10); - - for (int j = 0; j < nbttaglist.size(); ++j) { - nbttaglist.set(j, convert(LegacyType.ITEM_INSTANCE, nbttaglist.getCompound(j), sourceVer, targetVer)); - } - } - - } - - private static class DataConverterEquipment implements DataConverter { - - DataConverterEquipment() { - } - - public int getDataVersion() { - return 100; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - net.minecraft.nbt.ListTag nbttaglist = cmp.getList("Equipment", 10); - net.minecraft.nbt.ListTag nbttaglist1; - - if (!nbttaglist.isEmpty() && !cmp.contains("HandItems", 10)) { - nbttaglist1 = new net.minecraft.nbt.ListTag(); - nbttaglist1.add(nbttaglist.get(0)); - nbttaglist1.add(new net.minecraft.nbt.CompoundTag()); - cmp.put("HandItems", nbttaglist1); - } - - if (nbttaglist.size() > 1 && !cmp.contains("ArmorItem", 10)) { - nbttaglist1 = new net.minecraft.nbt.ListTag(); - nbttaglist1.add(nbttaglist.get(1)); - nbttaglist1.add(nbttaglist.get(2)); - nbttaglist1.add(nbttaglist.get(3)); - nbttaglist1.add(nbttaglist.get(4)); - cmp.put("ArmorItems", nbttaglist1); - } - - cmp.remove("Equipment"); - if (cmp.contains("DropChances", 9)) { - nbttaglist1 = cmp.getList("DropChances", 5); - net.minecraft.nbt.ListTag nbttaglist2; - - if (!cmp.contains("HandDropChances", 10)) { - nbttaglist2 = new net.minecraft.nbt.ListTag(); - nbttaglist2.add(net.minecraft.nbt.FloatTag.valueOf(nbttaglist1.getFloat(0))); - nbttaglist2.add(net.minecraft.nbt.FloatTag.valueOf(0.0F)); - cmp.put("HandDropChances", nbttaglist2); - } - - if (!cmp.contains("ArmorDropChances", 10)) { - nbttaglist2 = new net.minecraft.nbt.ListTag(); - nbttaglist2.add(net.minecraft.nbt.FloatTag.valueOf(nbttaglist1.getFloat(1))); - nbttaglist2.add(net.minecraft.nbt.FloatTag.valueOf(nbttaglist1.getFloat(2))); - nbttaglist2.add(net.minecraft.nbt.FloatTag.valueOf(nbttaglist1.getFloat(3))); - nbttaglist2.add(net.minecraft.nbt.FloatTag.valueOf(nbttaglist1.getFloat(4))); - cmp.put("ArmorDropChances", nbttaglist2); - } - - cmp.remove("DropChances"); - } - - return cmp; - } - } - - private static class DataInspectorBlockEntity implements DataInspector { - - private static final Map b = Maps.newHashMap(); - private static final Map c = Maps.newHashMap(); - - DataInspectorBlockEntity() { - } - - @Nullable - private static String convertEntityId(int i, String s) { - String key = new ResourceLocation(s).toString(); - if (i < 515 && DataInspectorBlockEntity.b.containsKey(key)) { - return DataInspectorBlockEntity.b.get(key); - } else { - return DataInspectorBlockEntity.c.get(key); - } - } - - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (!cmp.contains("tag", 10)) { - return cmp; - } else { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); - - if (nbttagcompound1.contains("BlockEntityTag", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag"); - String s = cmp.getString("id"); - String s1 = convertEntityId(sourceVer, s); - boolean flag; - - if (s1 == null) { - // CraftBukkit - Remove unnecessary warning (occurs when deserializing a Shulker Box item) - // DataInspectorBlockEntity.a.warn("Unable to resolve BlockEntity for ItemInstance: {}", s); - flag = false; - } else { - flag = !nbttagcompound2.contains("id"); - nbttagcompound2.putString("id", s1); - } - - convert(LegacyType.BLOCK_ENTITY, nbttagcompound2, sourceVer, targetVer); - if (flag) { - nbttagcompound2.remove("id"); - } - } - - return cmp; - } - } - - static { - Map map = DataInspectorBlockEntity.b; - - map.put("minecraft:furnace", "Furnace"); - map.put("minecraft:lit_furnace", "Furnace"); - map.put("minecraft:chest", "Chest"); - map.put("minecraft:trapped_chest", "Chest"); - map.put("minecraft:ender_chest", "EnderChest"); - map.put("minecraft:jukebox", "RecordPlayer"); - map.put("minecraft:dispenser", "Trap"); - map.put("minecraft:dropper", "Dropper"); - map.put("minecraft:sign", "Sign"); - map.put("minecraft:mob_spawner", "MobSpawner"); - map.put("minecraft:noteblock", "Music"); - map.put("minecraft:brewing_stand", "Cauldron"); - map.put("minecraft:enhanting_table", "EnchantTable"); - map.put("minecraft:command_block", "CommandBlock"); - map.put("minecraft:beacon", "Beacon"); - map.put("minecraft:skull", "Skull"); - map.put("minecraft:daylight_detector", "DLDetector"); - map.put("minecraft:hopper", "Hopper"); - map.put("minecraft:banner", "Banner"); - map.put("minecraft:flower_pot", "FlowerPot"); - map.put("minecraft:repeating_command_block", "CommandBlock"); - map.put("minecraft:chain_command_block", "CommandBlock"); - map.put("minecraft:standing_sign", "Sign"); - map.put("minecraft:wall_sign", "Sign"); - map.put("minecraft:piston_head", "Piston"); - map.put("minecraft:daylight_detector_inverted", "DLDetector"); - map.put("minecraft:unpowered_comparator", "Comparator"); - map.put("minecraft:powered_comparator", "Comparator"); - map.put("minecraft:wall_banner", "Banner"); - map.put("minecraft:standing_banner", "Banner"); - map.put("minecraft:structure_block", "Structure"); - map.put("minecraft:end_portal", "Airportal"); - map.put("minecraft:end_gateway", "EndGateway"); - map.put("minecraft:shield", "Shield"); - map = DataInspectorBlockEntity.c; - map.put("minecraft:furnace", "minecraft:furnace"); - map.put("minecraft:lit_furnace", "minecraft:furnace"); - map.put("minecraft:chest", "minecraft:chest"); - map.put("minecraft:trapped_chest", "minecraft:chest"); - map.put("minecraft:ender_chest", "minecraft:enderchest"); - map.put("minecraft:jukebox", "minecraft:jukebox"); - map.put("minecraft:dispenser", "minecraft:dispenser"); - map.put("minecraft:dropper", "minecraft:dropper"); - map.put("minecraft:sign", "minecraft:sign"); - map.put("minecraft:mob_spawner", "minecraft:mob_spawner"); - map.put("minecraft:noteblock", "minecraft:noteblock"); - map.put("minecraft:brewing_stand", "minecraft:brewing_stand"); - map.put("minecraft:enhanting_table", "minecraft:enchanting_table"); - map.put("minecraft:command_block", "minecraft:command_block"); - map.put("minecraft:beacon", "minecraft:beacon"); - map.put("minecraft:skull", "minecraft:skull"); - map.put("minecraft:daylight_detector", "minecraft:daylight_detector"); - map.put("minecraft:hopper", "minecraft:hopper"); - map.put("minecraft:banner", "minecraft:banner"); - map.put("minecraft:flower_pot", "minecraft:flower_pot"); - map.put("minecraft:repeating_command_block", "minecraft:command_block"); - map.put("minecraft:chain_command_block", "minecraft:command_block"); - map.put("minecraft:shulker_box", "minecraft:shulker_box"); - map.put("minecraft:white_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:orange_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:magenta_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:light_blue_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:yellow_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:lime_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:pink_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:gray_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:silver_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:cyan_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:purple_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:blue_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:brown_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:green_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:red_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:black_shulker_box", "minecraft:shulker_box"); - map.put("minecraft:bed", "minecraft:bed"); - map.put("minecraft:standing_sign", "minecraft:sign"); - map.put("minecraft:wall_sign", "minecraft:sign"); - map.put("minecraft:piston_head", "minecraft:piston"); - map.put("minecraft:daylight_detector_inverted", "minecraft:daylight_detector"); - map.put("minecraft:unpowered_comparator", "minecraft:comparator"); - map.put("minecraft:powered_comparator", "minecraft:comparator"); - map.put("minecraft:wall_banner", "minecraft:banner"); - map.put("minecraft:standing_banner", "minecraft:banner"); - map.put("minecraft:structure_block", "minecraft:structure_block"); - map.put("minecraft:end_portal", "minecraft:end_portal"); - map.put("minecraft:end_gateway", "minecraft:end_gateway"); - map.put("minecraft:shield", "minecraft:shield"); - } - } - - private static class DataInspectorEntity implements DataInspector { - - DataInspectorEntity() { - } - - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); - - if (nbttagcompound1.contains("EntityTag", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("EntityTag"); - String s = cmp.getString("id"); - String s1; - - if ("minecraft:armor_stand".equals(s)) { - s1 = sourceVer < 515 ? "ArmorStand" : "minecraft:armor_stand"; - } else { - if (!"minecraft:spawn_egg".equals(s)) { - return cmp; - } - - s1 = nbttagcompound2.getString("id"); - } - - boolean flag; - - flag = !nbttagcompound2.contains("id", 8); - nbttagcompound2.putString("id", s1); - - convert(LegacyType.ENTITY, nbttagcompound2, sourceVer, targetVer); - if (flag) { - nbttagcompound2.remove("id"); - } - } - - return cmp; - } - } - - - private abstract static class DataInspectorTagged implements DataInspector { - - private final ResourceLocation key; - - DataInspectorTagged(String type) { - this.key = getKey(type); - } - - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (this.key.equals(new ResourceLocation(cmp.getString("id")))) { - cmp = this.inspectChecked(cmp, sourceVer, targetVer); - } - - return cmp; - } - - abstract net.minecraft.nbt.CompoundTag inspectChecked(net.minecraft.nbt.CompoundTag nbttagcompound, int sourceVer, int targetVer); - } - - private static class DataInspectorItemList extends DataInspectorTagged { - - private final String[] keys; - - DataInspectorItemList(String oclass, String... astring) { - super(oclass); - this.keys = astring; - } - - net.minecraft.nbt.CompoundTag inspectChecked(net.minecraft.nbt.CompoundTag nbttagcompound, int sourceVer, int targetVer) { - for (String s : this.keys) { - PaperweightDataConverters.convertItems(nbttagcompound, s, sourceVer, targetVer); - } - - return nbttagcompound; - } - } - - private static class DataInspectorItem extends DataInspectorTagged { - - private final String[] keys; - - DataInspectorItem(String oclass, String... astring) { - super(oclass); - this.keys = astring; - } - - net.minecraft.nbt.CompoundTag inspectChecked(net.minecraft.nbt.CompoundTag nbttagcompound, int sourceVer, int targetVer) { - for (String key : this.keys) { - PaperweightDataConverters.convertItem(nbttagcompound, key, sourceVer, targetVer); - } - - return nbttagcompound; - } - } - - private static class DataConverterMaterialId implements DataConverter { - - private static final String[] materials = new String[2268]; - - DataConverterMaterialId() { - } - - public int getDataVersion() { - return 102; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if (cmp.contains("id", 99)) { - short short0 = cmp.getShort("id"); - - if (short0 > 0 && short0 < materials.length && materials[short0] != null) { - cmp.putString("id", materials[short0]); - } - } - - return cmp; - } - - static { - materials[1] = "minecraft:stone"; - materials[2] = "minecraft:grass"; - materials[3] = "minecraft:dirt"; - materials[4] = "minecraft:cobblestone"; - materials[5] = "minecraft:planks"; - materials[6] = "minecraft:sapling"; - materials[7] = "minecraft:bedrock"; - materials[8] = "minecraft:flowing_water"; - materials[9] = "minecraft:water"; - materials[10] = "minecraft:flowing_lava"; - materials[11] = "minecraft:lava"; - materials[12] = "minecraft:sand"; - materials[13] = "minecraft:gravel"; - materials[14] = "minecraft:gold_ore"; - materials[15] = "minecraft:iron_ore"; - materials[16] = "minecraft:coal_ore"; - materials[17] = "minecraft:log"; - materials[18] = "minecraft:leaves"; - materials[19] = "minecraft:sponge"; - materials[20] = "minecraft:glass"; - materials[21] = "minecraft:lapis_ore"; - materials[22] = "minecraft:lapis_block"; - materials[23] = "minecraft:dispenser"; - materials[24] = "minecraft:sandstone"; - materials[25] = "minecraft:noteblock"; - materials[27] = "minecraft:golden_rail"; - materials[28] = "minecraft:detector_rail"; - materials[29] = "minecraft:sticky_piston"; - materials[30] = "minecraft:web"; - materials[31] = "minecraft:tallgrass"; - materials[32] = "minecraft:deadbush"; - materials[33] = "minecraft:piston"; - materials[35] = "minecraft:wool"; - materials[37] = "minecraft:yellow_flower"; - materials[38] = "minecraft:red_flower"; - materials[39] = "minecraft:brown_mushroom"; - materials[40] = "minecraft:red_mushroom"; - materials[41] = "minecraft:gold_block"; - materials[42] = "minecraft:iron_block"; - materials[43] = "minecraft:double_stone_slab"; - materials[44] = "minecraft:stone_slab"; - materials[45] = "minecraft:brick_block"; - materials[46] = "minecraft:tnt"; - materials[47] = "minecraft:bookshelf"; - materials[48] = "minecraft:mossy_cobblestone"; - materials[49] = "minecraft:obsidian"; - materials[50] = "minecraft:torch"; - materials[51] = "minecraft:fire"; - materials[52] = "minecraft:mob_spawner"; - materials[53] = "minecraft:oak_stairs"; - materials[54] = "minecraft:chest"; - materials[56] = "minecraft:diamond_ore"; - materials[57] = "minecraft:diamond_block"; - materials[58] = "minecraft:crafting_table"; - materials[60] = "minecraft:farmland"; - materials[61] = "minecraft:furnace"; - materials[62] = "minecraft:lit_furnace"; - materials[65] = "minecraft:ladder"; - materials[66] = "minecraft:rail"; - materials[67] = "minecraft:stone_stairs"; - materials[69] = "minecraft:lever"; - materials[70] = "minecraft:stone_pressure_plate"; - materials[72] = "minecraft:wooden_pressure_plate"; - materials[73] = "minecraft:redstone_ore"; - materials[76] = "minecraft:redstone_torch"; - materials[77] = "minecraft:stone_button"; - materials[78] = "minecraft:snow_layer"; - materials[79] = "minecraft:ice"; - materials[80] = "minecraft:snow"; - materials[81] = "minecraft:cactus"; - materials[82] = "minecraft:clay"; - materials[84] = "minecraft:jukebox"; - materials[85] = "minecraft:fence"; - materials[86] = "minecraft:pumpkin"; - materials[87] = "minecraft:netherrack"; - materials[88] = "minecraft:soul_sand"; - materials[89] = "minecraft:glowstone"; - materials[90] = "minecraft:portal"; - materials[91] = "minecraft:lit_pumpkin"; - materials[95] = "minecraft:stained_glass"; - materials[96] = "minecraft:trapdoor"; - materials[97] = "minecraft:monster_egg"; - materials[98] = "minecraft:stonebrick"; - materials[99] = "minecraft:brown_mushroom_block"; - materials[100] = "minecraft:red_mushroom_block"; - materials[101] = "minecraft:iron_bars"; - materials[102] = "minecraft:glass_pane"; - materials[103] = "minecraft:melon_block"; - materials[106] = "minecraft:vine"; - materials[107] = "minecraft:fence_gate"; - materials[108] = "minecraft:brick_stairs"; - materials[109] = "minecraft:stone_brick_stairs"; - materials[110] = "minecraft:mycelium"; - materials[111] = "minecraft:waterlily"; - materials[112] = "minecraft:nether_brick"; - materials[113] = "minecraft:nether_brick_fence"; - materials[114] = "minecraft:nether_brick_stairs"; - materials[116] = "minecraft:enchanting_table"; - materials[119] = "minecraft:end_portal"; - materials[120] = "minecraft:end_portal_frame"; - materials[121] = "minecraft:end_stone"; - materials[122] = "minecraft:dragon_egg"; - materials[123] = "minecraft:redstone_lamp"; - materials[125] = "minecraft:double_wooden_slab"; - materials[126] = "minecraft:wooden_slab"; - materials[127] = "minecraft:cocoa"; - materials[128] = "minecraft:sandstone_stairs"; - materials[129] = "minecraft:emerald_ore"; - materials[130] = "minecraft:ender_chest"; - materials[131] = "minecraft:tripwire_hook"; - materials[133] = "minecraft:emerald_block"; - materials[134] = "minecraft:spruce_stairs"; - materials[135] = "minecraft:birch_stairs"; - materials[136] = "minecraft:jungle_stairs"; - materials[137] = "minecraft:command_block"; - materials[138] = "minecraft:beacon"; - materials[139] = "minecraft:cobblestone_wall"; - materials[141] = "minecraft:carrots"; - materials[142] = "minecraft:potatoes"; - materials[143] = "minecraft:wooden_button"; - materials[145] = "minecraft:anvil"; - materials[146] = "minecraft:trapped_chest"; - materials[147] = "minecraft:light_weighted_pressure_plate"; - materials[148] = "minecraft:heavy_weighted_pressure_plate"; - materials[151] = "minecraft:daylight_detector"; - materials[152] = "minecraft:redstone_block"; - materials[153] = "minecraft:quartz_ore"; - materials[154] = "minecraft:hopper"; - materials[155] = "minecraft:quartz_block"; - materials[156] = "minecraft:quartz_stairs"; - materials[157] = "minecraft:activator_rail"; - materials[158] = "minecraft:dropper"; - materials[159] = "minecraft:stained_hardened_clay"; - materials[160] = "minecraft:stained_glass_pane"; - materials[161] = "minecraft:leaves2"; - materials[162] = "minecraft:log2"; - materials[163] = "minecraft:acacia_stairs"; - materials[164] = "minecraft:dark_oak_stairs"; - materials[170] = "minecraft:hay_block"; - materials[171] = "minecraft:carpet"; - materials[172] = "minecraft:hardened_clay"; - materials[173] = "minecraft:coal_block"; - materials[174] = "minecraft:packed_ice"; - materials[175] = "minecraft:double_plant"; - materials[256] = "minecraft:iron_shovel"; - materials[257] = "minecraft:iron_pickaxe"; - materials[258] = "minecraft:iron_axe"; - materials[259] = "minecraft:flint_and_steel"; - materials[260] = "minecraft:apple"; - materials[261] = "minecraft:bow"; - materials[262] = "minecraft:arrow"; - materials[263] = "minecraft:coal"; - materials[264] = "minecraft:diamond"; - materials[265] = "minecraft:iron_ingot"; - materials[266] = "minecraft:gold_ingot"; - materials[267] = "minecraft:iron_sword"; - materials[268] = "minecraft:wooden_sword"; - materials[269] = "minecraft:wooden_shovel"; - materials[270] = "minecraft:wooden_pickaxe"; - materials[271] = "minecraft:wooden_axe"; - materials[272] = "minecraft:stone_sword"; - materials[273] = "minecraft:stone_shovel"; - materials[274] = "minecraft:stone_pickaxe"; - materials[275] = "minecraft:stone_axe"; - materials[276] = "minecraft:diamond_sword"; - materials[277] = "minecraft:diamond_shovel"; - materials[278] = "minecraft:diamond_pickaxe"; - materials[279] = "minecraft:diamond_axe"; - materials[280] = "minecraft:stick"; - materials[281] = "minecraft:bowl"; - materials[282] = "minecraft:mushroom_stew"; - materials[283] = "minecraft:golden_sword"; - materials[284] = "minecraft:golden_shovel"; - materials[285] = "minecraft:golden_pickaxe"; - materials[286] = "minecraft:golden_axe"; - materials[287] = "minecraft:string"; - materials[288] = "minecraft:feather"; - materials[289] = "minecraft:gunpowder"; - materials[290] = "minecraft:wooden_hoe"; - materials[291] = "minecraft:stone_hoe"; - materials[292] = "minecraft:iron_hoe"; - materials[293] = "minecraft:diamond_hoe"; - materials[294] = "minecraft:golden_hoe"; - materials[295] = "minecraft:wheat_seeds"; - materials[296] = "minecraft:wheat"; - materials[297] = "minecraft:bread"; - materials[298] = "minecraft:leather_helmet"; - materials[299] = "minecraft:leather_chestplate"; - materials[300] = "minecraft:leather_leggings"; - materials[301] = "minecraft:leather_boots"; - materials[302] = "minecraft:chainmail_helmet"; - materials[303] = "minecraft:chainmail_chestplate"; - materials[304] = "minecraft:chainmail_leggings"; - materials[305] = "minecraft:chainmail_boots"; - materials[306] = "minecraft:iron_helmet"; - materials[307] = "minecraft:iron_chestplate"; - materials[308] = "minecraft:iron_leggings"; - materials[309] = "minecraft:iron_boots"; - materials[310] = "minecraft:diamond_helmet"; - materials[311] = "minecraft:diamond_chestplate"; - materials[312] = "minecraft:diamond_leggings"; - materials[313] = "minecraft:diamond_boots"; - materials[314] = "minecraft:golden_helmet"; - materials[315] = "minecraft:golden_chestplate"; - materials[316] = "minecraft:golden_leggings"; - materials[317] = "minecraft:golden_boots"; - materials[318] = "minecraft:flint"; - materials[319] = "minecraft:porkchop"; - materials[320] = "minecraft:cooked_porkchop"; - materials[321] = "minecraft:painting"; - materials[322] = "minecraft:golden_apple"; - materials[323] = "minecraft:sign"; - materials[324] = "minecraft:wooden_door"; - materials[325] = "minecraft:bucket"; - materials[326] = "minecraft:water_bucket"; - materials[327] = "minecraft:lava_bucket"; - materials[328] = "minecraft:minecart"; - materials[329] = "minecraft:saddle"; - materials[330] = "minecraft:iron_door"; - materials[331] = "minecraft:redstone"; - materials[332] = "minecraft:snowball"; - materials[333] = "minecraft:boat"; - materials[334] = "minecraft:leather"; - materials[335] = "minecraft:milk_bucket"; - materials[336] = "minecraft:brick"; - materials[337] = "minecraft:clay_ball"; - materials[338] = "minecraft:reeds"; - materials[339] = "minecraft:paper"; - materials[340] = "minecraft:book"; - materials[341] = "minecraft:slime_ball"; - materials[342] = "minecraft:chest_minecart"; - materials[343] = "minecraft:furnace_minecart"; - materials[344] = "minecraft:egg"; - materials[345] = "minecraft:compass"; - materials[346] = "minecraft:fishing_rod"; - materials[347] = "minecraft:clock"; - materials[348] = "minecraft:glowstone_dust"; - materials[349] = "minecraft:fish"; - materials[350] = "minecraft:cooked_fish"; // Paper - cooked_fished -> cooked_fish - materials[351] = "minecraft:dye"; - materials[352] = "minecraft:bone"; - materials[353] = "minecraft:sugar"; - materials[354] = "minecraft:cake"; - materials[355] = "minecraft:bed"; - materials[356] = "minecraft:repeater"; - materials[357] = "minecraft:cookie"; - materials[358] = "minecraft:filled_map"; - materials[359] = "minecraft:shears"; - materials[360] = "minecraft:melon"; - materials[361] = "minecraft:pumpkin_seeds"; - materials[362] = "minecraft:melon_seeds"; - materials[363] = "minecraft:beef"; - materials[364] = "minecraft:cooked_beef"; - materials[365] = "minecraft:chicken"; - materials[366] = "minecraft:cooked_chicken"; - materials[367] = "minecraft:rotten_flesh"; - materials[368] = "minecraft:ender_pearl"; - materials[369] = "minecraft:blaze_rod"; - materials[370] = "minecraft:ghast_tear"; - materials[371] = "minecraft:gold_nugget"; - materials[372] = "minecraft:nether_wart"; - materials[373] = "minecraft:potion"; - materials[374] = "minecraft:glass_bottle"; - materials[375] = "minecraft:spider_eye"; - materials[376] = "minecraft:fermented_spider_eye"; - materials[377] = "minecraft:blaze_powder"; - materials[378] = "minecraft:magma_cream"; - materials[379] = "minecraft:brewing_stand"; - materials[380] = "minecraft:cauldron"; - materials[381] = "minecraft:ender_eye"; - materials[382] = "minecraft:speckled_melon"; - materials[383] = "minecraft:spawn_egg"; - materials[384] = "minecraft:experience_bottle"; - materials[385] = "minecraft:fire_charge"; - materials[386] = "minecraft:writable_book"; - materials[387] = "minecraft:written_book"; - materials[388] = "minecraft:emerald"; - materials[389] = "minecraft:item_frame"; - materials[390] = "minecraft:flower_pot"; - materials[391] = "minecraft:carrot"; - materials[392] = "minecraft:potato"; - materials[393] = "minecraft:baked_potato"; - materials[394] = "minecraft:poisonous_potato"; - materials[395] = "minecraft:map"; - materials[396] = "minecraft:golden_carrot"; - materials[397] = "minecraft:skull"; - materials[398] = "minecraft:carrot_on_a_stick"; - materials[399] = "minecraft:nether_star"; - materials[400] = "minecraft:pumpkin_pie"; - materials[401] = "minecraft:fireworks"; - materials[402] = "minecraft:firework_charge"; - materials[403] = "minecraft:enchanted_book"; - materials[404] = "minecraft:comparator"; - materials[405] = "minecraft:netherbrick"; - materials[406] = "minecraft:quartz"; - materials[407] = "minecraft:tnt_minecart"; - materials[408] = "minecraft:hopper_minecart"; - materials[417] = "minecraft:iron_horse_armor"; - materials[418] = "minecraft:golden_horse_armor"; - materials[419] = "minecraft:diamond_horse_armor"; - materials[420] = "minecraft:lead"; - materials[421] = "minecraft:name_tag"; - materials[422] = "minecraft:command_block_minecart"; - materials[2256] = "minecraft:record_13"; - materials[2257] = "minecraft:record_cat"; - materials[2258] = "minecraft:record_blocks"; - materials[2259] = "minecraft:record_chirp"; - materials[2260] = "minecraft:record_far"; - materials[2261] = "minecraft:record_mall"; - materials[2262] = "minecraft:record_mellohi"; - materials[2263] = "minecraft:record_stal"; - materials[2264] = "minecraft:record_strad"; - materials[2265] = "minecraft:record_ward"; - materials[2266] = "minecraft:record_11"; - materials[2267] = "minecraft:record_wait"; - // Paper start - materials[409] = "minecraft:prismarine_shard"; - materials[410] = "minecraft:prismarine_crystals"; - materials[411] = "minecraft:rabbit"; - materials[412] = "minecraft:cooked_rabbit"; - materials[413] = "minecraft:rabbit_stew"; - materials[414] = "minecraft:rabbit_foot"; - materials[415] = "minecraft:rabbit_hide"; - materials[416] = "minecraft:armor_stand"; - materials[423] = "minecraft:mutton"; - materials[424] = "minecraft:cooked_mutton"; - materials[425] = "minecraft:banner"; - materials[426] = "minecraft:end_crystal"; - materials[427] = "minecraft:spruce_door"; - materials[428] = "minecraft:birch_door"; - materials[429] = "minecraft:jungle_door"; - materials[430] = "minecraft:acacia_door"; - materials[431] = "minecraft:dark_oak_door"; - materials[432] = "minecraft:chorus_fruit"; - materials[433] = "minecraft:chorus_fruit_popped"; - materials[434] = "minecraft:beetroot"; - materials[435] = "minecraft:beetroot_seeds"; - materials[436] = "minecraft:beetroot_soup"; - materials[437] = "minecraft:dragon_breath"; - materials[438] = "minecraft:splash_potion"; - materials[439] = "minecraft:spectral_arrow"; - materials[440] = "minecraft:tipped_arrow"; - materials[441] = "minecraft:lingering_potion"; - materials[442] = "minecraft:shield"; - materials[443] = "minecraft:elytra"; - materials[444] = "minecraft:spruce_boat"; - materials[445] = "minecraft:birch_boat"; - materials[446] = "minecraft:jungle_boat"; - materials[447] = "minecraft:acacia_boat"; - materials[448] = "minecraft:dark_oak_boat"; - materials[449] = "minecraft:totem_of_undying"; - materials[450] = "minecraft:shulker_shell"; - materials[452] = "minecraft:iron_nugget"; - materials[453] = "minecraft:knowledge_book"; - // Paper end - } - } - - private static class DataConverterArmorStand implements DataConverter { - - DataConverterArmorStand() { - } - - public int getDataVersion() { - return 147; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("ArmorStand".equals(cmp.getString("id")) && cmp.getBoolean("Silent") && !cmp.getBoolean("Marker")) { - cmp.remove("Silent"); - } - - return cmp; - } - } - - private static class DataConverterBanner implements DataConverter { - - DataConverterBanner() { - } - - public int getDataVersion() { - return 804; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("minecraft:banner".equals(cmp.getString("id")) && cmp.contains("tag", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); - - if (nbttagcompound1.contains("BlockEntityTag", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag"); - - if (nbttagcompound2.contains("Base", 99)) { - cmp.putShort("Damage", (short) (nbttagcompound2.getShort("Base") & 15)); - if (nbttagcompound1.contains("display", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound3 = nbttagcompound1.getCompound("display"); - - if (nbttagcompound3.contains("Lore", 9)) { - net.minecraft.nbt.ListTag nbttaglist = nbttagcompound3.getList("Lore", 8); - - if (nbttaglist.size() == 1 && "(+NBT)".equals(nbttaglist.getString(0))) { - return cmp; - } - } - } - - nbttagcompound2.remove("Base"); - if (nbttagcompound2.isEmpty()) { - nbttagcompound1.remove("BlockEntityTag"); - } - - if (nbttagcompound1.isEmpty()) { - cmp.remove("tag"); - } - } - } - } - - return cmp; - } - } - - private static class DataConverterPotionId implements DataConverter { - - private static final String[] potions = new String[128]; - - DataConverterPotionId() { - } - - public int getDataVersion() { - return 102; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("minecraft:potion".equals(cmp.getString("id"))) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); - short short0 = cmp.getShort("Damage"); - - if (!nbttagcompound1.contains("Potion", 8)) { - String s = DataConverterPotionId.potions[short0 & 127]; - - nbttagcompound1.putString("Potion", s == null ? "minecraft:water" : s); - cmp.put("tag", nbttagcompound1); - if ((short0 & 16384) == 16384) { - cmp.putString("id", "minecraft:splash_potion"); - } - } - - if (short0 != 0) { - cmp.putShort("Damage", (short) 0); - } - } - - return cmp; - } - - static { - DataConverterPotionId.potions[0] = "minecraft:water"; - DataConverterPotionId.potions[1] = "minecraft:regeneration"; - DataConverterPotionId.potions[2] = "minecraft:swiftness"; - DataConverterPotionId.potions[3] = "minecraft:fire_resistance"; - DataConverterPotionId.potions[4] = "minecraft:poison"; - DataConverterPotionId.potions[5] = "minecraft:healing"; - DataConverterPotionId.potions[6] = "minecraft:night_vision"; - DataConverterPotionId.potions[7] = null; - DataConverterPotionId.potions[8] = "minecraft:weakness"; - DataConverterPotionId.potions[9] = "minecraft:strength"; - DataConverterPotionId.potions[10] = "minecraft:slowness"; - DataConverterPotionId.potions[11] = "minecraft:leaping"; - DataConverterPotionId.potions[12] = "minecraft:harming"; - DataConverterPotionId.potions[13] = "minecraft:water_breathing"; - DataConverterPotionId.potions[14] = "minecraft:invisibility"; - DataConverterPotionId.potions[15] = null; - DataConverterPotionId.potions[16] = "minecraft:awkward"; - DataConverterPotionId.potions[17] = "minecraft:regeneration"; - DataConverterPotionId.potions[18] = "minecraft:swiftness"; - DataConverterPotionId.potions[19] = "minecraft:fire_resistance"; - DataConverterPotionId.potions[20] = "minecraft:poison"; - DataConverterPotionId.potions[21] = "minecraft:healing"; - DataConverterPotionId.potions[22] = "minecraft:night_vision"; - DataConverterPotionId.potions[23] = null; - DataConverterPotionId.potions[24] = "minecraft:weakness"; - DataConverterPotionId.potions[25] = "minecraft:strength"; - DataConverterPotionId.potions[26] = "minecraft:slowness"; - DataConverterPotionId.potions[27] = "minecraft:leaping"; - DataConverterPotionId.potions[28] = "minecraft:harming"; - DataConverterPotionId.potions[29] = "minecraft:water_breathing"; - DataConverterPotionId.potions[30] = "minecraft:invisibility"; - DataConverterPotionId.potions[31] = null; - DataConverterPotionId.potions[32] = "minecraft:thick"; - DataConverterPotionId.potions[33] = "minecraft:strong_regeneration"; - DataConverterPotionId.potions[34] = "minecraft:strong_swiftness"; - DataConverterPotionId.potions[35] = "minecraft:fire_resistance"; - DataConverterPotionId.potions[36] = "minecraft:strong_poison"; - DataConverterPotionId.potions[37] = "minecraft:strong_healing"; - DataConverterPotionId.potions[38] = "minecraft:night_vision"; - DataConverterPotionId.potions[39] = null; - DataConverterPotionId.potions[40] = "minecraft:weakness"; - DataConverterPotionId.potions[41] = "minecraft:strong_strength"; - DataConverterPotionId.potions[42] = "minecraft:slowness"; - DataConverterPotionId.potions[43] = "minecraft:strong_leaping"; - DataConverterPotionId.potions[44] = "minecraft:strong_harming"; - DataConverterPotionId.potions[45] = "minecraft:water_breathing"; - DataConverterPotionId.potions[46] = "minecraft:invisibility"; - DataConverterPotionId.potions[47] = null; - DataConverterPotionId.potions[48] = null; - DataConverterPotionId.potions[49] = "minecraft:strong_regeneration"; - DataConverterPotionId.potions[50] = "minecraft:strong_swiftness"; - DataConverterPotionId.potions[51] = "minecraft:fire_resistance"; - DataConverterPotionId.potions[52] = "minecraft:strong_poison"; - DataConverterPotionId.potions[53] = "minecraft:strong_healing"; - DataConverterPotionId.potions[54] = "minecraft:night_vision"; - DataConverterPotionId.potions[55] = null; - DataConverterPotionId.potions[56] = "minecraft:weakness"; - DataConverterPotionId.potions[57] = "minecraft:strong_strength"; - DataConverterPotionId.potions[58] = "minecraft:slowness"; - DataConverterPotionId.potions[59] = "minecraft:strong_leaping"; - DataConverterPotionId.potions[60] = "minecraft:strong_harming"; - DataConverterPotionId.potions[61] = "minecraft:water_breathing"; - DataConverterPotionId.potions[62] = "minecraft:invisibility"; - DataConverterPotionId.potions[63] = null; - DataConverterPotionId.potions[64] = "minecraft:mundane"; - DataConverterPotionId.potions[65] = "minecraft:long_regeneration"; - DataConverterPotionId.potions[66] = "minecraft:long_swiftness"; - DataConverterPotionId.potions[67] = "minecraft:long_fire_resistance"; - DataConverterPotionId.potions[68] = "minecraft:long_poison"; - DataConverterPotionId.potions[69] = "minecraft:healing"; - DataConverterPotionId.potions[70] = "minecraft:long_night_vision"; - DataConverterPotionId.potions[71] = null; - DataConverterPotionId.potions[72] = "minecraft:long_weakness"; - DataConverterPotionId.potions[73] = "minecraft:long_strength"; - DataConverterPotionId.potions[74] = "minecraft:long_slowness"; - DataConverterPotionId.potions[75] = "minecraft:long_leaping"; - DataConverterPotionId.potions[76] = "minecraft:harming"; - DataConverterPotionId.potions[77] = "minecraft:long_water_breathing"; - DataConverterPotionId.potions[78] = "minecraft:long_invisibility"; - DataConverterPotionId.potions[79] = null; - DataConverterPotionId.potions[80] = "minecraft:awkward"; - DataConverterPotionId.potions[81] = "minecraft:long_regeneration"; - DataConverterPotionId.potions[82] = "minecraft:long_swiftness"; - DataConverterPotionId.potions[83] = "minecraft:long_fire_resistance"; - DataConverterPotionId.potions[84] = "minecraft:long_poison"; - DataConverterPotionId.potions[85] = "minecraft:healing"; - DataConverterPotionId.potions[86] = "minecraft:long_night_vision"; - DataConverterPotionId.potions[87] = null; - DataConverterPotionId.potions[88] = "minecraft:long_weakness"; - DataConverterPotionId.potions[89] = "minecraft:long_strength"; - DataConverterPotionId.potions[90] = "minecraft:long_slowness"; - DataConverterPotionId.potions[91] = "minecraft:long_leaping"; - DataConverterPotionId.potions[92] = "minecraft:harming"; - DataConverterPotionId.potions[93] = "minecraft:long_water_breathing"; - DataConverterPotionId.potions[94] = "minecraft:long_invisibility"; - DataConverterPotionId.potions[95] = null; - DataConverterPotionId.potions[96] = "minecraft:thick"; - DataConverterPotionId.potions[97] = "minecraft:regeneration"; - DataConverterPotionId.potions[98] = "minecraft:swiftness"; - DataConverterPotionId.potions[99] = "minecraft:long_fire_resistance"; - DataConverterPotionId.potions[100] = "minecraft:poison"; - DataConverterPotionId.potions[101] = "minecraft:strong_healing"; - DataConverterPotionId.potions[102] = "minecraft:long_night_vision"; - DataConverterPotionId.potions[103] = null; - DataConverterPotionId.potions[104] = "minecraft:long_weakness"; - DataConverterPotionId.potions[105] = "minecraft:strength"; - DataConverterPotionId.potions[106] = "minecraft:long_slowness"; - DataConverterPotionId.potions[107] = "minecraft:leaping"; - DataConverterPotionId.potions[108] = "minecraft:strong_harming"; - DataConverterPotionId.potions[109] = "minecraft:long_water_breathing"; - DataConverterPotionId.potions[110] = "minecraft:long_invisibility"; - DataConverterPotionId.potions[111] = null; - DataConverterPotionId.potions[112] = null; - DataConverterPotionId.potions[113] = "minecraft:regeneration"; - DataConverterPotionId.potions[114] = "minecraft:swiftness"; - DataConverterPotionId.potions[115] = "minecraft:long_fire_resistance"; - DataConverterPotionId.potions[116] = "minecraft:poison"; - DataConverterPotionId.potions[117] = "minecraft:strong_healing"; - DataConverterPotionId.potions[118] = "minecraft:long_night_vision"; - DataConverterPotionId.potions[119] = null; - DataConverterPotionId.potions[120] = "minecraft:long_weakness"; - DataConverterPotionId.potions[121] = "minecraft:strength"; - DataConverterPotionId.potions[122] = "minecraft:long_slowness"; - DataConverterPotionId.potions[123] = "minecraft:leaping"; - DataConverterPotionId.potions[124] = "minecraft:strong_harming"; - DataConverterPotionId.potions[125] = "minecraft:long_water_breathing"; - DataConverterPotionId.potions[126] = "minecraft:long_invisibility"; - DataConverterPotionId.potions[127] = null; - } - } - - private static class DataConverterSpawnEgg implements DataConverter { - - private static final String[] eggs = new String[256]; - - DataConverterSpawnEgg() { - } - - public int getDataVersion() { - return 105; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("minecraft:spawn_egg".equals(cmp.getString("id"))) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); - net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("EntityTag"); - short short0 = cmp.getShort("Damage"); - - if (!nbttagcompound2.contains("id", 8)) { - String s = DataConverterSpawnEgg.eggs[short0 & 255]; - - if (s != null) { - nbttagcompound2.putString("id", s); - nbttagcompound1.put("EntityTag", nbttagcompound2); - cmp.put("tag", nbttagcompound1); - } - } - - if (short0 != 0) { - cmp.putShort("Damage", (short) 0); - } - } - - return cmp; - } - - static { - - DataConverterSpawnEgg.eggs[1] = "Item"; - DataConverterSpawnEgg.eggs[2] = "XPOrb"; - DataConverterSpawnEgg.eggs[7] = "ThrownEgg"; - DataConverterSpawnEgg.eggs[8] = "LeashKnot"; - DataConverterSpawnEgg.eggs[9] = "Painting"; - DataConverterSpawnEgg.eggs[10] = "Arrow"; - DataConverterSpawnEgg.eggs[11] = "Snowball"; - DataConverterSpawnEgg.eggs[12] = "Fireball"; - DataConverterSpawnEgg.eggs[13] = "SmallFireball"; - DataConverterSpawnEgg.eggs[14] = "ThrownEnderpearl"; - DataConverterSpawnEgg.eggs[15] = "EyeOfEnderSignal"; - DataConverterSpawnEgg.eggs[16] = "ThrownPotion"; - DataConverterSpawnEgg.eggs[17] = "ThrownExpBottle"; - DataConverterSpawnEgg.eggs[18] = "ItemFrame"; - DataConverterSpawnEgg.eggs[19] = "WitherSkull"; - DataConverterSpawnEgg.eggs[20] = "PrimedTnt"; - DataConverterSpawnEgg.eggs[21] = "FallingSand"; - DataConverterSpawnEgg.eggs[22] = "FireworksRocketEntity"; - DataConverterSpawnEgg.eggs[23] = "TippedArrow"; - DataConverterSpawnEgg.eggs[24] = "SpectralArrow"; - DataConverterSpawnEgg.eggs[25] = "ShulkerBullet"; - DataConverterSpawnEgg.eggs[26] = "DragonFireball"; - DataConverterSpawnEgg.eggs[30] = "ArmorStand"; - DataConverterSpawnEgg.eggs[41] = "Boat"; - DataConverterSpawnEgg.eggs[42] = "MinecartRideable"; - DataConverterSpawnEgg.eggs[43] = "MinecartChest"; - DataConverterSpawnEgg.eggs[44] = "MinecartFurnace"; - DataConverterSpawnEgg.eggs[45] = "MinecartTNT"; - DataConverterSpawnEgg.eggs[46] = "MinecartHopper"; - DataConverterSpawnEgg.eggs[47] = "MinecartSpawner"; - DataConverterSpawnEgg.eggs[40] = "MinecartCommandBlock"; - DataConverterSpawnEgg.eggs[48] = "Mob"; - DataConverterSpawnEgg.eggs[49] = "Monster"; - DataConverterSpawnEgg.eggs[50] = "Creeper"; - DataConverterSpawnEgg.eggs[51] = "Skeleton"; - DataConverterSpawnEgg.eggs[52] = "Spider"; - DataConverterSpawnEgg.eggs[53] = "Giant"; - DataConverterSpawnEgg.eggs[54] = "Zombie"; - DataConverterSpawnEgg.eggs[55] = "Slime"; - DataConverterSpawnEgg.eggs[56] = "Ghast"; - DataConverterSpawnEgg.eggs[57] = "PigZombie"; - DataConverterSpawnEgg.eggs[58] = "Enderman"; - DataConverterSpawnEgg.eggs[59] = "CaveSpider"; - DataConverterSpawnEgg.eggs[60] = "Silverfish"; - DataConverterSpawnEgg.eggs[61] = "Blaze"; - DataConverterSpawnEgg.eggs[62] = "LavaSlime"; - DataConverterSpawnEgg.eggs[63] = "EnderDragon"; - DataConverterSpawnEgg.eggs[64] = "WitherBoss"; - DataConverterSpawnEgg.eggs[65] = "Bat"; - DataConverterSpawnEgg.eggs[66] = "Witch"; - DataConverterSpawnEgg.eggs[67] = "Endermite"; - DataConverterSpawnEgg.eggs[68] = "Guardian"; - DataConverterSpawnEgg.eggs[69] = "Shulker"; - DataConverterSpawnEgg.eggs[90] = "Pig"; - DataConverterSpawnEgg.eggs[91] = "Sheep"; - DataConverterSpawnEgg.eggs[92] = "Cow"; - DataConverterSpawnEgg.eggs[93] = "Chicken"; - DataConverterSpawnEgg.eggs[94] = "Squid"; - DataConverterSpawnEgg.eggs[95] = "Wolf"; - DataConverterSpawnEgg.eggs[96] = "MushroomCow"; - DataConverterSpawnEgg.eggs[97] = "SnowMan"; - DataConverterSpawnEgg.eggs[98] = "Ozelot"; - DataConverterSpawnEgg.eggs[99] = "VillagerGolem"; - DataConverterSpawnEgg.eggs[100] = "EntityHorse"; - DataConverterSpawnEgg.eggs[101] = "Rabbit"; - DataConverterSpawnEgg.eggs[120] = "Villager"; - DataConverterSpawnEgg.eggs[200] = "EnderCrystal"; - } - } - - private static class DataConverterMinecart implements DataConverter { - - private static final List a = Lists.newArrayList("MinecartRideable", "MinecartChest", "MinecartFurnace", "MinecartTNT", "MinecartSpawner", "MinecartHopper", "MinecartCommandBlock"); - - DataConverterMinecart() { - } - - public int getDataVersion() { - return 106; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("Minecart".equals(cmp.getString("id"))) { - String s = "MinecartRideable"; - int i = cmp.getInt("Type"); - - if (i > 0 && i < DataConverterMinecart.a.size()) { - s = DataConverterMinecart.a.get(i); - } - - cmp.putString("id", s); - cmp.remove("Type"); - } - - return cmp; - } - } - - private static class DataConverterMobSpawner implements DataConverter { - - DataConverterMobSpawner() { - } - - public int getDataVersion() { - return 107; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if (!"MobSpawner".equals(cmp.getString("id"))) { - return cmp; - } else { - if (cmp.contains("EntityId", 8)) { - String s = cmp.getString("EntityId"); - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("SpawnData"); - - nbttagcompound1.putString("id", s.isEmpty() ? "Pig" : s); - cmp.put("SpawnData", nbttagcompound1); - cmp.remove("EntityId"); - } - - if (cmp.contains("SpawnPotentials", 9)) { - net.minecraft.nbt.ListTag nbttaglist = cmp.getList("SpawnPotentials", 10); - - for (int i = 0; i < nbttaglist.size(); ++i) { - net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttaglist.getCompound(i); - - if (nbttagcompound2.contains("Type", 8)) { - net.minecraft.nbt.CompoundTag nbttagcompound3 = nbttagcompound2.getCompound("Properties"); - - nbttagcompound3.putString("id", nbttagcompound2.getString("Type")); - nbttagcompound2.put("Entity", nbttagcompound3); - nbttagcompound2.remove("Type"); - nbttagcompound2.remove("Properties"); - } - } - } - - return cmp; - } - } - } - - private static class DataConverterUUID implements DataConverter { - - DataConverterUUID() { - } - - public int getDataVersion() { - return 108; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if (cmp.contains("UUID", 8)) { - cmp.putUUID("UUID", UUID.fromString(cmp.getString("UUID"))); - } - - return cmp; - } - } - - private static class DataConverterHealth implements DataConverter { - - private static final Set a = Sets.newHashSet("ArmorStand", "Bat", "Blaze", "CaveSpider", "Chicken", "Cow", "Creeper", "EnderDragon", "Enderman", "Endermite", "EntityHorse", "Ghast", "Giant", "Guardian", "LavaSlime", "MushroomCow", "Ozelot", "Pig", "PigZombie", "Rabbit", "Sheep", "Shulker", "Silverfish", "Skeleton", "Slime", "SnowMan", "Spider", "Squid", "Villager", "VillagerGolem", "Witch", "WitherBoss", "Wolf", "Zombie"); - - DataConverterHealth() { - } - - public int getDataVersion() { - return 109; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if (DataConverterHealth.a.contains(cmp.getString("id"))) { - float f; - - if (cmp.contains("HealF", 99)) { - f = cmp.getFloat("HealF"); - cmp.remove("HealF"); - } else { - if (!cmp.contains("Health", 99)) { - return cmp; - } - - f = cmp.getFloat("Health"); - } - - cmp.putFloat("Health", f); - } - - return cmp; - } - } - - private static class DataConverterSaddle implements DataConverter { - - DataConverterSaddle() { - } - - public int getDataVersion() { - return 110; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("EntityHorse".equals(cmp.getString("id")) && !cmp.contains("SaddleItem", 10) && cmp.getBoolean("Saddle")) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = new net.minecraft.nbt.CompoundTag(); - - nbttagcompound1.putString("id", "minecraft:saddle"); - nbttagcompound1.putByte("Count", (byte) 1); - nbttagcompound1.putShort("Damage", (short) 0); - cmp.put("SaddleItem", nbttagcompound1); - cmp.remove("Saddle"); - } - - return cmp; - } - } - - private static class DataConverterHanging implements DataConverter { - - DataConverterHanging() { - } - - public int getDataVersion() { - return 111; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - String s = cmp.getString("id"); - boolean flag = "Painting".equals(s); - boolean flag1 = "ItemFrame".equals(s); - - if ((flag || flag1) && !cmp.contains("Facing", 99)) { - Direction enumdirection; - - if (cmp.contains("Direction", 99)) { - enumdirection = Direction.from2DDataValue(cmp.getByte("Direction")); - cmp.putInt("TileX", cmp.getInt("TileX") + enumdirection.getStepX()); - cmp.putInt("TileY", cmp.getInt("TileY") + enumdirection.getStepY()); - cmp.putInt("TileZ", cmp.getInt("TileZ") + enumdirection.getStepZ()); - cmp.remove("Direction"); - if (flag1 && cmp.contains("ItemRotation", 99)) { - cmp.putByte("ItemRotation", (byte) (cmp.getByte("ItemRotation") * 2)); - } - } else { - enumdirection = Direction.from2DDataValue(cmp.getByte("Dir")); - cmp.remove("Dir"); - } - - cmp.putByte("Facing", (byte) enumdirection.get2DDataValue()); - } - - return cmp; - } - } - - private static class DataConverterDropChances implements DataConverter { - - DataConverterDropChances() { - } - - public int getDataVersion() { - return 113; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - net.minecraft.nbt.ListTag nbttaglist; - - if (cmp.contains("HandDropChances", 9)) { - nbttaglist = cmp.getList("HandDropChances", 5); - if (nbttaglist.size() == 2 && nbttaglist.getFloat(0) == 0.0F && nbttaglist.getFloat(1) == 0.0F) { - cmp.remove("HandDropChances"); - } - } - - if (cmp.contains("ArmorDropChances", 9)) { - nbttaglist = cmp.getList("ArmorDropChances", 5); - if (nbttaglist.size() == 4 && nbttaglist.getFloat(0) == 0.0F && nbttaglist.getFloat(1) == 0.0F && nbttaglist.getFloat(2) == 0.0F && nbttaglist.getFloat(3) == 0.0F) { - cmp.remove("ArmorDropChances"); - } - } - - return cmp; - } - } - - private static class DataConverterRiding implements DataConverter { - - DataConverterRiding() { - } - - public int getDataVersion() { - return 135; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - while (cmp.contains("Riding", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = this.b(cmp); - - this.convert(cmp, nbttagcompound1); - cmp = nbttagcompound1; - } - - return cmp; - } - - protected void convert(net.minecraft.nbt.CompoundTag nbttagcompound, net.minecraft.nbt.CompoundTag nbttagcompound1) { - net.minecraft.nbt.ListTag nbttaglist = new net.minecraft.nbt.ListTag(); - - nbttaglist.add(nbttagcompound); - nbttagcompound1.put("Passengers", nbttaglist); - } - - protected net.minecraft.nbt.CompoundTag b(net.minecraft.nbt.CompoundTag nbttagcompound) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = nbttagcompound.getCompound("Riding"); - - nbttagcompound.remove("Riding"); - return nbttagcompound1; - } - } - - private static class DataConverterBook implements DataConverter { - - DataConverterBook() { - } - - public int getDataVersion() { - return 165; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("minecraft:written_book".equals(cmp.getString("id"))) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); - - if (nbttagcompound1.contains("pages", 9)) { - net.minecraft.nbt.ListTag nbttaglist = nbttagcompound1.getList("pages", 8); - - for (int i = 0; i < nbttaglist.size(); ++i) { - String s = nbttaglist.getString(i); - Component object = null; - - if (!"null".equals(s) && !StringUtil.isNullOrEmpty(s)) { - if ((s.charAt(0) != 34 || s.charAt(s.length() - 1) != 34) && (s.charAt(0) != 123 || s.charAt(s.length() - 1) != 125)) { - object = Component.literal(s); - } else { - try { - object = GsonHelper.fromJson(DataConverterSignText.a, s, Component.class, true); - if (object == null) { - object = Component.literal(""); - } - } catch (JsonParseException jsonparseexception) { - ; - } - - if (object == null) { - try { - object = Component.Serializer.fromJson(s); - } catch (JsonParseException jsonparseexception1) { - ; - } - } - - if (object == null) { - try { - object = Component.Serializer.fromJsonLenient(s); - } catch (JsonParseException jsonparseexception2) { - ; - } - } - - if (object == null) { - object = Component.literal(s); - } - } - } else { - object = Component.literal(""); - } - - nbttaglist.set(i, net.minecraft.nbt.StringTag.valueOf(Component.Serializer.toJson(object))); - } - - nbttagcompound1.put("pages", nbttaglist); - } - } - - return cmp; - } - } - - private static class DataConverterCookedFish implements DataConverter { - - private static final ResourceLocation a = new ResourceLocation("cooked_fished"); - - DataConverterCookedFish() { - } - - public int getDataVersion() { - return 502; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if (cmp.contains("id", 8) && DataConverterCookedFish.a.equals(new ResourceLocation(cmp.getString("id")))) { - cmp.putString("id", "minecraft:cooked_fish"); - } - - return cmp; - } - } - - private static class DataConverterZombie implements DataConverter { - - private static final Random a = new Random(); - - DataConverterZombie() { - } - - public int getDataVersion() { - return 502; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("Zombie".equals(cmp.getString("id")) && cmp.getBoolean("IsVillager")) { - if (!cmp.contains("ZombieType", 99)) { - int i = -1; - - if (cmp.contains("VillagerProfession", 99)) { - try { - i = this.convert(cmp.getInt("VillagerProfession")); - } catch (RuntimeException runtimeexception) { - ; - } - } - - if (i == -1) { - i = this.convert(DataConverterZombie.a.nextInt(6)); - } - - cmp.putInt("ZombieType", i); - } - - cmp.remove("IsVillager"); - } - - return cmp; - } - - private int convert(int i) { - return i >= 0 && i < 6 ? i : -1; - } - } - - private static class DataConverterVBO implements DataConverter { - - DataConverterVBO() { - } - - public int getDataVersion() { - return 505; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - cmp.putString("useVbo", "true"); - return cmp; - } - } - - private static class DataConverterGuardian implements DataConverter { - - DataConverterGuardian() { - } - - public int getDataVersion() { - return 700; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("Guardian".equals(cmp.getString("id"))) { - if (cmp.getBoolean("Elder")) { - cmp.putString("id", "ElderGuardian"); - } - - cmp.remove("Elder"); - } - - return cmp; - } - } - - private static class DataConverterSkeleton implements DataConverter { - - DataConverterSkeleton() { - } - - public int getDataVersion() { - return 701; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - String s = cmp.getString("id"); - - if ("Skeleton".equals(s)) { - int i = cmp.getInt("SkeletonType"); - - if (i == 1) { - cmp.putString("id", "WitherSkeleton"); - } else if (i == 2) { - cmp.putString("id", "Stray"); - } - - cmp.remove("SkeletonType"); - } - - return cmp; - } - } - - private static class DataConverterZombieType implements DataConverter { - - DataConverterZombieType() { - } - - public int getDataVersion() { - return 702; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("Zombie".equals(cmp.getString("id"))) { - int i = cmp.getInt("ZombieType"); - - switch (i) { - case 0: - default: - break; - - case 1: - case 2: - case 3: - case 4: - case 5: - cmp.putString("id", "ZombieVillager"); - cmp.putInt("Profession", i - 1); - break; - - case 6: - cmp.putString("id", "Husk"); - } - - cmp.remove("ZombieType"); - } - - return cmp; - } - } - - private static class DataConverterHorse implements DataConverter { - - DataConverterHorse() { - } - - public int getDataVersion() { - return 703; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("EntityHorse".equals(cmp.getString("id"))) { - int i = cmp.getInt("Type"); - - switch (i) { - case 0: - default: - cmp.putString("id", "Horse"); - break; - - case 1: - cmp.putString("id", "Donkey"); - break; - - case 2: - cmp.putString("id", "Mule"); - break; - - case 3: - cmp.putString("id", "ZombieHorse"); - break; - - case 4: - cmp.putString("id", "SkeletonHorse"); - } - - cmp.remove("Type"); - } - - return cmp; - } - } - - private static class DataConverterTileEntity implements DataConverter { - - private static final Map a = Maps.newHashMap(); - - DataConverterTileEntity() { - } - - public int getDataVersion() { - return 704; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - String s = DataConverterTileEntity.a.get(cmp.getString("id")); - - if (s != null) { - cmp.putString("id", s); - } - - return cmp; - } - - static { - DataConverterTileEntity.a.put("Airportal", "minecraft:end_portal"); - DataConverterTileEntity.a.put("Banner", "minecraft:banner"); - DataConverterTileEntity.a.put("Beacon", "minecraft:beacon"); - DataConverterTileEntity.a.put("Cauldron", "minecraft:brewing_stand"); - DataConverterTileEntity.a.put("Chest", "minecraft:chest"); - DataConverterTileEntity.a.put("Comparator", "minecraft:comparator"); - DataConverterTileEntity.a.put("Control", "minecraft:command_block"); - DataConverterTileEntity.a.put("DLDetector", "minecraft:daylight_detector"); - DataConverterTileEntity.a.put("Dropper", "minecraft:dropper"); - DataConverterTileEntity.a.put("EnchantTable", "minecraft:enchanting_table"); - DataConverterTileEntity.a.put("EndGateway", "minecraft:end_gateway"); - DataConverterTileEntity.a.put("EnderChest", "minecraft:ender_chest"); - DataConverterTileEntity.a.put("FlowerPot", "minecraft:flower_pot"); - DataConverterTileEntity.a.put("Furnace", "minecraft:furnace"); - DataConverterTileEntity.a.put("Hopper", "minecraft:hopper"); - DataConverterTileEntity.a.put("MobSpawner", "minecraft:mob_spawner"); - DataConverterTileEntity.a.put("Music", "minecraft:noteblock"); - DataConverterTileEntity.a.put("Piston", "minecraft:piston"); - DataConverterTileEntity.a.put("RecordPlayer", "minecraft:jukebox"); - DataConverterTileEntity.a.put("Sign", "minecraft:sign"); - DataConverterTileEntity.a.put("Skull", "minecraft:skull"); - DataConverterTileEntity.a.put("Structure", "minecraft:structure_block"); - DataConverterTileEntity.a.put("Trap", "minecraft:dispenser"); - } - } - - private static class DataConverterEntity implements DataConverter { - - private static final Map a = Maps.newHashMap(); - - DataConverterEntity() { - } - - public int getDataVersion() { - return 704; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - String s = DataConverterEntity.a.get(cmp.getString("id")); - - if (s != null) { - cmp.putString("id", s); - } - - return cmp; - } - - static { - DataConverterEntity.a.put("AreaEffectCloud", "minecraft:area_effect_cloud"); - DataConverterEntity.a.put("ArmorStand", "minecraft:armor_stand"); - DataConverterEntity.a.put("Arrow", "minecraft:arrow"); - DataConverterEntity.a.put("Bat", "minecraft:bat"); - DataConverterEntity.a.put("Blaze", "minecraft:blaze"); - DataConverterEntity.a.put("Boat", "minecraft:boat"); - DataConverterEntity.a.put("CaveSpider", "minecraft:cave_spider"); - DataConverterEntity.a.put("Chicken", "minecraft:chicken"); - DataConverterEntity.a.put("Cow", "minecraft:cow"); - DataConverterEntity.a.put("Creeper", "minecraft:creeper"); - DataConverterEntity.a.put("Donkey", "minecraft:donkey"); - DataConverterEntity.a.put("DragonFireball", "minecraft:dragon_fireball"); - DataConverterEntity.a.put("ElderGuardian", "minecraft:elder_guardian"); - DataConverterEntity.a.put("EnderCrystal", "minecraft:ender_crystal"); - DataConverterEntity.a.put("EnderDragon", "minecraft:ender_dragon"); - DataConverterEntity.a.put("Enderman", "minecraft:enderman"); - DataConverterEntity.a.put("Endermite", "minecraft:endermite"); - DataConverterEntity.a.put("EyeOfEnderSignal", "minecraft:eye_of_ender_signal"); - DataConverterEntity.a.put("FallingSand", "minecraft:falling_block"); - DataConverterEntity.a.put("Fireball", "minecraft:fireball"); - DataConverterEntity.a.put("FireworksRocketEntity", "minecraft:fireworks_rocket"); - DataConverterEntity.a.put("Ghast", "minecraft:ghast"); - DataConverterEntity.a.put("Giant", "minecraft:giant"); - DataConverterEntity.a.put("Guardian", "minecraft:guardian"); - DataConverterEntity.a.put("Horse", "minecraft:horse"); - DataConverterEntity.a.put("Husk", "minecraft:husk"); - DataConverterEntity.a.put("Item", "minecraft:item"); - DataConverterEntity.a.put("ItemFrame", "minecraft:item_frame"); - DataConverterEntity.a.put("LavaSlime", "minecraft:magma_cube"); - DataConverterEntity.a.put("LeashKnot", "minecraft:leash_knot"); - DataConverterEntity.a.put("MinecartChest", "minecraft:chest_minecart"); - DataConverterEntity.a.put("MinecartCommandBlock", "minecraft:commandblock_minecart"); - DataConverterEntity.a.put("MinecartFurnace", "minecraft:furnace_minecart"); - DataConverterEntity.a.put("MinecartHopper", "minecraft:hopper_minecart"); - DataConverterEntity.a.put("MinecartRideable", "minecraft:minecart"); - DataConverterEntity.a.put("MinecartSpawner", "minecraft:spawner_minecart"); - DataConverterEntity.a.put("MinecartTNT", "minecraft:tnt_minecart"); - DataConverterEntity.a.put("Mule", "minecraft:mule"); - DataConverterEntity.a.put("MushroomCow", "minecraft:mooshroom"); - DataConverterEntity.a.put("Ozelot", "minecraft:ocelot"); - DataConverterEntity.a.put("Painting", "minecraft:painting"); - DataConverterEntity.a.put("Pig", "minecraft:pig"); - DataConverterEntity.a.put("PigZombie", "minecraft:zombie_pigman"); - DataConverterEntity.a.put("PolarBear", "minecraft:polar_bear"); - DataConverterEntity.a.put("PrimedTnt", "minecraft:tnt"); - DataConverterEntity.a.put("Rabbit", "minecraft:rabbit"); - DataConverterEntity.a.put("Sheep", "minecraft:sheep"); - DataConverterEntity.a.put("Shulker", "minecraft:shulker"); - DataConverterEntity.a.put("ShulkerBullet", "minecraft:shulker_bullet"); - DataConverterEntity.a.put("Silverfish", "minecraft:silverfish"); - DataConverterEntity.a.put("Skeleton", "minecraft:skeleton"); - DataConverterEntity.a.put("SkeletonHorse", "minecraft:skeleton_horse"); - DataConverterEntity.a.put("Slime", "minecraft:slime"); - DataConverterEntity.a.put("SmallFireball", "minecraft:small_fireball"); - DataConverterEntity.a.put("SnowMan", "minecraft:snowman"); - DataConverterEntity.a.put("Snowball", "minecraft:snowball"); - DataConverterEntity.a.put("SpectralArrow", "minecraft:spectral_arrow"); - DataConverterEntity.a.put("Spider", "minecraft:spider"); - DataConverterEntity.a.put("Squid", "minecraft:squid"); - DataConverterEntity.a.put("Stray", "minecraft:stray"); - DataConverterEntity.a.put("ThrownEgg", "minecraft:egg"); - DataConverterEntity.a.put("ThrownEnderpearl", "minecraft:ender_pearl"); - DataConverterEntity.a.put("ThrownExpBottle", "minecraft:xp_bottle"); - DataConverterEntity.a.put("ThrownPotion", "minecraft:potion"); - DataConverterEntity.a.put("Villager", "minecraft:villager"); - DataConverterEntity.a.put("VillagerGolem", "minecraft:villager_golem"); - DataConverterEntity.a.put("Witch", "minecraft:witch"); - DataConverterEntity.a.put("WitherBoss", "minecraft:wither"); - DataConverterEntity.a.put("WitherSkeleton", "minecraft:wither_skeleton"); - DataConverterEntity.a.put("WitherSkull", "minecraft:wither_skull"); - DataConverterEntity.a.put("Wolf", "minecraft:wolf"); - DataConverterEntity.a.put("XPOrb", "minecraft:xp_orb"); - DataConverterEntity.a.put("Zombie", "minecraft:zombie"); - DataConverterEntity.a.put("ZombieHorse", "minecraft:zombie_horse"); - DataConverterEntity.a.put("ZombieVillager", "minecraft:zombie_villager"); - } - } - - private static class DataConverterPotionWater implements DataConverter { - - DataConverterPotionWater() { - } - - public int getDataVersion() { - return 806; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - String s = cmp.getString("id"); - - if ("minecraft:potion".equals(s) || "minecraft:splash_potion".equals(s) || "minecraft:lingering_potion".equals(s) || "minecraft:tipped_arrow".equals(s)) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); - - if (!nbttagcompound1.contains("Potion", 8)) { - nbttagcompound1.putString("Potion", "minecraft:water"); - } - - if (!cmp.contains("tag", 10)) { - cmp.put("tag", nbttagcompound1); - } - } - - return cmp; - } - } - - private static class DataConverterShulker implements DataConverter { - - DataConverterShulker() { - } - - public int getDataVersion() { - return 808; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("minecraft:shulker".equals(cmp.getString("id")) && !cmp.contains("Color", 99)) { - cmp.putByte("Color", (byte) 10); - } - - return cmp; - } - } - - private static class DataConverterShulkerBoxItem implements DataConverter { - - public static final String[] a = new String[] { "minecraft:white_shulker_box", "minecraft:orange_shulker_box", "minecraft:magenta_shulker_box", "minecraft:light_blue_shulker_box", "minecraft:yellow_shulker_box", "minecraft:lime_shulker_box", "minecraft:pink_shulker_box", "minecraft:gray_shulker_box", "minecraft:silver_shulker_box", "minecraft:cyan_shulker_box", "minecraft:purple_shulker_box", "minecraft:blue_shulker_box", "minecraft:brown_shulker_box", "minecraft:green_shulker_box", "minecraft:red_shulker_box", "minecraft:black_shulker_box" }; - - DataConverterShulkerBoxItem() { - } - - public int getDataVersion() { - return 813; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("minecraft:shulker_box".equals(cmp.getString("id")) && cmp.contains("tag", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag"); - - if (nbttagcompound1.contains("BlockEntityTag", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag"); - - if (nbttagcompound2.getList("Items", 10).isEmpty()) { - nbttagcompound2.remove("Items"); - } - - int i = nbttagcompound2.getInt("Color"); - - nbttagcompound2.remove("Color"); - if (nbttagcompound2.isEmpty()) { - nbttagcompound1.remove("BlockEntityTag"); - } - - if (nbttagcompound1.isEmpty()) { - cmp.remove("tag"); - } - - cmp.putString("id", DataConverterShulkerBoxItem.a[i % 16]); - } - } - - return cmp; - } - } - - private static class DataConverterShulkerBoxBlock implements DataConverter { - - DataConverterShulkerBoxBlock() { - } - - public int getDataVersion() { - return 813; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("minecraft:shulker".equals(cmp.getString("id"))) { - cmp.remove("Color"); - } - - return cmp; - } - } - - private static class DataConverterLang implements DataConverter { - - DataConverterLang() { - } - - public int getDataVersion() { - return 816; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if (cmp.contains("lang", 8)) { - cmp.putString("lang", cmp.getString("lang").toLowerCase(Locale.ROOT)); - } - - return cmp; - } - } - - private static class DataConverterTotem implements DataConverter { - - DataConverterTotem() { - } - - public int getDataVersion() { - return 820; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("minecraft:totem".equals(cmp.getString("id"))) { - cmp.putString("id", "minecraft:totem_of_undying"); - } - - return cmp; - } - } - - private static class DataConverterBedBlock implements DataConverter { - - private static final Logger a = LogManager.getLogger(PaperweightDataConverters.class); - - DataConverterBedBlock() { - } - - public int getDataVersion() { - return 1125; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - try { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("Level"); - int i = nbttagcompound1.getInt("xPos"); - int j = nbttagcompound1.getInt("zPos"); - net.minecraft.nbt.ListTag nbttaglist = nbttagcompound1.getList("TileEntities", 10); - net.minecraft.nbt.ListTag nbttaglist1 = nbttagcompound1.getList("Sections", 10); - - for (int k = 0; k < nbttaglist1.size(); ++k) { - net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttaglist1.getCompound(k); - byte b0 = nbttagcompound2.getByte("Y"); - byte[] abyte = nbttagcompound2.getByteArray("Blocks"); - - for (int l = 0; l < abyte.length; ++l) { - if (416 == (abyte[l] & 255) << 4) { - int i1 = l & 15; - int j1 = l >> 8 & 15; - int k1 = l >> 4 & 15; - net.minecraft.nbt.CompoundTag nbttagcompound3 = new net.minecraft.nbt.CompoundTag(); - - nbttagcompound3.putString("id", "bed"); - nbttagcompound3.putInt("x", i1 + (i << 4)); - nbttagcompound3.putInt("y", j1 + (b0 << 4)); - nbttagcompound3.putInt("z", k1 + (j << 4)); - nbttaglist.add(nbttagcompound3); - } - } - } - } catch (Exception exception) { - DataConverterBedBlock.a.warn("Unable to datafix Bed blocks, level format may be missing tags."); - } - - return cmp; - } - } - - private static class DataConverterBedItem implements DataConverter { - - DataConverterBedItem() { - } - - public int getDataVersion() { - return 1125; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("minecraft:bed".equals(cmp.getString("id")) && cmp.getShort("Damage") == 0) { - cmp.putShort("Damage", (short) DyeColor.RED.getId()); - } - - return cmp; - } - } - - private static class DataConverterSignText implements DataConverter { - - public static final Gson a = new GsonBuilder().registerTypeAdapter(Component.class, new JsonDeserializer() { - MutableComponent a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { - if (jsonelement.isJsonPrimitive()) { - return Component.literal(jsonelement.getAsString()); - } else if (jsonelement.isJsonArray()) { - JsonArray jsonarray = jsonelement.getAsJsonArray(); - MutableComponent ichatbasecomponent = null; - Iterator iterator = jsonarray.iterator(); - - while (iterator.hasNext()) { - JsonElement jsonelement1 = (JsonElement) iterator.next(); - MutableComponent ichatbasecomponent1 = this.a(jsonelement1, jsonelement1.getClass(), jsondeserializationcontext); - - if (ichatbasecomponent == null) { - ichatbasecomponent = ichatbasecomponent1; - } else { - ichatbasecomponent.append(ichatbasecomponent1); - } - } - - return ichatbasecomponent; - } else { - throw new JsonParseException("Don't know how to turn " + jsonelement + " into a Component"); - } - } - - public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { - return this.a(jsonelement, type, jsondeserializationcontext); - } - }).create(); - - DataConverterSignText() { - } - - public int getDataVersion() { - return 101; - } - - public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) { - if ("Sign".equals(cmp.getString("id"))) { - this.convert(cmp, "Text1"); - this.convert(cmp, "Text2"); - this.convert(cmp, "Text3"); - this.convert(cmp, "Text4"); - } - - return cmp; - } - - private void convert(net.minecraft.nbt.CompoundTag nbttagcompound, String s) { - String s1 = nbttagcompound.getString(s); - Component object = null; - - if (!"null".equals(s1) && !StringUtil.isNullOrEmpty(s1)) { - if ((s1.charAt(0) != 34 || s1.charAt(s1.length() - 1) != 34) && (s1.charAt(0) != 123 || s1.charAt(s1.length() - 1) != 125)) { - object = Component.literal(s1); - } else { - try { - object = GsonHelper.fromJson(DataConverterSignText.a, s1, Component.class, true); - if (object == null) { - object = Component.literal(""); - } - } catch (JsonParseException jsonparseexception) { - ; - } - - if (object == null) { - try { - object = Component.Serializer.fromJson(s1); - } catch (JsonParseException jsonparseexception1) { - ; - } - } - - if (object == null) { - try { - object = Component.Serializer.fromJsonLenient(s1); - } catch (JsonParseException jsonparseexception2) { - ; - } - } - - if (object == null) { - object = Component.literal(s1); - } - } - } else { - object = Component.literal(""); - } - - nbttagcompound.putString(s, Component.Serializer.toJson(object)); - } - } - - private static class DataInspectorPlayerVehicle implements DataInspector { - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (cmp.contains("RootVehicle", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("RootVehicle"); - - if (nbttagcompound1.contains("Entity", 10)) { - convertCompound(LegacyType.ENTITY, nbttagcompound1, "Entity", sourceVer, targetVer); - } - } - - return cmp; - } - } - - private static class DataInspectorLevelPlayer implements DataInspector { - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (cmp.contains("Player", 10)) { - convertCompound(LegacyType.PLAYER, cmp, "Player", sourceVer, targetVer); - } - - return cmp; - } - } - - private static class DataInspectorStructure implements DataInspector { - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - net.minecraft.nbt.ListTag nbttaglist; - int j; - net.minecraft.nbt.CompoundTag nbttagcompound1; - - if (cmp.contains("entities", 9)) { - nbttaglist = cmp.getList("entities", 10); - - for (j = 0; j < nbttaglist.size(); ++j) { - nbttagcompound1 = (net.minecraft.nbt.CompoundTag) nbttaglist.get(j); - if (nbttagcompound1.contains("nbt", 10)) { - convertCompound(LegacyType.ENTITY, nbttagcompound1, "nbt", sourceVer, targetVer); - } - } - } - - if (cmp.contains("blocks", 9)) { - nbttaglist = cmp.getList("blocks", 10); - - for (j = 0; j < nbttaglist.size(); ++j) { - nbttagcompound1 = (net.minecraft.nbt.CompoundTag) nbttaglist.get(j); - if (nbttagcompound1.contains("nbt", 10)) { - convertCompound(LegacyType.BLOCK_ENTITY, nbttagcompound1, "nbt", sourceVer, targetVer); - } - } - } - - return cmp; - } - } - - private static class DataInspectorChunks implements DataInspector { - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (cmp.contains("Level", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("Level"); - net.minecraft.nbt.ListTag nbttaglist; - int j; - - if (nbttagcompound1.contains("Entities", 9)) { - nbttaglist = nbttagcompound1.getList("Entities", 10); - - for (j = 0; j < nbttaglist.size(); ++j) { - nbttaglist.set(j, convert(LegacyType.ENTITY, (net.minecraft.nbt.CompoundTag) nbttaglist.get(j), sourceVer, targetVer)); - } - } - - if (nbttagcompound1.contains("TileEntities", 9)) { - nbttaglist = nbttagcompound1.getList("TileEntities", 10); - - for (j = 0; j < nbttaglist.size(); ++j) { - nbttaglist.set(j, convert(LegacyType.BLOCK_ENTITY, (net.minecraft.nbt.CompoundTag) nbttaglist.get(j), sourceVer, targetVer)); - } - } - } - - return cmp; - } - } - - private static class DataInspectorEntityPassengers implements DataInspector { - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (cmp.contains("Passengers", 9)) { - net.minecraft.nbt.ListTag nbttaglist = cmp.getList("Passengers", 10); - - for (int j = 0; j < nbttaglist.size(); ++j) { - nbttaglist.set(j, convert(LegacyType.ENTITY, nbttaglist.getCompound(j), sourceVer, targetVer)); - } - } - - return cmp; - } - } - - private static class DataInspectorPlayer implements DataInspector { - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - convertItems(cmp, "Inventory", sourceVer, targetVer); - convertItems(cmp, "EnderItems", sourceVer, targetVer); - if (cmp.contains("ShoulderEntityLeft", 10)) { - convertCompound(LegacyType.ENTITY, cmp, "ShoulderEntityLeft", sourceVer, targetVer); - } - - if (cmp.contains("ShoulderEntityRight", 10)) { - convertCompound(LegacyType.ENTITY, cmp, "ShoulderEntityRight", sourceVer, targetVer); - } - - return cmp; - } - } - - private static class DataInspectorVillagers implements DataInspector { - ResourceLocation entityVillager = getKey("EntityVillager"); - - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (entityVillager.equals(new ResourceLocation(cmp.getString("id"))) && cmp.contains("Offers", 10)) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("Offers"); - - if (nbttagcompound1.contains("Recipes", 9)) { - net.minecraft.nbt.ListTag nbttaglist = nbttagcompound1.getList("Recipes", 10); - - for (int j = 0; j < nbttaglist.size(); ++j) { - net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttaglist.getCompound(j); - - convertItem(nbttagcompound2, "buy", sourceVer, targetVer); - convertItem(nbttagcompound2, "buyB", sourceVer, targetVer); - convertItem(nbttagcompound2, "sell", sourceVer, targetVer); - nbttaglist.set(j, nbttagcompound2); - } - } - } - - return cmp; - } - } - - private static class DataInspectorMobSpawnerMinecart implements DataInspector { - ResourceLocation entityMinecartMobSpawner = getKey("EntityMinecartMobSpawner"); - ResourceLocation tileEntityMobSpawner = getKey("TileEntityMobSpawner"); - - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - String s = cmp.getString("id"); - if (entityMinecartMobSpawner.equals(new ResourceLocation(s))) { - cmp.putString("id", tileEntityMobSpawner.toString()); - convert(LegacyType.BLOCK_ENTITY, cmp, sourceVer, targetVer); - cmp.putString("id", s); - } - - return cmp; - } - } - - private static class DataInspectorMobSpawnerMobs implements DataInspector { - ResourceLocation tileEntityMobSpawner = getKey("TileEntityMobSpawner"); - - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (tileEntityMobSpawner.equals(new ResourceLocation(cmp.getString("id")))) { - if (cmp.contains("SpawnPotentials", 9)) { - net.minecraft.nbt.ListTag nbttaglist = cmp.getList("SpawnPotentials", 10); - - for (int j = 0; j < nbttaglist.size(); ++j) { - net.minecraft.nbt.CompoundTag nbttagcompound1 = nbttaglist.getCompound(j); - - convertCompound(LegacyType.ENTITY, nbttagcompound1, "Entity", sourceVer, targetVer); - } - } - - convertCompound(LegacyType.ENTITY, cmp, "SpawnData", sourceVer, targetVer); - } - - return cmp; - } - } - - private static class DataInspectorCommandBlock implements DataInspector { - ResourceLocation tileEntityCommand = getKey("TileEntityCommand"); - - @Override - public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) { - if (tileEntityCommand.equals(new ResourceLocation(cmp.getString("id")))) { - cmp.putString("id", "Control"); - convert(LegacyType.BLOCK_ENTITY, cmp, sourceVer, targetVer); - cmp.putString("id", "MinecartCommandBlock"); - } - - return cmp; - } - } -} diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R2/PaperweightFakePlayer.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R2/PaperweightFakePlayer.java deleted file mode 100644 index 874b5323f..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R2/PaperweightFakePlayer.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_19_R2; - -import com.mojang.authlib.GameProfile; -import net.minecraft.network.chat.Component; -import net.minecraft.network.protocol.game.ServerboundClientInformationPacket; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.stats.Stat; -import net.minecraft.world.MenuProvider; -import net.minecraft.world.damagesource.DamageSource; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.block.entity.SignBlockEntity; -import net.minecraft.world.phys.Vec3; -import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; - -import java.util.OptionalInt; -import java.util.UUID; - -class PaperweightFakePlayer extends ServerPlayer { - private static final GameProfile FAKE_WORLDEDIT_PROFILE = new GameProfile(UUID.nameUUIDFromBytes("worldedit".getBytes()), "[WorldEdit]"); - private static final Vec3 ORIGIN = new Vec3(0.0D, 0.0D, 0.0D); - - PaperweightFakePlayer(ServerLevel world) { - super(world.getServer(), world, FAKE_WORLDEDIT_PROFILE); - } - - @Override - public Vec3 position() { - return ORIGIN; - } - - @Override - public void tick() { - } - - @Override - public void die(DamageSource damagesource) { - } - - @Override - public Entity changeDimension(ServerLevel worldserver, TeleportCause cause) { - return this; - } - - @Override - public OptionalInt openMenu(MenuProvider factory) { - return OptionalInt.empty(); - } - - @Override - public void updateOptions(ServerboundClientInformationPacket packet) { - } - - @Override - public void displayClientMessage(Component message, boolean actionBar) { - } - - @Override - public void awardStat(Stat stat, int amount) { - } - - @Override - public void awardStat(Stat stat) { - } - - @Override - public boolean isInvulnerableTo(DamageSource damageSource) { - return true; - } - - @Override - public void openTextEdit(SignBlockEntity sign) { - } -} diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R2/PaperweightWorldNativeAccess.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R2/PaperweightWorldNativeAccess.java deleted file mode 100644 index 32d5682b1..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_19_R2/PaperweightWorldNativeAccess.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * WorldEdit, a Minecraft world manipulation toolkit - * Copyright (C) sk89q - * Copyright (C) WorldEdit team and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_19_R2; - -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.internal.block.BlockStateIdAccess; -import com.sk89q.worldedit.internal.wna.WorldNativeAccess; -import com.sk89q.worldedit.util.SideEffect; -import com.sk89q.worldedit.util.SideEffectSet; -import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; -import com.sk89q.worldedit.world.block.BlockState; -import net.minecraft.core.BlockPos; -import net.minecraft.server.level.ChunkHolder; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.chunk.LevelChunk; -import org.bukkit.craftbukkit.v1_19_R2.CraftWorld; -import org.bukkit.craftbukkit.v1_19_R2.block.data.CraftBlockData; -import org.bukkit.event.block.BlockPhysicsEvent; - -import java.lang.ref.WeakReference; -import java.util.Objects; -import javax.annotation.Nullable; - -public class PaperweightWorldNativeAccess implements WorldNativeAccess { - private static final int UPDATE = 1; - private static final int NOTIFY = 2; - - private final PaperweightAdapter adapter; - private final WeakReference world; - private SideEffectSet sideEffectSet; - - public PaperweightWorldNativeAccess(PaperweightAdapter adapter, WeakReference world) { - this.adapter = adapter; - this.world = world; - } - - private ServerLevel getWorld() { - return Objects.requireNonNull(world.get(), "The reference to the world was lost"); - } - - @Override - public void setCurrentSideEffectSet(SideEffectSet sideEffectSet) { - this.sideEffectSet = sideEffectSet; - } - - @Override - public LevelChunk getChunk(int x, int z) { - return getWorld().getChunk(x, z); - } - - @Override - public net.minecraft.world.level.block.state.BlockState toNative(BlockState state) { - int stateId = BlockStateIdAccess.getBlockStateId(state); - return BlockStateIdAccess.isValidInternalId(stateId) - ? Block.stateById(stateId) - : ((CraftBlockData) BukkitAdapter.adapt(state)).getState(); - } - - @Override - public net.minecraft.world.level.block.state.BlockState getBlockState(LevelChunk chunk, BlockPos position) { - return chunk.getBlockState(position); - } - - @Nullable - @Override - public net.minecraft.world.level.block.state.BlockState setBlockState(LevelChunk chunk, BlockPos position, net.minecraft.world.level.block.state.BlockState state) { - return chunk.setBlockState(position, state, false, this.sideEffectSet.shouldApply(SideEffect.UPDATE)); - } - - @Override - public net.minecraft.world.level.block.state.BlockState getValidBlockForPosition(net.minecraft.world.level.block.state.BlockState block, BlockPos position) { - return Block.updateFromNeighbourShapes(block, getWorld(), position); - } - - @Override - public BlockPos getPosition(int x, int y, int z) { - return new BlockPos(x, y, z); - } - - @Override - public void updateLightingForBlock(BlockPos position) { - getWorld().getChunkSource().getLightEngine().checkBlock(position); - } - - @Override - public boolean updateTileEntity(final BlockPos position, final CompoundBinaryTag tag) { - return false; - } - - @Override - public void notifyBlockUpdate(LevelChunk chunk, BlockPos position, net.minecraft.world.level.block.state.BlockState oldState, net.minecraft.world.level.block.state.BlockState newState) { - if (chunk.getSections()[getWorld().getSectionIndex(position.getY())] != null) { - getWorld().sendBlockUpdated(position, oldState, newState, UPDATE | NOTIFY); - } - } - - @Override - public boolean isChunkTicking(LevelChunk chunk) { - return chunk.getFullStatus().isOrAfter(ChunkHolder.FullChunkStatus.TICKING); - } - - @Override - public void markBlockChanged(LevelChunk chunk, BlockPos position) { - if (chunk.getSections()[getWorld().getSectionIndex(position.getY())] != null) { - getWorld().getChunkSource().blockChanged(position); - } - } - - @Override - public void notifyNeighbors(BlockPos pos, net.minecraft.world.level.block.state.BlockState oldState, net.minecraft.world.level.block.state.BlockState newState) { - ServerLevel world = getWorld(); - if (sideEffectSet.shouldApply(SideEffect.EVENTS)) { - world.updateNeighborsAt(pos, oldState.getBlock()); - } else { - // When we don't want events, manually run the physics without them. - Block block = oldState.getBlock(); - fireNeighborChanged(pos, world, block, pos.west()); - fireNeighborChanged(pos, world, block, pos.east()); - fireNeighborChanged(pos, world, block, pos.below()); - fireNeighborChanged(pos, world, block, pos.above()); - fireNeighborChanged(pos, world, block, pos.north()); - fireNeighborChanged(pos, world, block, pos.south()); - } - if (newState.hasAnalogOutputSignal()) { - world.updateNeighbourForOutputSignal(pos, newState.getBlock()); - } - } - - // Not sure why neighborChanged is deprecated - @SuppressWarnings("deprecation") - private void fireNeighborChanged(BlockPos pos, ServerLevel world, Block block, BlockPos neighborPos) { - world.getBlockState(neighborPos).neighborChanged(world, neighborPos, block, pos, false); - } - - @Override - public void updateNeighbors(BlockPos pos, net.minecraft.world.level.block.state.BlockState oldState, net.minecraft.world.level.block.state.BlockState newState, int recursionLimit) { - ServerLevel world = getWorld(); - // a == updateNeighbors - // b == updateDiagonalNeighbors - oldState.updateIndirectNeighbourShapes(world, pos, NOTIFY, recursionLimit); - if (sideEffectSet.shouldApply(SideEffect.EVENTS)) { - CraftWorld craftWorld = world.getWorld(); - BlockPhysicsEvent event = new BlockPhysicsEvent(craftWorld.getBlockAt(pos.getX(), pos.getY(), pos.getZ()), CraftBlockData.fromData(newState)); - world.getCraftServer().getPluginManager().callEvent(event); - if (event.isCancelled()) { - return; - } - } - newState.updateNeighbourShapes(world, pos, NOTIFY, recursionLimit); - newState.updateIndirectNeighbourShapes(world, pos, NOTIFY, recursionLimit); - } - - @Override - public void onBlockStateChange(BlockPos pos, net.minecraft.world.level.block.state.BlockState oldState, net.minecraft.world.level.block.state.BlockState newState) { - getWorld().onBlockStateChange(pos, oldState, newState); - } - - @Override - public void flush() { - - } -} diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightBlockMaterial.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightBlockMaterial.java deleted file mode 100644 index 69528e201..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightBlockMaterial.java +++ /dev/null @@ -1,189 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R2; - -import com.google.common.base.Suppliers; -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.util.ReflectionUtil; -import com.sk89q.worldedit.bukkit.adapter.Refraction; -import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R2.nbt.PaperweightLazyCompoundTag; -import com.sk89q.worldedit.world.registry.BlockMaterial; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.EmptyBlockGetter; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.EntityBlock; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockBehaviour; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.Material; -import net.minecraft.world.level.material.PushReaction; -import org.bukkit.craftbukkit.v1_19_R2.block.data.CraftBlockData; - -public class PaperweightBlockMaterial implements BlockMaterial { - - private final Block block; - private final BlockState blockState; - private final Material material; - private final boolean isTranslucent; - private final CraftBlockData craftBlockData; - private final org.bukkit.Material craftMaterial; - private final int opacity; - private final CompoundTag tile; - - public PaperweightBlockMaterial(Block block) { - this(block, block.defaultBlockState()); - } - - public PaperweightBlockMaterial(Block block, BlockState blockState) { - this.block = block; - this.blockState = blockState; - this.material = blockState.getMaterial(); - this.craftBlockData = CraftBlockData.fromData(blockState); - this.craftMaterial = craftBlockData.getMaterial(); - BlockBehaviour.Properties blockInfo = ReflectionUtil.getField(BlockBehaviour.class, block, - Refraction.pickName("properties", "aP")); - this.isTranslucent = !(boolean) ReflectionUtil.getField(BlockBehaviour.Properties.class, blockInfo, - Refraction.pickName("canOcclude", "n") - ); - opacity = blockState.getLightBlock(EmptyBlockGetter.INSTANCE, BlockPos.ZERO); - BlockEntity tileEntity = !(block instanceof EntityBlock) ? null : ((EntityBlock) block).newBlockEntity( - BlockPos.ZERO, - blockState - ); - tile = tileEntity == null - ? null - : new PaperweightLazyCompoundTag(Suppliers.memoize(tileEntity::saveWithId)); - } - - public Block getBlock() { - return block; - } - - public BlockState getState() { - return blockState; - } - - public CraftBlockData getCraftBlockData() { - return craftBlockData; - } - - public Material getMaterial() { - return material; - } - - @Override - public boolean isAir() { - return blockState.isAir(); - } - - @Override - public boolean isFullCube() { - return craftMaterial.isOccluding(); - } - - @Override - public boolean isOpaque() { - return material.isSolidBlocking(); - } - - @Override - public boolean isPowerSource() { - return blockState.isSignalSource(); - } - - @Override - public boolean isLiquid() { - return material.isLiquid(); - } - - @Override - public boolean isSolid() { - return material.isSolid(); - } - - @Override - public float getHardness() { - return craftBlockData.getState().destroySpeed; - } - - @Override - public float getResistance() { - return block.getExplosionResistance(); - } - - @Override - public float getSlipperiness() { - return block.getFriction(); - } - - @Override - public int getLightValue() { - return blockState.getLightEmission(); - } - - @Override - public int getLightOpacity() { - return opacity; - } - - @Override - public boolean isFragileWhenPushed() { - return material.getPushReaction() == PushReaction.DESTROY; - } - - @Override - public boolean isUnpushable() { - return material.getPushReaction() == PushReaction.BLOCK; - } - - @Override - public boolean isTicksRandomly() { - return block.isRandomlyTicking(blockState); - } - - @Override - public boolean isMovementBlocker() { - return material.isSolid(); - } - - @Override - public boolean isBurnable() { - return material.isFlammable(); - } - - @Override - public boolean isToolRequired() { - // Removed in 1.16.1, this is not present in higher versions - return false; - } - - @Override - public boolean isReplacedDuringPlacement() { - return material.isReplaceable(); - } - - @Override - public boolean isTranslucent() { - return isTranslucent; - } - - @Override - public boolean hasContainer() { - return block instanceof EntityBlock; - } - - @Override - public boolean isTile() { - return block instanceof EntityBlock; - } - - @Override - public CompoundTag getDefaultTile() { - return tile; - } - - @Override - public int getMapColor() { - // rgb field - return material.getColor().col; - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightFaweAdapter.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightFaweAdapter.java deleted file mode 100644 index 7cfce755e..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightFaweAdapter.java +++ /dev/null @@ -1,706 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R2; - -import com.fastasyncworldedit.bukkit.adapter.CachedBukkitAdapter; -import com.fastasyncworldedit.bukkit.adapter.IDelegateBukkitImplAdapter; -import com.fastasyncworldedit.bukkit.adapter.NMSRelighterFactory; -import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.entity.LazyBaseEntity; -import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory; -import com.fastasyncworldedit.core.queue.IBatchProcessor; -import com.fastasyncworldedit.core.queue.IChunkGet; -import com.fastasyncworldedit.core.queue.implementation.packet.ChunkPacket; -import com.fastasyncworldedit.core.util.NbtUtils; -import com.fastasyncworldedit.core.util.TaskManager; -import com.google.common.base.Preconditions; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.EditSession; -import com.sk89q.worldedit.blocks.BaseItemStack; -import com.sk89q.worldedit.blocks.TileEntityBlock; -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.bukkit.BukkitWorld; -import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; -import com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_19_R2.PaperweightAdapter; -import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R2.nbt.PaperweightLazyCompoundTag; -import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R2.regen.PaperweightRegen; -import com.sk89q.worldedit.entity.BaseEntity; -import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.internal.block.BlockStateIdAccess; -import com.sk89q.worldedit.internal.util.LogManagerCompat; -import com.sk89q.worldedit.internal.wna.WorldNativeAccess; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.registry.state.BooleanProperty; -import com.sk89q.worldedit.registry.state.DirectionalProperty; -import com.sk89q.worldedit.registry.state.EnumProperty; -import com.sk89q.worldedit.registry.state.IntegerProperty; -import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.util.Direction; -import com.sk89q.worldedit.util.SideEffect; -import com.sk89q.worldedit.util.SideEffectSet; -import com.sk89q.worldedit.util.TreeGenerator; -import com.sk89q.worldedit.util.formatting.text.Component; -import com.sk89q.worldedit.util.nbt.BinaryTag; -import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; -import com.sk89q.worldedit.util.nbt.StringBinaryTag; -import com.sk89q.worldedit.world.RegenOptions; -import com.sk89q.worldedit.world.biome.BiomeType; -import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockStateHolder; -import com.sk89q.worldedit.world.block.BlockType; -import com.sk89q.worldedit.world.block.BlockTypes; -import com.sk89q.worldedit.world.block.BlockTypesCache; -import com.sk89q.worldedit.world.entity.EntityType; -import com.sk89q.worldedit.world.item.ItemType; -import com.sk89q.worldedit.world.registry.BlockMaterial; -import io.papermc.lib.PaperLib; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Registry; -import net.minecraft.core.WritableRegistry; -import net.minecraft.core.registries.Registries; -import net.minecraft.nbt.IntTag; -import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.dedicated.DedicatedServer; -import net.minecraft.server.level.ChunkHolder; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.util.StringRepresentable; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.properties.BlockStateProperties; -import net.minecraft.world.level.block.state.properties.DirectionProperty; -import net.minecraft.world.level.chunk.LevelChunk; -import net.minecraft.world.level.chunk.LevelChunkSection; -import org.apache.logging.log4j.Logger; -import org.bukkit.Bukkit; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.NamespacedKey; -import org.bukkit.TreeType; -import org.bukkit.block.data.BlockData; -import org.bukkit.craftbukkit.v1_19_R2.CraftChunk; -import org.bukkit.craftbukkit.v1_19_R2.CraftServer; -import org.bukkit.craftbukkit.v1_19_R2.CraftWorld; -import org.bukkit.craftbukkit.v1_19_R2.block.CraftBlockState; -import org.bukkit.craftbukkit.v1_19_R2.block.data.CraftBlockData; -import org.bukkit.craftbukkit.v1_19_R2.entity.CraftEntity; -import org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer; -import org.bukkit.craftbukkit.v1_19_R2.inventory.CraftItemStack; -import org.bukkit.craftbukkit.v1_19_R2.util.CraftNamespacedKey; -import org.bukkit.entity.Player; - -import javax.annotation.Nullable; -import java.lang.ref.WeakReference; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import java.util.Objects; -import java.util.OptionalInt; -import java.util.Set; -import java.util.function.Supplier; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import static net.minecraft.core.registries.Registries.BIOME; - -public final class PaperweightFaweAdapter extends CachedBukkitAdapter implements - IDelegateBukkitImplAdapter { - - private static final Logger LOGGER = LogManagerCompat.getLogger(); - private static Method CHUNK_HOLDER_WAS_ACCESSIBLE_SINCE_LAST_SAVE; - - static { - try { - CHUNK_HOLDER_WAS_ACCESSIBLE_SINCE_LAST_SAVE = ChunkHolder.class.getDeclaredMethod("wasAccessibleSinceLastSave"); - } catch (NoSuchMethodException ignored) { // may not be present in newer paper versions - } - } - - private final PaperweightAdapter parent; - // ------------------------------------------------------------------------ - // Code that may break between versions of Minecraft - // ------------------------------------------------------------------------ - private final PaperweightMapChunkUtil mapUtil = new PaperweightMapChunkUtil(); - private char[] ibdToStateOrdinal = null; - private int[] ordinalToIbdID = null; - private boolean initialised = false; - private Map>> allBlockProperties = null; - - public PaperweightFaweAdapter() throws NoSuchFieldException, NoSuchMethodException { - this.parent = new PaperweightAdapter(); - } - - @Nullable - private static String getEntityId(Entity entity) { - ResourceLocation resourceLocation = net.minecraft.world.entity.EntityType.getKey(entity.getType()); - return resourceLocation == null ? null : resourceLocation.toString(); - } - - private static void readEntityIntoTag(Entity entity, net.minecraft.nbt.CompoundTag compoundTag) { - entity.save(compoundTag); - } - - @Override - public BukkitImplAdapter getParent() { - return parent; - } - - private synchronized boolean init() { - if (ibdToStateOrdinal != null && ibdToStateOrdinal[1] != 0) { - return false; - } - ibdToStateOrdinal = new char[BlockTypesCache.states.length]; // size - ordinalToIbdID = new int[ibdToStateOrdinal.length]; // size - for (int i = 0; i < ibdToStateOrdinal.length; i++) { - BlockState blockState = BlockTypesCache.states[i]; - PaperweightBlockMaterial material = (PaperweightBlockMaterial) blockState.getMaterial(); - int id = Block.BLOCK_STATE_REGISTRY.getId(material.getState()); - char ordinal = blockState.getOrdinalChar(); - ibdToStateOrdinal[id] = ordinal; - ordinalToIbdID[ordinal] = id; - } - Map>> properties = new HashMap<>(); - try { - for (Field field : BlockStateProperties.class.getDeclaredFields()) { - Object obj = field.get(null); - if (!(obj instanceof net.minecraft.world.level.block.state.properties.Property state)) { - continue; - } - Property property; - if (state instanceof net.minecraft.world.level.block.state.properties.BooleanProperty) { - property = new BooleanProperty( - state.getName(), - (List) ImmutableList.copyOf(state.getPossibleValues()) - ); - } else if (state instanceof DirectionProperty) { - property = new DirectionalProperty( - state.getName(), - state - .getPossibleValues() - .stream() - .map(e -> Direction.valueOf(((StringRepresentable) e).getSerializedName().toUpperCase())) - .collect(Collectors.toList()) - ); - } else if (state instanceof net.minecraft.world.level.block.state.properties.EnumProperty) { - property = new EnumProperty( - state.getName(), - state - .getPossibleValues() - .stream() - .map(e -> ((StringRepresentable) e).getSerializedName()) - .collect(Collectors.toList()) - ); - } else if (state instanceof net.minecraft.world.level.block.state.properties.IntegerProperty) { - property = new IntegerProperty( - state.getName(), - (List) ImmutableList.copyOf(state.getPossibleValues()) - ); - } else { - throw new IllegalArgumentException("FastAsyncWorldEdit needs an update to support " + state - .getClass() - .getSimpleName()); - } - properties.compute(property.getName().toLowerCase(Locale.ROOT), (k, v) -> { - if (v == null) { - v = new ArrayList<>(Collections.singletonList(property)); - } else { - v.add(property); - } - return v; - }); - } - } catch (IllegalAccessException e) { - e.printStackTrace(); - } finally { - allBlockProperties = ImmutableMap.copyOf(properties); - } - initialised = true; - return true; - } - - @Override - public BlockMaterial getMaterial(BlockType blockType) { - Block block = getBlock(blockType); - return new PaperweightBlockMaterial(block); - } - - @Override - public synchronized BlockMaterial getMaterial(BlockState state) { - net.minecraft.world.level.block.state.BlockState blockState = ((CraftBlockData) Bukkit.createBlockData(state.getAsString())).getState(); - return new PaperweightBlockMaterial(blockState.getBlock(), blockState); - } - - public Block getBlock(BlockType blockType) { - return DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.BLOCK) - .get(new ResourceLocation(blockType.getNamespace(), blockType.getResource())); - } - - @Deprecated - @Override - public BlockState getBlock(Location location) { - Preconditions.checkNotNull(location); - - CraftWorld craftWorld = ((CraftWorld) location.getWorld()); - int x = location.getBlockX(); - int y = location.getBlockY(); - int z = location.getBlockZ(); - final ServerLevel handle = craftWorld.getHandle(); - LevelChunk chunk = handle.getChunk(x >> 4, z >> 4); - final BlockPos blockPos = new BlockPos(x, y, z); - final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(blockPos); - BlockState state = adapt(blockData); - if (state == null) { - org.bukkit.block.Block bukkitBlock = location.getBlock(); - state = BukkitAdapter.adapt(bukkitBlock.getBlockData()); - } - return state; - } - - @Override - public BaseBlock getFullBlock(final Location location) { - Preconditions.checkNotNull(location); - - CraftWorld craftWorld = ((CraftWorld) location.getWorld()); - int x = location.getBlockX(); - int y = location.getBlockY(); - int z = location.getBlockZ(); - - final ServerLevel handle = craftWorld.getHandle(); - LevelChunk chunk = handle.getChunk(x >> 4, z >> 4); - final BlockPos blockPos = new BlockPos(x, y, z); - final net.minecraft.world.level.block.state.BlockState blockData = chunk.getBlockState(blockPos); - BlockState state = adapt(blockData); - if (state == null) { - org.bukkit.block.Block bukkitBlock = location.getBlock(); - state = BukkitAdapter.adapt(bukkitBlock.getBlockData()); - } - if (state.getBlockType().getMaterial().hasContainer()) { - - // Read the NBT data - BlockEntity blockEntity = chunk.getBlockEntity(blockPos, LevelChunk.EntityCreationType.CHECK); - if (blockEntity != null) { - net.minecraft.nbt.CompoundTag tag = blockEntity.saveWithId(); - return state.toBaseBlock((CompoundBinaryTag) toNativeBinary(tag)); - } - } - - return state.toBaseBlock(); - } - - @Override - public Set getSupportedSideEffects() { - return SideEffectSet.defaults().getSideEffectsToApply(); - } - - public boolean setBlock(org.bukkit.Chunk chunk, int x, int y, int z, BlockStateHolder state, boolean update) { - CraftChunk craftChunk = (CraftChunk) chunk; - LevelChunk levelChunk = craftChunk.getHandle(); - Level level = levelChunk.getLevel(); - - BlockPos blockPos = new BlockPos(x, y, z); - net.minecraft.world.level.block.state.BlockState blockState = ((PaperweightBlockMaterial) state.getMaterial()).getState(); - LevelChunkSection[] levelChunkSections = levelChunk.getSections(); - int y4 = y >> 4; - LevelChunkSection section = levelChunkSections[y4]; - - net.minecraft.world.level.block.state.BlockState existing; - if (section == null) { - existing = ((PaperweightBlockMaterial) BlockTypes.AIR.getDefaultState().getMaterial()).getState(); - } else { - existing = section.getBlockState(x & 15, y & 15, z & 15); - } - - levelChunk.removeBlockEntity(blockPos); // Force delete the old tile entity - - CompoundBinaryTag compoundTag = state instanceof BaseBlock ? state.getNbt() : null; - if (compoundTag != null || existing instanceof TileEntityBlock) { - level.setBlock(blockPos, blockState, 0); - // remove tile - if (compoundTag != null) { - // We will assume that the tile entity was created for us, - // though we do not do this on the Forge version - BlockEntity blockEntity = level.getBlockEntity(blockPos); - if (blockEntity != null) { - net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) fromNativeBinary(compoundTag); - tag.put("x", IntTag.valueOf(x)); - tag.put("y", IntTag.valueOf(y)); - tag.put("z", IntTag.valueOf(z)); - blockEntity.load(tag); // readTagIntoTileEntity - load data - } - } - } else { - if (existing == blockState) { - return true; - } - levelChunk.setBlockState(blockPos, blockState, false); - } - if (update) { - level.getMinecraftWorld().sendBlockUpdated(blockPos, existing, blockState, 0); - } - return true; - } - - @Override - public WorldNativeAccess createWorldNativeAccess(org.bukkit.World world) { - return new PaperweightFaweWorldNativeAccess( - this, - new WeakReference<>(((CraftWorld) world).getHandle()) - ); - } - - @Override - public BaseEntity getEntity(org.bukkit.entity.Entity entity) { - Preconditions.checkNotNull(entity); - - CraftEntity craftEntity = ((CraftEntity) entity); - Entity mcEntity = craftEntity.getHandle(); - - String id = getEntityId(mcEntity); - - if (id != null) { - EntityType type = com.sk89q.worldedit.world.entity.EntityTypes.get(id); - Supplier saveTag = () -> { - final net.minecraft.nbt.CompoundTag minecraftTag = new net.minecraft.nbt.CompoundTag(); - readEntityIntoTag(mcEntity, minecraftTag); - //add Id for AbstractChangeSet to work - final CompoundBinaryTag tag = (CompoundBinaryTag) toNativeBinary(minecraftTag); - final Map tags = NbtUtils.getCompoundBinaryTagValues(tag); - tags.put("Id", StringBinaryTag.of(id)); - return CompoundBinaryTag.from(tags); - }; - return new LazyBaseEntity(type, saveTag); - } else { - return null; - } - } - - @Override - public Component getRichBlockName(BlockType blockType) { - return parent.getRichBlockName(blockType); - } - - @Override - public Component getRichItemName(ItemType itemType) { - return parent.getRichItemName(itemType); - } - - @Override - public Component getRichItemName(BaseItemStack itemStack) { - return parent.getRichItemName(itemStack); - } - - @Override - public OptionalInt getInternalBlockStateId(BlockState state) { - PaperweightBlockMaterial material = (PaperweightBlockMaterial) state.getMaterial(); - net.minecraft.world.level.block.state.BlockState mcState = material.getCraftBlockData().getState(); - return OptionalInt.of(Block.BLOCK_STATE_REGISTRY.getId(mcState)); - } - - @Override - public BlockState adapt(BlockData blockData) { - CraftBlockData cbd = ((CraftBlockData) blockData); - net.minecraft.world.level.block.state.BlockState ibd = cbd.getState(); - return adapt(ibd); - } - - public BlockState adapt(net.minecraft.world.level.block.state.BlockState blockState) { - return BlockTypesCache.states[adaptToChar(blockState)]; - } - - public char adaptToChar(net.minecraft.world.level.block.state.BlockState blockState) { - int id = Block.BLOCK_STATE_REGISTRY.getId(blockState); - if (initialised) { - return ibdToStateOrdinal[id]; - } - synchronized (this) { - if (initialised) { - return ibdToStateOrdinal[id]; - } - try { - init(); - return ibdToStateOrdinal[id]; - } catch (ArrayIndexOutOfBoundsException e1) { - LOGGER.error("Attempted to convert {} with ID {} to char. ibdToStateOrdinal length: {}. Defaulting to air!", - blockState.getBlock(), Block.BLOCK_STATE_REGISTRY.getId(blockState), ibdToStateOrdinal.length, e1 - ); - return BlockTypesCache.ReservedIDs.AIR; - } - } - } - - public char ibdIDToOrdinal(int id) { - if (initialised) { - return ibdToStateOrdinal[id]; - } - synchronized (this) { - if (initialised) { - return ibdToStateOrdinal[id]; - } - init(); - return ibdToStateOrdinal[id]; - } - } - - @Override - public char[] getIbdToStateOrdinal() { - if (initialised) { - return ibdToStateOrdinal; - } - synchronized (this) { - if (initialised) { - return ibdToStateOrdinal; - } - init(); - return ibdToStateOrdinal; - } - } - - public int ordinalToIbdID(char ordinal) { - if (initialised) { - return ordinalToIbdID[ordinal]; - } - synchronized (this) { - if (initialised) { - return ordinalToIbdID[ordinal]; - } - init(); - return ordinalToIbdID[ordinal]; - } - } - - @Override - public int[] getOrdinalToIbdID() { - if (initialised) { - return ordinalToIbdID; - } - synchronized (this) { - if (initialised) { - return ordinalToIbdID; - } - init(); - return ordinalToIbdID; - } - } - - @Override - public > BlockData adapt(B state) { - PaperweightBlockMaterial material = (PaperweightBlockMaterial) state.getMaterial(); - return material.getCraftBlockData(); - } - - @Override - public void sendFakeChunk(org.bukkit.World world, Player player, ChunkPacket chunkPacket) { - ServerLevel nmsWorld = ((CraftWorld) world).getHandle(); - ChunkHolder map = PaperweightPlatformAdapter.getPlayerChunk(nmsWorld, chunkPacket.getChunkX(), chunkPacket.getChunkZ()); - if (map != null && wasAccessibleSinceLastSave(map)) { - boolean flag = false; - // PlayerChunk.d players = map.players; - Stream stream = /*players.a(new ChunkCoordIntPair(packet.getChunkX(), packet.getChunkZ()), flag) - */ Stream.empty(); - - ServerPlayer checkPlayer = player == null ? null : ((CraftPlayer) player).getHandle(); - stream.filter(entityPlayer -> checkPlayer == null || entityPlayer == checkPlayer) - .forEach(entityPlayer -> { - synchronized (chunkPacket) { - ClientboundLevelChunkWithLightPacket nmsPacket = (ClientboundLevelChunkWithLightPacket) chunkPacket.getNativePacket(); - if (nmsPacket == null) { - nmsPacket = mapUtil.create(this, chunkPacket); - chunkPacket.setNativePacket(nmsPacket); - } - try { - FaweCache.INSTANCE.CHUNK_FLAG.get().set(true); - entityPlayer.connection.send(nmsPacket); - } finally { - FaweCache.INSTANCE.CHUNK_FLAG.get().set(false); - } - } - }); - } - } - - @Override - public Map> getProperties(BlockType blockType) { - return getParent().getProperties(blockType); - } - - @Override - public boolean canPlaceAt(org.bukkit.World world, BlockVector3 blockVector3, BlockState blockState) { - int internalId = BlockStateIdAccess.getBlockStateId(blockState); - net.minecraft.world.level.block.state.BlockState blockState1 = Block.stateById(internalId); - return blockState1.hasPostProcess( - ((CraftWorld) world).getHandle(), - new BlockPos(blockVector3.getX(), blockVector3.getY(), blockVector3.getZ()) - ); - } - - @Override - public org.bukkit.inventory.ItemStack adapt(BaseItemStack baseItemStack) { - ItemStack stack = new ItemStack( - DedicatedServer.getServer().registryAccess().registryOrThrow(Registries.ITEM) - .get(ResourceLocation.tryParse(baseItemStack.getType().getId())), - baseItemStack.getAmount() - ); - stack.setTag(((net.minecraft.nbt.CompoundTag) fromNative(baseItemStack.getNbtData()))); - return CraftItemStack.asCraftMirror(stack); - } - - @Override - public boolean generateTree( - TreeGenerator.TreeType treeType, EditSession editSession, BlockVector3 blockVector3, - org.bukkit.World bukkitWorld - ) { - TreeType bukkitType = BukkitWorld.toBukkitTreeType(treeType); - if (bukkitType == TreeType.CHORUS_PLANT) { - blockVector3 = blockVector3.add( - 0, - 1, - 0 - ); // bukkit skips the feature gen which does this offset normally, so we have to add it back - } - ServerLevel serverLevel = ((CraftWorld) bukkitWorld).getHandle(); - final BlockVector3 finalBlockVector = blockVector3; - // Sync to main thread to ensure no clashes occur - Map placed = TaskManager.taskManager().sync(() -> { - serverLevel.captureTreeGeneration = true; - serverLevel.captureBlockStates = true; - try { - if (!bukkitWorld.generateTree(BukkitAdapter.adapt(bukkitWorld, finalBlockVector), bukkitType)) { - return null; - } - return ImmutableMap.copyOf(serverLevel.capturedBlockStates); - } finally { - serverLevel.captureBlockStates = false; - serverLevel.captureTreeGeneration = false; - serverLevel.capturedBlockStates.clear(); - } - }); - if (placed == null || placed.isEmpty()) { - return false; - } - for (CraftBlockState craftBlockState : placed.values()) { - if (craftBlockState == null || craftBlockState.getType() == Material.AIR) { - continue; - } - editSession.setBlock(craftBlockState.getX(), craftBlockState.getY(), craftBlockState.getZ(), - BukkitAdapter.adapt(((org.bukkit.block.BlockState) craftBlockState).getBlockData()) - ); - } - return true; - } - - @Override - public BaseItemStack adapt(org.bukkit.inventory.ItemStack itemStack) { - final ItemStack nmsStack = CraftItemStack.asNMSCopy(itemStack); - final BaseItemStack weStack = new BaseItemStack(BukkitAdapter.asItemType(itemStack.getType()), itemStack.getAmount()); - weStack.setNbt(((CompoundBinaryTag) toNativeBinary(nmsStack.getTag()))); - return weStack; - } - - @Override - public Tag toNative(net.minecraft.nbt.Tag foreign) { - return parent.toNative(foreign); - } - - @Override - public net.minecraft.nbt.Tag fromNative(Tag foreign) { - if (foreign instanceof PaperweightLazyCompoundTag) { - return ((PaperweightLazyCompoundTag) foreign).get(); - } - return parent.fromNative(foreign); - } - - @Override - public boolean regenerate(org.bukkit.World bukkitWorld, Region region, Extent target, RegenOptions options) throws Exception { - return new PaperweightRegen(bukkitWorld, region, target, options).regenerate(); - } - - @Override - public IChunkGet get(org.bukkit.World world, int chunkX, int chunkZ) { - return new PaperweightGetBlocks(world, chunkX, chunkZ); - } - - @Override - public int getInternalBiomeId(BiomeType biomeType) { - final Registry registry = MinecraftServer - .getServer() - .registryAccess() - .registryOrThrow(BIOME); - ResourceLocation resourceLocation = ResourceLocation.tryParse(biomeType.getId()); - Biome biome = registry.get(resourceLocation); - return registry.getId(biome); - } - - @Override - public Iterable getRegisteredBiomes() { - WritableRegistry biomeRegistry = (WritableRegistry) ((CraftServer) Bukkit.getServer()) - .getServer() - .registryAccess() - .registryOrThrow(BIOME); - List keys = biomeRegistry.stream() - .map(biomeRegistry::getKey).filter(Objects::nonNull).toList(); - List namespacedKeys = new ArrayList<>(); - for (ResourceLocation key : keys) { - try { - namespacedKeys.add(CraftNamespacedKey.fromMinecraft(key)); - } catch (IllegalArgumentException e) { - LOGGER.error("Error converting biome key {}", key.toString(), e); - } - } - return namespacedKeys; - } - - @Override - public RelighterFactory getRelighterFactory() { - if (PaperLib.isPaper()) { - return new PaperweightStarlightRelighterFactory(); - } else { - return new NMSRelighterFactory(); - } - } - - @Override - public Map>> getAllProperties() { - if (initialised) { - return allBlockProperties; - } - synchronized (this) { - if (initialised) { - return allBlockProperties; - } - init(); - return allBlockProperties; - } - } - - @Override - public IBatchProcessor getTickingPostProcessor() { - return new PaperweightPostProcessor(); - } - - private boolean wasAccessibleSinceLastSave(ChunkHolder holder) { - if (!PaperLib.isPaper() || !PaperweightPlatformAdapter.POST_CHUNK_REWRITE) { - try { - return (boolean) CHUNK_HOLDER_WAS_ACCESSIBLE_SINCE_LAST_SAVE.invoke(holder); - } catch (IllegalAccessException | InvocationTargetException ignored) { - // fall-through - } - } - // Papers new chunk system has no related replacement - therefor we assume true. - return true; - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightFaweWorldNativeAccess.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightFaweWorldNativeAccess.java deleted file mode 100644 index e5c26aba5..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightFaweWorldNativeAccess.java +++ /dev/null @@ -1,286 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R2; - -import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.math.IntPair; -import com.fastasyncworldedit.core.util.TaskManager; -import com.fastasyncworldedit.core.util.task.RunnableVal; -import com.sk89q.worldedit.bukkit.BukkitAdapter; -import com.sk89q.worldedit.internal.block.BlockStateIdAccess; -import com.sk89q.worldedit.internal.wna.WorldNativeAccess; -import com.sk89q.worldedit.util.SideEffect; -import com.sk89q.worldedit.util.SideEffectSet; -import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; -import com.sk89q.worldedit.world.block.BlockState; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.level.ChunkHolder; -import net.minecraft.server.level.ServerChunkCache; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.chunk.LevelChunk; -import org.bukkit.craftbukkit.v1_19_R2.CraftWorld; -import org.bukkit.craftbukkit.v1_19_R2.block.data.CraftBlockData; -import org.bukkit.event.block.BlockPhysicsEvent; - -import javax.annotation.Nullable; -import java.lang.ref.WeakReference; -import java.util.Collections; -import java.util.HashSet; -import java.util.Objects; -import java.util.Set; -import java.util.concurrent.atomic.AtomicInteger; - -public class PaperweightFaweWorldNativeAccess implements WorldNativeAccess { - - private static final int UPDATE = 1; - private static final int NOTIFY = 2; - private static final Direction[] NEIGHBOUR_ORDER = { - Direction.EAST, - Direction.WEST, - Direction.DOWN, - Direction.UP, - Direction.NORTH, - Direction.SOUTH - }; - private final PaperweightFaweAdapter paperweightFaweAdapter; - private final WeakReference level; - private final AtomicInteger lastTick; - private final Set cachedChanges = new HashSet<>(); - private final Set cachedChunksToSend = new HashSet<>(); - private SideEffectSet sideEffectSet; - - public PaperweightFaweWorldNativeAccess(PaperweightFaweAdapter paperweightFaweAdapter, WeakReference level) { - this.paperweightFaweAdapter = paperweightFaweAdapter; - this.level = level; - // Use the actual tick as minecraft-defined so we don't try to force blocks into the world when the server's already lagging. - // - With the caveat that we don't want to have too many cached changed (1024) so we'd flush those at 1024 anyway. - this.lastTick = new AtomicInteger(MinecraftServer.currentTick); - } - - private Level getLevel() { - return Objects.requireNonNull(level.get(), "The reference to the world was lost"); - } - - @Override - public void setCurrentSideEffectSet(SideEffectSet sideEffectSet) { - this.sideEffectSet = sideEffectSet; - } - - @Override - public LevelChunk getChunk(int x, int z) { - return getLevel().getChunk(x, z); - } - - @Override - public net.minecraft.world.level.block.state.BlockState toNative(BlockState blockState) { - int stateId = paperweightFaweAdapter.ordinalToIbdID(blockState.getOrdinalChar()); - return BlockStateIdAccess.isValidInternalId(stateId) - ? Block.stateById(stateId) - : ((CraftBlockData) BukkitAdapter.adapt(blockState)).getState(); - } - - @Override - public net.minecraft.world.level.block.state.BlockState getBlockState(LevelChunk levelChunk, BlockPos blockPos) { - return levelChunk.getBlockState(blockPos); - } - - @Nullable - @Override - public synchronized net.minecraft.world.level.block.state.BlockState setBlockState( - LevelChunk levelChunk, BlockPos blockPos, - net.minecraft.world.level.block.state.BlockState blockState - ) { - int currentTick = MinecraftServer.currentTick; - if (Fawe.isMainThread()) { - return levelChunk.setBlockState(blockPos, blockState, - this.sideEffectSet != null && this.sideEffectSet.shouldApply(SideEffect.UPDATE) - ); - } - // Since FAWE is.. Async we need to do it on the main thread (wooooo.. :( ) - cachedChanges.add(new CachedChange(levelChunk, blockPos, blockState)); - cachedChunksToSend.add(new IntPair(levelChunk.bukkitChunk.getX(), levelChunk.bukkitChunk.getZ())); - boolean nextTick = lastTick.get() > currentTick; - if (nextTick || cachedChanges.size() >= 1024) { - if (nextTick) { - lastTick.set(currentTick); - } - flushAsync(nextTick); - } - return blockState; - } - - @Override - public net.minecraft.world.level.block.state.BlockState getValidBlockForPosition( - net.minecraft.world.level.block.state.BlockState blockState, - BlockPos blockPos - ) { - return Block.updateFromNeighbourShapes(blockState, getLevel(), blockPos); - } - - @Override - public BlockPos getPosition(int x, int y, int z) { - return new BlockPos(x, y, z); - } - - @Override - public void updateLightingForBlock(BlockPos blockPos) { - getLevel().getChunkSource().getLightEngine().checkBlock(blockPos); - } - - @Override - public boolean updateTileEntity(BlockPos blockPos, CompoundBinaryTag tag) { - // We will assume that the tile entity was created for us, - // though we do not do this on the other versions - BlockEntity blockEntity = getLevel().getBlockEntity(blockPos); - if (blockEntity == null) { - return false; - } - net.minecraft.nbt.Tag nativeTag = paperweightFaweAdapter.fromNativeBinary(tag); - blockEntity.load((CompoundTag) nativeTag); - return true; - } - - @Override - public void notifyBlockUpdate( - LevelChunk levelChunk, BlockPos blockPos, - net.minecraft.world.level.block.state.BlockState oldState, - net.minecraft.world.level.block.state.BlockState newState - ) { - if (levelChunk.getSections()[level.get().getSectionIndex(blockPos.getY())] != null) { - getLevel().sendBlockUpdated(blockPos, oldState, newState, UPDATE | NOTIFY); - } - } - - @Override - public boolean isChunkTicking(LevelChunk levelChunk) { - return levelChunk.getFullStatus().isOrAfter(ChunkHolder.FullChunkStatus.TICKING); - } - - @Override - public void markBlockChanged(LevelChunk levelChunk, BlockPos blockPos) { - if (levelChunk.getSections()[level.get().getSectionIndex(blockPos.getY())] != null) { - ((ServerChunkCache) getLevel().getChunkSource()).blockChanged(blockPos); - } - } - - @Override - public void notifyNeighbors( - BlockPos blockPos, - net.minecraft.world.level.block.state.BlockState oldState, - net.minecraft.world.level.block.state.BlockState newState - ) { - Level level = getLevel(); - if (sideEffectSet.shouldApply(SideEffect.EVENTS)) { - level.blockUpdated(blockPos, oldState.getBlock()); - } else { - // When we don't want events, manually run the physics without them. - // Un-nest neighbour updating - for (Direction direction : NEIGHBOUR_ORDER) { - BlockPos shifted = blockPos.relative(direction); - level.getBlockState(shifted).neighborChanged(level, shifted, oldState.getBlock(), blockPos, false); - } - } - if (newState.hasAnalogOutputSignal()) { - level.updateNeighbourForOutputSignal(blockPos, newState.getBlock()); - } - } - - @Override - public void updateNeighbors( - BlockPos blockPos, - net.minecraft.world.level.block.state.BlockState oldState, - net.minecraft.world.level.block.state.BlockState newState, - int recursionLimit - ) { - Level level = getLevel(); - // a == updateNeighbors - // b == updateDiagonalNeighbors - oldState.updateIndirectNeighbourShapes(level, blockPos, NOTIFY, recursionLimit); - if (sideEffectSet.shouldApply(SideEffect.EVENTS)) { - CraftWorld craftWorld = level.getWorld(); - if (craftWorld != null) { - BlockPhysicsEvent event = new BlockPhysicsEvent( - craftWorld.getBlockAt(blockPos.getX(), blockPos.getY(), blockPos.getZ()), - CraftBlockData.fromData(newState) - ); - level.getCraftServer().getPluginManager().callEvent(event); - if (event.isCancelled()) { - return; - } - } - } - newState.triggerEvent(level, blockPos, NOTIFY, recursionLimit); - newState.updateIndirectNeighbourShapes(level, blockPos, NOTIFY, recursionLimit); - } - - @Override - public void onBlockStateChange( - BlockPos blockPos, - net.minecraft.world.level.block.state.BlockState oldState, - net.minecraft.world.level.block.state.BlockState newState - ) { - getLevel().onBlockStateChange(blockPos, oldState, newState); - } - - private synchronized void flushAsync(final boolean sendChunks) { - final Set changes = Set.copyOf(cachedChanges); - cachedChanges.clear(); - final Set toSend; - if (sendChunks) { - toSend = Set.copyOf(cachedChunksToSend); - cachedChunksToSend.clear(); - } else { - toSend = Collections.emptySet(); - } - RunnableVal runnableVal = new RunnableVal<>() { - @Override - public void run(Object value) { - changes.forEach(cc -> cc.levelChunk.setBlockState(cc.blockPos, cc.blockState, - sideEffectSet != null && sideEffectSet.shouldApply(SideEffect.UPDATE) - )); - if (!sendChunks) { - return; - } - for (IntPair chunk : toSend) { - PaperweightPlatformAdapter.sendChunk(getLevel().getWorld().getHandle(), chunk.x(), chunk.z(), false); - } - } - }; - TaskManager.taskManager().async(() -> TaskManager.taskManager().sync(runnableVal)); - } - - @Override - public synchronized void flush() { - RunnableVal runnableVal = new RunnableVal<>() { - @Override - public void run(Object value) { - cachedChanges.forEach(cc -> cc.levelChunk.setBlockState(cc.blockPos, cc.blockState, - sideEffectSet != null && sideEffectSet.shouldApply(SideEffect.UPDATE) - )); - for (IntPair chunk : cachedChunksToSend) { - PaperweightPlatformAdapter.sendChunk(getLevel().getWorld().getHandle(), chunk.x(), chunk.z(), false); - } - } - }; - if (Fawe.isMainThread()) { - runnableVal.run(); - } else { - TaskManager.taskManager().sync(runnableVal); - } - cachedChanges.clear(); - cachedChunksToSend.clear(); - } - - private record CachedChange( - LevelChunk levelChunk, - BlockPos blockPos, - net.minecraft.world.level.block.state.BlockState blockState - ) { - - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java deleted file mode 100644 index 9edb79974..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks.java +++ /dev/null @@ -1,1166 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R2; - -import com.fastasyncworldedit.bukkit.adapter.BukkitGetBlocks; -import com.fastasyncworldedit.bukkit.adapter.DelegateSemaphore; -import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; -import com.fastasyncworldedit.core.math.BitArrayUnstretched; -import com.fastasyncworldedit.core.queue.IChunkGet; -import com.fastasyncworldedit.core.queue.IChunkSet; -import com.fastasyncworldedit.core.queue.implementation.QueueHandler; -import com.fastasyncworldedit.core.queue.implementation.blocks.CharGetBlocks; -import com.fastasyncworldedit.core.util.MathMan; -import com.fastasyncworldedit.core.util.collection.AdaptedMap; -import com.google.common.base.Suppliers; -import com.sk89q.jnbt.CompoundTag; -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.WorldEditPlugin; -import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R2.nbt.PaperweightLazyCompoundTag; -import com.sk89q.worldedit.internal.Constants; -import com.sk89q.worldedit.internal.util.LogManagerCompat; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.biome.BiomeType; -import com.sk89q.worldedit.world.biome.BiomeTypes; -import com.sk89q.worldedit.world.block.BlockTypesCache; -import io.papermc.lib.PaperLib; -import io.papermc.paper.event.block.BeaconDeactivatedEvent; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Holder; -import net.minecraft.core.IdMap; -import net.minecraft.core.Registry; -import net.minecraft.core.SectionPos; -import net.minecraft.nbt.IntTag; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.sounds.SoundEvents; -import net.minecraft.util.BitStorage; -import net.minecraft.util.ZeroBitStorage; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.level.LightLayer; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.block.entity.BeaconBlockEntity; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.chunk.DataLayer; -import net.minecraft.world.level.chunk.HashMapPalette; -import net.minecraft.world.level.chunk.LevelChunk; -import net.minecraft.world.level.chunk.LevelChunkSection; -import net.minecraft.world.level.chunk.LinearPalette; -import net.minecraft.world.level.chunk.Palette; -import net.minecraft.world.level.chunk.PalettedContainer; -import net.minecraft.world.level.chunk.PalettedContainerRO; -import net.minecraft.world.level.levelgen.Heightmap; -import net.minecraft.world.level.lighting.LevelLightEngine; -import org.apache.logging.log4j.Logger; -import org.bukkit.World; -import org.bukkit.craftbukkit.v1_19_R2.CraftWorld; -import org.bukkit.craftbukkit.v1_19_R2.block.CraftBlock; -import org.bukkit.event.entity.CreatureSpawnEvent; - -import javax.annotation.Nonnull; -import java.util.AbstractSet; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.Callable; -import java.util.concurrent.Future; -import java.util.concurrent.Semaphore; -import java.util.concurrent.locks.ReadWriteLock; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.function.Function; -import java.util.stream.Collectors; - -import static net.minecraft.core.registries.Registries.BIOME; - -public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBlocks { - - private static final Logger LOGGER = LogManagerCompat.getLogger(); - - private static final Function posNms2We = v -> BlockVector3.at(v.getX(), v.getY(), v.getZ()); - private static final Function nmsTile2We = - tileEntity -> new PaperweightLazyCompoundTag(Suppliers.memoize(tileEntity::saveWithId)); - private final PaperweightFaweAdapter adapter = ((PaperweightFaweAdapter) WorldEditPlugin - .getInstance() - .getBukkitImplAdapter()); - private final ReadWriteLock sectionLock = new ReentrantReadWriteLock(); - private final ServerLevel serverLevel; - private final int chunkX; - private final int chunkZ; - private final int minHeight; - private final int maxHeight; - private final int minSectionPosition; - private final int maxSectionPosition; - private final Registry biomeRegistry; - private final IdMap> biomeHolderIdMap; - private LevelChunkSection[] sections; - private LevelChunk levelChunk; - private DataLayer[] blockLight; - private DataLayer[] skyLight; - private boolean createCopy = false; - private PaperweightGetBlocks_Copy copy = null; - private boolean forceLoadSections = true; - private boolean lightUpdate = false; - - public PaperweightGetBlocks(World world, int chunkX, int chunkZ) { - this(((CraftWorld) world).getHandle(), chunkX, chunkZ); - } - - public PaperweightGetBlocks(ServerLevel serverLevel, int chunkX, int chunkZ) { - super(serverLevel.getMinBuildHeight() >> 4, (serverLevel.getMaxBuildHeight() - 1) >> 4); - this.serverLevel = serverLevel; - this.chunkX = chunkX; - this.chunkZ = chunkZ; - this.minHeight = serverLevel.getMinBuildHeight(); - this.maxHeight = serverLevel.getMaxBuildHeight() - 1; // Minecraft max limit is exclusive. - this.minSectionPosition = minHeight >> 4; - this.maxSectionPosition = maxHeight >> 4; - this.skyLight = new DataLayer[getSectionCount()]; - this.blockLight = new DataLayer[getSectionCount()]; - this.biomeRegistry = serverLevel.registryAccess().registryOrThrow(BIOME); - this.biomeHolderIdMap = biomeRegistry.asHolderIdMap(); - } - - public int getChunkX() { - return chunkX; - } - - public int getChunkZ() { - return chunkZ; - } - - @Override - public boolean isCreateCopy() { - return createCopy; - } - - @Override - public void setCreateCopy(boolean createCopy) { - this.createCopy = createCopy; - } - - @Override - public IChunkGet getCopy() { - return copy; - } - - @Override - public void setLightingToGet(char[][] light, int minSectionPosition, int maxSectionPosition) { - if (light != null) { - lightUpdate = true; - try { - fillLightNibble(light, LightLayer.BLOCK, minSectionPosition, maxSectionPosition); - } catch (Throwable e) { - e.printStackTrace(); - } - } - } - - @Override - public void setSkyLightingToGet(char[][] light, int minSectionPosition, int maxSectionPosition) { - if (light != null) { - lightUpdate = true; - try { - fillLightNibble(light, LightLayer.SKY, minSectionPosition, maxSectionPosition); - } catch (Throwable e) { - e.printStackTrace(); - } - } - } - - @Override - public void setHeightmapToGet(HeightMapType type, int[] data) { - // height + 1 to match server internal - BitArrayUnstretched bitArray = new BitArrayUnstretched(MathMan.log2nlz(getChunk().getHeight() + 1), 256); - bitArray.fromRaw(data); - Heightmap.Types nativeType = Heightmap.Types.valueOf(type.name()); - Heightmap heightMap = getChunk().heightmaps.get(nativeType); - heightMap.setRawData(getChunk(), nativeType, bitArray.getData()); - } - - @Override - public int getMaxY() { - return maxHeight; - } - - @Override - public int getMinY() { - return minHeight; - } - - @Override - public BiomeType getBiomeType(int x, int y, int z) { - LevelChunkSection section = getSections(false)[(y >> 4) - getMinSectionPosition()]; - Holder biomes = section.getNoiseBiome(x >> 2, (y & 15) >> 2, z >> 2); - return PaperweightPlatformAdapter.adapt(biomes, serverLevel); - } - - @Override - public void removeSectionLighting(int layer, boolean sky) { - SectionPos sectionPos = SectionPos.of(getChunk().getPos(), layer); - DataLayer dataLayer = serverLevel.getChunkSource().getLightEngine().getLayerListener(LightLayer.BLOCK).getDataLayerData( - sectionPos); - if (dataLayer != null) { - lightUpdate = true; - synchronized (dataLayer) { - byte[] bytes = dataLayer.getData(); - Arrays.fill(bytes, (byte) 0); - } - } - if (sky) { - SectionPos sectionPos1 = SectionPos.of(getChunk().getPos(), layer); - DataLayer dataLayer1 = serverLevel - .getChunkSource() - .getLightEngine() - .getLayerListener(LightLayer.SKY) - .getDataLayerData(sectionPos1); - if (dataLayer1 != null) { - lightUpdate = true; - synchronized (dataLayer1) { - byte[] bytes = dataLayer1.getData(); - Arrays.fill(bytes, (byte) 0); - } - } - } - } - - @Override - public CompoundTag getTile(int x, int y, int z) { - BlockEntity blockEntity = getChunk().getBlockEntity(new BlockPos((x & 15) + ( - chunkX << 4), y, (z & 15) + ( - chunkZ << 4))); - if (blockEntity == null) { - return null; - } - return new PaperweightLazyCompoundTag(Suppliers.memoize(blockEntity::saveWithId)); - } - - @Override - public Map getTiles() { - Map nmsTiles = getChunk().getBlockEntities(); - if (nmsTiles.isEmpty()) { - return Collections.emptyMap(); - } - return AdaptedMap.immutable(nmsTiles, posNms2We, nmsTile2We); - } - - @Override - public int getSkyLight(int x, int y, int z) { - int layer = y >> 4; - int alayer = layer - getMinSectionPosition(); - if (skyLight[alayer] == null) { - SectionPos sectionPos = SectionPos.of(getChunk().getPos(), layer); - DataLayer dataLayer = - serverLevel.getChunkSource().getLightEngine().getLayerListener(LightLayer.SKY).getDataLayerData(sectionPos); - // If the server hasn't generated the section's NibbleArray yet, it will be null - if (dataLayer == null) { - byte[] LAYER_COUNT = new byte[2048]; - // Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway. - Arrays.fill(LAYER_COUNT, (byte) 15); - dataLayer = new DataLayer(LAYER_COUNT); - ((LevelLightEngine) serverLevel.getChunkSource().getLightEngine()).queueSectionData( - LightLayer.BLOCK, - sectionPos, - dataLayer, - true - ); - } - skyLight[alayer] = dataLayer; - } - return skyLight[alayer].get(x & 15, y & 15, z & 15); - } - - @Override - public int getEmittedLight(int x, int y, int z) { - int layer = y >> 4; - int alayer = layer - getMinSectionPosition(); - if (blockLight[alayer] == null) { - serverLevel.getRawBrightness(new BlockPos(1, 1, 1), 5); - SectionPos sectionPos = SectionPos.of(getChunk().getPos(), layer); - DataLayer dataLayer = serverLevel - .getChunkSource() - .getLightEngine() - .getLayerListener(LightLayer.BLOCK) - .getDataLayerData(sectionPos); - // If the server hasn't generated the section's DataLayer yet, it will be null - if (dataLayer == null) { - byte[] LAYER_COUNT = new byte[2048]; - // Safe enough to assume if it's not created, it's under the sky. Unlikely to be created before lighting is fixed anyway. - Arrays.fill(LAYER_COUNT, (byte) 15); - dataLayer = new DataLayer(LAYER_COUNT); - ((LevelLightEngine) serverLevel.getChunkSource().getLightEngine()).queueSectionData(LightLayer.BLOCK, sectionPos, - dataLayer, true - ); - } - blockLight[alayer] = dataLayer; - } - return blockLight[alayer].get(x & 15, y & 15, z & 15); - } - - @Override - public int[] getHeightMap(HeightMapType type) { - long[] longArray = getChunk().heightmaps.get(Heightmap.Types.valueOf(type.name())).getRawData(); - BitArrayUnstretched bitArray = new BitArrayUnstretched(9, 256, longArray); - return bitArray.toRaw(new int[256]); - } - - @Override - public CompoundTag getEntity(UUID uuid) { - Entity entity = serverLevel.getEntity(uuid); - if (entity != null) { - org.bukkit.entity.Entity bukkitEnt = entity.getBukkitEntity(); - return BukkitAdapter.adapt(bukkitEnt).getState().getNbtData(); - } - for (CompoundTag tag : getEntities()) { - if (uuid.equals(tag.getUUID())) { - return tag; - } - } - return null; - } - - @Override - public Set getEntities() { - List entities = PaperweightPlatformAdapter.getEntities(getChunk()); - 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 CompoundTag getTag)) { - return false; - } - UUID getUUID = getTag.getUUID(); - for (Entity entity : entities) { - UUID uuid = entity.getUUID(); - if (uuid.equals(getUUID)) { - return true; - } - } - return false; - } - - @Nonnull - @Override - public Iterator iterator() { - Iterable result = entities.stream().map(input -> { - net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag(); - input.save(tag); - return (CompoundTag) adapter.toNative(tag); - }).collect(Collectors.toList()); - return result.iterator(); - } - }; - } - - private void removeEntity(Entity entity) { - entity.discard(); - } - - public LevelChunk ensureLoaded(ServerLevel nmsWorld, int chunkX, int chunkZ) { - return PaperweightPlatformAdapter.ensureLoaded(nmsWorld, chunkX, chunkZ); - } - - @Override - @SuppressWarnings("rawtypes") - public synchronized > T call(IChunkSet set, Runnable finalizer) { - forceLoadSections = false; - copy = createCopy ? new PaperweightGetBlocks_Copy(levelChunk) : null; - try { - ServerLevel nmsWorld = serverLevel; - LevelChunk nmsChunk = ensureLoaded(nmsWorld, chunkX, chunkZ); - - // Remove existing tiles. Create a copy so that we can remove blocks - Map chunkTiles = new HashMap<>(nmsChunk.getBlockEntities()); - List beacons = null; - if (!chunkTiles.isEmpty()) { - for (Map.Entry entry : chunkTiles.entrySet()) { - final BlockPos pos = entry.getKey(); - final int lx = pos.getX() & 15; - final int ly = pos.getY(); - final int lz = pos.getZ() & 15; - final int layer = ly >> 4; - if (!set.hasSection(layer)) { - continue; - } - - int ordinal = set.getBlock(lx, ly, lz).getOrdinal(); - if (ordinal != BlockTypesCache.ReservedIDs.__RESERVED__) { - BlockEntity tile = entry.getValue(); - if (PaperLib.isPaper() && tile instanceof BeaconBlockEntity) { - if (beacons == null) { - beacons = new ArrayList<>(); - } - beacons.add(tile); - PaperweightPlatformAdapter.removeBeacon(tile, nmsChunk); - continue; - } - nmsChunk.removeBlockEntity(tile.getBlockPos()); - if (createCopy) { - copy.storeTile(tile); - } - } - } - } - final BiomeType[][] biomes = set.getBiomes(); - - int bitMask = 0; - synchronized (nmsChunk) { - LevelChunkSection[] levelChunkSections = nmsChunk.getSections(); - - for (int layerNo = getMinSectionPosition(); layerNo <= getMaxSectionPosition(); layerNo++) { - - int getSectionIndex = layerNo - getMinSectionPosition(); - int setSectionIndex = layerNo - set.getMinSectionPosition(); - - if (!set.hasSection(layerNo)) { - // No blocks, but might be biomes present. Handle this lazily. - if (biomes == null) { - continue; - } - if (layerNo < set.getMinSectionPosition() || layerNo > set.getMaxSectionPosition()) { - continue; - } - if (biomes[setSectionIndex] != null) { - synchronized (super.sectionLocks[getSectionIndex]) { - LevelChunkSection existingSection = levelChunkSections[getSectionIndex]; - if (createCopy && existingSection != null) { - copy.storeBiomes(getSectionIndex, existingSection.getBiomes()); - } - - if (existingSection == null) { - PalettedContainer> biomeData = PaperweightPlatformAdapter.getBiomePalettedContainer( - biomes[setSectionIndex], - biomeHolderIdMap - ); - LevelChunkSection newSection = PaperweightPlatformAdapter.newChunkSection( - layerNo, - new char[4096], - adapter, - biomeRegistry, - biomeData - ); - if (PaperweightPlatformAdapter.setSectionAtomic( - levelChunkSections, - null, - newSection, - getSectionIndex - )) { - updateGet(nmsChunk, levelChunkSections, newSection, new char[4096], getSectionIndex); - continue; - } else { - existingSection = levelChunkSections[getSectionIndex]; - if (existingSection == null) { - LOGGER.error("Skipping invalid null section. chunk: {}, {} layer: {}", chunkX, chunkZ, - getSectionIndex - ); - continue; - } - } - } else { - setBiomesToPalettedContainer(biomes, setSectionIndex, existingSection.getBiomes()); - } - } - } - continue; - } - - bitMask |= 1 << getSectionIndex; - - char[] setArr = set.load(layerNo); - - // synchronise on internal section to avoid circular locking with a continuing edit if the chunk was - // submitted to keep loaded internal chunks to queue target size. - synchronized (super.sectionLocks[getSectionIndex]) { - - LevelChunkSection newSection; - LevelChunkSection existingSection = levelChunkSections[getSectionIndex]; - // Don't attempt to tick section whilst we're editing - if (existingSection != null) { - PaperweightPlatformAdapter.clearCounts(existingSection); - if (PaperLib.isPaper()) { - existingSection.tickingList.clear(); - } - } - - if (createCopy) { - char[] tmpLoad = loadPrivately(layerNo); - char[] copyArr = new char[4096]; - System.arraycopy(tmpLoad, 0, copyArr, 0, 4096); - copy.storeSection(getSectionIndex, copyArr); - if (biomes != null && existingSection != null) { - copy.storeBiomes(getSectionIndex, existingSection.getBiomes()); - } - } - - if (existingSection == null) { - PalettedContainer> biomeData = biomes == null ? new PalettedContainer<>( - biomeHolderIdMap, - biomeHolderIdMap.byIdOrThrow(WorldEditPlugin - .getInstance() - .getBukkitImplAdapter() - .getInternalBiomeId( - BiomeTypes.PLAINS)), - PalettedContainer.Strategy.SECTION_BIOMES, - null - ) : PaperweightPlatformAdapter.getBiomePalettedContainer(biomes[setSectionIndex], biomeHolderIdMap); - newSection = PaperweightPlatformAdapter.newChunkSection( - layerNo, - setArr, - adapter, - biomeRegistry, - biomeData - ); - if (PaperweightPlatformAdapter.setSectionAtomic( - levelChunkSections, - null, - newSection, - getSectionIndex - )) { - updateGet(nmsChunk, levelChunkSections, newSection, setArr, getSectionIndex); - continue; - } else { - existingSection = levelChunkSections[getSectionIndex]; - if (existingSection == null) { - LOGGER.error("Skipping invalid null section. chunk: {}, {} layer: {}", chunkX, chunkZ, - getSectionIndex - ); - continue; - } - } - } - - //ensure that the server doesn't try to tick the chunksection while we're editing it. (Again) - PaperweightPlatformAdapter.clearCounts(existingSection); - if (PaperLib.isPaper()) { - existingSection.tickingList.clear(); - } - DelegateSemaphore lock = PaperweightPlatformAdapter.applyLock(existingSection); - - // Synchronize to prevent further acquisitions - synchronized (lock) { - lock.acquire(); // Wait until we have the lock - lock.release(); - try { - sectionLock.writeLock().lock(); - if (this.getChunk() != nmsChunk) { - this.levelChunk = nmsChunk; - this.sections = null; - this.reset(); - } else if (existingSection != getSections(false)[getSectionIndex]) { - this.sections[getSectionIndex] = existingSection; - this.reset(); - } else if (!Arrays.equals( - update(getSectionIndex, new char[4096], true), - loadPrivately(layerNo) - )) { - this.reset(layerNo); - /*} else if (lock.isModified()) { - this.reset(layerNo);*/ - } - } finally { - sectionLock.writeLock().unlock(); - } - - PalettedContainer> biomeData = setBiomesToPalettedContainer( - biomes, - setSectionIndex, - existingSection.getBiomes() - ); - - newSection = - PaperweightPlatformAdapter.newChunkSection( - layerNo, - this::loadPrivately, - setArr, - adapter, - biomeRegistry, - biomeData - ); - if (!PaperweightPlatformAdapter.setSectionAtomic( - levelChunkSections, - existingSection, - newSection, - getSectionIndex - )) { - LOGGER.error("Skipping invalid null section. chunk: {}, {} layer: {}", chunkX, chunkZ, - getSectionIndex - ); - } else { - updateGet(nmsChunk, levelChunkSections, newSection, setArr, getSectionIndex); - } - } - } - } - - Map heightMaps = set.getHeightMaps(); - for (Map.Entry entry : heightMaps.entrySet()) { - PaperweightGetBlocks.this.setHeightmapToGet(entry.getKey(), entry.getValue()); - } - PaperweightGetBlocks.this.setLightingToGet( - set.getLight(), - set.getMinSectionPosition(), - set.getMaxSectionPosition() - ); - PaperweightGetBlocks.this.setSkyLightingToGet( - set.getSkyLight(), - set.getMinSectionPosition(), - set.getMaxSectionPosition() - ); - - Runnable[] syncTasks = null; - - int bx = chunkX << 4; - int bz = chunkZ << 4; - - // Call beacon deactivate events here synchronously - // list will be null on spigot, so this is an implicit isPaper check - if (beacons != null && !beacons.isEmpty()) { - final List finalBeacons = beacons; - - syncTasks = new Runnable[4]; - - syncTasks[3] = () -> { - for (BlockEntity beacon : finalBeacons) { - BeaconBlockEntity.playSound(beacon.getLevel(), beacon.getBlockPos(), SoundEvents.BEACON_DEACTIVATE); - new BeaconDeactivatedEvent(CraftBlock.at(beacon.getLevel(), beacon.getBlockPos())).callEvent(); - } - }; - } - - Set entityRemoves = set.getEntityRemoves(); - if (entityRemoves != null && !entityRemoves.isEmpty()) { - if (syncTasks == null) { - syncTasks = new Runnable[3]; - } - - syncTasks[2] = () -> { - Set entitiesRemoved = new HashSet<>(); - final List entities = PaperweightPlatformAdapter.getEntities(nmsChunk); - - for (Entity entity : entities) { - UUID uuid = entity.getUUID(); - if (entityRemoves.contains(uuid)) { - if (createCopy) { - copy.storeEntity(entity); - } - removeEntity(entity); - entitiesRemoved.add(uuid); - entityRemoves.remove(uuid); - } - } - if (Settings.settings().EXPERIMENTAL.REMOVE_ENTITY_FROM_WORLD_ON_CHUNK_FAIL) { - for (UUID uuid : entityRemoves) { - Entity entity = nmsWorld.getEntities().get(uuid); - if (entity != null) { - removeEntity(entity); - } - } - } - // Only save entities that were actually removed to history - set.getEntityRemoves().clear(); - set.getEntityRemoves().addAll(entitiesRemoved); - }; - } - - Set entities = set.getEntities(); - if (entities != null && !entities.isEmpty()) { - if (syncTasks == null) { - syncTasks = new Runnable[2]; - } - - syncTasks[1] = () -> { - Iterator iterator = entities.iterator(); - while (iterator.hasNext()) { - final CompoundTag nativeTag = iterator.next(); - final Map entityTagMap = nativeTag.getValue(); - final StringTag idTag = (StringTag) entityTagMap.get("Id"); - final ListTag posTag = (ListTag) entityTagMap.get("Pos"); - final ListTag rotTag = (ListTag) entityTagMap.get("Rotation"); - if (idTag == null || posTag == null || rotTag == null) { - LOGGER.error("Unknown entity tag: {}", nativeTag); - continue; - } - final double x = posTag.getDouble(0); - final double y = posTag.getDouble(1); - final double z = posTag.getDouble(2); - final float yaw = rotTag.getFloat(0); - final float pitch = rotTag.getFloat(1); - final String id = idTag.getValue(); - - EntityType type = EntityType.byString(id).orElse(null); - if (type != null) { - Entity entity = type.create(nmsWorld); - if (entity != null) { - final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative( - nativeTag); - for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) { - tag.remove(name); - } - entity.load(tag); - entity.absMoveTo(x, y, z, yaw, pitch); - entity.setUUID(nativeTag.getUUID()); - if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) { - LOGGER.warn( - "Error creating entity of type `{}` in world `{}` at location `{},{},{}`", - id, - nmsWorld.getWorld().getName(), - x, - y, - z - ); - // Unsuccessful create should not be saved to history - iterator.remove(); - } - } - } - } - }; - } - - // set tiles - Map tiles = set.getTiles(); - if (tiles != null && !tiles.isEmpty()) { - if (syncTasks == null) { - syncTasks = new Runnable[1]; - } - - syncTasks[0] = () -> { - for (final Map.Entry entry : tiles.entrySet()) { - final CompoundTag nativeTag = entry.getValue(); - final BlockVector3 blockHash = entry.getKey(); - final int x = blockHash.getX() + bx; - final int y = blockHash.getY(); - final int z = blockHash.getZ() + bz; - final BlockPos pos = new BlockPos(x, y, z); - - synchronized (nmsWorld) { - BlockEntity tileEntity = nmsWorld.getBlockEntity(pos); - if (tileEntity == null || tileEntity.isRemoved()) { - nmsWorld.removeBlockEntity(pos); - tileEntity = nmsWorld.getBlockEntity(pos); - } - if (tileEntity != null) { - final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative( - nativeTag); - tag.put("x", IntTag.valueOf(x)); - tag.put("y", IntTag.valueOf(y)); - tag.put("z", IntTag.valueOf(z)); - tileEntity.load(tag); - } - } - } - }; - } - - Runnable callback; - if (bitMask == 0 && biomes == null && !lightUpdate) { - callback = null; - } else { - int finalMask = bitMask != 0 ? bitMask : lightUpdate ? set.getBitMask() : 0; - boolean finalLightUpdate = lightUpdate; - callback = () -> { - // Set Modified - nmsChunk.setLightCorrect(true); // Set Modified - nmsChunk.mustNotSave = false; - nmsChunk.setUnsaved(true); - // send to player - if (Settings.settings().LIGHTING.MODE == 0 || !Settings.settings().LIGHTING.DELAY_PACKET_SENDING) { - this.send(finalMask, finalLightUpdate); - } - if (finalizer != null) { - finalizer.run(); - } - }; - } - if (syncTasks != null) { - QueueHandler queueHandler = Fawe.instance().getQueueHandler(); - Runnable[] finalSyncTasks = syncTasks; - - // Chain the sync tasks and the callback - Callable chain = () -> { - try { - // Run the sync tasks - for (Runnable task : finalSyncTasks) { - if (task != null) { - task.run(); - } - } - if (callback == null) { - if (finalizer != null) { - finalizer.run(); - } - return null; - } else { - return queueHandler.async(callback, null); - } - } catch (Throwable e) { - e.printStackTrace(); - throw e; - } - }; - //noinspection unchecked - required at compile time - return (T) (Future) queueHandler.sync(chain); - } else { - if (callback == null) { - if (finalizer != null) { - finalizer.run(); - } - } else { - callback.run(); - } - } - } - return null; - } catch (Throwable e) { - e.printStackTrace(); - return null; - } finally { - forceLoadSections = true; - } - } - - private void updateGet( - LevelChunk nmsChunk, - LevelChunkSection[] chunkSections, - LevelChunkSection section, - char[] arr, - int layer - ) { - try { - sectionLock.writeLock().lock(); - if (this.getChunk() != nmsChunk) { - this.levelChunk = nmsChunk; - this.sections = new LevelChunkSection[chunkSections.length]; - System.arraycopy(chunkSections, 0, this.sections, 0, chunkSections.length); - this.reset(); - } - if (this.sections == null) { - this.sections = new LevelChunkSection[chunkSections.length]; - System.arraycopy(chunkSections, 0, this.sections, 0, chunkSections.length); - } - if (this.sections[layer] != section) { - // Not sure why it's funky, but it's what I did in commit fda7d00747abe97d7891b80ed8bb88d97e1c70d1 and I don't want to touch it >dords - this.sections[layer] = new LevelChunkSection[]{section}.clone()[0]; - } - } finally { - sectionLock.writeLock().unlock(); - } - this.blocks[layer] = arr; - } - - private char[] loadPrivately(int layer) { - layer -= getMinSectionPosition(); - if (super.sections[layer] != null) { - synchronized (super.sectionLocks[layer]) { - if (super.sections[layer].isFull() && super.blocks[layer] != null) { - char[] blocks = new char[4096]; - System.arraycopy(super.blocks[layer], 0, blocks, 0, 4096); - return blocks; - } - } - } - return PaperweightGetBlocks.this.update(layer, null, true); - } - - @Override - public synchronized void send(int mask, boolean lighting) { - PaperweightPlatformAdapter.sendChunk(serverLevel, chunkX, chunkZ, lighting); - } - - /** - * Update a given (nullable) data array to the current data stored in the server's chunk, associated with this - * {@link PaperweightPlatformAdapter} instance. Not synchronised to the {@link PaperweightPlatformAdapter} instance as synchronisation - * is handled where necessary in the method, and should otherwise be handled correctly by this method's caller. - * - * @param layer layer index (0 may denote a negative layer in the world, e.g. at y=-32) - * @param data array to be updated/filled with data or null - * @param aggressive if the cached section array should be re-acquired. - * @return the given array to be filled with data, or a new array if null is given. - */ - @Override - @SuppressWarnings("unchecked") - public char[] update(int layer, char[] data, boolean aggressive) { - LevelChunkSection section = getSections(aggressive)[layer]; - // Section is null, return empty array - if (section == null) { - data = new char[4096]; - Arrays.fill(data, (char) BlockTypesCache.ReservedIDs.AIR); - return data; - } - if (data != null && data.length != 4096) { - data = new char[4096]; - Arrays.fill(data, (char) BlockTypesCache.ReservedIDs.AIR); - } - if (data == null || data == FaweCache.INSTANCE.EMPTY_CHAR_4096) { - data = new char[4096]; - Arrays.fill(data, (char) BlockTypesCache.ReservedIDs.AIR); - } - Semaphore lock = PaperweightPlatformAdapter.applyLock(section); - synchronized (lock) { - // Efficiently convert ChunkSection to raw data - try { - lock.acquire(); - - final PalettedContainer blocks = section.getStates(); - final Object dataObject = PaperweightPlatformAdapter.fieldData.get(blocks); - final BitStorage bits = (BitStorage) PaperweightPlatformAdapter.fieldStorage.get(dataObject); - - if (bits instanceof ZeroBitStorage) { - Arrays.fill(data, adapter.adaptToChar(blocks.get(0, 0, 0))); // get(int) is only public on paper - return data; - } - - final Palette palette = (Palette) PaperweightPlatformAdapter.fieldPalette.get(dataObject); - - final int bitsPerEntry = bits.getBits(); - final long[] blockStates = bits.getRaw(); - - new BitArrayUnstretched(bitsPerEntry, 4096, blockStates).toRaw(data); - - int num_palette; - if (palette instanceof LinearPalette || palette instanceof HashMapPalette) { - num_palette = palette.getSize(); - } else { - // The section's palette is the global block palette. - for (int i = 0; i < 4096; i++) { - char paletteVal = data[i]; - char ordinal = adapter.ibdIDToOrdinal(paletteVal); - data[i] = ordinal; - } - return data; - } - - char[] paletteToOrdinal = FaweCache.INSTANCE.PALETTE_TO_BLOCK_CHAR.get(); - try { - if (num_palette != 1) { - for (int i = 0; i < num_palette; i++) { - char ordinal = ordinal(palette.valueFor(i), adapter); - paletteToOrdinal[i] = ordinal; - } - for (int i = 0; i < 4096; i++) { - char paletteVal = data[i]; - char val = paletteToOrdinal[paletteVal]; - if (val == Character.MAX_VALUE) { - val = ordinal(palette.valueFor(i), adapter); - paletteToOrdinal[i] = val; - } - data[i] = val; - } - } else { - char ordinal = ordinal(palette.valueFor(0), adapter); - Arrays.fill(data, ordinal); - } - } finally { - for (int i = 0; i < num_palette; i++) { - paletteToOrdinal[i] = Character.MAX_VALUE; - } - } - return data; - } catch (IllegalAccessException | InterruptedException e) { - e.printStackTrace(); - throw new RuntimeException(e); - } finally { - lock.release(); - } - } - } - - private char ordinal(BlockState ibd, PaperweightFaweAdapter adapter) { - if (ibd == null) { - return BlockTypesCache.ReservedIDs.AIR; - } else { - return adapter.adaptToChar(ibd); - } - } - - public LevelChunkSection[] getSections(boolean force) { - force &= forceLoadSections; - sectionLock.readLock().lock(); - LevelChunkSection[] tmp = sections; - sectionLock.readLock().unlock(); - if (tmp == null || force) { - try { - sectionLock.writeLock().lock(); - tmp = sections; - if (tmp == null || force) { - LevelChunkSection[] chunkSections = getChunk().getSections(); - tmp = new LevelChunkSection[chunkSections.length]; - System.arraycopy(chunkSections, 0, tmp, 0, chunkSections.length); - sections = tmp; - } - } finally { - sectionLock.writeLock().unlock(); - } - } - return tmp; - } - - public LevelChunk getChunk() { - LevelChunk levelChunk = this.levelChunk; - if (levelChunk == null) { - synchronized (this) { - levelChunk = this.levelChunk; - if (levelChunk == null) { - this.levelChunk = levelChunk = ensureLoaded(this.serverLevel, chunkX, chunkZ); - } - } - } - return levelChunk; - } - - private void fillLightNibble(char[][] light, LightLayer lightLayer, int minSectionPosition, int maxSectionPosition) { - for (int Y = 0; Y <= maxSectionPosition - minSectionPosition; Y++) { - if (light[Y] == null) { - continue; - } - SectionPos sectionPos = SectionPos.of(levelChunk.getPos(), Y + minSectionPosition); - DataLayer dataLayer = serverLevel.getChunkSource().getLightEngine().getLayerListener(lightLayer).getDataLayerData( - sectionPos); - if (dataLayer == null) { - byte[] LAYER_COUNT = new byte[2048]; - Arrays.fill(LAYER_COUNT, lightLayer == LightLayer.SKY ? (byte) 15 : (byte) 0); - dataLayer = new DataLayer(LAYER_COUNT); - ((LevelLightEngine) serverLevel.getChunkSource().getLightEngine()).queueSectionData( - lightLayer, - sectionPos, - dataLayer, - true - ); - } - synchronized (dataLayer) { - for (int x = 0; x < 16; x++) { - for (int y = 0; y < 16; y++) { - for (int z = 0; z < 16; z++) { - int i = y << 8 | z << 4 | x; - if (light[Y][i] < 16) { - dataLayer.set(x, y, z, light[Y][i]); - } - } - } - } - } - } - } - - private PalettedContainer> setBiomesToPalettedContainer( - final BiomeType[][] biomes, - final int sectionIndex, - final PalettedContainerRO> data - ) { - PalettedContainer> biomeData; - if (data instanceof PalettedContainer> palettedContainer) { - biomeData = palettedContainer; - } else { - LOGGER.warn( - "Cannot correctly set biomes to world, existing biomes may be lost. Expected class " + - "type {} but got {}", - PalettedContainer.class.getSimpleName(), - data.getClass().getSimpleName() - ); - biomeData = data.recreate(); - } - BiomeType[] sectionBiomes; - if (biomes == null || (sectionBiomes = biomes[sectionIndex]) == null) { - return biomeData; - } - for (int y = 0, index = 0; y < 4; y++) { - for (int z = 0; z < 4; z++) { - for (int x = 0; x < 4; x++, index++) { - BiomeType biomeType = sectionBiomes[index]; - if (biomeType == null) { - continue; - } - biomeData.set( - x, - y, - z, - biomeHolderIdMap.byIdOrThrow(WorldEditPlugin - .getInstance() - .getBukkitImplAdapter() - .getInternalBiomeId(biomeType)) - ); - } - } - } - return biomeData; - } - - @Override - public boolean hasSection(int layer) { - layer -= getMinSectionPosition(); - return getSections(false)[layer] != null; - } - - @Override - @SuppressWarnings("unchecked") - public synchronized boolean trim(boolean aggressive) { - skyLight = new DataLayer[getSectionCount()]; - blockLight = new DataLayer[getSectionCount()]; - if (aggressive) { - sectionLock.writeLock().lock(); - sections = null; - levelChunk = null; - sectionLock.writeLock().unlock(); - return super.trim(true); - } else if (sections == null) { - // don't bother trimming if there are no sections stored. - return true; - } else { - for (int i = getMinSectionPosition(); i <= getMaxSectionPosition(); i++) { - int layer = i - getMinSectionPosition(); - if (!hasSection(i) || !super.sections[layer].isFull()) { - continue; - } - LevelChunkSection existing = getSections(true)[layer]; - try { - final PalettedContainer blocksExisting = existing.getStates(); - - final Object dataObject = PaperweightPlatformAdapter.fieldData.get(blocksExisting); - final Palette palette = (Palette) PaperweightPlatformAdapter.fieldPalette.get( - dataObject); - int paletteSize; - - if (palette instanceof LinearPalette || palette instanceof HashMapPalette) { - paletteSize = palette.getSize(); - } else { - super.trim(false, i); - continue; - } - if (paletteSize == 1) { - //If the cached palette size is 1 then no blocks can have been changed i.e. do not need to update these chunks. - continue; - } - super.trim(false, i); - } catch (IllegalAccessException ignored) { - super.trim(false, i); - } - } - return true; - } - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks_Copy.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks_Copy.java deleted file mode 100644 index c56de7093..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightGetBlocks_Copy.java +++ /dev/null @@ -1,248 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R2; - -import com.fastasyncworldedit.core.extent.processor.heightmap.HeightMapType; -import com.fastasyncworldedit.core.queue.IBlocks; -import com.fastasyncworldedit.core.queue.IChunkGet; -import com.fastasyncworldedit.core.queue.IChunkSet; -import com.google.common.base.Suppliers; -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; -import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; -import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R2.nbt.PaperweightLazyCompoundTag; -import com.sk89q.worldedit.internal.util.LogManagerCompat; -import com.sk89q.worldedit.math.BlockVector3; -import com.sk89q.worldedit.world.biome.BiomeType; -import com.sk89q.worldedit.world.block.BaseBlock; -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockTypesCache; -import net.minecraft.core.Holder; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.chunk.LevelChunk; -import net.minecraft.world.level.chunk.PalettedContainer; -import net.minecraft.world.level.chunk.PalettedContainerRO; -import org.apache.logging.log4j.Logger; - -import javax.annotation.Nullable; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.UUID; -import java.util.concurrent.Future; - -public class PaperweightGetBlocks_Copy implements IChunkGet { - - private static final Logger LOGGER = LogManagerCompat.getLogger(); - - private final Map tiles = new HashMap<>(); - private final Set entities = new HashSet<>(); - private final char[][] blocks; - private final int minHeight; - private final int maxHeight; - final ServerLevel serverLevel; - final LevelChunk levelChunk; - private PalettedContainer>[] biomes = null; - - protected PaperweightGetBlocks_Copy(LevelChunk levelChunk) { - this.levelChunk = levelChunk; - this.serverLevel = levelChunk.level; - this.minHeight = serverLevel.getMinBuildHeight(); - this.maxHeight = serverLevel.getMaxBuildHeight() - 1; // Minecraft max limit is exclusive. - this.blocks = new char[getSectionCount()][]; - } - - protected void storeTile(BlockEntity blockEntity) { - tiles.put( - BlockVector3.at( - blockEntity.getBlockPos().getX(), - blockEntity.getBlockPos().getY(), - blockEntity.getBlockPos().getZ() - ), - new PaperweightLazyCompoundTag(Suppliers.memoize(blockEntity::saveWithId)) - ); - } - - @Override - public Map getTiles() { - return tiles; - } - - @Override - @Nullable - public CompoundTag getTile(int x, int y, int z) { - return tiles.get(BlockVector3.at(x, y, z)); - } - - @SuppressWarnings({"unchecked", "rawtypes"}) - protected void storeEntity(Entity entity) { - BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); - net.minecraft.nbt.CompoundTag compoundTag = new net.minecraft.nbt.CompoundTag(); - entity.save(compoundTag); - entities.add((CompoundTag) adapter.toNative(compoundTag)); - } - - @Override - public Set getEntities() { - return this.entities; - } - - @Override - public CompoundTag getEntity(UUID uuid) { - for (CompoundTag tag : entities) { - if (uuid.equals(tag.getUUID())) { - return tag; - } - } - return null; - } - - @Override - public boolean isCreateCopy() { - return false; - } - - @Override - public void setCreateCopy(boolean createCopy) { - } - - @Override - public void setLightingToGet(char[][] lighting, int minSectionPosition, int maxSectionPosition) { - } - - @Override - public void setSkyLightingToGet(char[][] lighting, int minSectionPosition, int maxSectionPosition) { - } - - @Override - public void setHeightmapToGet(HeightMapType type, int[] data) { - } - - @Override - public int getMaxY() { - return maxHeight; - } - - @Override - public int getMinY() { - return minHeight; - } - - @Override - public int getMaxSectionPosition() { - return maxHeight >> 4; - } - - @Override - public int getMinSectionPosition() { - return minHeight >> 4; - } - - @Override - public BiomeType getBiomeType(int x, int y, int z) { - Holder biome = biomes[(y >> 4) - getMinSectionPosition()].get(x >> 2, (y & 15) >> 2, z >> 2); - return PaperweightPlatformAdapter.adapt(biome, serverLevel); - } - - @Override - public void removeSectionLighting(int layer, boolean sky) { - } - - @Override - public boolean trim(boolean aggressive, int layer) { - return false; - } - - @Override - public IBlocks reset() { - return null; - } - - @Override - public int getSectionCount() { - return serverLevel.getSectionsCount(); - } - - protected void storeSection(int layer, char[] data) { - blocks[layer] = data; - } - - protected void storeBiomes(int layer, PalettedContainerRO> biomeData) { - if (biomes == null) { - biomes = new PalettedContainer[getSectionCount()]; - } - if (biomeData instanceof PalettedContainer> palettedContainer) { - biomes[layer] = palettedContainer.copy(); - } else { - LOGGER.error( - "Cannot correctly save biomes to history. Expected class type {} but got {}", - PalettedContainer.class.getSimpleName(), - biomeData.getClass().getSimpleName() - ); - } - } - - @Override - public BaseBlock getFullBlock(int x, int y, int z) { - BlockState state = BlockTypesCache.states[get(x, y, z)]; - return state.toBaseBlock(this, x, y, z); - } - - @Override - public boolean hasSection(int layer) { - layer -= getMinSectionPosition(); - return blocks[layer] != null; - } - - @Override - public char[] load(int layer) { - layer -= getMinSectionPosition(); - return blocks[layer]; - } - - @Override - public char[] loadIfPresent(int layer) { - layer -= getMinSectionPosition(); - return blocks[layer]; - } - - @Override - public BlockState getBlock(int x, int y, int z) { - return BlockTypesCache.states[get(x, y, z)]; - } - - @Override - public int getSkyLight(int x, int y, int z) { - return 0; - } - - @Override - public int getEmittedLight(int x, int y, int z) { - return 0; - } - - @Override - public int[] getHeightMap(HeightMapType type) { - return new int[0]; - } - - @Override - public > T call(IChunkSet set, Runnable finalize) { - return null; - } - - public char get(int x, int y, int z) { - final int layer = (y >> 4) - getMinSectionPosition(); - final int index = (y & 15) << 8 | z << 4 | x; - return blocks[layer][index]; - } - - - @Override - public boolean trim(boolean aggressive) { - return false; - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightMapChunkUtil.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightMapChunkUtil.java deleted file mode 100644 index c8acc3cd2..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightMapChunkUtil.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R2; - -import com.fastasyncworldedit.bukkit.adapter.MapChunkUtil; -import com.sk89q.worldedit.bukkit.adapter.Refraction; -import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; -import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; - -//TODO un-very-break-this -public class PaperweightMapChunkUtil extends MapChunkUtil { - - public PaperweightMapChunkUtil() throws NoSuchFieldException { - fieldX = ClientboundLevelChunkPacketData.class.getDeclaredField(Refraction.pickName("TWO_MEGABYTES", "a")); - fieldZ = ClientboundLevelChunkWithLightPacket.class.getDeclaredField(Refraction.pickName("x", "a")); - fieldBitMask = ClientboundLevelChunkWithLightPacket.class.getDeclaredField(Refraction.pickName("z", "b")); - fieldHeightMap = ClientboundLevelChunkPacketData.class.getDeclaredField(Refraction.pickName("heightmaps", "b")); - fieldChunkData = ClientboundLevelChunkWithLightPacket.class.getDeclaredField(Refraction.pickName("chunkData", "c")); - fieldBlockEntities = ClientboundLevelChunkPacketData.class.getDeclaredField(Refraction.pickName("buffer", "c")); - fieldFull = ClientboundLevelChunkPacketData.class.getDeclaredField(Refraction.pickName("blockEntitiesData", "d")); - fieldX.setAccessible(true); - fieldZ.setAccessible(true); - fieldBitMask.setAccessible(true); - fieldHeightMap.setAccessible(true); - fieldChunkData.setAccessible(true); - fieldBlockEntities.setAccessible(true); - fieldFull.setAccessible(true); - } - - @Override - public ClientboundLevelChunkWithLightPacket createPacket() { - // TODO ??? return new ClientboundLevelChunkPacket(); - throw new UnsupportedOperationException(); - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightPlatformAdapter.java deleted file mode 100644 index 479df3b1a..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightPlatformAdapter.java +++ /dev/null @@ -1,700 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R2; - -import com.destroystokyo.paper.util.maplist.EntityList; -import com.fastasyncworldedit.bukkit.adapter.CachedBukkitAdapter; -import com.fastasyncworldedit.bukkit.adapter.DelegateSemaphore; -import com.fastasyncworldedit.bukkit.adapter.NMSAdapter; -import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.math.BitArrayUnstretched; -import com.fastasyncworldedit.core.util.MathMan; -import com.fastasyncworldedit.core.util.ReflectionUtils; -import com.fastasyncworldedit.core.util.TaskManager; -import com.mojang.datafixers.util.Either; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; -import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; -import com.sk89q.worldedit.bukkit.adapter.Refraction; -import com.sk89q.worldedit.world.biome.BiomeType; -import com.sk89q.worldedit.world.biome.BiomeTypes; -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockTypesCache; -import io.papermc.lib.PaperLib; -import io.papermc.paper.world.ChunkEntitySlices; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Holder; -import net.minecraft.core.IdMap; -import net.minecraft.core.Registry; -import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; -import net.minecraft.server.level.ChunkHolder; -import net.minecraft.server.level.ChunkMap; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.server.level.TicketType; -import net.minecraft.util.BitStorage; -import net.minecraft.util.ExceptionCollector; -import net.minecraft.util.SimpleBitStorage; -import net.minecraft.util.ThreadingDetector; -import net.minecraft.util.Unit; -import net.minecraft.util.ZeroBitStorage; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.LevelAccessor; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.chunk.GlobalPalette; -import net.minecraft.world.level.chunk.HashMapPalette; -import net.minecraft.world.level.chunk.LevelChunk; -import net.minecraft.world.level.chunk.LevelChunkSection; -import net.minecraft.world.level.chunk.LinearPalette; -import net.minecraft.world.level.chunk.Palette; -import net.minecraft.world.level.chunk.PalettedContainer; -import net.minecraft.world.level.chunk.SingleValuePalette; -import net.minecraft.world.level.entity.PersistentEntitySectionManager; -import org.bukkit.craftbukkit.v1_19_R2.CraftChunk; -import sun.misc.Unsafe; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.Semaphore; -import java.util.function.Function; - -import static net.minecraft.core.registries.Registries.BIOME; - -public final class PaperweightPlatformAdapter extends NMSAdapter { - - public static final Field fieldData; - - public static final Constructor dataConstructor; - - public static final Field fieldStorage; - public static final Field fieldPalette; - - private static final Field fieldTickingFluidCount; - private static final Field fieldTickingBlockCount; - private static final Field fieldNonEmptyBlockCount; - - private static final MethodHandle methodGetVisibleChunk; - - private static final int CHUNKSECTION_BASE; - private static final int CHUNKSECTION_SHIFT; - - private static final Field fieldThreadingDetector; - private static final long fieldThreadingDetectorOffset; - - private static final Field fieldLock; - private static final long fieldLockOffset; - - private static final MethodHandle methodRemoveGameEventListener; - private static final MethodHandle methodremoveTickingBlockEntity; - - private static final Field fieldRemove; - - static final boolean POST_CHUNK_REWRITE; - private static Method PAPER_CHUNK_GEN_ALL_ENTITIES; - private static Field LEVEL_CHUNK_ENTITIES; - private static Field SERVER_LEVEL_ENTITY_MANAGER; - - static { - try { - fieldData = PalettedContainer.class.getDeclaredField(Refraction.pickName("data", "d")); - fieldData.setAccessible(true); - - Class dataClazz = fieldData.getType(); - dataConstructor = dataClazz.getDeclaredConstructors()[0]; - dataConstructor.setAccessible(true); - - fieldStorage = dataClazz.getDeclaredField(Refraction.pickName("storage", "b")); - fieldStorage.setAccessible(true); - fieldPalette = dataClazz.getDeclaredField(Refraction.pickName("palette", "c")); - fieldPalette.setAccessible(true); - - fieldTickingFluidCount = LevelChunkSection.class.getDeclaredField(Refraction.pickName("tickingFluidCount", "h")); - fieldTickingFluidCount.setAccessible(true); - fieldTickingBlockCount = LevelChunkSection.class.getDeclaredField(Refraction.pickName("tickingBlockCount", "g")); - fieldTickingBlockCount.setAccessible(true); - fieldNonEmptyBlockCount = LevelChunkSection.class.getDeclaredField(Refraction.pickName("nonEmptyBlockCount", "f")); - fieldNonEmptyBlockCount.setAccessible(true); - - Method getVisibleChunkIfPresent = ChunkMap.class.getDeclaredMethod(Refraction.pickName( - "getVisibleChunkIfPresent", - "b" - ), long.class); - getVisibleChunkIfPresent.setAccessible(true); - methodGetVisibleChunk = MethodHandles.lookup().unreflect(getVisibleChunkIfPresent); - - Unsafe unsafe = ReflectionUtils.getUnsafe(); - if (!PaperLib.isPaper()) { - fieldThreadingDetector = PalettedContainer.class.getDeclaredField(Refraction.pickName("threadingDetector", "f")); - fieldThreadingDetectorOffset = unsafe.objectFieldOffset(fieldThreadingDetector); - - fieldLock = ThreadingDetector.class.getDeclaredField(Refraction.pickName("lock", "c")); - fieldLockOffset = unsafe.objectFieldOffset(fieldLock); - } else { - // in paper, the used methods are synchronized properly - fieldThreadingDetector = null; - fieldThreadingDetectorOffset = -1; - - fieldLock = null; - fieldLockOffset = -1; - } - - Method removeGameEventListener = LevelChunk.class.getDeclaredMethod( - Refraction.pickName("removeGameEventListener", "a"), - BlockEntity.class, - ServerLevel.class - ); - removeGameEventListener.setAccessible(true); - methodRemoveGameEventListener = MethodHandles.lookup().unreflect(removeGameEventListener); - - Method removeBlockEntityTicker = LevelChunk.class.getDeclaredMethod( - Refraction.pickName( - "removeBlockEntityTicker", - "l" - ), BlockPos.class - ); - removeBlockEntityTicker.setAccessible(true); - methodremoveTickingBlockEntity = MethodHandles.lookup().unreflect(removeBlockEntityTicker); - - fieldRemove = BlockEntity.class.getDeclaredField(Refraction.pickName("remove", "p")); - fieldRemove.setAccessible(true); - - CHUNKSECTION_BASE = unsafe.arrayBaseOffset(LevelChunkSection[].class); - int scale = unsafe.arrayIndexScale(LevelChunkSection[].class); - if ((scale & (scale - 1)) != 0) { - throw new Error("data type scale not a power of two"); - } - CHUNKSECTION_SHIFT = 31 - Integer.numberOfLeadingZeros(scale); - boolean chunkRewrite; - try { - ServerLevel.class.getDeclaredMethod("getEntityLookup"); - chunkRewrite = true; - PAPER_CHUNK_GEN_ALL_ENTITIES = ChunkEntitySlices.class.getDeclaredMethod("getAllEntities"); - PAPER_CHUNK_GEN_ALL_ENTITIES.setAccessible(true); - } catch (NoSuchMethodException ignored) { - chunkRewrite = false; - } - try { - // Paper - Pre-Chunk-Update - LEVEL_CHUNK_ENTITIES = LevelChunk.class.getDeclaredField("entities"); - LEVEL_CHUNK_ENTITIES.setAccessible(true); - } catch (NoSuchFieldException ignored) { - } - try { - // Non-Paper - SERVER_LEVEL_ENTITY_MANAGER = ServerLevel.class.getDeclaredField(Refraction.pickName("entityManager", "P")); - SERVER_LEVEL_ENTITY_MANAGER.setAccessible(true); - } catch (NoSuchFieldException ignored) { - } - POST_CHUNK_REWRITE = chunkRewrite; - } catch (RuntimeException e) { - throw e; - } catch (Throwable rethrow) { - rethrow.printStackTrace(); - throw new RuntimeException(rethrow); - } - } - - static boolean setSectionAtomic( - LevelChunkSection[] sections, - LevelChunkSection expected, - LevelChunkSection value, - int layer - ) { - long offset = ((long) layer << CHUNKSECTION_SHIFT) + CHUNKSECTION_BASE; - if (layer >= 0 && layer < sections.length) { - return ReflectionUtils.getUnsafe().compareAndSwapObject(sections, offset, expected, value); - } - return false; - } - - // There is no point in having a functional semaphore for paper servers. - private static final ThreadLocal SEMAPHORE_THREAD_LOCAL = - ThreadLocal.withInitial(() -> new DelegateSemaphore(1, null)); - - static DelegateSemaphore applyLock(LevelChunkSection section) { - if (PaperLib.isPaper()) { - return SEMAPHORE_THREAD_LOCAL.get(); - } - try { - synchronized (section) { - Unsafe unsafe = ReflectionUtils.getUnsafe(); - PalettedContainer blocks = section.getStates(); - ThreadingDetector currentThreadingDetector = (ThreadingDetector) unsafe.getObject( - blocks, - fieldThreadingDetectorOffset - ); - synchronized (currentThreadingDetector) { - Semaphore currentLock = (Semaphore) unsafe.getObject(currentThreadingDetector, fieldLockOffset); - if (currentLock instanceof DelegateSemaphore delegateSemaphore) { - return delegateSemaphore; - } - DelegateSemaphore newLock = new DelegateSemaphore(1, currentLock); - unsafe.putObject(currentThreadingDetector, fieldLockOffset, newLock); - return newLock; - } - } - } catch (Throwable e) { - e.printStackTrace(); - throw new RuntimeException(e); - } - } - - public static LevelChunk ensureLoaded(ServerLevel serverLevel, int chunkX, int chunkZ) { - if (!PaperLib.isPaper()) { - LevelChunk nmsChunk = serverLevel.getChunkSource().getChunk(chunkX, chunkZ, false); - if (nmsChunk != null) { - return nmsChunk; - } - if (Fawe.isMainThread()) { - return serverLevel.getChunk(chunkX, chunkZ); - } - } else { - LevelChunk nmsChunk = serverLevel.getChunkSource().getChunkAtIfCachedImmediately(chunkX, chunkZ); - if (nmsChunk != null) { - addTicket(serverLevel, chunkX, chunkZ); - return nmsChunk; - } - nmsChunk = serverLevel.getChunkSource().getChunkAtIfLoadedImmediately(chunkX, chunkZ); - if (nmsChunk != null) { - addTicket(serverLevel, chunkX, chunkZ); - return nmsChunk; - } - // Avoid "async" methods from the main thread. - if (Fawe.isMainThread()) { - return serverLevel.getChunk(chunkX, chunkZ); - } - CompletableFuture future = serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true); - try { - CraftChunk chunk = (CraftChunk) future.get(); - return chunk.getHandle(); - } catch (Throwable e) { - e.printStackTrace(); - } - } - return TaskManager.taskManager().sync(() -> serverLevel.getChunk(chunkX, chunkZ)); - } - - private static void addTicket(ServerLevel serverLevel, int chunkX, int chunkZ) { - // Ensure chunk is definitely loaded before applying a ticket - io.papermc.paper.util.MCUtil.MAIN_EXECUTOR.execute(() -> serverLevel - .getChunkSource() - .addRegionTicket(TicketType.PLUGIN, new ChunkPos(chunkX, chunkZ), 0, Unit.INSTANCE)); - } - - public static ChunkHolder getPlayerChunk(ServerLevel nmsWorld, final int chunkX, final int chunkZ) { - ChunkMap chunkMap = nmsWorld.getChunkSource().chunkMap; - try { - return (ChunkHolder) methodGetVisibleChunk.invoke(chunkMap, ChunkPos.asLong(chunkX, chunkZ)); - } catch (Throwable thr) { - throw new RuntimeException(thr); - } - } - - @SuppressWarnings("deprecation") - public static void sendChunk(ServerLevel nmsWorld, int chunkX, int chunkZ, boolean lighting) { - ChunkHolder chunkHolder = getPlayerChunk(nmsWorld, chunkX, chunkZ); - if (chunkHolder == null) { - return; - } - ChunkPos coordIntPair = new ChunkPos(chunkX, chunkZ); - LevelChunk levelChunk; - if (PaperLib.isPaper()) { - // getChunkAtIfLoadedImmediately is paper only - levelChunk = nmsWorld - .getChunkSource() - .getChunkAtIfLoadedImmediately(chunkX, chunkZ); - } else { - levelChunk = ((Optional) ((Either) chunkHolder - .getTickingChunkFuture() // method is not present with new paper chunk system - .getNow(ChunkHolder.UNLOADED_LEVEL_CHUNK)).left()) - .orElse(null); - } - if (levelChunk == null) { - return; - } - TaskManager.taskManager().task(() -> { - ClientboundLevelChunkWithLightPacket packet; - if (PaperLib.isPaper()) { - packet = new ClientboundLevelChunkWithLightPacket( - levelChunk, - nmsWorld.getChunkSource().getLightEngine(), - null, - null, - true, - false // last false is to not bother with x-ray - ); - } else { - // deprecated on paper - deprecation suppressed - packet = new ClientboundLevelChunkWithLightPacket( - levelChunk, - nmsWorld.getChunkSource().getLightEngine(), - null, - null, - true - ); - } - nearbyPlayers(nmsWorld, coordIntPair).forEach(p -> p.connection.send(packet)); - }); - } - - private static List nearbyPlayers(ServerLevel serverLevel, ChunkPos coordIntPair) { - return serverLevel.getChunkSource().chunkMap.getPlayers(coordIntPair, false); - } - - /* - NMS conversion - */ - public static LevelChunkSection newChunkSection( - final int layer, - final char[] blocks, - CachedBukkitAdapter adapter, - Registry biomeRegistry, - @Nullable PalettedContainer> biomes - ) { - return newChunkSection(layer, null, blocks, adapter, biomeRegistry, biomes); - } - - public static LevelChunkSection newChunkSection( - final int layer, - final Function get, - char[] set, - CachedBukkitAdapter adapter, - Registry biomeRegistry, - @Nullable PalettedContainer> biomes - ) { - if (set == null) { - return newChunkSection(layer, biomeRegistry, biomes); - } - final int[] blockToPalette = FaweCache.INSTANCE.BLOCK_TO_PALETTE.get(); - final int[] paletteToBlock = FaweCache.INSTANCE.PALETTE_TO_BLOCK.get(); - final long[] blockStates = FaweCache.INSTANCE.BLOCK_STATES.get(); - final int[] blocksCopy = FaweCache.INSTANCE.SECTION_BLOCKS.get(); - try { - int num_palette; - if (get == null) { - num_palette = createPalette(blockToPalette, paletteToBlock, blocksCopy, set, adapter, null); - } else { - num_palette = createPalette(layer, blockToPalette, paletteToBlock, blocksCopy, get, set, adapter, null); - } - - int bitsPerEntry = MathMan.log2nlz(num_palette - 1); - if (bitsPerEntry > 0 && bitsPerEntry < 5) { - bitsPerEntry = 4; - } else if (bitsPerEntry > 8) { - bitsPerEntry = MathMan.log2nlz(Block.BLOCK_STATE_REGISTRY.size() - 1); - } - - int bitsPerEntryNonZero = Math.max(bitsPerEntry, 1); // We do want to use zero sometimes - final int blocksPerLong = MathMan.floorZero((double) 64 / bitsPerEntryNonZero); - final int blockBitArrayEnd = MathMan.ceilZero((float) 4096 / blocksPerLong); - - if (num_palette == 1) { - for (int i = 0; i < blockBitArrayEnd; i++) { - blockStates[i] = 0; - } - } else { - final BitArrayUnstretched bitArray = new BitArrayUnstretched(bitsPerEntryNonZero, 4096, blockStates); - bitArray.fromRaw(blocksCopy); - } - - final long[] bits = Arrays.copyOfRange(blockStates, 0, blockBitArrayEnd); - final BitStorage nmsBits; - if (bitsPerEntry == 0) { - nmsBits = new ZeroBitStorage(4096); - } else { - nmsBits = new SimpleBitStorage(bitsPerEntry, 4096, bits); - } - List palette; - if (bitsPerEntry < 9) { - palette = new ArrayList<>(); - for (int i = 0; i < num_palette; i++) { - int ordinal = paletteToBlock[i]; - blockToPalette[ordinal] = Integer.MAX_VALUE; - final BlockState state = BlockTypesCache.states[ordinal]; - palette.add(((PaperweightBlockMaterial) state.getMaterial()).getState()); - } - } else { - palette = List.of(); - } - - // Create palette with data - @SuppressWarnings("deprecation") // constructor is deprecated on paper, but needed to keep compatibility with spigot - final PalettedContainer blockStatePalettedContainer = - new PalettedContainer<>( - Block.BLOCK_STATE_REGISTRY, - PalettedContainer.Strategy.SECTION_STATES, - PalettedContainer.Strategy.SECTION_STATES.getConfiguration(Block.BLOCK_STATE_REGISTRY, bitsPerEntry), - nmsBits, - palette - ); - if (biomes == null) { - IdMap> biomeHolderIdMap = biomeRegistry.asHolderIdMap(); - biomes = new PalettedContainer<>( - biomeHolderIdMap, - biomeHolderIdMap.byIdOrThrow(WorldEditPlugin - .getInstance() - .getBukkitImplAdapter() - .getInternalBiomeId( - BiomeTypes.PLAINS)), - PalettedContainer.Strategy.SECTION_BIOMES, - null - ); - } - - return new LevelChunkSection(layer, blockStatePalettedContainer, biomes); - } catch (final Throwable e) { - throw e; - } finally { - Arrays.fill(blockToPalette, Integer.MAX_VALUE); - Arrays.fill(paletteToBlock, Integer.MAX_VALUE); - Arrays.fill(blockStates, 0); - Arrays.fill(blocksCopy, 0); - } - } - - @SuppressWarnings("deprecation") // Only deprecated in paper - private static LevelChunkSection newChunkSection( - int layer, - Registry biomeRegistry, - @Nullable PalettedContainer> biomes - ) { - if (biomes == null) { - return new LevelChunkSection(layer, biomeRegistry); - } - PalettedContainer dataPaletteBlocks = new PalettedContainer<>( - Block.BLOCK_STATE_REGISTRY, - Blocks.AIR.defaultBlockState(), - PalettedContainer.Strategy.SECTION_STATES, - null - ); - return new LevelChunkSection(layer, dataPaletteBlocks, biomes); - } - - /** - * Create a new {@link PalettedContainer}. Should only be used if no biome container existed beforehand. - */ - public static PalettedContainer> getBiomePalettedContainer( - BiomeType[] biomes, - IdMap> biomeRegistry - ) { - if (biomes == null) { - return null; - } - BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter(); - // Don't stream this as typically will see 1-4 biomes; stream overhead is large for the small length - Map> palette = new HashMap<>(); - for (BiomeType biomeType : new LinkedList<>(Arrays.asList(biomes))) { - Holder biome; - if (biomeType == null) { - biome = biomeRegistry.byId(adapter.getInternalBiomeId(BiomeTypes.PLAINS)); - } else { - biome = biomeRegistry.byId(adapter.getInternalBiomeId(biomeType)); - } - palette.put(biomeType, biome); - } - int biomeCount = palette.size(); - int bitsPerEntry = MathMan.log2nlz(biomeCount - 1); - Object configuration = PalettedContainer.Strategy.SECTION_STATES.getConfiguration( - new FakeIdMapBiome(biomeCount), - bitsPerEntry - ); - if (bitsPerEntry > 3) { - bitsPerEntry = MathMan.log2nlz(biomeRegistry.size() - 1); - } - PalettedContainer> biomePalettedContainer = new PalettedContainer<>( - biomeRegistry, - biomeRegistry.byIdOrThrow(adapter.getInternalBiomeId(BiomeTypes.PLAINS)), - PalettedContainer.Strategy.SECTION_BIOMES, - null - ); - - final Palette> biomePalette; - if (bitsPerEntry == 0) { - biomePalette = new SingleValuePalette<>( - biomePalettedContainer.registry, - biomePalettedContainer, - new ArrayList<>(palette.values()) // Must be modifiable - ); - } else if (bitsPerEntry == 4) { - biomePalette = LinearPalette.create( - 4, - biomePalettedContainer.registry, - biomePalettedContainer, - new ArrayList<>(palette.values()) // Must be modifiable - ); - } else if (bitsPerEntry < 9) { - biomePalette = HashMapPalette.create( - bitsPerEntry, - biomePalettedContainer.registry, - biomePalettedContainer, - new ArrayList<>(palette.values()) // Must be modifiable - ); - } else { - biomePalette = GlobalPalette.create( - bitsPerEntry, - biomePalettedContainer.registry, - biomePalettedContainer, - null // unused - ); - } - - int bitsPerEntryNonZero = Math.max(bitsPerEntry, 1); // We do want to use zero sometimes - final int blocksPerLong = MathMan.floorZero((double) 64 / bitsPerEntryNonZero); - final int arrayLength = MathMan.ceilZero(64f / blocksPerLong); - - - BitStorage bitStorage = bitsPerEntry == 0 ? new ZeroBitStorage(64) : new SimpleBitStorage( - bitsPerEntry, - 64, - new long[arrayLength] - ); - - try { - Object data = dataConstructor.newInstance(configuration, bitStorage, biomePalette); - fieldData.set(biomePalettedContainer, data); - int index = 0; - for (int y = 0; y < 4; y++) { - for (int z = 0; z < 4; z++) { - for (int x = 0; x < 4; x++, index++) { - BiomeType biomeType = biomes[index]; - if (biomeType == null) { - continue; - } - Holder biome = biomeRegistry.byId(WorldEditPlugin - .getInstance() - .getBukkitImplAdapter() - .getInternalBiomeId(biomeType)); - if (biome == null) { - continue; - } - biomePalettedContainer.set(x, y, z, biome); - } - } - } - } catch (InstantiationException | IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException(e); - } - return biomePalettedContainer; - } - - public static void clearCounts(final LevelChunkSection section) throws IllegalAccessException { - fieldTickingFluidCount.setShort(section, (short) 0); - fieldTickingBlockCount.setShort(section, (short) 0); - } - - public static BiomeType adapt(Holder biome, LevelAccessor levelAccessor) { - final Registry biomeRegistry = levelAccessor.registryAccess().registryOrThrow(BIOME); - if (biomeRegistry.getKey(biome.value()) == null) { - return biomeRegistry.asHolderIdMap().getId(biome) == -1 ? BiomeTypes.OCEAN - : null; - } - return BiomeTypes.get(biome.unwrapKey().orElseThrow().location().toString()); - } - - static void removeBeacon(BlockEntity beacon, LevelChunk levelChunk) { - try { - if (levelChunk.loaded || levelChunk.level.isClientSide()) { - BlockEntity blockEntity = levelChunk.blockEntities.remove(beacon.getBlockPos()); - if (blockEntity != null) { - if (!levelChunk.level.isClientSide) { - methodRemoveGameEventListener.invoke(levelChunk, beacon, levelChunk.level); - } - fieldRemove.set(beacon, true); - } - } - methodremoveTickingBlockEntity.invoke(levelChunk, beacon.getBlockPos()); - } catch (Throwable throwable) { - throwable.printStackTrace(); - } - } - - static List getEntities(LevelChunk chunk) { - ExceptionCollector collector = new ExceptionCollector<>(); - if (PaperLib.isPaper()) { - if (POST_CHUNK_REWRITE) { - try { - //noinspection unchecked - return (List) PAPER_CHUNK_GEN_ALL_ENTITIES.invoke(chunk.level.getEntityLookup().getChunk(chunk.locX, chunk.locZ)); - } catch (IllegalAccessException | InvocationTargetException e) { - throw new RuntimeException("Failed to lookup entities [POST_CHUNK_REWRITE=true]", e); - } - } - try { - EntityList entityList = (EntityList) LEVEL_CHUNK_ENTITIES.get(chunk); - return List.of(entityList.getRawData()); - } catch (IllegalAccessException e) { - collector.add(new RuntimeException("Failed to lookup entities [POST_CHUNK_REWRITE=false]", e)); - // fall through - } - } - try { - //noinspection unchecked - return ((PersistentEntitySectionManager) (SERVER_LEVEL_ENTITY_MANAGER.get(chunk.level))).getEntities(chunk.getPos()); - } catch (IllegalAccessException e) { - collector.add(new RuntimeException("Failed to lookup entities [PAPER=false]", e)); - } - collector.throwIfPresent(); - return List.of(); - } - - record FakeIdMapBlock(int size) implements IdMap { - - @Override - public int getId(final net.minecraft.world.level.block.state.BlockState entry) { - return 0; - } - - @Nullable - @Override - public net.minecraft.world.level.block.state.BlockState byId(final int index) { - return null; - } - - @Nonnull - @Override - public Iterator iterator() { - return Collections.emptyIterator(); - } - - } - - record FakeIdMapBiome(int size) implements IdMap { - - @Override - public int getId(final Biome entry) { - return 0; - } - - @Nullable - @Override - public Biome byId(final int index) { - return null; - } - - @Nonnull - @Override - public Iterator iterator() { - return Collections.emptyIterator(); - } - - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightPostProcessor.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightPostProcessor.java deleted file mode 100644 index a3f016f42..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightPostProcessor.java +++ /dev/null @@ -1,175 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R2; - -import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.extent.processor.ProcessorScope; -import com.fastasyncworldedit.core.queue.IBatchProcessor; -import com.fastasyncworldedit.core.queue.IChunk; -import com.fastasyncworldedit.core.queue.IChunkGet; -import com.fastasyncworldedit.core.queue.IChunkSet; -import com.fastasyncworldedit.core.registry.state.PropertyKey; -import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockTypes; -import com.sk89q.worldedit.world.block.BlockTypesCache; -import net.minecraft.core.BlockPos; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.world.level.material.Fluid; -import net.minecraft.world.level.material.Fluids; - -import javax.annotation.Nullable; - -public class PaperweightPostProcessor implements IBatchProcessor { - - @Override - public IChunkSet processSet(final IChunk chunk, final IChunkGet get, final IChunkSet set) { - return set; - } - - @SuppressWarnings("deprecation") - @Override - public void postProcess(final IChunk chunk, final IChunkGet iChunkGet, final IChunkSet iChunkSet) { - boolean tickFluid = Settings.settings().EXPERIMENTAL.ALLOW_TICK_FLUIDS; - // The PostProcessor shouldn't be added, but just in case - if (!tickFluid) { - return; - } - PaperweightGetBlocks_Copy getBlocks = (PaperweightGetBlocks_Copy) iChunkGet; - layer: - for (int layer = iChunkSet.getMinSectionPosition(); layer <= iChunkSet.getMaxSectionPosition(); layer++) { - char[] set = iChunkSet.loadIfPresent(layer); - if (set == null) { - // No edit means no need to process - continue; - } - char[] get = null; - for (int i = 0; i < 4096; i++) { - char ordinal = set[i]; - char replacedOrdinal = BlockTypesCache.ReservedIDs.__RESERVED__; - boolean fromGet = false; // Used for liquids - if (ordinal == BlockTypesCache.ReservedIDs.__RESERVED__) { - if (get == null) { - get = getBlocks.load(layer); - } - // If this is null, then it's because we're loading a layer in the range of 0->15, but blocks aren't - // actually being set - if (get == null) { - continue layer; - } - fromGet = true; - ordinal = replacedOrdinal = get[i]; - } - if (ordinal == BlockTypesCache.ReservedIDs.__RESERVED__) { - continue; - } else if (!fromGet) { // if fromGet, don't do the same again - if (get == null) { - get = getBlocks.load(layer); - } - replacedOrdinal = get[i]; - } - boolean ticking = BlockTypesCache.ticking[ordinal]; - boolean replacedWasTicking = BlockTypesCache.ticking[replacedOrdinal]; - boolean replacedWasLiquid = false; - BlockState replacedState = null; - if (!ticking) { - // If the block being replaced was not ticking, it cannot be a liquid - if (!replacedWasTicking) { - continue; - } - // If the block being replaced is not fluid, we do not need to worry - if (!(replacedWasLiquid = - (replacedState = BlockState.getFromOrdinal(replacedOrdinal)).getMaterial().isLiquid())) { - continue; - } - } - BlockState state = BlockState.getFromOrdinal(ordinal); - boolean liquid = state.getMaterial().isLiquid(); - int x = i & 15; - int y = (i >> 8) & 15; - int z = (i >> 4) & 15; - BlockPos position = new BlockPos((chunk.getX() << 4) + x, (layer << 4) + y, (chunk.getZ() << 4) + z); - if (liquid || replacedWasLiquid) { - if (liquid) { - addFluid(getBlocks.serverLevel, state, position); - continue; - } - // If the replaced fluid (is?) adjacent to water. Do not bother to check adjacent chunks(sections) as this - // may be time consuming. Chances are any fluid blocks in adjacent chunks are being replaced or will end up - // being ticked anyway. We only need it to be "hit" once. - if (!wasAdjacentToWater(get, set, i, x, y, z)) { - continue; - } - addFluid(getBlocks.serverLevel, replacedState, position); - } - } - } - } - - @Nullable - @Override - public Extent construct(final Extent child) { - throw new UnsupportedOperationException("Processing only"); - } - - @Override - public ProcessorScope getScope() { - return ProcessorScope.READING_SET_BLOCKS; - } - - private boolean wasAdjacentToWater(char[] get, char[] set, int i, int x, int y, int z) { - if (set == null || get == null) { - return false; - } - char ordinal; - char reserved = BlockTypesCache.ReservedIDs.__RESERVED__; - if (x > 0 && set[i - 1] != reserved) { - if (BlockTypesCache.ticking[(ordinal = get[i - 1])] && isFluid(ordinal)) { - return true; - } - } - if (x < 15 && set[i + 1] != reserved) { - if (BlockTypesCache.ticking[(ordinal = get[i + 1])] && isFluid(ordinal)) { - return true; - } - } - if (z > 0 && set[i - 16] != reserved) { - if (BlockTypesCache.ticking[(ordinal = get[i - 16])] && isFluid(ordinal)) { - return true; - } - } - if (z < 15 && set[i + 16] != reserved) { - if (BlockTypesCache.ticking[(ordinal = get[i + 16])] && isFluid(ordinal)) { - return true; - } - } - if (y > 0 && set[i - 256] != reserved) { - if (BlockTypesCache.ticking[(ordinal = get[i - 256])] && isFluid(ordinal)) { - return true; - } - } - if (y < 15 && set[i + 256] != reserved) { - return BlockTypesCache.ticking[(ordinal = get[i + 256])] && isFluid(ordinal); - } - return false; - } - - @SuppressWarnings("deprecation") - private boolean isFluid(char ordinal) { - return BlockState.getFromOrdinal(ordinal).getMaterial().isLiquid(); - } - - @SuppressWarnings("deprecation") - private void addFluid(final ServerLevel serverLevel, final BlockState replacedState, final BlockPos position) { - Fluid type; - if (replacedState.getBlockType() == BlockTypes.LAVA) { - type = (int) replacedState.getState(PropertyKey.LEVEL) == 0 ? Fluids.LAVA : Fluids.FLOWING_LAVA; - } else { - type = (int) replacedState.getState(PropertyKey.LEVEL) == 0 ? Fluids.WATER : Fluids.FLOWING_WATER; - } - serverLevel.scheduleTick( - position, - type, - type.getTickDelay(serverLevel) - ); - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightStarlightRelighter.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightStarlightRelighter.java deleted file mode 100644 index 642250aa0..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightStarlightRelighter.java +++ /dev/null @@ -1,205 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R2; - -import com.fastasyncworldedit.core.configuration.Settings; -import com.fastasyncworldedit.core.extent.processor.lighting.NMSRelighter; -import com.fastasyncworldedit.core.extent.processor.lighting.Relighter; -import com.fastasyncworldedit.core.queue.IQueueChunk; -import com.fastasyncworldedit.core.queue.IQueueExtent; -import com.fastasyncworldedit.core.util.MathMan; -import com.fastasyncworldedit.core.util.TaskManager; -import com.sk89q.worldedit.internal.util.LogManagerCompat; -import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; -import it.unimi.dsi.fastutil.longs.LongArraySet; -import it.unimi.dsi.fastutil.longs.LongIterator; -import it.unimi.dsi.fastutil.longs.LongSet; -import net.minecraft.server.level.ChunkMap; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.TicketType; -import net.minecraft.util.Unit; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.chunk.ChunkStatus; -import org.apache.logging.log4j.Logger; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.locks.ReentrantLock; -import java.util.function.Consumer; -import java.util.function.IntConsumer; - -public class PaperweightStarlightRelighter implements Relighter { - - private static final Logger LOGGER = LogManagerCompat.getLogger(); - private static final int CHUNKS_PER_BATCH = 1024; // 32 * 32 - private static final int CHUNKS_PER_BATCH_SQRT_LOG2 = 5; // for shifting - - private static final TicketType FAWE_TICKET = TicketType.create("fawe_ticket", (a, b) -> 0); - private static final int LIGHT_LEVEL = ChunkMap.MAX_VIEW_DISTANCE + ChunkStatus.getDistance(ChunkStatus.LIGHT); - - - private final ServerLevel serverLevel; - private final ReentrantLock lock = new ReentrantLock(); - private final Long2ObjectLinkedOpenHashMap regions = new Long2ObjectLinkedOpenHashMap<>(); - private final ReentrantLock areaLock = new ReentrantLock(); - private final NMSRelighter delegate; - - @SuppressWarnings("rawtypes") - public PaperweightStarlightRelighter(ServerLevel serverLevel, IQueueExtent queue) { - this.serverLevel = serverLevel; - this.delegate = new NMSRelighter(queue); - } - - @Override - public boolean addChunk(int cx, int cz, byte[] skipReason, int bitmask) { - areaLock.lock(); - try { - long key = MathMan.pairInt(cx >> CHUNKS_PER_BATCH_SQRT_LOG2, cz >> CHUNKS_PER_BATCH_SQRT_LOG2); - // TODO probably submit here already if chunks.size == CHUNKS_PER_BATCH? - LongSet chunks = this.regions.computeIfAbsent(key, k -> new LongArraySet(CHUNKS_PER_BATCH >> 2)); - chunks.add(ChunkPos.asLong(cx, cz)); - } finally { - areaLock.unlock(); - } - return true; - } - - @Override - public void addLightUpdate(int x, int y, int z) { - delegate.addLightUpdate(x, y, z); - } - - /* - * This method is called "recursively", iterating and removing elements - * from the regions linked map. This way, chunks are loaded in batches to avoid - * OOMEs. - */ - @Override - public void fixLightingSafe(boolean sky) { - this.areaLock.lock(); - try { - if (regions.isEmpty()) { - return; - } - LongSet first = regions.removeFirst(); - fixLighting(first, () -> fixLightingSafe(true)); - } finally { - this.areaLock.unlock(); - } - } - - /* - * Processes a set of chunks and runs an action afterwards. - * The action is run async, the chunks are partly processed on the main thread - * (as required by the server). - */ - private void fixLighting(LongSet chunks, Runnable andThen) { - // convert from long keys to ChunkPos - Set coords = new HashSet<>(); - LongIterator iterator = chunks.iterator(); - while (iterator.hasNext()) { - coords.add(new ChunkPos(iterator.nextLong())); - } - TaskManager.taskManager().task(() -> { - // trigger chunk load and apply ticket on main thread - List> futures = new ArrayList<>(); - for (ChunkPos pos : coords) { - futures.add(serverLevel.getWorld().getChunkAtAsync(pos.x, pos.z) - .thenAccept(c -> serverLevel.getChunkSource().addTicketAtLevel( - FAWE_TICKET, - pos, - LIGHT_LEVEL, - Unit.INSTANCE - )) - ); - } - // collect futures and trigger relight once all chunks are loaded - CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).thenAccept(v -> - invokeRelight( - coords, - c -> { - }, // no callback for single chunks required - i -> { - if (i != coords.size()) { - LOGGER.warn("Processed {} chunks instead of {}", i, coords.size()); - } - // post process chunks on main thread - TaskManager.taskManager().task(() -> postProcessChunks(coords)); - // call callback on our own threads - TaskManager.taskManager().async(andThen); - } - ) - ); - }); - } - - private void invokeRelight( - Set coords, - Consumer chunkCallback, - IntConsumer processCallback - ) { - try { - serverLevel.getChunkSource().getLightEngine().relight(coords, chunkCallback, processCallback); - } catch (Exception e) { - LOGGER.error("Error occurred on relighting", e); - } - } - - /* - * Allow the server to unload the chunks again. - * Also, if chunk packets are sent delayed, we need to do that here - */ - private void postProcessChunks(Set coords) { - boolean delay = Settings.settings().LIGHTING.DELAY_PACKET_SENDING; - for (ChunkPos pos : coords) { - int x = pos.x; - int z = pos.z; - if (delay) { // we still need to send the block changes of that chunk - PaperweightPlatformAdapter.sendChunk(serverLevel, x, z, false); - } - serverLevel.getChunkSource().removeTicketAtLevel(FAWE_TICKET, pos, LIGHT_LEVEL, Unit.INSTANCE); - } - } - - @Override - public void clear() { - - } - - @Override - public void removeLighting() { - this.delegate.removeLighting(); - } - - @Override - public void fixBlockLighting() { - fixLightingSafe(true); - } - - @Override - public void fixSkyLighting() { - fixLightingSafe(true); - } - - @Override - public boolean isEmpty() { - return true; - } - - @Override - public ReentrantLock getLock() { - return this.lock; - } - - @Override - public boolean isFinished() { - return false; - } - - @Override - public void close() throws Exception { - fixLightingSafe(true); - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightStarlightRelighterFactory.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightStarlightRelighterFactory.java deleted file mode 100644 index 3741b552c..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/PaperweightStarlightRelighterFactory.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R2; - -import com.fastasyncworldedit.core.extent.processor.lighting.NullRelighter; -import com.fastasyncworldedit.core.extent.processor.lighting.RelightMode; -import com.fastasyncworldedit.core.extent.processor.lighting.Relighter; -import com.fastasyncworldedit.core.extent.processor.lighting.RelighterFactory; -import com.fastasyncworldedit.core.queue.IQueueChunk; -import com.fastasyncworldedit.core.queue.IQueueExtent; -import com.sk89q.worldedit.world.World; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_19_R2.CraftWorld; - -import javax.annotation.Nonnull; - -public class PaperweightStarlightRelighterFactory implements RelighterFactory { - - @Override - public @Nonnull - @SuppressWarnings("rawtypes") - Relighter createRelighter(RelightMode relightMode, World world, IQueueExtent queue) { - org.bukkit.World w = Bukkit.getWorld(world.getName()); - if (w == null) { - return NullRelighter.INSTANCE; - } - return new PaperweightStarlightRelighter(((CraftWorld) w).getHandle(), queue); - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/nbt/PaperweightLazyCompoundTag.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/nbt/PaperweightLazyCompoundTag.java deleted file mode 100644 index 9ff3c1f61..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/nbt/PaperweightLazyCompoundTag.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R2.nbt; - -import com.sk89q.jnbt.CompoundTag; -import com.sk89q.jnbt.LazyCompoundTag; -import com.sk89q.jnbt.ListTag; -import com.sk89q.jnbt.StringTag; -import com.sk89q.jnbt.Tag; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; -import com.sk89q.worldedit.util.nbt.CompoundBinaryTag; -import net.minecraft.nbt.NumericTag; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; - -public class PaperweightLazyCompoundTag extends LazyCompoundTag { - - private final Supplier compoundTagSupplier; - private CompoundTag compoundTag; - - public PaperweightLazyCompoundTag(Supplier compoundTagSupplier) { - super(new HashMap<>()); - this.compoundTagSupplier = compoundTagSupplier; - } - - public PaperweightLazyCompoundTag(net.minecraft.nbt.CompoundTag compoundTag) { - this(() -> compoundTag); - } - - public net.minecraft.nbt.CompoundTag get() { - return compoundTagSupplier.get(); - } - - @Override - @SuppressWarnings("unchecked") - public Map getValue() { - if (compoundTag == null) { - compoundTag = (CompoundTag) WorldEditPlugin.getInstance().getBukkitImplAdapter().toNative(compoundTagSupplier.get()); - } - return compoundTag.getValue(); - } - - @Override - public CompoundBinaryTag asBinaryTag() { - getValue(); - return compoundTag.asBinaryTag(); - } - - public boolean containsKey(String key) { - return compoundTagSupplier.get().contains(key); - } - - public byte[] getByteArray(String key) { - return compoundTagSupplier.get().getByteArray(key); - } - - public byte getByte(String key) { - return compoundTagSupplier.get().getByte(key); - } - - public double getDouble(String key) { - return compoundTagSupplier.get().getDouble(key); - } - - public double asDouble(String key) { - net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key); - if (tag instanceof NumericTag numTag) { - return numTag.getAsDouble(); - } - return 0; - } - - public float getFloat(String key) { - return compoundTagSupplier.get().getFloat(key); - } - - public int[] getIntArray(String key) { - return compoundTagSupplier.get().getIntArray(key); - } - - public int getInt(String key) { - return compoundTagSupplier.get().getInt(key); - } - - public int asInt(String key) { - net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key); - if (tag instanceof NumericTag numTag) { - return numTag.getAsInt(); - } - return 0; - } - - @SuppressWarnings("unchecked") - public List getList(String key) { - net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key); - if (tag instanceof net.minecraft.nbt.ListTag nbtList) { - ArrayList list = new ArrayList<>(); - for (net.minecraft.nbt.Tag elem : nbtList) { - if (elem instanceof net.minecraft.nbt.CompoundTag compoundTag) { - list.add(new PaperweightLazyCompoundTag(compoundTag)); - } else { - list.add(WorldEditPlugin.getInstance().getBukkitImplAdapter().toNative(elem)); - } - } - return list; - } - return Collections.emptyList(); - } - - @SuppressWarnings("unchecked") - public ListTag getListTag(String key) { - net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key); - if (tag instanceof net.minecraft.nbt.ListTag) { - return (ListTag) WorldEditPlugin.getInstance().getBukkitImplAdapter().toNative(tag); - } - return new ListTag(StringTag.class, Collections.emptyList()); - } - - @SuppressWarnings("unchecked") - public List getList(String key, Class listType) { - ListTag listTag = getListTag(key); - if (listTag.getType().equals(listType)) { - return (List) listTag.getValue(); - } else { - return Collections.emptyList(); - } - } - - public long[] getLongArray(String key) { - return compoundTagSupplier.get().getLongArray(key); - } - - public long getLong(String key) { - return compoundTagSupplier.get().getLong(key); - } - - public long asLong(String key) { - net.minecraft.nbt.Tag tag = compoundTagSupplier.get().get(key); - if (tag instanceof NumericTag numTag) { - return numTag.getAsLong(); - } - return 0; - } - - public short getShort(String key) { - return compoundTagSupplier.get().getShort(key); - } - - public String getString(String key) { - return compoundTagSupplier.get().getString(key); - } - - @Override - public String toString() { - return compoundTagSupplier.get().toString(); - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/regen/PaperweightRegen.java b/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/regen/PaperweightRegen.java deleted file mode 100644 index 74dccf63b..000000000 --- a/worldedit-bukkit/adapters/adapter-1_19_3/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R2/regen/PaperweightRegen.java +++ /dev/null @@ -1,594 +0,0 @@ -package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R2.regen; - -import com.fastasyncworldedit.bukkit.adapter.Regenerator; -import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.queue.IChunkCache; -import com.fastasyncworldedit.core.queue.IChunkGet; -import com.fastasyncworldedit.core.util.ReflectionUtils; -import com.fastasyncworldedit.core.util.TaskManager; -import com.google.common.collect.ImmutableList; -import com.mojang.datafixers.util.Either; -import com.mojang.serialization.Lifecycle; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; -import com.sk89q.worldedit.bukkit.adapter.Refraction; -import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R2.PaperweightGetBlocks; -import com.sk89q.worldedit.extent.Extent; -import com.sk89q.worldedit.internal.util.LogManagerCompat; -import com.sk89q.worldedit.regions.Region; -import com.sk89q.worldedit.util.io.file.SafeFiles; -import com.sk89q.worldedit.world.RegenOptions; -import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; -import net.minecraft.core.Holder; -import net.minecraft.core.Registry; -import net.minecraft.core.registries.Registries; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.resources.ResourceKey; -import net.minecraft.server.MinecraftServer; -import net.minecraft.server.dedicated.DedicatedServer; -import net.minecraft.server.level.ChunkMap; -import net.minecraft.server.level.ChunkTaskPriorityQueueSorter.Message; -import net.minecraft.server.level.ServerChunkCache; -import net.minecraft.server.level.ServerLevel; -import net.minecraft.server.level.ThreadedLevelLightEngine; -import net.minecraft.server.level.progress.ChunkProgressListener; -import net.minecraft.util.thread.ProcessorHandle; -import net.minecraft.util.thread.ProcessorMailbox; -import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelHeightAccessor; -import net.minecraft.world.level.LevelSettings; -import net.minecraft.world.level.biome.Biome; -import net.minecraft.world.level.biome.BiomeSource; -import net.minecraft.world.level.biome.FixedBiomeSource; -import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkGenerator; -import net.minecraft.world.level.chunk.ChunkGeneratorStructureState; -import net.minecraft.world.level.chunk.ChunkStatus; -import net.minecraft.world.level.chunk.LevelChunk; -import net.minecraft.world.level.chunk.ProtoChunk; -import net.minecraft.world.level.chunk.UpgradeData; -import net.minecraft.world.level.dimension.LevelStem; -import net.minecraft.world.level.levelgen.FlatLevelSource; -import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator; -import net.minecraft.world.level.levelgen.NoiseGeneratorSettings; -import net.minecraft.world.level.levelgen.WorldOptions; -import net.minecraft.world.level.levelgen.blending.BlendingData; -import net.minecraft.world.level.levelgen.flat.FlatLevelGeneratorSettings; -import net.minecraft.world.level.levelgen.structure.placement.ConcentricRingsStructurePlacement; -import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager; -import net.minecraft.world.level.storage.LevelStorageSource; -import net.minecraft.world.level.storage.PrimaryLevelData; -import org.apache.logging.log4j.Logger; -import org.bukkit.Bukkit; -import org.bukkit.craftbukkit.v1_19_R2.CraftServer; -import org.bukkit.craftbukkit.v1_19_R2.CraftWorld; -import org.bukkit.craftbukkit.v1_19_R2.generator.CustomChunkGenerator; -import org.bukkit.generator.BiomeProvider; -import org.bukkit.generator.BlockPopulator; - -import javax.annotation.Nullable; -import java.lang.reflect.Field; -import java.nio.file.Path; -import java.util.Collections; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.OptionalLong; -import java.util.Random; -import java.util.concurrent.CompletableFuture; -import java.util.function.BooleanSupplier; -import java.util.function.Supplier; - -import static net.minecraft.core.registries.Registries.BIOME; - -public class PaperweightRegen extends Regenerator { - - private static final Logger LOGGER = LogManagerCompat.getLogger(); - - private static final Field serverWorldsField; - private static final Field paperConfigField; - private static final Field flatBedrockField; - private static final Field generatorSettingFlatField; - private static final Field generatorSettingBaseSupplierField; - private static final Field delegateField; - private static final Field chunkSourceField; - private static final Field generatorStructureStateField; - private static final Field ringPositionsField; - private static final Field hasGeneratedPositionsField; - - //list of chunk stati in correct order without FULL - private static final Map chunkStati = new LinkedHashMap<>(); - - static { - chunkStati.put(ChunkStatus.EMPTY, Concurrency.FULL); // empty: radius -1, does nothing - chunkStati.put(ChunkStatus.STRUCTURE_STARTS, Concurrency.NONE); // structure starts: uses unsynchronized maps - chunkStati.put( - ChunkStatus.STRUCTURE_REFERENCES, - Concurrency.FULL - ); // structure refs: radius 8, but only writes to current chunk - chunkStati.put(ChunkStatus.BIOMES, Concurrency.FULL); // biomes: radius 0 - chunkStati.put(ChunkStatus.NOISE, Concurrency.RADIUS); // noise: radius 8 - chunkStati.put(ChunkStatus.SURFACE, Concurrency.NONE); // surface: radius 0, requires NONE - chunkStati.put(ChunkStatus.CARVERS, Concurrency.NONE); // carvers: radius 0, but RADIUS and FULL change results - chunkStati.put( - ChunkStatus.LIQUID_CARVERS, - Concurrency.NONE - ); // liquid carvers: radius 0, but RADIUS and FULL change results - chunkStati.put(ChunkStatus.FEATURES, Concurrency.NONE); // features: uses unsynchronized maps - chunkStati.put( - ChunkStatus.LIGHT, - Concurrency.FULL - ); // light: radius 1, but no writes to other chunks, only current chunk - chunkStati.put(ChunkStatus.SPAWN, Concurrency.FULL); // spawn: radius 0 - chunkStati.put(ChunkStatus.HEIGHTMAPS, Concurrency.FULL); // heightmaps: radius 0 - - try { - serverWorldsField = CraftServer.class.getDeclaredField("worlds"); - serverWorldsField.setAccessible(true); - - Field tmpPaperConfigField; - Field tmpFlatBedrockField; - try { //only present on paper - tmpPaperConfigField = Level.class.getDeclaredField("paperConfig"); - tmpPaperConfigField.setAccessible(true); - - tmpFlatBedrockField = tmpPaperConfigField.getType().getDeclaredField("generateFlatBedrock"); - tmpFlatBedrockField.setAccessible(true); - } catch (Exception e) { - tmpPaperConfigField = null; - tmpFlatBedrockField = null; - } - paperConfigField = tmpPaperConfigField; - flatBedrockField = tmpFlatBedrockField; - - generatorSettingBaseSupplierField = NoiseBasedChunkGenerator.class.getDeclaredField(Refraction.pickName( - "settings", "e")); - generatorSettingBaseSupplierField.setAccessible(true); - - generatorSettingFlatField = FlatLevelSource.class.getDeclaredField(Refraction.pickName("settings", "d")); - generatorSettingFlatField.setAccessible(true); - - delegateField = CustomChunkGenerator.class.getDeclaredField("delegate"); - delegateField.setAccessible(true); - - chunkSourceField = ServerLevel.class.getDeclaredField(Refraction.pickName("chunkSource", "L")); - chunkSourceField.setAccessible(true); - - generatorStructureStateField = ChunkMap.class.getDeclaredField(Refraction.pickName("chunkGeneratorState", "w")); - generatorStructureStateField.setAccessible(true); - - ringPositionsField = ChunkGeneratorStructureState.class.getDeclaredField(Refraction.pickName("ringPositions", "g")); - ringPositionsField.setAccessible(true); - - hasGeneratedPositionsField = ChunkGeneratorStructureState.class.getDeclaredField( - Refraction.pickName("hasGeneratedPositions", "h") - ); - hasGeneratedPositionsField.setAccessible(true); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - //runtime - private ServerLevel originalServerWorld; - private ServerChunkCache originalChunkProvider; - private ServerLevel freshWorld; - private ServerChunkCache freshChunkProvider; - private LevelStorageSource.LevelStorageAccess session; - private StructureTemplateManager structureTemplateManager; - private ThreadedLevelLightEngine threadedLevelLightEngine; - private ChunkGenerator chunkGenerator; - - private Path tempDir; - - private boolean generateFlatBedrock = false; - - public PaperweightRegen(org.bukkit.World originalBukkitWorld, Region region, Extent target, RegenOptions options) { - super(originalBukkitWorld, region, target, options); - } - - @Override - protected boolean prepare() { - this.originalServerWorld = ((CraftWorld) originalBukkitWorld).getHandle(); - originalChunkProvider = originalServerWorld.getChunkSource(); - if (!(originalChunkProvider instanceof ServerChunkCache)) { - return false; - } - - //flat bedrock? (only on paper) - if (paperConfigField != null) { - try { - generateFlatBedrock = flatBedrockField.getBoolean(paperConfigField.get(originalServerWorld)); - } catch (Exception ignored) { - } - } - - seed = options.getSeed().orElse(originalServerWorld.getSeed()); - chunkStati.forEach((s, c) -> super.chunkStati.put(new ChunkStatusWrap(s), c)); - - return true; - } - - @Override - @SuppressWarnings("unchecked") - protected boolean initNewWorld() throws Exception { - //world folder - tempDir = java.nio.file.Files.createTempDirectory("FastAsyncWorldEditWorldGen"); - - //prepare for world init (see upstream implementation for reference) - org.bukkit.World.Environment environment = originalBukkitWorld.getEnvironment(); - org.bukkit.generator.ChunkGenerator generator = originalBukkitWorld.getGenerator(); - LevelStorageSource levelStorageSource = LevelStorageSource.createDefault(tempDir); - ResourceKey levelStemResourceKey = getWorldDimKey(environment); - session = levelStorageSource.createAccess("faweregentempworld", levelStemResourceKey); - PrimaryLevelData originalWorldData = originalServerWorld.serverLevelData; - - MinecraftServer server = originalServerWorld.getCraftServer().getServer(); - WorldOptions originalOpts = originalWorldData.worldGenOptions(); - WorldOptions newOpts = options.getSeed().isPresent() - ? originalOpts.withSeed(OptionalLong.of(seed)) - : originalOpts; - LevelSettings newWorldSettings = new LevelSettings( - "faweregentempworld", - originalWorldData.settings.gameType(), - originalWorldData.settings.hardcore(), - originalWorldData.settings.difficulty(), - originalWorldData.settings.allowCommands(), - originalWorldData.settings.gameRules(), - originalWorldData.settings.getDataConfiguration() - ); - - PrimaryLevelData.SpecialWorldProperty specialWorldProperty = - originalWorldData.isFlatWorld() - ? PrimaryLevelData.SpecialWorldProperty.FLAT - : originalWorldData.isDebugWorld() - ? PrimaryLevelData.SpecialWorldProperty.DEBUG - : PrimaryLevelData.SpecialWorldProperty.NONE; - PrimaryLevelData newWorldData = new PrimaryLevelData(newWorldSettings, newOpts, specialWorldProperty, Lifecycle.stable()); - - BiomeProvider biomeProvider = getBiomeProvider(); - - - //init world - freshWorld = Fawe.instance().getQueueHandler().sync((Supplier) () -> new ServerLevel( - server, - server.executor, - session, - newWorldData, - originalServerWorld.dimension(), - DedicatedServer.getServer().registryAccess().registry(Registries.LEVEL_STEM).orElseThrow() - .getOrThrow(levelStemResourceKey), - new RegenNoOpWorldLoadListener(), - originalServerWorld.isDebug(), - seed, - ImmutableList.of(), - false, - environment, - generator, - biomeProvider - ) { - - private final Holder singleBiome = options.hasBiomeType() ? DedicatedServer.getServer().registryAccess() - .registryOrThrow(BIOME).asHolderIdMap().byIdOrThrow( - WorldEditPlugin.getInstance().getBukkitImplAdapter().getInternalBiomeId(options.getBiomeType()) - ) : null; - - @Override - public void tick(BooleanSupplier shouldKeepTicking) { //no ticking - } - - @Override - public Holder getUncachedNoiseBiome(int biomeX, int biomeY, int biomeZ) { - if (options.hasBiomeType()) { - return singleBiome; - } - return PaperweightRegen.this.chunkGenerator.getBiomeSource().getNoiseBiome( - biomeX, biomeY, biomeZ, getChunkSource().randomState().sampler() - ); - } - }).get(); - freshWorld.noSave = true; - removeWorldFromWorldsMap(); - newWorldData.checkName(originalServerWorld.serverLevelData.getLevelName()); //rename to original world name - if (paperConfigField != null) { - paperConfigField.set(freshWorld, originalServerWorld.paperConfig()); - } - - ChunkGenerator originalGenerator = originalChunkProvider.getGenerator(); - if (originalGenerator instanceof FlatLevelSource flatLevelSource) { - FlatLevelGeneratorSettings generatorSettingFlat = flatLevelSource.settings(); - chunkGenerator = new FlatLevelSource(generatorSettingFlat); - } else if (originalGenerator instanceof NoiseBasedChunkGenerator noiseBasedChunkGenerator) { - Holder generatorSettingBaseSupplier = (Holder) generatorSettingBaseSupplierField.get( - originalGenerator); - BiomeSource biomeSource; - if (options.hasBiomeType()) { - - biomeSource = new FixedBiomeSource( - DedicatedServer.getServer().registryAccess() - .registryOrThrow(BIOME).asHolderIdMap().byIdOrThrow( - WorldEditPlugin.getInstance().getBukkitImplAdapter().getInternalBiomeId(options.getBiomeType()) - ) - ); - } else { - biomeSource = originalGenerator.getBiomeSource(); - } - chunkGenerator = new NoiseBasedChunkGenerator( - biomeSource, - generatorSettingBaseSupplier - ); - } else if (originalGenerator instanceof CustomChunkGenerator customChunkGenerator) { - chunkGenerator = customChunkGenerator.getDelegate(); - } else { - LOGGER.error("Unsupported generator type {}", originalGenerator.getClass().getName()); - return false; - } - if (generator != null) { - chunkGenerator = new CustomChunkGenerator(freshWorld, chunkGenerator, generator); - generateConcurrent = generator.isParallelCapable(); - } -// chunkGenerator.conf = freshWorld.spigotConfig; - Does not exist anymore, may need to be re-addressed - - freshChunkProvider = new ServerChunkCache( - freshWorld, - session, - server.getFixerUpper(), - server.getStructureManager(), - server.executor, - chunkGenerator, - freshWorld.spigotConfig.viewDistance, - freshWorld.spigotConfig.simulationDistance, - server.forceSynchronousWrites(), - new RegenNoOpWorldLoadListener(), - (chunkCoordIntPair, state) -> { - }, - () -> server.overworld().getDataStorage() - ) { - // redirect to LevelChunks created in #createChunks - @Override - public ChunkAccess getChunk(int x, int z, ChunkStatus chunkstatus, boolean create) { - ChunkAccess chunkAccess = getChunkAt(x, z); - if (chunkAccess == null && create) { - chunkAccess = createChunk(getProtoChunkAt(x, z)); - } - return chunkAccess; - } - }; - - if (seed == originalOpts.seed() && !options.hasBiomeType()) { - // Optimisation for needless ring position calculation when the seed and biome is the same. - ChunkGeneratorStructureState state = (ChunkGeneratorStructureState) generatorStructureStateField.get(originalChunkProvider.chunkMap); - boolean hasGeneratedPositions = hasGeneratedPositionsField.getBoolean(state); - if (hasGeneratedPositions) { - Map>> origPositions = - (Map>>) ringPositionsField.get(state); - Map>> copy = new Object2ObjectArrayMap<>( - origPositions); - ChunkGeneratorStructureState newState = (ChunkGeneratorStructureState) generatorStructureStateField.get(freshChunkProvider.chunkMap); - ringPositionsField.set(newState, copy); - hasGeneratedPositionsField.setBoolean(newState, true); - } - } - - - ReflectionUtils.unsafeSet(chunkSourceField, freshWorld, freshChunkProvider); - //let's start then - structureTemplateManager = server.getStructureManager(); - threadedLevelLightEngine = new NoOpLightEngine(freshChunkProvider); - - return true; - } - - @Override - protected void cleanup() { - try { - session.close(); - } catch (Exception ignored) { - } - - //shutdown chunk provider - try { - Fawe.instance().getQueueHandler().sync(() -> { - try { - freshChunkProvider.close(false); - } catch (Exception e) { - throw new RuntimeException(e); - } - }); - } catch (Exception ignored) { - } - - //remove world from server - try { - Fawe.instance().getQueueHandler().sync(this::removeWorldFromWorldsMap); - } catch (Exception ignored) { - } - - //delete directory - try { - SafeFiles.tryHardToDeleteDir(tempDir); - } catch (Exception ignored) { - } - } - - @Override - protected ProtoChunk createProtoChunk(int x, int z) { - return new FastProtoChunk(new ChunkPos(x, z), UpgradeData.EMPTY, freshWorld, - this.freshWorld.registryAccess().registryOrThrow(BIOME), null - ); - } - - @Override - protected LevelChunk createChunk(ProtoChunk protoChunk) { - return new LevelChunk( - freshWorld, - protoChunk, - null // we don't want to add entities - ); - } - - @Override - protected ChunkStatusWrap getFullChunkStatus() { - return new ChunkStatusWrap(ChunkStatus.FULL); - } - - @Override - protected List getBlockPopulators() { - return originalServerWorld.getWorld().getPopulators(); - } - - @Override - protected void populate(LevelChunk levelChunk, Random random, BlockPopulator blockPopulator) { - // BlockPopulator#populate has to be called synchronously for TileEntity access - TaskManager.taskManager().task(() -> blockPopulator.populate(freshWorld.getWorld(), random, levelChunk.getBukkitChunk())); - } - - @Override - protected IChunkCache initSourceQueueCache() { - return (chunkX, chunkZ) -> new PaperweightGetBlocks(freshWorld, chunkX, chunkZ) { - @Override - public LevelChunk ensureLoaded(ServerLevel nmsWorld, int x, int z) { - return getChunkAt(x, z); - } - }; - } - - //util - @SuppressWarnings("unchecked") - private void removeWorldFromWorldsMap() { - Fawe.instance().getQueueHandler().sync(() -> { - try { - Map map = (Map) serverWorldsField.get(Bukkit.getServer()); - map.remove("faweregentempworld"); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - }); - } - - private ResourceKey getWorldDimKey(org.bukkit.World.Environment env) { - return switch (env) { - case NETHER -> LevelStem.NETHER; - case THE_END -> LevelStem.END; - default -> LevelStem.OVERWORLD; - }; - } - - private static class RegenNoOpWorldLoadListener implements ChunkProgressListener { - - private RegenNoOpWorldLoadListener() { - } - - @Override - public void updateSpawnPos(ChunkPos spawnPos) { - } - - @Override - public void onStatusChange(ChunkPos pos, @Nullable ChunkStatus status) { - } - - @Override - public void start() { - - } - - @Override - public void stop() { - } - - // TODO Paper only(?) @Override - public void setChunkRadius(int radius) { - } - - } - - private class FastProtoChunk extends ProtoChunk { - - public FastProtoChunk( - final ChunkPos pos, - final UpgradeData upgradeData, - final LevelHeightAccessor world, - final Registry biomeRegistry, - @Nullable final BlendingData blendingData - ) { - super(pos, upgradeData, world, biomeRegistry, blendingData); - } - - // avoid warning on paper - - // compatibility with spigot - - public boolean generateFlatBedrock() { - return generateFlatBedrock; - } - - // no one will ever see the entities! - @Override - public List getEntities() { - return Collections.emptyList(); - } - - } - - protected class ChunkStatusWrap extends ChunkStatusWrapper { - - private final ChunkStatus chunkStatus; - - public ChunkStatusWrap(ChunkStatus chunkStatus) { - this.chunkStatus = chunkStatus; - } - - @Override - public int requiredNeighborChunkRadius() { - return chunkStatus.getRange(); - } - - @Override - public String name() { - return chunkStatus.getName(); - } - - @Override - public CompletableFuture processChunk(Long xz, List accessibleChunks) { - return chunkStatus.generate( - Runnable::run, // TODO revisit, we might profit from this somehow? - freshWorld, - chunkGenerator, - structureTemplateManager, - threadedLevelLightEngine, - c -> CompletableFuture.completedFuture(Either.left(c)), - accessibleChunks, - true - ); - } - - } - - /** - * A light engine that does nothing. As light is calculated after pasting anyway, we can avoid - * work this way. - */ - static class NoOpLightEngine extends ThreadedLevelLightEngine { - - private static final ProcessorMailbox MAILBOX = ProcessorMailbox.create(task -> { - }, "fawe-no-op"); - private static final ProcessorHandle> HANDLE = ProcessorHandle.of("fawe-no-op", m -> { - }); - - public NoOpLightEngine(final ServerChunkCache chunkProvider) { - super(chunkProvider, chunkProvider.chunkMap, false, MAILBOX, HANDLE); - } - - @Override - public CompletableFuture retainData(final ChunkAccess chunk) { - return CompletableFuture.completedFuture(chunk); - } - - @Override - public CompletableFuture lightChunk(final ChunkAccess chunk, final boolean excludeBlocks) { - return CompletableFuture.completedFuture(chunk); - } - - } - -} diff --git a/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts index 4c0d110e2..cf13348ff 100644 --- a/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts +++ b/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts @@ -12,6 +12,6 @@ repositories { dependencies { // https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/ - the().paperDevBundle("1.20.1-R0.1-20230617.023453-15") + the().paperDevBundle("1.20.1-R0.1-20230623.105806-29") compileOnly("io.papermc:paperlib") } diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index a393413f3..9a9ffd86b 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -206,7 +206,7 @@ tasks { versionNumber.set("${project.version}") versionType.set("release") uploadFile.set(file("build/libs/${rootProject.name}-Bukkit-${project.version}.jar")) - gameVersions.addAll(listOf("1.20", "1.19.4", "1.19.3", "1.19.2", "1.19.1", "1.19", "1.18.2", "1.17.1", "1.16.5")) + gameVersions.addAll(listOf("1.20.1", "1.20", "1.19.4", "1.18.2", "1.17.1", "1.16.5")) loaders.addAll(listOf("paper", "spigot")) changelog.set("The changelog is available on GitHub: https://github.com/IntellectualSites/" + "FastAsyncWorldEdit/releases/tag/${project.version}") From e5cbf33317ea4c983b79fd6bc44afbce2dd1cb16 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Thu, 29 Jun 2023 12:29:37 +0200 Subject: [PATCH 104/161] Release 2.6.4 --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 642d6d09b..eb458b391 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -52,7 +52,7 @@ ext { } } -version = String.format("%s-%s", rootVersion, buildNumber) +version = String.format("%s", rootVersion) if (!project.hasProperty("gitCommitHash")) { apply(plugin = "org.ajoberstar.grgit") From 903064fd4106c57862dd576cf53f7ea59b702be7 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Thu, 29 Jun 2023 12:46:35 +0200 Subject: [PATCH 105/161] Back to snapshot for development --- build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index eb458b391..781f1fba2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,7 +34,7 @@ logger.lifecycle(""" ******************************************* """) -var rootVersion by extra("2.6.4") +var rootVersion by extra("2.6.5") var snapshot by extra("SNAPSHOT") var revision: String by extra("") var buildNumber by extra("") @@ -52,7 +52,7 @@ ext { } } -version = String.format("%s", rootVersion) +version = String.format("%s-%s", rootVersion, buildNumber) if (!project.hasProperty("gitCommitHash")) { apply(plugin = "org.ajoberstar.grgit") From 83a4987252593b24897cf94479fde160db2988a5 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Fri, 30 Jun 2023 19:36:35 +0100 Subject: [PATCH 106/161] chore: queue progress messages are not implemented --- .../com/fastasyncworldedit/core/configuration/Settings.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java index a8d28d048..bb5f16eb3 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java @@ -584,7 +584,8 @@ public class Settings extends Config { @Comment({"Display constant titles about the progress of a user's edit", " - false = disabled", " - title = Display progress titles", - " - chat = Display progress in chat" + " - chat = Display progress in chat", + " - Currently not implemented" }) public String DISPLAY = "false"; @Comment("How often edit progress is displayed") From c880badaf410adcbaf4cb2eb10e05986620c4be4 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sat, 1 Jul 2023 10:32:39 +0200 Subject: [PATCH 107/161] [ci skip] Update renovate.json --- .github/renovate.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/renovate.json b/.github/renovate.json index 2c23e9441..787e44030 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -4,6 +4,7 @@ "config:base", ":semanticCommitsDisabled" ], + "automerge": true, "ignoreDeps": [ "guava", "com.google.guava:guava", From 4583acda6bf96f421e85ea700c2d96d7e6817440 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 1 Jul 2023 08:46:19 +0000 Subject: [PATCH 108/161] Update auto.value to v1.10.2 (#2324) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 892d1c7cf..6f198a85c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -19,7 +19,7 @@ sparsebitset = "1.2" parallelgzip = "1.0.5" adventure = "4.9.3" truezip = "6.8.4" -auto-value = "1.10.1" +auto-value = "1.10.2" findbugs = "3.0.2" rhino-runtime = "1.7.14" zstd-jni = "1.4.8-1" # Not latest as it can be difficult to obtain latest ZSTD libs From e680e8fe1f4588d87759f685b0af1f7df9ff6683 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 1 Jul 2023 08:47:03 +0000 Subject: [PATCH 109/161] Update dependency com.palmergames.bukkit.towny:towny to v0.99.2.5 (#2325) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6f198a85c..9ffe90850 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,7 +11,7 @@ mapmanager = "1.8.0-SNAPSHOT" griefprevention = "16.18.1" griefdefender = "2.1.0-SNAPSHOT" residence = "4.5._13.1" -towny = "0.99.1.2" +towny = "0.99.2.5" # Third party bstats = "3.0.2" From a0acbc716800ac97ec9f330b36c0a3e11900dfbe Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 1 Jul 2023 18:49:40 +0200 Subject: [PATCH 110/161] Update dependency org.mockito:mockito-core to v5.4.0 (#2328) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- worldedit-sponge/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9ffe90850..4588bc54c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -36,7 +36,7 @@ text = "3.0.4" piston = "0.5.7" # Tests -mockito = "5.3.1" +mockito = "5.4.0" # Gradle plugins pluginyml = "0.5.3" diff --git a/worldedit-sponge/build.gradle.kts b/worldedit-sponge/build.gradle.kts index e895e2989..aba91acea 100644 --- a/worldedit-sponge/build.gradle.kts +++ b/worldedit-sponge/build.gradle.kts @@ -28,7 +28,7 @@ dependencies { }) api("org.apache.logging.log4j:log4j-api") api("org.bstats:bstats-sponge:1.7") - testImplementation("org.mockito:mockito-core:5.3.1") + testImplementation("org.mockito:mockito-core:5.4.0") } <<<<<<< HEAD From d7cc65d2f238467e9fc4539e8dbeb9ef448f3598 Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 3 Jul 2023 16:37:42 +0100 Subject: [PATCH 111/161] refactor: some changes that may help #2289 (#2307) --- .../com/sk89q/worldedit/LocalSession.java | 4 +- .../worldedit/session/SessionManager.java | 4 +- .../session/storage/JsonFileSessionStore.java | 70 +++++++++++-------- .../sk89q/worldedit/world/item/ItemType.java | 12 ++-- 4 files changed, 50 insertions(+), 40 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index 1ef2af6d6..dfa29a2e3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -105,8 +105,8 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public class LocalSession implements TextureHolder { - private static final transient int CUI_VERSION_UNINITIALIZED = -1; - public static transient int MAX_HISTORY_SIZE = 15; + public static int MAX_HISTORY_SIZE = 15; + private static final int CUI_VERSION_UNINITIALIZED = -1; // Non-session related fields private transient LocalConfiguration config; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java index d93a6b298..646b18bc0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/SessionManager.java @@ -45,8 +45,8 @@ import com.sk89q.worldedit.world.item.ItemTypes; import org.apache.logging.log4j.Logger; import javax.annotation.Nullable; -import java.io.File; import java.io.IOException; +import java.nio.file.Path; import java.util.HashMap; import java.util.Iterator; import java.util.Map; @@ -354,7 +354,7 @@ public class SessionManager { @Subscribe public void onConfigurationLoad(ConfigurationLoadEvent event) { LocalConfiguration config = event.getConfiguration(); - File dir = new File(config.getWorkingDirectoryPath().toFile(), "sessions"); + Path dir = config.getWorkingDirectoryPath().resolve("sessions"); store = new JsonFileSessionStore(dir); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/session/storage/JsonFileSessionStore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/session/storage/JsonFileSessionStore.java index b383bda21..eb4b1ee1a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/session/storage/JsonFileSessionStore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/session/storage/JsonFileSessionStore.java @@ -36,6 +36,10 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.NoSuchFileException; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; import java.util.UUID; import static com.google.common.base.Preconditions.checkNotNull; @@ -49,20 +53,31 @@ public class JsonFileSessionStore implements SessionStore { private static final Logger LOGGER = LogManagerCompat.getLogger(); private final Gson gson; - private final File dir; + private final Path dir; + + /** + * Create a new session store. + * + * @param dir the directory + * @deprecated Use {@link #JsonFileSessionStore(Path)} + */ + @Deprecated + public JsonFileSessionStore(File dir) { + this(dir.toPath()); + } /** * Create a new session store. * * @param dir the directory */ - public JsonFileSessionStore(File dir) { + public JsonFileSessionStore(Path dir) { checkNotNull(dir); - if (!dir.isDirectory()) { - if (!dir.mkdirs()) { - LOGGER.warn("Failed to create directory '" + dir.getPath() + "' for sessions"); - } + try { + Files.createDirectories(dir); + } catch (IOException e) { + LOGGER.warn("Failed to create directory '" + dir + "' for sessions", e); } this.dir = dir; @@ -77,21 +92,19 @@ public class JsonFileSessionStore implements SessionStore { * @param id the ID * @return the file */ - private File getPath(UUID id) { + private Path getPath(UUID id) { checkNotNull(id); - return new File(dir, id + ".json"); + return dir.resolve(id + ".json"); } @Override public LocalSession load(UUID id) throws IOException { - File file = getPath(id); - try (Closer closer = Closer.create()) { - FileReader fr = closer.register(new FileReader(file)); - BufferedReader br = closer.register(new BufferedReader(fr)); - LocalSession session = gson.fromJson(br, LocalSession.class); + Path file = getPath(id); + try (var reader = Files.newBufferedReader(file)) { + LocalSession session = gson.fromJson(reader, LocalSession.class); if (session == null) { LOGGER.warn("Loaded a null session from {}, creating new session", file); - if (!file.delete()) { + if (!Files.deleteIfExists(file)) { LOGGER.warn("Failed to delete corrupted session {}", file); } session = new LocalSession(); @@ -99,7 +112,7 @@ public class JsonFileSessionStore implements SessionStore { return session; } catch (JsonParseException e) { throw new IOException(e); - } catch (FileNotFoundException e) { + } catch (NoSuchFileException e) { return new LocalSession(); } } @@ -107,29 +120,26 @@ public class JsonFileSessionStore implements SessionStore { @Override public void save(UUID id, LocalSession session) throws IOException { checkNotNull(session); - File finalFile = getPath(id); - File tempFile = new File(finalFile.getParentFile(), finalFile.getName() + ".tmp"); + Path finalFile = getPath(id); + Path tempFile = finalFile.getParent().resolve(finalFile.getFileName() + ".tmp"); - try (Closer closer = Closer.create()) { - FileWriter fr = closer.register(new FileWriter(tempFile)); - BufferedWriter bw = closer.register(new BufferedWriter(fr)); - gson.toJson(session, bw); + try (var writer = Files.newBufferedWriter(tempFile)) { + gson.toJson(session, writer); } catch (JsonIOException e) { throw new IOException(e); } - if (finalFile.exists()) { - if (!finalFile.delete()) { - LOGGER.warn("Failed to delete " + finalFile.getPath() + " so the .tmp file can replace it"); - } - } - - if (tempFile.length() == 0) { + if (Files.size(tempFile) == 0) { throw new IllegalStateException("Gson wrote zero bytes"); } - if (!tempFile.renameTo(finalFile)) { - LOGGER.warn("Failed to rename temporary session file to " + finalFile.getPath()); + try { + Files.move( + tempFile, finalFile, + StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING + ); + } catch (IOException e) { + LOGGER.warn("Failed to rename temporary session file to " + finalFile.toAbsolutePath(), e); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java index ecba92f8b..5a1e7653f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/item/ItemType.java @@ -43,7 +43,7 @@ public class ItemType implements RegistryItem, Keyed { private final String id; @SuppressWarnings("deprecation") - private final LazyReference name = LazyReference.from(() -> { + private transient final LazyReference name = LazyReference.from(() -> { String name = GuavaUtil.firstNonNull( WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS) .getRegistries().getItemRegistry().getName(this), @@ -51,18 +51,18 @@ public class ItemType implements RegistryItem, Keyed { ); return name.isEmpty() ? getId() : name; }); - private final LazyReference richName = LazyReference.from(() -> + private transient final LazyReference richName = LazyReference.from(() -> WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS) .getRegistries().getItemRegistry().getRichName(this) ); - private final LazyReference itemMaterial = LazyReference.from(() -> + private transient final LazyReference itemMaterial = LazyReference.from(() -> WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.GAME_HOOKS) .getRegistries().getItemRegistry().getMaterial(this) ); //FAWE start - private BlockType blockType; - private boolean initBlockType; - private BaseItem defaultState; + private transient BlockType blockType; + private transient boolean initBlockType; + private transient BaseItem defaultState; //FAWE end public ItemType(String id) { From 52a51753dd2c5e2be4094afda60a8f49a1544c2b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 5 Jul 2023 15:50:09 +0200 Subject: [PATCH 112/161] Update dependency com.palmergames.bukkit.towny:towny to v0.99.2.7 (#2329) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4588bc54c..afda60933 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,7 +11,7 @@ mapmanager = "1.8.0-SNAPSHOT" griefprevention = "16.18.1" griefdefender = "2.1.0-SNAPSHOT" residence = "4.5._13.1" -towny = "0.99.2.5" +towny = "0.99.2.7" # Third party bstats = "3.0.2" From 34ead35e03fbc1894139f12acd79c0ce37084abe Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 5 Jul 2023 15:50:20 +0200 Subject: [PATCH 113/161] Update dependency net.minecrell.plugin-yml.bukkit to v0.6.0 (#2327) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index afda60933..cf04ae8f8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -39,7 +39,7 @@ piston = "0.5.7" mockito = "5.4.0" # Gradle plugins -pluginyml = "0.5.3" +pluginyml = "0.6.0" [libraries] # Minecraft expectations From ccdb002adef3041505fd5526a89bb840775a0ad3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 5 Jul 2023 15:50:49 +0200 Subject: [PATCH 114/161] Update dependency gradle to v8.2 (#2326) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/wrapper/gradle-wrapper.jar | Bin 62076 -> 63375 bytes gradle/wrapper/gradle-wrapper.properties | 3 ++- gradlew | 5 ++++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index c1962a79e29d3e0ab67b14947c167a862655af9b..033e24c4cdf41af1ab109bc7f253b2b887023340 100644 GIT binary patch delta 16170 zcmZv@1C%B~(=OPyZQHhOo71+Qo{!^7;G&o^S)+pkaqdJWHm~1r7od1qA}a4m7bN0H~O_TWh$Qcv`r+nb?b4TbS8d zxH6g9o4C29YUpd@YhrwdLs-IyGpjd3(n_D1EQ+2>M}EC_Qd^DMB&z+Y-R@$d*<|Y<~_L?8O}c#13DZ`CI-je^V*!p27iTh zVF^v_sc+#ATfG`o!(m-#)8OIgpcJaaK&dTtcz~bzH_spvFh(X~Nd=l%)i95)K-yk?O~JY-q9yJKyNwGpuUo601UzzZnZP2>f~C7ET%*JQ`7U^c%Ay= z*VXGhB(=zePs-uvej`1AV`+URCzI7opL{ct^|Lg3`JRQ#N2liRT0J3kn2{O5?+)Xh zg+2W4_vVGeL^tu5mNC*w+M@qOsA?i7Q5Y!W}0%`WElV9J|}=8*@{O1`1(!wCebWJz&EbIE09Ar_<&ldhsD}pR(~NfS=IJb>x%X z{2ulD!5`cb!w+v^IGu~jd3D$fUs>e3cW|v_Cm{8={NL)ZoxNQqikAB&nbiz7mbKz( zWjH73t*#;8Rv5%^+JhrK!zDSutNaUZF#xIcX-J?XTXJMUzc0+Q{3)Xt)KYbRR4)MYT4?1fDz4 z0NVFLz!!^q(*mC;cfO~%{B}A^V3|1aPPqpOYCO4o^)?p?Hn17_0AbdX$f;k!9sL^g z{n_Q5yM!yp{oU))sbp&r6v}Au6R`9Z#h@0oM&1n0>wAP27GtH zG#~tyCu38r+Xh)31z*ShTdXWfb`4h!sraW8_kR1VGraUOtA9}O2g{N$S+1{3q>z*< zDEs&xo6@|O7lJlzn%!gmnJL@mh6XY?H2^>+tYwAp2aD&ve*;dNlFRUUD4uJsz0s{jA0wM|`g_Bk- z2nGTI4FLio^iSgCYQ<~?w6VhgXuFy?J6pI)*tog7+L(H{+c-IDy4s67IsWSv-2ZoX zkgKk*j4q1tU51^udPJsziAoFE%s5Wgi({t%V=JasWm6hHcE*-AVByK0i}t9!4^NT& zYJ1?sHp;I5vxtJi@z=?8N5Bc2Rp96QJ7Pawo_W$pO{f?a?6fX`?dHe8J+yAg-F$LU zXmTjqP`_JciO)bHLs}L><&(2CORPpITFZ5y{Ha$rW};;c-n)RcD`TyHnL?)Fx{0?I zqQ|D4T`xLJy`A}h{D57UR@bD8{Bw{9rlPt&U?{4 zTbO4-nHnPS!as<)ecV@VpH~W*$zoPr8f09_MZBPjoU zamA5hmU=F0q4v*u)BvEyDNo)GJxs9tiPkp2uhlGLR2bUD{NSjGGCixR9?$LKAlsip zUIa{WQs#68GH3NL{(FUyk-k=lrtx{V24k>kq~uc+St1uH0Yf3s547xvD5T*@n^+VN zKO~$H#RFW+Sd*M?`&+A$L<%DwNmIW&h>4j}vyxu3PmHrGwp?hXJp!{^>$Ax2WY&9} z5fJvDKBT&~%2QWqTGf{=6Pv2U+0HUQRv9%RZLR`G^XNdKRZt`Zs z)vuUr#7C#oQ00KL7$M$(yHa*C4XZ~*t9NPMJU`fACD3v+wvLzMJipnOfRmh_kN5oD zZ;)G|-j$^OF~-yWW*p1m#1)%%tWgg_?ps;<cvxwa&b=_7Iu)xM#KIHR~gWVSQGmujR;bCgI%H#(_~8O`LAHbJ%9L?R(Dt zq%5@6HsP4(%%tF4t#7v$y&h*i|KihD+E^Q7n~`1KzELK>5I8-`H|JF2Cq9CgniYyS z_4op2_>b9Il(p8PquZ{h8Gy$%WA+8t)o_gCdb75|9NJ&}Y*D~a6)VE@eT3!qvvSPz z4-A4Vw^rS17uWVctor@Gky4eiT6nF=PVY~8jzjKM-GlQzF5I-V&Z7d^G3?o9`C9gHU5GOAMLIZIOBw|s--tIy=R#b8@3;?-9Y8jeFt`AhO z8tTwGxksHRNk>;%uqWW&Q!^M?CwVDvX-*wTji*J^X%}1`6Z(#9OsQQfUI9x&CAj=W z-tDF7TYPVS7zfx~aje8Z@J>er!E<@63gEY)W{b!AF%?j%VG;B3b;Kt6VVH0qxBLrC z*82l$taUKcm}zRM=K+>H%w7(10hX25ud7r}c#sEK;mnBsVbD;$qu_|UEarcuS7aYi zcMjgkjmj=#d&K?NX=qgouhsLh{iYTe8qtsU~kLwg4&&Q1YGyz6D@(-w< zl~tx6ulu}VfKZ@_gt2aL@E`A`ULme@K+ zek2hch6FNgHdbowNo)mBs0da-}bhPw|R1u{4 zEZ?T!7j&^lNPs1je%@Em^CPp$cX%GrCBn66>D{`Ugf%+~@)w+gX2xGJ1qCy6|1f8m zkW@0=CvkEuR0$mn*wuIvn?-qRMNjtj*c5Z_P}N^he{2=<@XK4^ zC{Zs89DIB6QjEE2PRx9Le^?_kvTpBWr~%L249F}8N&xTV?+_;?oyfV?V^T(ioIxw@ zYNZUlBAc=A{A709=R`$--jqG{jPQj-7f_Sr1$o&kapsFL3jBVIE*Z4&L}1ve?@wh=%eda^BRYm=>pJ z{p#Gotpa1aH^l+Oclp_+$Whjp_q3(G8zS<1;!#*67K0Du1}RQPo&G8mVeftaJ&a++ zYlh?j&;3LJA5Q4fDBsWauFn>VvG_9Tcrr2Yt-#+%rO0ST1GFitK8f10=rq|6lf1q? zZgVH$pWLo_(3QZ@KH}q%V;KT>r!K|?t?LSBWRUoPcv3to`%wC6ZRPF|G1tKl`(7G_xblMQANQ+j&NIeH&TK6-$u*4Uh&0t&ePU zPJkhRuh#-@_X+0}aV*Jb0Bfa+LZNqQVWJ0#=KA~Bqt%4}(36~^U)lvrj$CQX%P=?D ziHvZYaHPO6-Q>+|s~lNFW0?Bv%tzi)3M>X`;!RfF3<~0HjHc|}*l~bKATK4IXdR!B zMf+A}Up#I+)T8aogDs8)j}J)JK!%rH9&J59H~Q@Ntd^EV{~c7kTX%dQB_?kfOR-tn zA=NR@abtm5k{N9NS^G$1>>Td<278}g(`E7_k5+?RgoT&-Nqa5AjkAAn7s8#Vc=*sd zmyzfjfeIp0Fehg1gbSQ(_~qXV=y0ShN7ck^V@6t(5C%IxDmYn-~2#bGniWG#vS zWlnC*Dbfin3QX!ZI-YRxCO7uBG+d>=s@*c0sPmByGDc2mN&24$GkoH0oitsFTV0_} z4iATfIz{jBODQY1t{lpUS%Q1Hzdel~82P1N#Cura_7k&{mUoI@q?W7&Jzo61$}3G7 zl`3shFi_Vnoh`5OIKHqV;wTULz2GkZgW0zNjk3t#5aH8tz(R^=;i?c~(3-;#WM50snq>qF)cu>}tWC*wTO7r93>;1Cbif%d{o% zC1Eyo7UwX41o7QLvdU_to(vzDD`*KK^3HBZvx@j@i1Nbt-w8Z5`>?)c;rXTjdt#k# zOfJED_)awGGGg*Z0Rgo!JN?rDkpZFr6pE4%K}BPXJ>0O@93hgvCGJz?oUweJQjnVi zNQKWhxNpSd36=ip(-D4iOtMG99MY(y86GtXS~1%=jipBb#D;tZpKmMRZ_t=10TL%p z21RJ%0X=&&WUDYBbTcwsof1(CDGDD)eW`d#Y*Z87@k z^{dy_GcUp~J?qJ=i#H#EeSsp^TSr@dt$%q>c3_o1F9sr_ta1PLWYBdi1BNUNu0`v` zvgB;K@#gLmv#tD2Mf21LHU0Hq2~Ro}Upex$#h~)93nAvxcS6wkM&UVy#4RnSG6QX9 zQ;r$p=AKnBnUe=hZPH*u-Q4Ta4COuQ7TQGIqbUi4&eot$D2GHljdSdbc-MK-t1R86opRwDuUN+ zw(1^ybD7grBO>ySm29}i&+s{~7uz?*?K;N9?Yw~zd6 z*Xfoqv-*O~(QBAVpOqwZ``Qmd5qbL#d`>U7rT&?h?FN=iYu*vFfck~?6h=b48;n}$ zQrzUxWJ{eaR2!*MSX=+F*)ECE#91?SmduzuZwQ! z!ydL4;ljZ(9R_<=q z!=`&+*DUw>CsM8xVDT-;zFYUu%hn$rxPXhKztEb98>7ow#=fdMWJ!i$jJ=MIBspC; zvoJ2R96iz*(%23uM#WtAe661ynV`4t?K~eV&7!-r+tg^aw3Jiql zX^)V(pEN2WfQOL4!JgVGIoQ~a8}Gy_4l92Wst~iEI zANmgs#tUnQcv2E7>g!{jjC+X-g)LH8&8VQNoBvicmuID9WQoa^S-h?S(POL5f({Fs zWfe|-nRh@hz|Ck@iKm0C75R&`CWwUy<05TSN_IH3aMaO_Kw>0#Pv&-Dfl7b}3qfofON-WA!AB)QpF2FTnvu;s>T;lA1&Fh0 zBl$6%ODbhP1gIh2T%!8 zZ%&Q`_{;znmFQruzy3PWP@echTsS*JR65#1s^Yda=tWMNX?a%+u|@dSu2I$CfK@Jn zawQv>0i4QnlbtbIr{`+ihYt_GdJHR=O@6{5LHt~olXhcS{M}I*a8tl}U4uzgBx*jp zRji6=dfc!=jHsx4K9~%u9#`zIn~cO6$jl}Nco#8;2pDgqvpvO#S|Y1K4rie3vqVCS zI#QhtFED4h{9VA1j=@RcVQaORXzjNxK8$SAK4wPeIC%aePdZXEx8yE+0I;$3%avkwY+41*ee; z&@xvi6UvJOhfU)RKMMK5Ge)~VT{PNe>z_T^X7?!+cO%0O9;nBI39kOtN@7LUz)ZmX zVkxf)8QPZBxVNXV%s6vVeKr}hCJ=hY`pM{cihwK~6q{=~trr;R=dFS{Nx9;4Zr!`7 zG7^c|#x2=Z`)Um#l$|b#-4ZUow`yGvfCXce%qd#AG~sxuJ6eX@lQ?Gjjp4vuTv(to zGf_0z8b@Z3BzdaEB6`wXLwFwkyA*4$k{>ml#wj!^5x4DqDUFA|FW+@VD-FJyK3ynY z+{Gi9YbWOrqc_u1`$TYn+)Y1`=FhpVDRPdVzJ(>N;7R=OCBBghMVep-7atEDV6AsR zbPurLbCNf;oXDMCcEh;jgbeA|IE5ZbQ52ds%s}TJ-6?8~*qMF3@X8c=bL@w}r$Eeo zYUC@E6+viob;vjUn;z&lgCas{XLW zcxyK?xbJRX+WU9|%5bsaPbm!Tu)E}a&!br8FTR3?Cb%vZ7|$~!=Ixn55uZS#3NRZZ zs<82Gtkto2fzIEbE1T5-++IkANc74_ zARU;|ap|KEBu3}J?H?y>a845^ydr)R0F1K65>38_s0!GY|0t(o^g;aU(_1BuV33!b zi%`3stu>SZm%sRQ;lF#YPI4YIjsAv*0wm?LyvmEf2gKw__$W9yX+jR-P0o&>kaw+` zGf&tUrybKn0W_!YI0F{}d-V@ih~H2E^+PAzPlxaLf!!ly_BXZb`x{oX?}Ft-Yf}M7 zL{95Z!O*@rVV2j3Pjafo*D)wz$d3nQ2r{c~F-B4MlK60ouc3wU3}PEHhb{(moORi; zz5Hl)0M*Q# zOMmV8+5Oqz@+KiFk}x13`>Sg5)om(PI7B*n7hy<%)eZ%l1W=X?1Jtm2HUs`O#YFrj z9oFV(XD8)A{GK75(qMrd3jxUxPO`+Y7MVo#OtQX}E3fEqAVqj*?6JOOe$$5fn+5s? zx6moNC@o%1rwax68*VH@V-ANJ;x0GK{o3~V@1MKuiCN^IycAo;ZVc_;2O7q6eCH1I zoe1{_eg#}yXybiKf2$)I+FsNMa7IrsH~HZ|$A{s0LJf%{UQD;+jsdG?0>7hBQV)4Z z9Aj3a;Zp^Un5Ljqh`L5U{X*^*a6hqP--eRfh0}0|6M_IUiNtOni5Fk^t?onDM*MD^ zJegBUHkuv4>|8kN#xJYTzk`=4HR0PzpzJwG>KT()`#P3VF~fM5zGtG$RvQ|WmyaWj zqa&<4PU$5f921)o=e5(&Jm@$x-k);(lbnuD;XVQ&-lY< z+qf+FM4LeIsrObq4%f816^m|}8*00qF5^nxMS|H$dd#|s?}S(ciSghkJ(SJ=5y+twusP{MwkwIq zG2jBiouA4dgIuopX4Fp~UOni({ADA{&bB1_SYl{Q1wI*BTif%ee(N*7Z#OJCY z`He1l4dzecQ4W@TWAOkMgb_`GjENXd#_HoZ02Mr-Do>Xl9w;r*JD0R$si9tO6>US| zW|-ViVwqmhC1e{PTM51QN-HWn*EaOG$)PA8f8Q$HRNa&V^1`9Dp(-VE<`-cJRki~l zeQ) zV@HnYenHV4B4{V-j?tY(Fc2FsQ|x6Gw;Our*EHIetWC6h>UX4AD|F*5bjP5T z@3kaY0O%|F3o`0WTWlQP;ddr(jcn4KyY(k|Jxi~yT38Bltin0O;H6rTSn6Vcdf`n& z3VU99zPfSZtoV`jNq@?f5~?~6My$>J%7mhCr9$Go0cVO)?rpbQDqH4OAWGC zt!B23yF^#B>^~P@O$qgThx4S#JI`u=3Vb8kfuoSrCVyU3+I_TDPtMd zh77hUa;@t9$3OrpW1;dq;7e|B=27+?L&)R206N7fz6u?Vpo*g6vIY5v1DKt|AK$2M zJi?{ZR|-bTbSdNw@;C%KmF)oF@02bTYv#S(-3CkWy`T4^;;km9dfr10T|IR>C-<0| zdFuPGMJ!X;7kkg1rSdU~d23f8Z6O>Wa7!Q!!DKWHYFT(lU)%HbfN|7|CApdi!p6M* zZmPd41(qS*oGsEeT8dw)S%!yhgr&Tky+y^toYWPz1+9)DO8jzecE{}r$;iVGY{|@p zrp?%)e$c+T^FP36!i|qrv2(?@HIV=2NN1;L5puOPYfUZcG0NMuFx0O6`UePVOQ79wGgMj)l5<4?a<`Yl_RhY_C7U=0zKBC2$EhP^_G|S) zwv*z48K19@_pT*WUhAAZmlp){uf+E+7CcPp@0fe!wZ0R-R5-^z@HriduQz zZow5@W~ILN%8FlEM2p$(xE>5I81*!?MyluZ_h+)_1Ug0r&e(>Yv0M~3hqW5MAzFyu zT~rkx=9&{Z2Vck0$yI7kx_X*?*}kLE$UCA?X#yX}J5mqJIW0vPm&dE7bya_O96Z%~ zl$ilJ>NzFyNQyi0rMf#i6p;Rs2}#%Va%#q3X3af9vR@Gu^|I*Uw9XEY{t`plKE}Dw z8XFLZIremOfC4J$_eo{BWTsF}V-fd#;9O9P@gDn1IpW}EqCsR)gC7BFD#!|v9*h%1 z*&6syZPLg3GRsaVn+HT0jx{p1-AFJ$!XJPR;zEERi4XWy8F%Ob0bCHy{|+cVgt zxUeBR@Fg+_?_9G>{k)>Pg*RYkst}Ve&Yr9ku!oPKAT5$zr_hh$bio?MkK~VXg<}A0 z(xHUlM(j$|fxDCvX(ON*g)b7>LKCWPKjS0%J1wRdl;<;+3;S1WAQF7)9UG>EBPO4+ z+60A8s;x%l0#{t#>M3qq-pVQOPavJPiz)V?3tAxyIwpNpQ#BQ7cUn49TfXdRMw84e znq4y_=;tRzm6)Uu*a@=Cyn@(7`XL|*GokZSuV40Fdtg?L=UjQd71V&Il|4)T&J8z^ zX>1PZv)eLcn%pp%s3)`~`Cg;oBWcd_nBp_R7 z(cbpAAxWQ&^ZmRDkLbO=Jfb(k(=z$y_Dzc|sd{p_6S+9#Fbr7HEPqyXNdaJ3`3u6( zWDF@;ybOj>Le%rvVTGL7*S;P6;T6lI#?Yp@KX&- zeXq*<7IsOCb=uS5s0Mmf25>+hk)wj?se_5MedT~~WtEfn%Dxk#_W?Lj?3>GwN46fK z!IYgVw^_>#<=3oy;69J;(4rMSQ*bk#e z*O9H2VyX^(Rhj_h2~RKjRb;#jfWoVR_7xu0|7d;#jJeOlwzc=%h&6f;S#I99}wvxDNo zQFoYVq&-Mp!>+&et%Z3e-=EL?u?LUtia5D*zj}rztU#KX9V6C7;j7Q8S0 zlB*6q%yF@-Yf+q;a1)&^0$8&K{HXDYS&Ed)vJ!l6r$n9U8P`MUQZI)eK-^u6*Kdpf zzNar-y5wx;ZtRJpbYCGEd0*84PVL8&+BWu$y*{?sk&bhCehjZArP1SSX2_6(z{nE6M^R*|f6 z$ynra_U-VwV*BF1^ho4}C9XiaVprNH`hGFmgiUX%Pv*@VcTI~^;m|JEntHi&{_L&; zNnO;cWA4aJODk4op9K>jC_D0@eyJFuB2hh`Cwo{)#83w{6&Ky2xe7(Qnzks)2SH`f z9MmfjA!;HpQ_Q@C+Q5Zs>7ASx!lG`27XazRsQ1uR^eWQATS z(PqV@o6r#!swbqh-w^cNgLo54+nw2GAw@~>UnR!SfLMDZrFXJ!$OoPmtDTp_b;9`K z6tL5XDPoLt$~OS+O>IkYa^+oW@Jfg_g4g+JCAzGU4dsZ-rcx~ZL}!pigv95Pq3LG} zPEIepL$%a4dNpm5R9%Wqxwu3dl8$7pq4pjr{XIuHbFK8kLrI(}DqKPN12YQ2t3qzdnN!ez3Fd zp@($04skG7>K4pGr(&g2KJoRf`ea1&(??Wp<%O(8*U+X0RR*C;2`Ok6Xl&E2*5VdI zwm9bdWnitI-|PHYdRgj21CFGr*CO^yY1 zJkS;V*|!ymL(H~{Vz-foW=m%#Bb9256n3?)QAHTMGkd{94WY{Y;*C_3_M$LA@*1`k zcOc;KRtbu3LZZcSJ$Y@4f9q(6`;*$pPvvNuPTT!YP)11=@3hLs*qSRmT&kfVB_E~J`wO&l5No9Hxys8+F-y1{*16v=L0gph z26scBjUWa-_NHH!@XYfp&9h5bno!vSYX-@^Wni0>qJlmngFgNZ=RDuIzHu6Ja}IZ- zz~}h(TRXn514hbq<};7Yp!(msmGT0$WLE$i%+~T+S)Z&w;Z3dPlWkfIw!BJ{{~Rcq z;&sxPHBu7o@hrM#E2pGw2J~6gLR;dze8@5(Xd~jE(gF~%!U~&-tl;CBXIrbO$!#%# z7Wnm3NH%VXo`JPuS>tD|@@o51t zvF6hSTV`=L1picH03CEV53d&h8m~F=xI^xq$^KQg$S?s!Y>X4C8px}6>=*DKtGGqORX z>@+KMD)Z8^xQbawX$BD?6-3UNB<=xuVC8wB+3{ z$(6jJF;?=cj{Vw_x`S}-Rt)sM&?wC`WeCKUYuI|Su&3BBDm>S9B?@}*DAYqI@VH5J zx@#>WGMvy{SU5}Z-ds4VIzM&)$RV?;m6yYnO)4jn1+66*NN(r@8i51e)@X?XxljW& z!Mqh9S&j$#%jy30)1H zmLPP5mM-sO3a)B03I-**B$D}Mg=LNdyPsRNgzN$c%7l1~0s5sGk5LwCFlp`b1}{tY z`Ax$;Fh0h_WqU?!RsMi?(oU6P#~_3MRFz6_$2S%Y&}kOb(M&MiPm~{! zI`z;?7q`8^+qCNSK{t`or*wkUEAx){Js`RRh|P9E(`1{cvg-PRvg+x{^u&;j#m+6UDx{Mo^f1Zw);JI=wvFcnuMO()EMgA1m%4ZN)t=+tTUo{-mt26* z+YtnDP|`%#Mc4r*9=JNUppLb2m|;RLP_~8+D>BB^VX@~;nM(ASLh@oz5vUeD^CYnE z%sZ0<+!;U4eDkEZZ{0f~Z`$qI8Kw{pGxP)o=!I`)$0qyhKYNP`j1A-|^8Q z(IE~i2!?diQoAET^xIFq^XF(^gAzEOveZ#&@hY^0Wsx#jKD!&*f^7=zg?p!e4zYCx zm`g2=4;L3|Jv~$BIf>zyPp4%@okJzf`yPuSHMH7A&2cKN05YV1W^!P1%kc4LP+B=1 z_v)WD&+J|8+5u@+^?n)Tl-y?P6@xH|G0q5VL4U@?0e!W-O=L>!?VrBX+I?s$~ z+R^j|7)h>Gl(Pq9{aK<-m@9xaP!=*m9OgP;S(LE4#j`zVvSzF=uH6#r*@8;YNf6h? zM?C0=;hrzuLP9<(sJ`tcn#1=oI}cKoBNT{G4h~EsKbQ$)+upOKO24nXjex~C@DYjI z^H-KT^YiY_{qyYHG3Y~NID^UJ%(tUUUwxScD9C&CqBy=;?RY2TQ!LL8zEHK#JA-4h zjyvrS%@N-z=x&oyw-C1sVCr+(u(?A&MbAjX;!_=O(G+RJ=S%0kDY{G5j7R%f*!3Lu z4g14hdT%|ONka2%Mt^)pzcR6H!Ci>hDIGNc zI{I>=8v><;f>XvXd#l3P8Sj{536jWYa>{EhzwaYB%d0E%34 zs;&Z4pI+PJX=`lcUrsKkWLbX_E%z}twRY>ZWZ*ayyQpMM6JFI513Q{C3N3tqjZF3}4n~f@ z1^DS=&vW?GO_0n2{*g|QW&^Pcv|^Nh{_vAra`IX=Q)i-TJ>vbBs9PT;-Zf8d37A(w z!a&fT*gXFS6Cl`Ms(4TK0AUu%bg;1yNP>Qg`Kw6&A z+==jRb-{oPy?$sWM+5q(TH6-Hfq2}yOJs1A)gEt5iq_r(A0M%haJb?CJEE%{9MDb_ z?k8%7DL9hlwp;KtwOhovV+jatf2)5LG6%b3u;fgv&Cg)q9kg70Pa;_(Dp@-f085&lb{lrqjJ8XBwmAHz2ZU?>J&&Qt_utVGrOC;QXfP8-` z4(gvV_VMBckHXq0&CBQV*-Eb~g%i_xDBsc{u4VJ4V# z)zc`WeInwd{2}6{tnH<*T%#<~5YXqUVk1X0kyKV;V?B|?2qvfZWWJ%1d`v`{qzb8V z0%GqJ)!KpL8n(^YXvhTEPbM&N*Par2=zIcS*g*o-ew6NnE^4gHYxS2%ry#CtVr*@z zwt5j^SX@|L!FP+QdTwr(_G}*BfVwZnBq>D@EX6A;D}&V7K($g}Tv*OMQeQ4@(&KM| z2s5;`v-L$^DpBPqp^j)l1@*YY?SXH7bfVx?iP_RDr0jm5SQh>h;Fr&o!O%Lp_!MyQ(3)9E>d8DS=Y4e zX)UA3i+h_{j7JFweESq*VAY`P6_?Kr-?5{BV5qBo;43bLHH`A=dgd&kl&zpM)0G~- zkYP(@b$G@?HAcPDoRnK_YmTf}Ws}xe`c;l-nL+x$=@8O8&cTz-?T`>Xcq?7!eD(4w3I*^4gr*Mix$f6~Eu zL$d6&d$SyJiHzaTS(jn`-^OdoV(+^g%*5}4xiC2Aak%H8E}-9`mywb6OE#R#DUKP0 zdVGquO}fc|BHvLQwJS8k9BrC71m+*>?CBUI*L5bKEk5sD9UG+hR$T?L*a!IL8`Y<} z&x+sOGNWy`IELU&chBa@Wn5*JQwk!Xhw9c?0vrmnKecLQ>fuH_$bg-=YRIa%TxyLo zrXGl{;J`Zv|A^Xvbl*h*J0&R$R$Rl=v^#;vag}wz+Rgq4TQ~~#9XPJ=@F5%1fwVd6 zwJpeIYBSy8SmYE>Y_|F5&zWOuclzUs*!*9kb2>WvSW?oMoqvilS#gEiSRGUE;I)7W z)|E64QMUT8l=6U7@`hl*Ovr9SK?>h|yCXrQs?Za{(SF-2A^8r&;ma$yVXAv`?iY{Ruo_RpDc?$_mYe{$)!^{E%qV{M2lfi_`V{uh1LEo>ktW3KNwUB-O7WqdeNMZ^^ls8k6M-)JZs71vu_ddp;A!#g zw=wtYZZm1OVjZP72UQC)kLNf_2zE52^+~SYDd|&iCX;n0jA1Nw6}NY_8G`LN)DBhy zlWWng+oB7p6uXX_xHm4%EQ_n-YYtYEm)n7Ire#_8@fetEqAR^npHzl3SwWn01Ob3= z!A_Q3z;1)Bo}q*_D{yf z0m3N7l%x{&a?jd;^375PLG6R;IOpFh&DIHCqCl1a+`{_Se9*!4zMNmwTXL?t-{>jE z$Xie}xGj0iG^@ABlUF;!?(uq#xzp6Mx6Ul| z3hNeNoe5K6q?JwT%srU~F1bBLqFO8mC)Wd7Dz-`Q%l1u3F$h{!@}CpLAq!dM@jwH~ zzHhAgn;pmsF?>(7CxarmhWJxMrq1YZGA3Wz1@87!l!Y$CN7tfF!$-OzeglAe#;Fqa zb|lGe83*!xm~EW<$fAy1pN?N+1jh^7N;Fv(sOA#NdztDyHWHT705>9F7bCiiL`lba zuDrfhCqn3b@|o;We}3e5IwV1`^#tA^5N0csa*5^|Uaps2XI>j8J}+D#EV;>^A;+$G z{+Fs8c|#Tpo@yv3lRlyn4l|&^Jq!=;RL~3`^STI9=)eF$xiBRN8|}78od%veM~uY) z0C)8CXU0XqVAmNhW(c_;_7qO7P9Tn+s_`f9{trxKU`5_w6P2pjL)u0+J>yQ3gVFf0 zp=6XES5&pbv1@k6pqhcrgVuVtUW~TY!ys3EARHo4$Ke6b!DtC%RRM6oORchPV{wJY zZ}*hbvZAiz_e>FnKS<7#U`cJvJ>LqprgBT)h+^0Ho6q_}){b232RhdecEVytoPMp0 zb}X+S_}3#I8U0T`m*iv^+k>vWbCBpy_!MNYRb=0pTRjiRFc832V;`7x*oAZ;SCur1 z_GrOqO9Zi1Ne1W4*j)f`>&H2fMn&F+oRYW*b=kx34~c^V9_qgv*6_HFZ~iiEJits& zJgk4!dkVNb_Yt7=p~7YNNtUeMg9d6_pr;P4dJhBf@Gx$7RFGT^gE5s7moU@iGu znT^V@qS_zWer=95u@i1Gc?UB|gCk{NS3gMhr#ad8(I`@qG)aZ|UUS{}148nldRpo!`)^i0VQ@Qq^g+rJ?5f==gq7w{|_pWO}2l;^b=O{q0k^lGSE1USIAOou2v4CCA|EEaC9V5YiIo|(O)%OZ;|4x|Tf4Ktx n;|ctiLEZX40|KDl3KEuzJmfzPJO~KSzcU9N1Z4a0|3?28SkL|f delta 14892 zcmZ9z1yJQo8#Rc#yE_c-?(Q(S!{F}j7k6iHcbDPfHu&J~?p)lRft~-Y-P-*&ovJ=b zPCcEZ(n&v^a}uv1KMo-qHSCbPyRfYTA;G}#V8Fm=QcdiL0D3mg>h?Cy%x3l`Zf@Zk z3SJA+Sf4aal*3xyaB2f3RRkn*SV?+h;Z&T^;?_1w-kD)ErLoZ*yb=~;X(Oel*}4?iD#$8Yf!k8VzF5ri5)v$q$PmQzX#Mo_b>H9f*}wI2bh=zdc02i z;^4S!nnA%cfQQqR@Co07R@RcgmP`h7cPDz8z?<;!8ogf2z0PnSL>@*)EN9FgD7y@s z^W_ap{$|BPvj8b+wJA2d1I!7ej#qC9)(e&~Sw?Q#a|)ln6^VJ?vi5;Ni+ououb+G^ zbm|dvYPlMrwgWuk=$t>1Ao1yvB?XbREP9B>-xvpj0Y61>sF)?`*NhIiIs+}cAHqbA z#70YORkWhxs)3kJHE`d?Kk|%P`D&hpDy-YSd=k`&l|TIr>W@?Z zL7A=7dW%+}=x=8RUBgWhY%o=)t?9h8a`vU_2*AxQzi`Q2Y&Xrknv0Mr<8iwXf)>)3 z<**xfFVfQ9Sj^S9l~kQrqzQej1}+|6<=p28(#4VzP*g|RLouQ|xL>)e?aY5C>-_7U9h9=6~`#trpq4ttaDv%2@Bl~{dtJGpZ!6iID=J3 z37~>*=BRr#3KFW2AQdid5m84OEL(CEP>E7qhjqrN;Lp%DwroXr!VM6>`@|fHNuBr` z{t>g6<~8>PalEtbbZBC(`aFly>9EhKigz9(ES}BLoM_Q|0o6Y{>SY{Aqqc4{Zr5*X zI`0OfN6X1}#y5Q7{PX6LhG+)g-ed;_2H^Dz0Bd=reHdru2l_+HFbl$Q#)))JFfVY0 z2mR(+8#b?wl@n0{x}?#FCITWSS^Ug%A)%Hfx4n<~VD+7|HDFIv$_ejs2eU?=a*N{T zbIheH;rgJ*?Y3!+jzB+&$C0PmaqFD$%TezQvT3GYTt)iTq zKjmqowDPDslv)ivU4X%#$N@K1ECF-hDp-2mrNhn?-^)4v+I>70b9f3qV+6V*@Ditv zb?`iIy7gXnom^~L%>eu%cA5N(D5IbCW+T{4M#9HV&8H(>#QsQilZqi^42@e5YqO&F zQ{n_Ho;R!ioIe(8K6g+`BsTc^Pq`94ZV7ENxc#v* zh8_@c;!6i4@7cb=K{P<|HTI$9Ix`Hlv{(c9KJ?5ivi$Cko0J%$i}krLp%;KdU&p4i z4Z0o?`Er31_N$*JS@>}w5(i-p%jdZe%tXWI4*>I$5;@K6-V~>|_&3QZ_v-F}*>vV@ z?v=^f!M_*r9pa9@de-xk@={dBQ9U5bsC2`~lsBm>jlTqW7o4HJsRrh87~-$faUFnl zja&?aygao`O(WNP8hDL`4V}xQh?C@#qwMHi2k(g~9LtKU^w(;q4wPS@!c-<6`?Hjc z0dpgIuOY91h3z8zosxE7X~rhZ@F7z_duOVZ4j2Jw!~^n@*Rc>X4@S9gqE8nIv&ICO z6hBj9OjKkV?_smM&Sbj}nbBGYD<6<}s)JfM!ZTHpPA2#RRJ&)X?e{) zsaJ?h!r5?}%q*t+iG5!WDiRlaNNO@wUF%HX<#?EP$b`BL4+#U|b$((L+gKw-^%k+o zemdq-`Ne!PEp&>Tu>;}L@i#@uIGVw!OYF&BWThXI93thPv}67vGrbVAeTc~dFi1e( z4(1{k?mCs^4QQ+&_(a{#rT{eCZE$nAc-IacUt9?my^(i_4~kBH&Y1LT@2F^H!=e-q zkj+wipZG3pNGbPh1LSa8G3Fi!1Z%%RO#cm>xaTldF4rrw)c~ZsNNkAZi%!mJ z&dOE#v(cX2Uu+cMjFxKjdHWL02{j_*or_hD6i*MyP^80napiFY|9~zp%j4gPXb(R^SuO z15FztfoYjWtwwZasY41y?<|FinhI;cFDDhf;L9mx-&rtGtk{ioh|zetBQM%YyCxZ3X>aQex*ifMvglV(FS&z3q(GUXhLL$HS;V=k%cV` z(NT{50gFjSd8OANbvr}{XhW^)u4KXjKcnVr##Sp{*rPks)5Zr-yOdJB)9Ccp_GfZUcyN0U9hImp{JVS8Yx8f6Q|Ck7G~m?W5yAoAnzr8^t` zK~AvPGzZzue5g$|Da;?}^wSfkZz<&+xLJ6|9&lf=4s9UgqgZWtLm#<`a`8efYc$jR zk)y(I`f4D>OSsCPZDpHHmWxo4S0$}*%ufBWWS$m>!_5GQS>zU4+SFi*q|#5)$UU6c z#Y35zp4!y0lO|O>Ap1rDUm$Be8%_poL5B6W5kcpwZM7FG~axmn>+LqRc_JB{A zHgs|13VDKZ+eT3WG44un=ElhbCE9E9>P@^g8!YC(!<1M?q~$D6zrp^uD@QhJylr8C zfd$clfsy~~$|V1ua3ny-SMQ{&6AceJJ{fBiE4{)K9ECB2Dh39edA}kAj7B#V&sd*1 z&Ge>;OC6%4X3f%aUH#Jha+$RSg!C|TaZBC)ypsO=Q}4=??#}0%k;9wF$@W?b+x+v} zd&|dU$BF-mz{y5N>dX3dfnRb|`rXW3RaoFjQ6lJ>WO9U!H5w3%J$;{)LrmfulLvia z>IE(|7K5h|evc??mKYggKxU~2F4P~6fD0c5>2=4+h80^RY0?lW@6)L>i8iPxR;Y2L zyT53k7Jx8wJ1ZzWHt61CZKnIARXVZu+l16GF@y+@Ee1l;`AHjiTRDPF5qBlKZNcD-0iG71$bXvso z%9wU8XfRVVRI~)qq_+nXKJ%nPDWD-N8sP`6=!Rymtc77w2G;i8p753S8k!dptzhL%(zsZfS9Q0-QPTKe$e+eS5>+3` zqgc&^Y9jSD4Ziw2M;GVB0YB{RKcy`ZgVN1(rGHGN<7__l%tR9-CtH$*_EaRVcd+7- zq~mpJneYG{$Ykt3;OkvZN}ELN1D1{7c__h@&rerZ=Q_&F-j9##MeVF$XV*Q?x*pe) zNJwgtGv|!G8}q9g=`a$qd{;MXBljc5Ggz5)Ha45eE9(6GWZa(9r|aW4y7V`41pGSN z+S*!MT41ts_yv|>GTWELn%gt03V&6Um37$p6?y>dI7BUmG@7ew+zhqd$QpZWgkGHC z7&tm4lKaK_Z{!@3LB^NH8rP`!Eq=vsqfzK}4yifDa{ZkWq}*u8nGW2=zl^CSH3Zq^ zZq5vz{d4o3-CXQRj|W%5i}A76^DOD89bqI|F5lpi?jZa78y!bVjCUt5wlq_@c=6|h z1Y!UK5gp$!ww8#AxG7vPiyIIkLM$nMz^VzRz>8siW%N?$*w^`Py5Zxnl5Dvrh}<+vFZv>ZLEKZM61 znA=^jf_H6OdpUq?II^raf|U3x8OOcE)sX;9GJh!Pbl0bNDr}8{^G`*6ud7v?hpfj` z@`2@WaP{kraJM_|a2CxM_HY&}TM@S4@2geyne(CmMXFr5VR$X{)_{kZ(LQ)vxkjI( z0`>3ga3t>&+CLB7m_t0sc%w9Ueua$2ozr5<+Wwv*l25*z8+B|EGOT+V?w55?U^NHG zZZY@*exrfWu@Yii6z@c3^*081sXpmKx!rFIn@QU5JG-P<+O2XHn+SzL-e#g3a#*jX zA-MEV3bT?`i*C0{qoMqX>_X}{55{MERLMan;f!Q=WPeK~+YVaHVx&<@ZYK+7gf|Ro zSj)0+E8>knKQTriVvovC*+!9k^TY>~=k2LaLe7wL1lq{=O}F!5@D%w-kdAm7vF6I# ztU4fDInuKQ^ns!yXh02hMtclcy=r^k>HO0Mv>E)B5cozpokC2;ztMjkGKw1iSY3R! zyd}b2`8nVl@5{K#Glx0uMiAJP5{Bsgre?>R*r;dcO%~E>8A-yC&SHo1Jhl&LsbrLK zm{=;pLM15opj~&<9n)R)#TJ#Dfdgt80PvpGq2)GZ@yB2ELOD03@a$JT0x7brT~( zAnYt*w8|r>_G6GF+aBl@EiH1B4E1w1gU0GD=*7lPV#jmKa^qySDD%0+jdu68!kHV)wu* zR6Hl-u7WhPx~aEPw_+yIu4Yd({{qvix|hTG$+=T|%j91(Qn0s?S$+bbJt5ecZnOE& zeN#CQ7`jmYBqErj8=3`ay~Rnl&9xA0DYIJq#TrEvE|P;C{P2kvR`9ZR=h-Tp1G>Wr zbD3vTa#2z|Be>c6g}NH*BH?vEk_k#t{|%_34w#d{W!h-2VT_g%G;8UOzG=+KZ3sz!eQ~ygG=)) zT%Q=Evo8}L*zv#VBmTU?#}^z{aDEbyYP{IQ7wk3IeK781b7sj#=2aD%-BE`>T+f+( z7RoNpy+qkOtiYW`Vkuh-jz@9{56rM7510{%%s9v4hIyU<#H*zNhstr;Bi^i3W}Q@W z_@ZB;oa`4XFH*wv5gBOVpWwv&rw#Wx%Xy#dzwVI_=k|0ub}w^AC9>G+Z`;C70`!qs z5V46cf!aei^f0+EDBUhGMDe8=maT|fh+!Pu6>YK+AC^NR#WH3QKW0mR%r(qODR|Al zaD6f_d@|W}^6LozmS6o$#hV_twsJn$58i?5y&@qr+YOOL51Dh3F#QG7XCbmp)o(7N zzmTq}q^VvZ=3= z@!L11xFzPe*9n}Fvm?L}zIy!5K>>xpk*sf>oq7*wO#Ntx8nmq9f&fGSFa6%2Zvt_S zOU>abG@r6(XZ4$EIm{8IdSVOCf~MIS#@ABWdcqZucU5F^*vD=vqFBl@UYox*F&T2?sE_)xkp3FI&R!yngE?oVegg-Dzp zd*Mm7WYf`qE)6MMpIz0c4i4P#`4a`o)=pOv=EqOD|BMGT$z*^`i9^K^V_h3lQ(xB9 zy(9tZ4$L|f@Z~}_11xufY=g~Rh(k)!=b7Q(u9L0`Wx$(rTX}7wA2=q2x@$!6!fVTZQBG?g>`Xy$nKNu-=yKs( zHygJ-npfA8B>GB}f$Rdk$MO4WW-x>}`cP#J3s!XWbL%S7!Pyz6Z^v4l#$TupA~66b zI)J&BZ`gBqu|7quLQV*y^oA{)NyNpu>+H5C}aRx7EQVnp{ z>8+Pm9_4cT;D7k?RCK)*=tgW{s!x`A*yeVsEkGlAq{E*9jLPf2YTb;vCewwCF_;!?~_F zj#y&cdU^jL2UCO(gkM5O(z0tH03ea6YX1I$GBs{O_YkImG*gjabqd1W{)C2+G!}EzMTwUoOezvH| zmI(3@ll&>VK#pt){tAp0ngH*msdJfCLo$T6Yi9y#Yrf|SYme=lZr~&!>2vm9*p)FN zJbnQ4*8z+k;+9`fXAcJKmYBK7m+k7rdv40#>VJ`~sF{v=kau#N2 zMp{qNK||@X8HyW2t*))ItW+;M#nwi?x{R(Wy}VSI|r79A-N{?=nPMZu*9baTTuQUH5DMjq?K&GXOOJ`PG3SY)+^Px zY5C=H`qRe^QP%ssvTmNlRfncZewGfN-$Nl>W!vVo638r!nlK;xy8QFRQvaQm_*dOC zQT*QFeF~mB-aT&05RqRI{B7ipTYKoaL0Y7ZSP0H?#~*9eYdoea=)ERY`sd9enjIUlGcW5Zlz$g@9=&rYg6zpL6%NdGuNe8Gd)#SceU? z4;}utA=4nk{DNmPL+8wNYS5%#rE^^Rv#)mC{CG(jG{^n(IRk<`;!#`UzgKJ?S1#b> zZ>h-y@N3%7CLs);0YS{sliIipTBdSaX-RmAjRPPeR)Z3^6Ipke(1@i0Ay$F$G# zT!I#60qDdPsMhf>cmCGzkit@dOkVA{fy(aW4}s|ZO0Zg_QzhW$Ddg4S@w)N?$!VVC zz5t1vXOpvtver4c%fi^ba8=`BYo083>S0y8rvczIISNbJw^MfS^P>lcH!RR~ML{8Z zPvZDPTi+Wr{XDEYSAgtFQ0iX;u@x64!UoEq!O!jI;#?i93&=)X-9F6dv@? z19vPwE$Ab}Q^KfBe`kzxC(~nakuH#aAwUPLJ_2Mhi9r6x3k|WM?~ib)o-a0o)Qjdk zB^yu(gJXj7z8(Dapz9C})xN;PMJOP#7Zn-%R?RnWI|vZN%BKu{K&Dx#5-sk4K&%Z? z3g1=(IfQQ~XSqeKM$3}Q&?<%xW1Kh7yRbGK4oQ%cM8@gnm^=Lvx0A+t>*vML0Jtzi zy_2f2#z~AOmL#JmR=)%^6Qx(nxi zQ-6jmd?Z_ZN8|Mgvn+~wQ?=JFnJxEAi_jpjlP&uN^F~KRg<7FKKV$BT>o1}Ey97eV zQ(C@YBKSf0@84Th9}prj`wO}YVd>=hl$7;cy!aK`azMsW?(_|(O8a3?mf}nH z3yLH>f`QJ7=#Y3m9$oY|78@E#0f00~47qn@b@_an z(;cKui-(z}*W5^|N3n4)6%UbOn40r}W2dAx#sa!ue%S(4HC?H-tz$>|_F_-vP{|Vk zV-|Vp^(=CAhOPlNwwF&vTD9^r{UdRr4Sfappztne-z{P7LhaiQ$R1mZ!nRezaIq>B zqVfsU@@z1MY@I07apAC0#48=~}&cWqTPT5bE`GNbS%`Z*cQUYku zPN}rkg5{gn8e>Zd_B-mNLAw>--*1*zrfHwCpBvovOuZBoWs)`#n;7k^B~vbQPSksX zZ=`&mEc969(0qFXFOdogw=nGp%p#~eHNi#wb|fArU*P}d$AIJ+XPC$*HoRg>_+Vh? zTwq{i|E9)pfXp>J$bc15+m3llUbGa1c1o(1bm$a=l*h)j%}q#L-HeA`PO_0rie>XN z^7E!Uog3FnNi1#~?lhHe=%$PShU+TZz}-E&Vh0-qjyY7oV*vWtqEgjHtYf z&R)rcO7l?{D7|sau1cCoFTwqL3Jea1+#Fxw_$E+OYk;GMvVfWRq)$AbaR!o-?z{0n zqxwdVct@lv0{$eI8m=XV326#86nQWtTCgdbEo}y(s&q2Il5W|GuawhgF z%Ji*EX70)PA`B>&**su(cYthaT}(esCqL)|rc855MSqY;J3jJ7+L+c&{F=NpDi3{? z^BYs&-&W{!BjqEW5TwrUQL&Laf>UB{ASj|cYU;zI`2h%@;SyJ$V3_4Yu6b59tE-Uo z+K~wtUICgLlThWUp1U%;{U}LH2Ne{mqby8L4|3MHg?&f?BW+Mx18 z_IuqP#vyk-i0aCKHvCi=m(3E)#bAX?QbuPZ)-118iSkti^dJh5Nzim59G5EAIdlJb zY*m`6JAirkmu-@-HLT@zDcWVRkUL#KCbN3>B{Y`^*ejBd0!b}zXnsk<0kWQ)&AV2a zl$KL^>yeWCg^H6Y;y2!|nID|rIx|` zq#Ak}>5JzddM76ISG7dtu6_tc3{B-45akfcc(1IQ!D=2AI&GF=IE$SDS0;KoH4|pZ z-*F6=}ZX zP6B-3OXG{vDxgF3`Zn)AYj&fx7j#vweLGQVyv+W_>i`KE9K*7njhB>IZ>QXO0^kx{ zV%a?fkOVTg87TRG`LYG*cgTSK+O>E?LGr}Uz2ftgk_!2z2If8B$>W1bYpvrJ)r&}v zVzGKu8gFW5h<_Je%EaWR6;1t{2SI?3BN9-i9rqgW7ECN{1jV-YWN>8N@(#*vRUEEs z_CIp}wMNgG_VoU12?;GXnV^>6RTO>~hSH;z-wGl_l2mHP5Yz+N{uggx-)LRZYaZv# zo1WHp4|iq`6?=U~iSB6gr*>|QznFUUC}o{)Mdz2X90t$>&o?d5{LhtBNE}qB#}NPy z*{W5Gq}aE-wOS&Kz@LR_PysU3$c4L+z+p8vKV2(nz1d<11cY4_K7|9IuKS@wU59e) ze78&T$xe1i8JLtFeffouxJynw$xjV&M+tHD9aORVVg=$-6B20~Cj7oGus_gn`Viap z)BJboiUVY?sZ|;CZF5X>h30C0D-GbtCWUZ%J%w&Z?^op!FP)h$Ls6V%B%@JekO8?} z^=y8RlqXP;S0=nVz&j8p^Nq+m0FC4pjrEh&L1F}n%&Oc?Ut4~g`7O<%n^~ZAN^JeL z1;K`*A`&gX6}%ch`46Snl;>HyKD1zQPK+Lkn%#tn?YShg(axEUrjF>3r$qq2mGyH{ zgPLNi$x>XG%$Mq(8^0ye0^hqd0P(Q(nzCe>nnid8J!)~zlA##qbVPH%+IK&&nyz%N z8e?Uj0cBpA0nEX5Tj5pMsz1bJy?glNXFZ>Oy~}OyT!wkc{9j{72)sJYBGWQoJ=^uT zfv`e29xPVysxGuKKZIOgm`#8;GnNVrHly^D0SeyYz7I`4a^JIF6aa<&nEP-t@GvSC zeJL`DR5+;j9Lz%X(x=a#eDPUe$OpDkxnyU7v@kyqDoq3;%5fcT9WYSY_et}{@slyo zoA__|C&I9DAp^+i!Rw|MXYHI+=e#eU;k4iZP)ISNBl|`R*QIgzk^xZulD_Z`1u12B z!W2RCm4WT>Plb#fQ}}d8H>YN?Y?rp#?+`*G4oEiK3AuDK?Ym>fPJ0L|=jA1gCxkXX zk~wT7Cf}>{Y=;&-6AK;kN}kxIN5194o`zVl*}SW!nv*q(9A#8gGd^O3eR2;4;KM&- zlihXQ6p)f3e4#}Jqybt78Km+Q7*W(^FI$Avw?830Yzv$6wj&bx8$EG)O8ogQ>)4;% z2!}C8Z@FLh>eSOLV}89D()PQqWc*4Fi;bwZ8uJ00UJ18Va$fAw?j7EU@pY%xmXfJZ z-*=FysHrYlxO9ujZDFRfppwe>{U@Yxg;E&!RQ5$a{88cmvIdZR(S+Y+!|uz3g=Fb> zgPzP`z93MWr+BL3&%*l1S1Xf-tPb`Q6Dd$OLv~WGeQJ_OBk&yc=uyHnepLicpa!=B zO+yecFEQk)sF1r}OND+f z_dl$LF@jH>w69IA0i0VDelSLec6+kgNDFE6x1X)mR-*-3T*689khQfgVDmog{^DJve6UL2 zpfOM8K1XHARbU6)dj|++GHrZ7u5GY<#snaz{vA-^eADde6mfEOf^mdG{Q$??z0&H7 z>0^A&bc#XnHNcMy62wo-NYEoi%Ze6`_Me`VldMrKuU$C3a|tXoK^ST=JzQIr?5=MI zRfoDio}6ZzbhefigF*-0^N3{YfZ5vRH-cC<7V>X$%NRLMkb3#mn>wkaYYqe7#kJra zJOJ3^88~|`0d_|moIAg4rK#_>E?mRA#_?mp1b=c*UHG`vV>30d**CDcJ5KY3Qn!$D^yrsscj?Ipds93(`n$^ooqcrMHbC}4R^e~s* z@oN(QQoH7L?Us<@fA<;5AuAsHN;m%VvjVWl7im3Xvc45R`D_`)+v=h;Q0E&N)huiR44j%A9>2%J}tu^aE0C(5GJfwlc7CUD&YSH z7og~Gb}dX085-HWxBJWK0p-HG0t>_EZht}|{2Xf9Z@B#>w%Uqh+E;te2iveDe;V*$ zlk&YnP&kyvS?JZ93vDB6P!=<<->x!xrnsd$q16@f(UnlpR0zewfivoad0RBYRY0&b zw0_{;SJ3G&z6w&B&f|ti82U{&A&Lig+=%V4}>fRsih>I9rCuC~c8#CLutITP?(|K!XI#F^&^Q!n$&r<`H5kgFIH)fL4j^lqC% zDGfR6vE!rJregSe;df&_J&+{%iWc~mBgo*mJ9b1{i%%Xc;%c4e?OV_<;$SPMPBhIj z9w%}hr!w(v>4jJSp}&aM%uX}1=Vf%!3gGj<8KM<@*f=R|0@AB7Zh>5z3Eth0X6V7hwjBSz*NeBs(mee4F;T#Wh^5{VBx(@>%50I0zG0< z?Ge8|>d9J53NBU6VQmrdsN539WKQv!lImkfwTJHRQQDJ5Fm7S$M2JT5NPZ2NxI&zs zz*Bpf@WJN0ZqZ2I`i#SM#VuhLecRH(5W}(aE|@lioo}*a-51G;R_>4cPf{Sx@DmyW zZg7S!&OddG3S6p6C4MT)G7-Q~eL)l}Vn*C%9RuX`iiM7~UMMN10vW#u*N5+v z`Evxr9+O7SVr1tqe0tSo1Q8Gv94+D- zgdlPskSuN>0xSo7wRqx$)7)kiXBT=(fb(KL36qRPG&o3SfpKH8nhBuK;SNz!=5_?6 zIIm_RO^eNeqR4wR99DxL+RTqAUO7Toe&FADR{k{uM3_!~&B{3gVMVY2|`3xZnLaGl<1%Q3Z?Hrn7U$R!j3_EeY zh@o7%phu}7pj;P>T#ij8&uffc$p&odBoLdA~JY!NX3VK1=>$E-Ts;5ku zZp6iCT`jln?22p}!Do05z|{8K^1^NNo*Hv^VwqX*5nUeKBDV4sC}(wiWC~Y#+_RM? zuetB9Ydz^p!4MA0rFFg$l0uh3&c%Y{B-A|3`ODJ469JpA?1LVh;oj9PtiR)y?!(}i>(!_)`nF|-6$ z=H)stA;(hDEeJTa80sT}5pO^^;1t$$DKPG3_zOib470JDYWm3yH_g9W8>;5cHXpHf zoiM=^m%95W6O1$;UHl7c-cX(b}i%B@^N z(48q?hEh9s_zHZTiK#`byC0sf%dIlYi%88e<3v>Zp&9_{e>M(=+&2@$X(x+KIu3r( zL4)T~2oMF;g8K29qxwP^-NdMb|JAjHmMy5V1CYA=A#sgl=LSjd{z>RK=8#-D0ir1+ zqmaz9LC|BaV(G7B;5g>ETphw>bf}WYAyB$WLd>HQ!m>%wKJnQ+0iq*%l~ED{~uvln@+CJ20R#8EjAb!?f*%+ zQ+L*I0Y1i9N7!FVO*v~wsm9z?XmFjTKP|k-V^q=5j^He~w1M!P#yQH|spjTD;PkYs zb=|O*9qOqZ(^G5RB96X2c~QAMYD`_v^?UF2dwI)s0LR6&BaFh=>TAMt?@rgw^JVIn z&w~pX!>toOOY-eJno)Tn0!xNVLkJlPZPE<_VB4oGPCNX@7QaE&8P}+$5C;}}vL773 zL7f#B);9WH__I4-B=TkV?}rbh`VQVej<-L@b$7Ux6Y`#epm1M7TjUK2$(@zKdwc8eqGw!Ul?mCN02fgw_ z1sxrjMi+_dg-{jciw)MsB?$u+X+?)E0BiSMbxovt=oZHDwd@me1&r^z00X+vPxEO$rzdR_YR9ymou&{zu)K*!1TTRG9EJbU-s*MS=o_hC%b+vx%ubY~WHvf~kvu^k( z5pmgY2w27`=qy|49b6uyb7#+OJnQHsOt(0BjVOgw7~8a(Se~jJWZER><~%m{0M;5o zc6#qr?vfMz1t`DV8uFQE*&q<@*=6K_9fs0c*K~>rpyeR$fzF7o$>#L6a$T5)Ev43t zG=)!cA%nhN1c`IC*7WVAx}!}uuJgEBlZK4OW^o0;3eyISSh1N>zW?cF&azuQEW}fo zSb~#)2xg93dj0}q05G{CmynJXFj{CK+fLRwiJr7{`PBbO1xw|GQ|nHrK^>!}LB?{R zZeCnwR{}9l)XeTqW@cLwklzf4uRHEyn8Ua(CjAZA5prqYkalZ>UyyvO>-yF1=(j|< zWnIB|gRwvN^-aOt&^t(R4S$QT>*^yZ#UL^(j>VzGX1%l^{d{?qd8)|+pfE&NsC!`U zP?CtGHsDM~-7K6Z3V$!{e>0~>w|Hr z{igU10dQ2imGX}!2pl{96kq11c{C-Kmu=^llHW~cQ=@5mnE#j`t(2RnwUK$~(a>Y4 zESJ~mq1+tN@W=mQV)LVH+C9IlY(ER6Jr_@c-2+l*>+iJ1Q@!N^_~(Vi`JQ=~q_1fD zL+)s}FgR-8GNo&b%vG#m()Ugg?Ui`q@qrCczxDc%7!lF@K(wN=2eDBW(^L2% z`B5|}?3|R!2v=0Zvq_M~;KGvgIkqp?Oo{*XN<6g;PH?wten{#-W9 z_rNmg^|2;7o{))iC!W*!4!BmsBbye}a}YO# zcX;ps;ANN!1ZbY1~hv1vdNMKW4PuVRTmoAo2vMh?jDvQ6SwCzL6R=1Fh;lLRni zs4|%^F2D`JQwD3*-i*q(TV9}bt1%$EKMRPL5fQ`9PFJmRp22%Fga2?QLjE=65@vRL zU>%pr9eHCc=mK$X`X`D#zMPIT*2Y^HRb7V_5T8!R=>CMm=T~Ry^b6=!1oT4pp=A$` z&6}d0KBf-&HMQ2YxYnh3!Q}B&JiXmylVr6Y`KwW;-Lm5#o43pIl~XI%Kg>R6mz;<^ zmAJxQ3^JgB3~>X5`Y1m+n0EMvvfr7#-;0o8#&xvJg%!t@Iiz>-ho5MuCCo*rsP@kw zpgrL;)Cp@k4t;#kdIWe&w0EYCH{u4)W(KQZI+CSMZLk$rT>)2`9YS9sU;g`vlg2uO zl>Ol-Nk2?i%8Zb&r6*P};1x6X`%i^Gv%KL9)>hOI`u|k24S4iaxBXVs0{XMJYHH39iKO+wUILxLBh*iwb~6HP zr-J@!ayCPucsqKI`V0+_1SPgC-2tpu z20?po6xi5Ery?X5|1|Q@5Tf@m%DwmCehnz%HKbl&khnib{k#VcnGMy6MLCJzSB{mSru-M7YIf>C&TK{asy8rb%F zI0J2{ddgkg_P%$+U07>uEGhXiF>IfuY*B?>PFp<)8O#cFMIu9gxRzhM_L}3WRT{(! zvT|tI;t12!ldM-%E8S>_&bSt*Tav&3U>3F(GdoBbt{YJLcz(+}1Y;VCwPqn}(iVHf z53|_BuBEQ;iZwYadD~U5D^_qs=rnYt?Nd6s5K`OA@DnPsV>+8ZJEPbe4*AOef=KN@ zBm%x3kRkp5OocQz^sxW8sW27%1Sj>?1r6z+7vaC9G#Jh)buJJ)mB^JS74`%zRpOQa z95ogEmOeG=mKDOx^WQ;|)F2<&)SX*2qW>&VP+(xI|I7@513LtG>3`6<67&CD5z+tri~66YM#}#Y z6(QF8{)=7u$PE!b_#a#uLrxjR`|p0xJP|MOB diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37aef8d3f..62f495dfe 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index aeb74cbb4..fcb6fca14 100755 --- a/gradlew +++ b/gradlew @@ -130,10 +130,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. From 67fd31ce4c3c7427714142f1d8d7d35e57a32f8c Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Wed, 5 Jul 2023 16:06:15 +0200 Subject: [PATCH 115/161] Update bom --- buildSrc/src/main/kotlin/AdapterConfig.kt | 2 +- buildSrc/src/main/kotlin/CommonJavaConfig.kt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/AdapterConfig.kt b/buildSrc/src/main/kotlin/AdapterConfig.kt index 9fb5595da..21cab4c73 100644 --- a/buildSrc/src/main/kotlin/AdapterConfig.kt +++ b/buildSrc/src/main/kotlin/AdapterConfig.kt @@ -15,7 +15,7 @@ fun Project.applyPaperweightAdapterConfiguration() { dependencies { "implementation"(project(":worldedit-bukkit")) - "implementation"(platform("com.intellectualsites.bom:bom-1.18.x:1.9")) + "implementation"(platform("com.intellectualsites.bom:bom-1.18.x:1.31")) } tasks.named("assemble") { diff --git a/buildSrc/src/main/kotlin/CommonJavaConfig.kt b/buildSrc/src/main/kotlin/CommonJavaConfig.kt index 8542fe252..759e45740 100644 --- a/buildSrc/src/main/kotlin/CommonJavaConfig.kt +++ b/buildSrc/src/main/kotlin/CommonJavaConfig.kt @@ -45,7 +45,7 @@ fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, banSlf4j: Boolean "testImplementation"("org.mockito:mockito-core:5.1.1") "testImplementation"("org.mockito:mockito-junit-jupiter:5.1.1") "testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:5.9.2") - "implementation"(platform("com.intellectualsites.bom:bom-1.18.x:1.9")) + "implementation"(platform("com.intellectualsites.bom:bom-1.18.x:1.31")) } // Java 8 turns on doclint which we fail From a669be20413bbfef91370bfba445a3ff9ddf2452 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Wed, 5 Jul 2023 22:03:13 +0100 Subject: [PATCH 116/161] fix #2319 --- .../fawe/v1_17_R1_2/PaperweightGetBlocks.java | 6 ++++- .../fawe/v1_18_R2/PaperweightGetBlocks.java | 6 ++++- .../fawe/v1_19_R3/PaperweightGetBlocks.java | 6 ++++- .../fawe/v1_20_R1/PaperweightGetBlocks.java | 6 ++++- .../bukkit/adapter/NMSAdapter.java | 27 ++++++++++--------- 5 files changed, 34 insertions(+), 17 deletions(-) diff --git a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java index 85be84901..aab9e5aa7 100644 --- a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java @@ -445,7 +445,11 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc bitMask |= 1 << layer; - char[] setArr = set.load(layerNo); + // setArr is modified by PaperweightPlatformAdapter#newChunkSection. This is in order to write changes to + // this chunk GET when #updateGet is called. Future dords, please listen this time. + char[] tmp = set.load(layerNo); + char[] setArr = new char[tmp.length]; + System.arraycopy(tmp, 0, setArr, 0, tmp.length); // synchronise on internal section to avoid circular locking with a continuing edit if the chunk was // submitted to keep loaded internal chunks to queue target size. diff --git a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java index 4e435e7ee..91a5abede 100644 --- a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java @@ -491,7 +491,11 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc bitMask |= 1 << getSectionIndex; - char[] setArr = set.load(layerNo); + // setArr is modified by PaperweightPlatformAdapter#newChunkSection. This is in order to write changes to + // this chunk GET when #updateGet is called. Future dords, please listen this time. + char[] tmp = set.load(layerNo); + char[] setArr = new char[tmp.length]; + System.arraycopy(tmp, 0, setArr, 0, tmp.length); // synchronise on internal section to avoid circular locking with a continuing edit if the chunk was // submitted to keep loaded internal chunks to queue target size. diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java index ba1bfe574..b13a273ec 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java @@ -490,7 +490,11 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc bitMask |= 1 << getSectionIndex; - char[] setArr = set.load(layerNo); + // setArr is modified by PaperweightPlatformAdapter#newChunkSection. This is in order to write changes to + // this chunk GET when #updateGet is called. Future dords, please listen this time. + char[] tmp = set.load(layerNo); + char[] setArr = new char[tmp.length]; + System.arraycopy(tmp, 0, setArr, 0, tmp.length); // synchronise on internal section to avoid circular locking with a continuing edit if the chunk was // submitted to keep loaded internal chunks to queue target size. diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java index 0dd292207..8662dc2a6 100644 --- a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java @@ -468,7 +468,11 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc bitMask |= 1 << getSectionIndex; - char[] setArr = set.load(layerNo); + // setArr is modified by PaperweightPlatformAdapter#newChunkSection. This is in order to write changes to + // this chunk GET when #updateGet is called. Future dords, please listen this time. + char[] tmp = set.load(layerNo); + char[] setArr = new char[tmp.length]; + System.arraycopy(tmp, 0, setArr, 0, tmp.length); // synchronise on internal section to avoid circular locking with a continuing edit if the chunk was // submitted to keep loaded internal chunks to queue target size. diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/NMSAdapter.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/NMSAdapter.java index b41da1679..c146153fc 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/NMSAdapter.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/adapter/NMSAdapter.java @@ -30,8 +30,7 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl { ordinal = BlockTypesCache.ReservedIDs.AIR; nonAir--; } - case BlockTypesCache.ReservedIDs.AIR, BlockTypesCache.ReservedIDs.CAVE_AIR, BlockTypesCache.ReservedIDs.VOID_AIR -> - nonAir--; + case BlockTypesCache.ReservedIDs.AIR, BlockTypesCache.ReservedIDs.CAVE_AIR, BlockTypesCache.ReservedIDs.VOID_AIR -> nonAir--; } int palette = blockToPalette[ordinal]; if (palette == Integer.MAX_VALUE) { @@ -74,8 +73,6 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl { CachedBukkitAdapter adapter, short[] nonEmptyBlockCount ) { - // Write to new array to avoid editing SET array - char[] copy = new char[set.length]; short nonAir = 4096; int num_palette = 0; char[] getArr = null; @@ -86,19 +83,23 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl { if (getArr == null) { getArr = get.apply(layer); } - switch (ordinal = getArr[i]) { + // write to set array as this should be a copied array, and will be important when the changes are written + // to the GET chunk cached by FAWE. Future dords, actually read this comment please. + set[i] = switch (ordinal = getArr[i]) { case BlockTypesCache.ReservedIDs.__RESERVED__ -> { nonAir--; - ordinal = BlockTypesCache.ReservedIDs.AIR; + yield (ordinal = BlockTypesCache.ReservedIDs.AIR); } - case BlockTypesCache.ReservedIDs.AIR, BlockTypesCache.ReservedIDs.CAVE_AIR, BlockTypesCache.ReservedIDs.VOID_AIR -> - nonAir--; - } + case BlockTypesCache.ReservedIDs.AIR, BlockTypesCache.ReservedIDs.CAVE_AIR, + BlockTypesCache.ReservedIDs.VOID_AIR -> { + nonAir--; + yield ordinal; + } + default -> ordinal; + }; } - case BlockTypesCache.ReservedIDs.AIR, BlockTypesCache.ReservedIDs.CAVE_AIR, BlockTypesCache.ReservedIDs.VOID_AIR -> - nonAir--; + case BlockTypesCache.ReservedIDs.AIR, BlockTypesCache.ReservedIDs.CAVE_AIR, BlockTypesCache.ReservedIDs.VOID_AIR -> nonAir--; } - copy[i] = ordinal; int palette = blockToPalette[ordinal]; if (palette == Integer.MAX_VALUE) { blockToPalette[ordinal] = num_palette; @@ -116,7 +117,7 @@ public class NMSAdapter implements FAWEPlatformAdapterImpl { System.arraycopy(adapter.getOrdinalToIbdID(), 0, blockToPalette, 0, adapter.getOrdinalToIbdID().length); } for (int i = 0; i < 4096; i++) { - char ordinal = copy[i]; + char ordinal = set[i]; if (ordinal == BlockTypesCache.ReservedIDs.__RESERVED__) { LOGGER.error("Empty (__RESERVED__) ordinal given where not expected, default to air."); ordinal = BlockTypesCache.ReservedIDs.AIR; From 888683d83b8d35ef27b75ad41181d2edc5dcdbd7 Mon Sep 17 00:00:00 2001 From: Jordan Date: Fri, 7 Jul 2023 17:23:37 +0100 Subject: [PATCH 117/161] fix: ignore clipboard origin when pasting to match P2 behaviour (#2336) --- .../bukkit/regions/plotsquared/FaweDelegateRegionManager.java | 1 + .../bukkit/regions/plotsquared/FaweDelegateSchematicHandler.java | 1 + 2 files changed, 2 insertions(+) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateRegionManager.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateRegionManager.java index e20c73809..66a9ef369 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateRegionManager.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateRegionManager.java @@ -183,6 +183,7 @@ public class FaweDelegateRegionManager { .findByFile(schematicFile) .getReader(new FileInputStream(schematicFile)) .read(); + clip.setOrigin(clip.getRegion().getMinimumPoint()); clip.paste(scheditsession, to, true, true, true); } catch (IOException e) { e.printStackTrace(); diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateSchematicHandler.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateSchematicHandler.java index 83de13f66..6cf09da28 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateSchematicHandler.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateSchematicHandler.java @@ -152,6 +152,7 @@ public class FaweDelegateSchematicHandler { final BlockVector3 to = BlockVector3 .at(region.getMinimumPoint().getX() + xOffset, y_offset_actual, region.getMinimumPoint().getZ() + zOffset); final Clipboard clipboard = schematic.getClipboard(); + clipboard.setOrigin(clipboard.getRegion().getMinimumPoint()); clipboard.paste(editSession, to, true, false, true); if (whenDone != null) { whenDone.value = true; From f38c81aa2ad70634e13586968f5a7ee5e3f27386 Mon Sep 17 00:00:00 2001 From: Jordan Date: Fri, 7 Jul 2023 17:27:10 +0100 Subject: [PATCH 118/161] fix: correctly invalidate mask after a plot is merged (#2333) --- .../bukkit/regions/plotsquared/PlotSquaredFeature.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java index 46ba12f68..e28602292 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java @@ -211,8 +211,9 @@ public class PlotSquaredFeature extends FaweMaskManager { @Override public boolean isValid(Player player, MaskType type, boolean notify) { - if ((!connectedPlots.refersTo(plot.getConnectedPlots()) && !singlePlot) || (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone( - plot))) { + if ((!connectedPlots.refersTo(plot.getConnectedPlots()) && (!singlePlot || plot + .getConnectedPlots() + .size() > 1)) || (Settings.Done.RESTRICT_BUILDING && DoneFlag.isDone(plot))) { return false; } return isAllowed(player, plot, type, notify); From 6fbdef5252f980ce900504a9892122945a8cd9f5 Mon Sep 17 00:00:00 2001 From: Jordan Date: Fri, 7 Jul 2023 17:36:02 +0100 Subject: [PATCH 119/161] feat: allow bracketless '%' pattern definition (#2322) --- .../extension/factory/parser/pattern/RichPatternParser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RichPatternParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RichPatternParser.java index 3ebd84fa6..bf2027c9b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RichPatternParser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/RichPatternParser.java @@ -117,7 +117,7 @@ public class RichPatternParser extends FaweParser { if (addBrackets) { value += "["; } - value += StringMan.join(entry.getValue(), " "); + value += StringMan.join(entry.getValue(), "]["); if (addBrackets) { value += "]"; } From d78092b4ca810a3c9ecacb4e7d1e0a507e3758c9 Mon Sep 17 00:00:00 2001 From: Jordan Date: Fri, 7 Jul 2023 17:36:12 +0100 Subject: [PATCH 120/161] fix: ensure chunk is loaded when getting entities (#2323) --- .../bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java | 1 + .../bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java | 1 + 2 files changed, 2 insertions(+) diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java index b13a273ec..c715e5fc2 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java @@ -332,6 +332,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc @Override public Set getEntities() { + ensureLoaded(serverLevel, chunkX, chunkZ); List entities = PaperweightPlatformAdapter.getEntities(getChunk()); if (entities.isEmpty()) { return Collections.emptySet(); diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java index 8662dc2a6..08d2f1069 100644 --- a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java @@ -310,6 +310,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc @Override public Set getEntities() { + ensureLoaded(serverLevel, chunkX, chunkZ); List entities = PaperweightPlatformAdapter.getEntities(getChunk()); if (entities.isEmpty()) { return Collections.emptySet(); From 90587e56fc139d106390df3cdcdb25d5c746780e Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Fri, 7 Jul 2023 18:38:10 +0200 Subject: [PATCH 121/161] Deprecate support for 1.16.5 (#2338) --- .github/ISSUE_TEMPLATE/bug_report.yml | 1 - build.gradle.kts | 2 +- .../java/com/fastasyncworldedit/bukkit/FaweBukkit.java | 8 ++++++++ .../fastasyncworldedit/bukkit/util/MinecraftVersion.java | 1 + 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 83d9f52d8..8a134b81e 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -32,7 +32,6 @@ body: - '1.19.4' - '1.18.2' - '1.17.1' - - '1.16.5' validations: required: true diff --git a/build.gradle.kts b/build.gradle.kts index 781f1fba2..de0d714cc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -83,7 +83,7 @@ allprojects { } applyCommonConfiguration() -val supportedVersions = listOf("1.16.5", "1.17.1", "1.18.2", "1.19.4", "1.20", "1.20.1") +val supportedVersions = listOf("1.17.1", "1.18.2", "1.19.4", "1.20", "1.20.1") tasks { supportedVersions.forEach { diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java index 46bf125c5..2e25c8c56 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java @@ -108,6 +108,14 @@ public class FaweBukkit implements IFawe, Listener { if (version.isEqualOrHigherThan(MinecraftVersion.CAVES_18) && Settings.settings().HISTORY.SMALL_EDITS) { LOGGER.warn("Small-edits enabled (maximum y range of 0 -> 256) with 1.18 world heights. Are you sure?"); } + + if (version.isEqualOrLowerThan(MinecraftVersion.ONE_DOT_SIXTEEN_EOL)) { + LOGGER.warn("You are running Minecraft 1.16.5. This version has been released over two years ago (January 2021)."); + LOGGER.warn("FastAsyncWorldEdit will stop operating on this version in the near future."); + LOGGER.warn("Neither Mojang, nor Spigot or other software vendors support this version anymore." + + "Please update your server to a newer version of Minecraft (1.20+) to continue receiving updates and " + + "support."); + } } @Override diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/util/MinecraftVersion.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/util/MinecraftVersion.java index 08ee52de6..f719d430d 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/util/MinecraftVersion.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/util/MinecraftVersion.java @@ -13,6 +13,7 @@ import java.util.regex.Pattern; public class MinecraftVersion implements Comparable { public static final MinecraftVersion NETHER = new MinecraftVersion(1, 16); + public static final MinecraftVersion ONE_DOT_SIXTEEN_EOL = new MinecraftVersion(1, 16, 5); public static final MinecraftVersion CAVES_17 = new MinecraftVersion(1, 17); public static final MinecraftVersion CAVES_18 = new MinecraftVersion(1, 18); private static MinecraftVersion current = null; From 68eb4e214ada9a7b6ccb3999d4db53bf8bc9d417 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Sat, 8 Jul 2023 19:41:20 +0200 Subject: [PATCH 122/161] refactor: use HttpClient for update check (#2331) --- .../core/util/UpdateNotification.java | 80 ++++++++++++------- 1 file changed, 51 insertions(+), 29 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/UpdateNotification.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/UpdateNotification.java index 6425cfd14..13effcc46 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/UpdateNotification.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/UpdateNotification.java @@ -14,7 +14,13 @@ import org.w3c.dom.Document; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import java.net.URL; +import java.io.InputStream; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.time.temporal.ChronoUnit; public class UpdateNotification { @@ -28,38 +34,54 @@ public class UpdateNotification { */ public static void doUpdateCheck() { if (Settings.settings().ENABLED_COMPONENTS.UPDATE_NOTIFICATIONS) { - try { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - DocumentBuilder db = dbf.newDocumentBuilder(); - Document doc = db.parse(new URL("https://ci.athion.net/job/FastAsyncWorldEdit/api/xml/").openStream()); - faweVersion = doc.getElementsByTagName("lastSuccessfulBuild").item(0).getFirstChild().getTextContent(); - FaweVersion faweVersion = Fawe.instance().getVersion(); - if (faweVersion.build == 0) { - LOGGER.warn("You are using a snapshot or a custom version of FAWE. This is not an official build distributed " + - "via https://www.spigotmc.org/resources/13932/"); - return; - } - if (faweVersion.build < Integer.parseInt(UpdateNotification.faweVersion)) { - hasUpdate = true; - int versionDifference = Integer.parseInt(UpdateNotification.faweVersion) - faweVersion.build; - LOGGER.warn( - """ - An update for FastAsyncWorldEdit is available. You are {} build(s) out of date. - You are running build {}, the latest version is build {}. - Update at https://www.spigotmc.org/resources/13932/""", - versionDifference, - faweVersion.build, - UpdateNotification.faweVersion - ); - } - } catch (Exception e) { - LOGGER.error("Unable to check for updates. Skipping."); - } + final HttpRequest request = HttpRequest + .newBuilder() + .uri(URI.create("https://ci.athion.net/job/FastAsyncWorldEdit/api/xml/")) + .timeout(Duration.of(10L, ChronoUnit.SECONDS)) + .build(); + HttpClient.newHttpClient() + .sendAsync(request, HttpResponse.BodyHandlers.ofInputStream()) + .whenComplete((response, thrown) -> { + if (thrown != null) { + LOGGER.error("Update check failed: {} ", thrown.getMessage()); + } + processResponseBody(response.body()); + }); } } + private static void processResponseBody(InputStream body) { + try { + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); + DocumentBuilder db = dbf.newDocumentBuilder(); + Document doc = db.parse(body); + faweVersion = doc.getElementsByTagName("lastSuccessfulBuild").item(0).getFirstChild().getTextContent(); + FaweVersion faweVersion = Fawe.instance().getVersion(); + if (faweVersion.build == 0) { + LOGGER.warn("You are using a snapshot or a custom version of FAWE. This is not an official build distributed " + + "via https://www.spigotmc.org/resources/13932/"); + return; + } + if (faweVersion.build < Integer.parseInt(UpdateNotification.faweVersion)) { + hasUpdate = true; + int versionDifference = Integer.parseInt(UpdateNotification.faweVersion) - faweVersion.build; + LOGGER.warn( + """ + An update for FastAsyncWorldEdit is available. You are {} build(s) out of date. + You are running build {}, the latest version is build {}. + Update at https://www.spigotmc.org/resources/13932/""", + versionDifference, + faweVersion.build, + UpdateNotification.faweVersion + ); + } + } catch (Exception ignored) { + LOGGER.error("Unable to check for updates. Skipping."); + } + } + /** * Trigger an update notification based on captions. Useful to notify server administrators ingame. * From 685248d8de979ef85bd7b0cbbae0421bcf1e4628 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sun, 9 Jul 2023 15:16:30 +0100 Subject: [PATCH 123/161] chore: deprecate some methods that ought to be removed (#2340) --- .../core/configuration/Settings.java | 38 ++----------------- .../core/util/TaskManager.java | 16 +++++++- 2 files changed, 18 insertions(+), 36 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java index bb5f16eb3..174d59f37 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/configuration/Settings.java @@ -468,24 +468,6 @@ public class Settings extends Config { }) public int BUFFER_SIZE = 531441; - - @Comment({ - "The maximum time in milliseconds to wait for a chunk to load for an edit.", - " (50ms = 1 server tick, 0 = Fastest).", - " The default value of 100 should be safe for most cases.", - "", - "Actions which require loaded chunks (e.g. copy) which do not load in time", - " will use the last chunk as filler, which may appear as bands of duplicated blocks.", - "Actions usually wait about 25-50ms for the chunk to load, more if the server is lagging.", - "A value of 100ms does not force it to wait 100ms if the chunk loads in 10ms.", - "", - "This value is a timeout in case a chunk is never going to load (for whatever odd reason).", - "If the action times out, the operation continues by using the previous chunk as filler,", - " and displaying an error message. In this case, either copy a smaller section,", - " or increase chunk-wait-ms.", - "A value of 0 is faster simply because it doesn't bother loading the chunks or waiting.", - }) - public int CHUNK_WAIT_MS = 1000; @Comment("Delete history on disk after a number of days") public int DELETE_AFTER_DAYS = 7; @Comment("Delete history in memory on logout (does not effect disk)") @@ -493,6 +475,7 @@ public class Settings extends Config { @Comment({ "If history should be enabled by default for plugins using WorldEdit:", " - It is faster to have disabled", + " - It is faster to have disabled", " - Use of the FAWE API will not be effected" }) public boolean ENABLE_FOR_CONSOLE = true; @@ -515,10 +498,12 @@ public class Settings extends Config { @Create public static PROGRESS PROGRESS; + @Comment({ "This should equal the number of processors you have", }) public int PARALLEL_THREADS = Math.max(1, Runtime.getRuntime().availableProcessors()); + @Comment({ "When doing edits that effect more than this many chunks:", " - FAWE will start placing before all calculations are finished", @@ -530,14 +515,6 @@ public class Settings extends Config { }) public int TARGET_SIZE = 8 * Runtime.getRuntime().availableProcessors(); - @Comment({ - "Force FAWE to start placing chunks regardless of whether an edit is finished processing", - " - A larger value will use slightly less CPU time", - " - A smaller value will reduce memory usage", - " - A value too small may break some operations (deform?)" - }) - //TODO Find out where this was used and why the usage was removed - public int MAX_WAIT_MS = 1000; @Comment({ "Increase or decrease queue intensity (ms) [-50,50]:", @@ -566,13 +543,6 @@ public class Settings extends Config { }) public boolean POOL = true; - @Comment({ - "Discard edits which have been idle for a certain amount of time (ms)", - " - E.g. A plugin creates an EditSession but never does anything with it", - " - This only applies to plugins improperly using WorldEdit's legacy API" - }) - public int DISCARD_AFTER_MS = 60000; - @Comment({ "When using fastmode do not bother to tick existing/placed blocks/fluids", "Only works in versions up to 1.17.1" @@ -639,7 +609,7 @@ public class Settings extends Config { public boolean REMOVE_ENTITY_FROM_WORLD_ON_CHUNK_FAIL = true; @Comment({ - "Other experimental features" + "Increased debug logging for brush actions and processor setup" }) public boolean OTHER = false; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TaskManager.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TaskManager.java index f3abf0ac3..65025bcd0 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TaskManager.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TaskManager.java @@ -88,7 +88,10 @@ public abstract class TaskManager { /** * Run a bunch of tasks in parallel using the shared thread pool. + * + * @deprecated Deprecated without replacement as unused internally, and poor implementation of what it's designed to do. */ + @Deprecated(forRemoval = true, since = "TODO") public void parallel(Collection runables) { for (Runnable run : runables) { pool.submit(run); @@ -101,8 +104,9 @@ public abstract class TaskManager { * * @param runnables the tasks to run * @param numThreads number of threads (null = config.yml parallel threads) + * @deprecated Deprecated without replacement as unused internally, and poor implementation of what it's designed to do. */ - @Deprecated + @Deprecated(forRemoval = true, since = "TODO") public void parallel(Collection runnables, @Nullable Integer numThreads) { if (runnables == null) { return; @@ -271,13 +275,17 @@ public abstract class TaskManager { }); } + /** + * @deprecated Deprecated without replacement as unused internally, and poor implementation of what it's designed to do. + */ + @Deprecated(forRemoval = true, since = "TODO") public void wait(AtomicBoolean running, int timeout) { try { long start = System.currentTimeMillis(); synchronized (running) { while (running.get()) { running.wait(timeout); - if (running.get() && System.currentTimeMillis() - start > Settings.settings().QUEUE.DISCARD_AFTER_MS) { + if (running.get() && System.currentTimeMillis() - start > 60000) { new RuntimeException("FAWE is taking a long time to execute a task (might just be a symptom): ").printStackTrace(); LOGGER.info("For full debug information use: /fawe threads"); } @@ -288,6 +296,10 @@ public abstract class TaskManager { } } + /** + * @deprecated Deprecated without replacement as unused internally, and poor implementation of what it's designed to do. + */ + @Deprecated(forRemoval = true, since = "TODO") public void notify(AtomicBoolean running) { running.set(false); synchronized (running) { From 1f29ab3b79451c028d2b3ec2032ea667a5d4090e Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 10 Jul 2023 22:04:33 +0100 Subject: [PATCH 124/161] fix: fix command brush (#2347) --- .../core/command/tool/brush/CommandBrush.java | 43 +++++++++++----- .../command/tool/brush/ScatterCommand.java | 51 +++++++------------ .../worldedit/command/BrushCommands.java | 6 ++- 3 files changed, 52 insertions(+), 48 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CommandBrush.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CommandBrush.java index 4072828bf..227960c1d 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CommandBrush.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/CommandBrush.java @@ -22,9 +22,27 @@ import java.util.List; public class CommandBrush implements Brush { private final String command; + private final boolean print; + /** + * New instance + * + * @deprecated Use {@link CommandBrush#CommandBrush(String, boolean)} + */ + @Deprecated(forRemoval = true) public CommandBrush(String command) { - this.command = command.charAt(0) == '/' ? "/" + command : command; + this(command, false); + } + + /** + * New instance + * + * @param command command to run, or commands split by ';' + * @param print if output should be printed to the actor for the run commands + */ + public CommandBrush(String command, boolean print) { + this.command = command; + this.print = print; } @Override @@ -36,7 +54,7 @@ public class CommandBrush implements Brush { position.subtract(radius, radius, radius), position.add(radius, radius, radius) ); - String replaced = command.replace("{x}", position.getBlockX() + "") + String replaced = command.replace("{x}", Integer.toString(position.getBlockX())) .replace("{y}", Integer.toString(position.getBlockY())) .replace("{z}", Integer.toString(position.getBlockZ())) .replace("{world}", editSession.getWorld().getName()) @@ -46,21 +64,22 @@ public class CommandBrush implements Brush { if (!(actor instanceof Player player)) { throw FaweCache.PLAYER_ONLY; } - //Use max world height to allow full coverage of the world height - Location face = player.getBlockTraceFace(editSession.getWorld().getMaxY(), true); - if (face == null) { - position = position.add(0, 1, 1); - } else { - position = position.add(face.getDirection().toBlockPoint()); - } player.setSelection(selector); - AsyncPlayer wePlayer = new SilentPlayerWrapper(new LocationMaskedPlayerWrapper( + AsyncPlayer wePlayer = new LocationMaskedPlayerWrapper( player, new Location(player.getExtent(), position.toVector3()) - )); + ); + if (!print) { + wePlayer = new SilentPlayerWrapper(wePlayer); + } List cmds = StringMan.split(replaced, ';'); for (String cmd : cmds) { - CommandEvent event = new CommandEvent(wePlayer, cmd); + if (cmd.isBlank()) { + continue; + } + cmd = cmd.charAt(0) != '/' ? "/" + cmd : cmd; + cmd = cmd.length() >1 && cmd.charAt(1) == '/' ? cmd.substring(1) : cmd; + CommandEvent event = new CommandEvent(wePlayer, cmd, editSession); PlatformCommandManager.getInstance().handleCommandOnCurrentThread(event); } } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterCommand.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterCommand.java index 81be2640c..1d7841355 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterCommand.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/command/tool/brush/ScatterCommand.java @@ -3,7 +3,9 @@ package com.fastasyncworldedit.core.command.tool.brush; import com.fastasyncworldedit.core.FaweCache; import com.fastasyncworldedit.core.math.LocalBlockVectorSet; import com.fastasyncworldedit.core.util.StringMan; +import com.fastasyncworldedit.core.wrappers.AsyncPlayer; import com.fastasyncworldedit.core.wrappers.LocationMaskedPlayerWrapper; +import com.fastasyncworldedit.core.wrappers.SilentPlayerWrapper; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.entity.Player; @@ -13,7 +15,7 @@ import com.sk89q.worldedit.extension.platform.PlatformCommandManager; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.regions.selector.CuboidRegionSelector; -import com.sk89q.worldedit.util.formatting.text.Component; +import com.sk89q.worldedit.util.Location; import java.util.List; @@ -43,7 +45,7 @@ public class ScatterCommand extends ScatterBrush { position.subtract(radius, radius, radius), position.add(radius, radius, radius) ); - String replaced = command.replace("{x}", position.getBlockX() + "") + String replaced = command.replace("{x}", Integer.toString(position.getBlockX())) .replace("{y}", Integer.toString(position.getBlockY())) .replace("{z}", Integer.toString(position.getBlockZ())) .replace("{world}", editSession.getWorld().getName()) @@ -55,41 +57,22 @@ public class ScatterCommand extends ScatterBrush { } player.setSelection(selector); List cmds = StringMan.split(replaced, ';'); + AsyncPlayer wePlayer = new LocationMaskedPlayerWrapper( + player, + new Location(player.getExtent(), position.toVector3()) + ); + if (!print) { + wePlayer = new SilentPlayerWrapper(wePlayer); + } for (String cmd : cmds) { - Player p = print ? - new LocationMaskedPlayerWrapper(player, player.getLocation().setPosition(position.toVector3()), false) : - new ScatterCommandPlayerWrapper(player, position); - CommandEvent event = new CommandEvent(p, cmd, editSession); + if (cmd.isBlank()) { + continue; + } + cmd = cmd.charAt(0) != '/' ? "/" + cmd : cmd; + cmd = cmd.length() >1 && cmd.charAt(1) == '/' ? cmd.substring(1) : cmd; + CommandEvent event = new CommandEvent(wePlayer, cmd, editSession); PlatformCommandManager.getInstance().handleCommandOnCurrentThread(event); } } - private static final class ScatterCommandPlayerWrapper extends LocationMaskedPlayerWrapper { - - ScatterCommandPlayerWrapper(Player player, BlockVector3 position) { - super(player, player.getLocation().setPosition(position.toVector3()), false); - } - - @Override - public void print(String msg) { - } - - @Override - public void print(Component component) { - } - - @Override - public void printDebug(String msg) { - } - - @Override - public void printError(String msg) { - } - - @Override - public void printRaw(String msg) { - } - - } - } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java index 358f75413..76cb60c64 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/BrushCommands.java @@ -929,11 +929,13 @@ public class BrushCommands { @Arg(desc = "Expression") Expression radius, @Arg(desc = "Command to run") - List input + List input, + @Switch(name = 'p', desc = "Show any printed output") + boolean print ) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); String cmd = StringMan.join(input, " "); - set(context, new CommandBrush(cmd), "worldedit.brush.command").setSize(radius); + set(context, new CommandBrush(cmd, print), "worldedit.brush.command").setSize(radius); } @Command( From c0e20a6fe5ec610f7ee0d9c4022ef01030792216 Mon Sep 17 00:00:00 2001 From: Jordan Date: Mon, 10 Jul 2023 22:16:05 +0100 Subject: [PATCH 125/161] feat: provide some information upon OverlappingFileLockException (#2341) --- .../clipboard/DiskOptimizedClipboard.java | 36 ++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java index a9704e36b..3f7c746c3 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/clipboard/DiskOptimizedClipboard.java @@ -39,6 +39,8 @@ import java.net.URI; import java.nio.ByteBuffer; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; +import java.nio.channels.FileLock; +import java.nio.channels.OverlappingFileLockException; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; @@ -46,6 +48,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; /** * A clipboard with disk backed storage. (lower memory + loads on crash) @@ -59,6 +62,7 @@ public class DiskOptimizedClipboard extends LinearClipboard { private static final int HEADER_SIZE = 27; // Current header size private static final int VERSION_1_HEADER_SIZE = 22; // Header size of "version 1" private static final int VERSION_2_HEADER_SIZE = 27; // Header size of "version 2" i.e. when NBT/entities could be saved + private static final Map LOCK_HOLDER_CACHE = new ConcurrentHashMap<>(); private final HashMap nbtMap; private final File file; @@ -301,7 +305,23 @@ public class DiskOptimizedClipboard extends LinearClipboard { private void init() throws IOException { if (this.fileChannel == null) { this.fileChannel = braf.getChannel(); - this.fileChannel.lock(); + try { + FileLock lock = this.fileChannel.lock(); + LOCK_HOLDER_CACHE.put(file.getName(), new LockHolder(lock)); + } catch (OverlappingFileLockException e) { + LockHolder existing = LOCK_HOLDER_CACHE.get(file.getName()); + if (existing != null) { + long ms = System.currentTimeMillis() - existing.lockHeldSince; + LOGGER.error( + "Cannot lock clipboard file {} acquired by thread {}, {}ms ago", + file.getName(), + existing.thread, + ms + ); + } + // Rethrow to prevent clipboard access + throw e; + } this.byteBuffer = fileChannel.map(FileChannel.MapMode.READ_WRITE, 0, braf.length()); } } @@ -737,4 +757,18 @@ public class DiskOptimizedClipboard extends LinearClipboard { return false; } + private static class LockHolder { + + final FileLock lock; + final long lockHeldSince; + final String thread; + + LockHolder(FileLock lock) { + this.lock = lock; + lockHeldSince = System.currentTimeMillis(); + this.thread = Thread.currentThread().getName(); + } + } + + } From 0a19f643b65f1f9b7c3fb79b67c123ed8f11a2ba Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Tue, 11 Jul 2023 16:39:53 +0100 Subject: [PATCH 126/161] fix #2349 --- .../plotsquared/PlotSquaredFeature.java | 10 +++- .../core/regions/FaweMask.java | 7 ++- .../worldedit/command/UtilityCommands.java | 58 +++++++++++++++++++ 3 files changed, 71 insertions(+), 4 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java index e28602292..a34fac51f 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java @@ -23,9 +23,11 @@ import com.sk89q.worldedit.world.World; import org.apache.logging.log4j.Logger; import org.bukkit.Bukkit; +import javax.annotation.Nonnull; import java.lang.ref.WeakReference; import java.util.List; import java.util.Locale; +import java.util.Objects; import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; @@ -192,6 +194,10 @@ public class PlotSquaredFeature extends FaweMaskManager { maskedRegion = new RegionIntersection(world, weRegions); } + if (plot == null) { + return new FaweMask(maskedRegion); + } + return new PlotSquaredMask(maskedRegion, finalPlot); } @@ -201,9 +207,9 @@ public class PlotSquaredFeature extends FaweMaskManager { private final WeakReference> connectedPlots; private final boolean singlePlot; - private PlotSquaredMask(Region region, Plot plot) { + private PlotSquaredMask(@Nonnull Region region, @Nonnull Plot plot) { super(region); - this.plot = plot; + this.plot = Objects.requireNonNull(plot); Set connected = plot.getConnectedPlots(); connectedPlots = new WeakReference<>(connected); singlePlot = connected.size() == 1; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMask.java index 4ea8c2c06..478ac90c9 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMask.java @@ -4,12 +4,15 @@ import com.fastasyncworldedit.core.extent.processor.ProcessorScope; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.regions.Region; +import javax.annotation.Nonnull; +import java.util.Objects; + public class FaweMask implements IDelegateRegion { private final Region region; - public FaweMask(Region region) { - this.region = region; + public FaweMask(@Nonnull Region region) { + this.region = Objects.requireNonNull(region); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java index f064868b4..aca13bc46 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/UtilityCommands.java @@ -50,12 +50,19 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormat; import com.sk89q.worldedit.extent.clipboard.io.ClipboardFormats; import com.sk89q.worldedit.function.EntityFunction; +import com.sk89q.worldedit.function.block.BlockReplace; import com.sk89q.worldedit.function.mask.BlockTypeMask; +import com.sk89q.worldedit.function.mask.BoundedHeightMask; import com.sk89q.worldedit.function.mask.ExistingBlockMask; import com.sk89q.worldedit.function.mask.Mask; +import com.sk89q.worldedit.function.mask.MaskIntersection; +import com.sk89q.worldedit.function.mask.Masks; +import com.sk89q.worldedit.function.mask.RegionMask; import com.sk89q.worldedit.function.operation.Operations; import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.function.visitor.DownwardVisitor; import com.sk89q.worldedit.function.visitor.EntityVisitor; +import com.sk89q.worldedit.function.visitor.RecursiveVisitor; import com.sk89q.worldedit.internal.annotation.Direction; import com.sk89q.worldedit.internal.annotation.VertHeight; import com.sk89q.worldedit.internal.expression.EvaluationException; @@ -63,8 +70,10 @@ import com.sk89q.worldedit.internal.expression.Expression; import com.sk89q.worldedit.internal.expression.ExpressionException; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.math.Vector2; +import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.CylinderRegion; +import com.sk89q.worldedit.regions.EllipsoidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.util.formatting.component.SubtleFormat; import com.sk89q.worldedit.util.formatting.text.Component; @@ -836,6 +845,55 @@ public class UtilityCommands { } } +// @Command( +// name = "/hollowr", +// desc = "Hollow out a space recursively with a pattern" +// ) +// @CommandPermissions("worldedit.hollowr") +// @Logging(PLACEMENT) +// public int hollowr( +// Actor actor, +// LocalSession session, +// EditSession editSession, +// @Arg(desc = "The radius to hollow out") Expression radiusExp, +// @ArgFlag(name = 'p', desc = "The blocks to fill with") Pattern pattern, +// @ArgFlag(name = 'm', desc = "The blocks remove", def = "") Mask mask +// ) throws WorldEditException { +// //FAWE start +// double radius = radiusExp.evaluate(); +// //FAWE end +// radius = Math.max(1, radius); +// we.checkMaxRadius(radius); +// if (mask == null) { +// Mask mask = new MaskIntersection( +// new RegionMask(new EllipsoidRegion(null, origin, Vector3.at(radius, radius, radius))), +// new BoundedHeightMask( +// Math.max(lowerBound, minY), +// Math.min(maxY, origin.getBlockY()) +// ), +// Masks.negate(new ExistingBlockMask(this)) +// ); +// } +// +// // Want to replace blocks +// BlockReplace replace = new BlockReplace(this, pattern); +// +// // Pick how we're going to visit blocks +// RecursiveVisitor visitor; +// //FAWE start - provide extent for preloading, min/max y +// if (recursive) { +// visitor = new RecursiveVisitor(mask, replace, (int) (radius * 2 + 1), minY, maxY, this); +// } else { +// visitor = new DownwardVisitor(mask, replace, origin.getBlockY(), (int) (radius * 2 + 1), minY, maxY, this); +// } +// //FAWE end +// +// BlockVector3 pos = session.getPlacementPosition(actor); +// int affected = editSession.res(pos, pattern, radius, depth, true); +// actor.print(Caption.of("worldedit.fillr.created", TextComponent.of(affected))); +// return affected; +// } + public static List> filesToEntry(final File root, final List files, final UUID uuid) { return files.stream() .map(input -> { // Keep this functional, as transform is evaluated lazily From a680c7ce97321da0fbb3afd13cf69684a8544e52 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Thu, 13 Jul 2023 17:08:18 +0100 Subject: [PATCH 127/161] fix: fix #2352 --- .../sk89q/worldedit/extension/platform/AbstractPlayerActor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java index d02819dc6..6adf7236c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java @@ -709,7 +709,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { @Override public void checkPermission(String permission) throws AuthorizationException { if (!hasPermission(permission)) { - throw new AuthorizationException(); + throw new AuthorizationException(Caption.of("fawe.error.no-perm", permission)); } } From 1745c50878435cb24aeed98ee70f8caad9692b6c Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sat, 15 Jul 2023 09:26:00 +0200 Subject: [PATCH 128/161] Improve error behaviour of //generate --- .../src/main/java/com/sk89q/worldedit/EditSession.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index f8a08148b..780ba90e1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -2991,9 +2991,10 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } catch (ExpressionTimeoutException e) { timedOut[0] = timedOut[0] + 1; return null; + } catch (RuntimeException e) { + throw e; } catch (Exception e) { - LOGGER.warn("Failed to create shape", e); - return null; + throw new RuntimeException(e); } } }; From 8da530ee8044bf37ea129cab12c0df6a337bdbb8 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sat, 15 Jul 2023 12:27:33 +0100 Subject: [PATCH 129/161] gracefully handle error in EntityInBlockRemovingProcessor - ensures edit continues on chunk correctly --- .../EntityInBlockRemovingProcessor.java | 44 +++++++++++-------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EntityInBlockRemovingProcessor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EntityInBlockRemovingProcessor.java index 0a8839409..1ffea1266 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EntityInBlockRemovingProcessor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EntityInBlockRemovingProcessor.java @@ -6,8 +6,10 @@ import com.fastasyncworldedit.core.queue.IChunkGet; import com.fastasyncworldedit.core.queue.IChunkSet; import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.math.BlockVector3; import com.sk89q.worldedit.world.block.BlockTypes; +import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.Nullable; /** @@ -17,27 +19,33 @@ import org.jetbrains.annotations.Nullable; */ public class EntityInBlockRemovingProcessor implements IBatchProcessor { + private static final Logger LOGGER = LogManagerCompat.getLogger(); + @Override public IChunkSet processSet(final IChunk chunk, final IChunkGet get, final IChunkSet set) { - for (CompoundTag tag : get.getEntities()) { - // Empty tags for seemingly non-existent entities can exist? - if (tag.getList("Pos").size() == 0) { - continue; - } - BlockVector3 pos = tag.getEntityPosition().toBlockPoint(); - int x = pos.getX() & 15; - int y = pos.getY(); - int z = pos.getZ() & 15; - if (!set.hasSection(y >> 4)) { - continue; - } - if (set.getBlock(x, y, z).getBlockType() != BlockTypes.__RESERVED__ && !set - .getBlock(x, y, z) - .getBlockType() - .getMaterial() - .isAir()) { - set.removeEntity(tag.getUUID()); + try { + for (CompoundTag tag : get.getEntities()) { + // Empty tags for seemingly non-existent entities can exist? + if (tag.getList("Pos").size() == 0) { + continue; + } + BlockVector3 pos = tag.getEntityPosition().toBlockPoint(); + int x = pos.getX() & 15; + int y = pos.getY(); + int z = pos.getZ() & 15; + if (!set.hasSection(y >> 4)) { + continue; + } + if (set.getBlock(x, y, z).getBlockType() != BlockTypes.__RESERVED__ && !set + .getBlock(x, y, z) + .getBlockType() + .getMaterial() + .isAir()) { + set.removeEntity(tag.getUUID()); + } } + } catch (Exception e) { + LOGGER.warn("Could not remove entities in blocks in chunk {},{}", chunk.getX(), chunk.getZ(), e); } return set; } From f4da4b0287d431b30cf39f77cf6089683bb38d32 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sat, 15 Jul 2023 16:40:29 +0100 Subject: [PATCH 130/161] fix: fix adding/getting masks to/from MaskExtent when it is a processor (#2351) - fixes #2350 --- .../core/util/ProcessorTraverser.java | 44 +++++++++++++++++++ .../java/com/sk89q/worldedit/EditSession.java | 32 ++++++++++---- 2 files changed, 67 insertions(+), 9 deletions(-) create mode 100644 worldedit-core/src/main/java/com/fastasyncworldedit/core/util/ProcessorTraverser.java diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/ProcessorTraverser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/ProcessorTraverser.java new file mode 100644 index 000000000..3c3a601a1 --- /dev/null +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/ProcessorTraverser.java @@ -0,0 +1,44 @@ +package com.fastasyncworldedit.core.util; + +import com.fastasyncworldedit.core.extent.processor.BatchProcessorHolder; +import com.fastasyncworldedit.core.extent.processor.MultiBatchProcessor; +import com.fastasyncworldedit.core.queue.IBatchProcessor; +import com.sk89q.worldedit.internal.util.LogManagerCompat; +import org.apache.logging.log4j.Logger; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import java.util.ArrayDeque; +import java.util.Queue; + +public class ProcessorTraverser { + + private static final Logger LOGGER = LogManagerCompat.getLogger(); + + private final T root; + + public ProcessorTraverser(@Nonnull T root) { + this.root = root; + } + + public @Nullable U find(Class clazz) { + try { + Queue processors = new ArrayDeque<>(); + IBatchProcessor processor = root; + do { + if (clazz.isAssignableFrom(processor.getClass())) { + return clazz.cast(processor); + } else if (processor instanceof MultiBatchProcessor multiProcessor) { + processors.addAll(multiProcessor.getBatchProcessors()); + } else if (processor instanceof BatchProcessorHolder holder) { + processors.add(holder.getProcessor()); + } + } while ((processor = processors.poll()) != null); + return null; + } catch (Throwable e) { + LOGGER.error("Error traversing processors", e); + return null; + } + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index 780ba90e1..03b838de6 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -30,6 +30,7 @@ import com.fastasyncworldedit.core.extent.ResettableExtent; import com.fastasyncworldedit.core.extent.SingleRegionExtent; import com.fastasyncworldedit.core.extent.SourceMaskExtent; import com.fastasyncworldedit.core.extent.clipboard.WorldCopyClipboard; +import com.fastasyncworldedit.core.extent.processor.ExtentBatchProcessorHolder; import com.fastasyncworldedit.core.extent.processor.lighting.NullRelighter; import com.fastasyncworldedit.core.extent.processor.lighting.Relighter; import com.fastasyncworldedit.core.function.SurfaceRegionFunction; @@ -55,6 +56,7 @@ import com.fastasyncworldedit.core.queue.implementation.preloader.Preloader; import com.fastasyncworldedit.core.util.ExtentTraverser; import com.fastasyncworldedit.core.util.MaskTraverser; import com.fastasyncworldedit.core.util.MathMan; +import com.fastasyncworldedit.core.util.ProcessorTraverser; import com.fastasyncworldedit.core.util.TaskManager; import com.fastasyncworldedit.core.util.collection.BlockVector3Set; import com.fastasyncworldedit.core.util.task.RunnableVal; @@ -524,9 +526,15 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { * @return mask, may be null */ public Mask getMask() { - //FAWE start - ExtendTraverser & MaskingExtents - ExtentTraverser maskingExtent = new ExtentTraverser<>(getExtent()).find(MaskingExtent.class); - return maskingExtent != null ? maskingExtent.get().getMask() : null; + //FAWE start - ExtentTraverser & MaskingExtents + MaskingExtent maskingExtent = new ExtentTraverser<>(getExtent()).findAndGet(MaskingExtent.class); + if (maskingExtent == null) { + ExtentTraverser processorExtent = + new ExtentTraverser<>(getExtent()).find(ExtentBatchProcessorHolder.class); + maskingExtent = + new ProcessorTraverser<>(processorExtent.get().getProcessor()).find(MaskingExtent.class); + } + return maskingExtent != null ? maskingExtent.getMask() : null; //FAWE end } @@ -609,23 +617,29 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { //FAWE start - use MaskingExtent & ExtentTraverser /** - * Set a mask. + * Set a mask. Combines with any existing masks, set null to clear existing masks. * * @param mask mask or null */ - public void setMask(Mask mask) { + public void setMask(@Nullable Mask mask) { if (mask == null) { mask = Masks.alwaysTrue(); } else { new MaskTraverser(mask).reset(this); } - ExtentTraverser maskingExtent = new ExtentTraverser<>(getExtent()).find(MaskingExtent.class); - if (maskingExtent != null && maskingExtent.get() != null) { - Mask oldMask = maskingExtent.get().getMask(); + MaskingExtent maskingExtent = new ExtentTraverser<>(getExtent()).findAndGet(MaskingExtent.class); + if (maskingExtent == null && mask != Masks.alwaysTrue()) { + ExtentTraverser processorExtent = + new ExtentTraverser<>(getExtent()).find(ExtentBatchProcessorHolder.class); + maskingExtent = + new ProcessorTraverser<>(processorExtent.get().getProcessor()).find(MaskingExtent.class); + } + if (maskingExtent != null) { + Mask oldMask = maskingExtent.getMask(); if (oldMask instanceof ResettableMask) { ((ResettableMask) oldMask).reset(); } - maskingExtent.get().setMask(mask); + maskingExtent.setMask(mask); } else if (mask != Masks.alwaysTrue()) { addProcessor(new MaskingExtent(getExtent(), mask)); } From e6b1308590098db40ea346c8d2412d02dcdb35bc Mon Sep 17 00:00:00 2001 From: Jordan Date: Sat, 15 Jul 2023 16:40:52 +0100 Subject: [PATCH 131/161] feat: synchronise disk clipboard loading and deletion to clipboardLock (#2342) - another possible help towards the OverlappingFileLockException --- .../com/fastasyncworldedit/core/Fawe.java | 1 - .../com/sk89q/worldedit/LocalSession.java | 57 +++++++++++++++++++ .../com/sk89q/worldedit/entity/Player.java | 35 +----------- 3 files changed, 59 insertions(+), 34 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java index eb7eaf8ce..b4d2816c3 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/Fawe.java @@ -449,7 +449,6 @@ public class Fawe { * @return Executor used for clipboard IO if clipboard on disk is enabled or null * @since 2.6.2 */ - @Nullable public KeyQueuedExecutorService getClipboardExecutor() { return this.clipboardExecutor; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java index dfa29a2e3..3391bad80 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/LocalSession.java @@ -23,8 +23,10 @@ import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.extent.ResettableExtent; +import com.fastasyncworldedit.core.extent.clipboard.DiskOptimizedClipboard; import com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder; import com.fastasyncworldedit.core.history.DiskStorageHistory; +import com.fastasyncworldedit.core.internal.exception.FaweClipboardVersionMismatchException; import com.fastasyncworldedit.core.internal.io.FaweInputStream; import com.fastasyncworldedit.core.internal.io.FaweOutputStream; import com.fastasyncworldedit.core.limit.FaweLimit; @@ -50,6 +52,8 @@ import com.sk89q.worldedit.command.tool.Tool; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Locatable; +import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; +import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.extent.inventory.BlockBag; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.function.operation.ChangeSetExecutor; @@ -93,6 +97,7 @@ import java.util.ListIterator; import java.util.Objects; import java.util.TimeZone; import java.util.UUID; +import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -877,6 +882,58 @@ public class LocalSession implements TextureHolder { } } } + + /** + * Load a clipboard from disk and into this localsession. Synchronises with other clipboard setting/getting to and from + * this session + * + * @param file Clipboard file to load + * @throws FaweClipboardVersionMismatchException in clipboard version mismatch (between saved and internal, expected, version) + * @throws ExecutionException if the computation threw an exception + * @throws InterruptedException if the current thread was interrupted while waiting + */ + public void loadClipboardFromDisk(File file) throws FaweClipboardVersionMismatchException, ExecutionException, + InterruptedException { + synchronized (clipboardLock) { + if (file.exists() && file.length() > 5) { + try { + if (getClipboard() != null) { + return; + } + } catch (EmptyClipboardException ignored) { + } + DiskOptimizedClipboard doc = Fawe.instance().getClipboardExecutor().submit( + uuid, + () -> DiskOptimizedClipboard.loadFromFile(file) + ).get(); + Clipboard clip = doc.toClipboard(); + ClipboardHolder holder = new ClipboardHolder(clip); + setClipboard(holder); + } + } + } + + public void deleteClipboardOnDisk() { + synchronized (clipboardLock) { + ClipboardHolder holder = getExistingClipboard(); + if (holder != null) { + for (Clipboard clipboard : holder.getClipboards()) { + DiskOptimizedClipboard doc; + if (clipboard instanceof DiskOptimizedClipboard) { + doc = (DiskOptimizedClipboard) clipboard; + } else if (clipboard instanceof BlockArrayClipboard && ((BlockArrayClipboard) clipboard).getParent() instanceof DiskOptimizedClipboard) { + doc = (DiskOptimizedClipboard) ((BlockArrayClipboard) clipboard).getParent(); + } else { + continue; + } + Fawe.instance().getClipboardExecutor().submit(uuid, () -> { + doc.close(); // Ensure closed before deletion + doc.getFile().delete(); + }); + } + } + } + } //FAWE end /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java index 8f5b5cb53..277d755b1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java @@ -426,23 +426,7 @@ public interface Player extends Entity, Actor { cancel(true); LocalSession session = getSession(); if (Settings.settings().CLIPBOARD.USE_DISK && Settings.settings().CLIPBOARD.DELETE_ON_LOGOUT) { - ClipboardHolder holder = session.getExistingClipboard(); - if (holder != null) { - for (Clipboard clipboard : holder.getClipboards()) { - DiskOptimizedClipboard doc; - if (clipboard instanceof DiskOptimizedClipboard) { - doc = (DiskOptimizedClipboard) clipboard; - } else if (clipboard instanceof BlockArrayClipboard && ((BlockArrayClipboard) clipboard).getParent() instanceof DiskOptimizedClipboard) { - doc = (DiskOptimizedClipboard) ((BlockArrayClipboard) clipboard).getParent(); - } else { - continue; - } - Fawe.instance().getClipboardExecutor().submit(getUniqueId(), () -> { - doc.close(); // Ensure closed before deletion - doc.getFile().delete(); - }); - } - } + session.deleteClipboardOnDisk(); } else if (Settings.settings().CLIPBOARD.USE_DISK) { Fawe.instance().getClipboardExecutor().submit(getUniqueId(), () -> session.setClipboard(null)); } else if (Settings.settings().CLIPBOARD.DELETE_ON_LOGOUT) { @@ -464,22 +448,7 @@ public interface Player extends Entity, Actor { Settings.settings().PATHS.CLIPBOARD + File.separator + getUniqueId() + ".bd" ); try { - if (file.exists() && file.length() > 5) { - LocalSession session = getSession(); - try { - if (session.getClipboard() != null) { - return; - } - } catch (EmptyClipboardException ignored) { - } - DiskOptimizedClipboard doc = Fawe.instance().getClipboardExecutor().submit( - getUniqueId(), - () -> DiskOptimizedClipboard.loadFromFile(file) - ).get(); - Clipboard clip = doc.toClipboard(); - ClipboardHolder holder = new ClipboardHolder(clip); - session.setClipboard(holder); - } + getSession().loadClipboardFromDisk(file); } catch (FaweClipboardVersionMismatchException e) { print(e.getComponent()); } catch (RuntimeException e) { From b1e0ad4ef7f39a5d376b374180f69930927168c3 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sat, 15 Jul 2023 16:41:04 +0100 Subject: [PATCH 132/161] feat: re-submit chunk load request after 10s after checking world is loaded (#2339) - #2332 makes it seem like paper forgets to load a chunk sometimes - resubmit chunk load request after a second to attempt to counter this --- .../PaperweightPlatformAdapter.java | 23 ++++++++++++++- .../v1_18_R2/PaperweightPlatformAdapter.java | 28 +++++++++++++++---- .../v1_19_R3/PaperweightPlatformAdapter.java | 26 ++++++++++++++--- .../v1_20_R1/PaperweightPlatformAdapter.java | 23 ++++++++++++++- 4 files changed, 88 insertions(+), 12 deletions(-) diff --git a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightPlatformAdapter.java index 69ab5fe9b..688a84a14 100644 --- a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightPlatformAdapter.java @@ -12,6 +12,7 @@ import com.fastasyncworldedit.core.util.ReflectionUtils; import com.fastasyncworldedit.core.util.TaskManager; import com.mojang.datafixers.util.Either; import com.sk89q.worldedit.bukkit.adapter.Refraction; +import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.block.BlockState; @@ -48,6 +49,8 @@ import net.minecraft.world.level.chunk.Palette; import net.minecraft.world.level.chunk.PalettedContainer; import net.minecraft.world.level.gameevent.GameEventDispatcher; import net.minecraft.world.level.gameevent.GameEventListener; +import org.apache.logging.log4j.Logger; +import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_17_R1.CraftChunk; import sun.misc.Unsafe; @@ -61,6 +64,8 @@ import java.util.Locale; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Semaphore; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import java.util.function.Function; import java.util.stream.Stream; @@ -91,6 +96,8 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { private static final Field fieldRemove; + private static final Logger LOGGER = LogManagerCompat.getLogger(); + static { try { fieldBits = PalettedContainer.class.getDeclaredField(Refraction.pickName("bits", "l")); @@ -225,7 +232,21 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { } CompletableFuture future = serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true); try { - CraftChunk chunk = (CraftChunk) future.get(); + CraftChunk chunk; + try { + chunk = (CraftChunk) future.get(10, TimeUnit.SECONDS); + } catch (TimeoutException e) { + String world = serverLevel.getWorld().getName(); + // We've already taken 10 seconds we can afford to wait a little here. + boolean loaded = TaskManager.taskManager().sync(() -> Bukkit.getWorld(world) != null); + if (loaded) { + LOGGER.warn("Chunk {},{} failed to load in 10 seconds in world {}. Retrying...", chunkX, chunkZ, world); + // Retry chunk load + chunk = (CraftChunk) serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true).get(); + } else { + throw new UnsupportedOperationException("Cannot load chunk from unloaded world " + world + "!"); + } + } return chunk.getHandle(); } catch (Throwable e) { e.printStackTrace(); diff --git a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightPlatformAdapter.java index 8e982a84e..dbf7f88f3 100644 --- a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightPlatformAdapter.java @@ -13,17 +13,16 @@ import com.mojang.datafixers.util.Either; import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.bukkit.adapter.Refraction; +import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.block.BlockState; import com.sk89q.worldedit.world.block.BlockTypesCache; import io.papermc.lib.PaperLib; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import net.minecraft.core.BlockPos; import net.minecraft.core.Holder; import net.minecraft.core.IdMap; import net.minecraft.core.Registry; -import net.minecraft.core.SectionPos; import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; import net.minecraft.server.level.ChunkHolder; import net.minecraft.server.level.ChunkMap; @@ -41,7 +40,6 @@ import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.EntityBlock; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.chunk.GlobalPalette; import net.minecraft.world.level.chunk.HashMapPalette; @@ -51,8 +49,8 @@ import net.minecraft.world.level.chunk.LinearPalette; import net.minecraft.world.level.chunk.Palette; import net.minecraft.world.level.chunk.PalettedContainer; import net.minecraft.world.level.chunk.SingleValuePalette; -import net.minecraft.world.level.gameevent.GameEventDispatcher; -import net.minecraft.world.level.gameevent.GameEventListener; +import org.apache.logging.log4j.Logger; +import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_18_R2.CraftChunk; import sun.misc.Unsafe; @@ -75,6 +73,8 @@ import java.util.Map; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Semaphore; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import java.util.function.Function; public final class PaperweightPlatformAdapter extends NMSAdapter { @@ -106,6 +106,8 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { private static final Field fieldRemove; + private static final Logger LOGGER = LogManagerCompat.getLogger(); + static { try { fieldData = PalettedContainer.class.getDeclaredField(Refraction.pickName("data", "d")); @@ -253,7 +255,21 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { } CompletableFuture future = serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true); try { - CraftChunk chunk = (CraftChunk) future.get(); + CraftChunk chunk; + try { + chunk = (CraftChunk) future.get(10, TimeUnit.SECONDS); + } catch (TimeoutException e) { + String world = serverLevel.getWorld().getName(); + // We've already taken 10 seconds we can afford to wait a little here. + boolean loaded = TaskManager.taskManager().sync(() -> Bukkit.getWorld(world) != null); + if (loaded) { + LOGGER.warn("Chunk {},{} failed to load in 10 seconds in world {}. Retrying...", chunkX, chunkZ, world); + // Retry chunk load + chunk = (CraftChunk) serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true).get(); + } else { + throw new UnsupportedOperationException("Cannot load chunk from unloaded world " + world + "!"); + } + } return chunk.getHandle(); } catch (Throwable e) { e.printStackTrace(); diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java index 5af8f2806..d351bbacd 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightPlatformAdapter.java @@ -14,6 +14,7 @@ import com.mojang.datafixers.util.Either; import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.bukkit.adapter.Refraction; +import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.block.BlockState; @@ -43,7 +44,6 @@ import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.GlobalPalette; import net.minecraft.world.level.chunk.HashMapPalette; @@ -54,6 +54,8 @@ import net.minecraft.world.level.chunk.Palette; import net.minecraft.world.level.chunk.PalettedContainer; import net.minecraft.world.level.chunk.SingleValuePalette; import net.minecraft.world.level.entity.PersistentEntitySectionManager; +import org.apache.logging.log4j.Logger; +import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_19_R3.CraftChunk; import sun.misc.Unsafe; @@ -61,7 +63,6 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.lang.invoke.MethodHandle; import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodType; import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; @@ -77,9 +78,10 @@ import java.util.Map; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Semaphore; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import java.util.function.Function; -import static java.lang.invoke.MethodType.methodType; import static net.minecraft.core.registries.Registries.BIOME; public final class PaperweightPlatformAdapter extends NMSAdapter { @@ -111,6 +113,8 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { private static final Field fieldRemove; + private static final Logger LOGGER = LogManagerCompat.getLogger(); + static final boolean POST_CHUNK_REWRITE; private static Method PAPER_CHUNK_GEN_ALL_ENTITIES; private static Field LEVEL_CHUNK_ENTITIES; @@ -287,7 +291,21 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { } CompletableFuture future = serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true); try { - CraftChunk chunk = (CraftChunk) future.get(); + CraftChunk chunk; + try { + chunk = (CraftChunk) future.get(10, TimeUnit.SECONDS); + } catch (TimeoutException e) { + String world = serverLevel.getWorld().getName(); + // We've already taken 10 seconds we can afford to wait a little here. + boolean loaded = TaskManager.taskManager().sync(() -> Bukkit.getWorld(world) != null); + if (loaded) { + LOGGER.warn("Chunk {},{} failed to load in 10 seconds in world {}. Retrying...", chunkX, chunkZ, world); + // Retry chunk load + chunk = (CraftChunk) serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true).get(); + } else { + throw new UnsupportedOperationException("Cannot load chunk from unloaded world " + world + "!"); + } + } addTicket(serverLevel, chunkX, chunkZ); return (LevelChunk) chunk.getHandle(ChunkStatus.FULL); } catch (Throwable e) { diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPlatformAdapter.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPlatformAdapter.java index f66e7dd6a..8cb8a8662 100644 --- a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPlatformAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightPlatformAdapter.java @@ -14,6 +14,7 @@ import com.mojang.datafixers.util.Either; import com.sk89q.worldedit.bukkit.WorldEditPlugin; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.bukkit.adapter.Refraction; +import com.sk89q.worldedit.internal.util.LogManagerCompat; import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.block.BlockState; @@ -54,6 +55,8 @@ import net.minecraft.world.level.chunk.Palette; import net.minecraft.world.level.chunk.PalettedContainer; import net.minecraft.world.level.chunk.SingleValuePalette; import net.minecraft.world.level.entity.PersistentEntitySectionManager; +import org.apache.logging.log4j.Logger; +import org.bukkit.Bukkit; import org.bukkit.craftbukkit.v1_20_R1.CraftChunk; import sun.misc.Unsafe; @@ -77,6 +80,8 @@ import java.util.Map; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Semaphore; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; import java.util.function.Function; import static java.lang.invoke.MethodType.methodType; @@ -117,6 +122,8 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { private static final Field fieldRemove; + private static final Logger LOGGER = LogManagerCompat.getLogger(); + static final boolean POST_CHUNK_REWRITE; private static Method PAPER_CHUNK_GEN_ALL_ENTITIES; private static Field LEVEL_CHUNK_ENTITIES; @@ -307,7 +314,21 @@ public final class PaperweightPlatformAdapter extends NMSAdapter { } CompletableFuture future = serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true); try { - CraftChunk chunk = (CraftChunk) future.get(); + CraftChunk chunk; + try { + chunk = (CraftChunk) future.get(10, TimeUnit.SECONDS); + } catch (TimeoutException e) { + String world = serverLevel.getWorld().getName(); + // We've already taken 10 seconds we can afford to wait a little here. + boolean loaded = TaskManager.taskManager().sync(() -> Bukkit.getWorld(world) != null); + if (loaded) { + LOGGER.warn("Chunk {},{} failed to load in 10 seconds in world {}. Retrying...", chunkX, chunkZ, world); + // Retry chunk load + chunk = (CraftChunk) serverLevel.getWorld().getChunkAtAsync(chunkX, chunkZ, true, true).get(); + } else { + throw new UnsupportedOperationException("Cannot load chunk from unloaded world " + world + "!"); + } + } addTicket(serverLevel, chunkX, chunkZ); return (LevelChunk) CRAFT_CHUNK_GET_HANDLE.invoke(chunk); } catch (Throwable e) { From e0507e64402315f4829aa077cf30d8428ea6ab0e Mon Sep 17 00:00:00 2001 From: Chris Lang Date: Sat, 15 Jul 2023 00:22:45 -0700 Subject: [PATCH 133/161] Added cone generation command (#2251) * Added cone generation command * Fix formatting problems --------- Co-authored-by: Madeline Miller --- .../java/com/sk89q/worldedit/EditSession.java | 84 +++++++++++++++++++ .../worldedit/command/GenerationCommands.java | 43 ++++++++++ .../src/main/resources/lang/strings.json | 2 + 3 files changed, 129 insertions(+) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index 03b838de6..f60a1cbf2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -2284,6 +2284,90 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { //FAWE end } + /** + * Makes a cone. + * + * @param pos Center of the cone + * @param block The block pattern to use + * @param radiusX The cone's largest north/south extent + * @param radiusZ The cone's largest east/west extent + * @param height The cone's up/down extent. If negative, extend downward. + * @param filled If false, only a shell will be generated. + * @param thickness The cone's wall thickness, if it's hollow. + * @return number of blocks changed + * @throws MaxChangedBlocksException thrown if too many blocks are changed + */ + public int makeCone( + BlockVector3 pos, + Pattern block, + double radiusX, + double radiusZ, + int height, + boolean filled, + double thickness + ) throws MaxChangedBlocksException { + int affected = 0; + + final int ceilRadiusX = (int) Math.ceil(radiusX); + final int ceilRadiusZ = (int) Math.ceil(radiusZ); + + double rx2 = Math.pow(radiusX, 2); + double ry2 = Math.pow(height, 2); + double rz2 = Math.pow(radiusZ, 2); + + int cx = pos.getX(); + int cy = pos.getY(); + int cz = pos.getZ(); + + for (int y = 0; y < height; ++y) { + double ySquaredMinusHeightOverHeightSquared = Math.pow(y - height, 2) / ry2; + int yy = cy + y; + forX: + for (int x = 0; x <= ceilRadiusX; ++x) { + double xSquaredOverRadiusX = Math.pow(x, 2) / rx2; + int xx = cx + x; + forZ: + for (int z = 0; z <= ceilRadiusZ; ++z) { + int zz = cz + z; + double zSquaredOverRadiusZ = Math.pow(z, 2) / rz2; + double distanceFromOriginMinusHeightSquared = xSquaredOverRadiusX + zSquaredOverRadiusZ - ySquaredMinusHeightOverHeightSquared; + + if (distanceFromOriginMinusHeightSquared > 1) { + if (z == 0) { + break forX; + } + break forZ; + } + + if (!filled) { + double xNext = Math.pow(x + thickness, 2) / rx2 + zSquaredOverRadiusZ - ySquaredMinusHeightOverHeightSquared; + double yNext = xSquaredOverRadiusX + zSquaredOverRadiusZ - Math.pow(y + thickness - height, 2) / ry2; + double zNext = xSquaredOverRadiusX + Math.pow(z + thickness, 2) / rz2 - ySquaredMinusHeightOverHeightSquared; + if (xNext <= 0 && zNext <= 0 && (yNext <= 0 && y + thickness != height)) { + continue; + } + } + + if (distanceFromOriginMinusHeightSquared <= 0) { + if (setBlock(xx, yy, zz, block)) { + ++affected; + } + if (setBlock(xx, yy, zz, block)) { + ++affected; + } + if (setBlock(xx, yy, zz, block)) { + ++affected; + } + if (setBlock(xx, yy, zz, block)) { + ++affected; + } + } + } + } + } + return affected; + } + /** * Move the blocks in a region a certain direction. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java index ca67ad132..dbd698b24 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/GenerationCommands.java @@ -188,6 +188,49 @@ public class GenerationCommands { return affected; } + @Command( + name = "/cone", + desc = "Generates a cone." + ) + @CommandPermissions("worldedit.generation.cone") + @Logging(PLACEMENT) + public int cone(Actor actor, LocalSession session, EditSession editSession, + @Arg(desc = "The pattern of blocks to generate") + Pattern pattern, + @Arg(desc = "The radii of the cone. 1st is N/S, 2nd is E/W") + @Radii(2) + List radii, + @Arg(desc = "The height of the cone", def = "1") + int height, + @Switch(name = 'h', desc = "Make a hollow cone") + boolean hollow, + @Arg(desc = "Thickness of the hollow cone", def = "1") + double thickness + ) throws WorldEditException { + double radiusX; + double radiusZ; + switch (radii.size()) { + case 1 -> radiusX = radiusZ = Math.max(1, radii.get(0)); + case 2 -> { + radiusX = Math.max(1, radii.get(0)); + radiusZ = Math.max(1, radii.get(1)); + } + default -> { + actor.printError(Caption.of("worldedit.cone.invalid-radius")); + return 0; + } + } + + worldEdit.checkMaxRadius(radiusX); + worldEdit.checkMaxRadius(radiusZ); + worldEdit.checkMaxRadius(height); + + BlockVector3 pos = session.getPlacementPosition(actor); + int affected = editSession.makeCone(pos, pattern, radiusX, radiusZ, height, !hollow, thickness); + actor.printInfo(Caption.of("worldedit.cone.created", TextComponent.of(affected))); + return affected; + } + @Command( name = "/hsphere", desc = "Generates a hollow sphere." diff --git a/worldedit-core/src/main/resources/lang/strings.json b/worldedit-core/src/main/resources/lang/strings.json index 790f7b6fa..5e922cdae 100644 --- a/worldedit-core/src/main/resources/lang/strings.json +++ b/worldedit-core/src/main/resources/lang/strings.json @@ -489,6 +489,8 @@ "worldedit.jumpto.none": "No block in sight (or too far away)!", "worldedit.up.obstructed": "You would hit something above you.", "worldedit.up.moved": "Woosh!", + "worldedit.cone.invalid-radius": "You must either specify 1 or 2 radius values.", + "worldedit.cone.created": "{0} blocks have been created.", "worldedit.cyl.invalid-radius": "You must either specify 1 or 2 radius values.", "worldedit.cyl.created": "{0} blocks have been created.", "worldedit.hcyl.thickness-too-large": "Thickness cannot be larger than x or z radii.", From 51670733262407ef964debde6fb84502fdefe700 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 17 Jul 2023 21:47:47 +0100 Subject: [PATCH 134/161] fix: regions not trimming Y correctly when restricted (#2363) --- .../java/com/fastasyncworldedit/core/queue/IBatchProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IBatchProcessor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IBatchProcessor.java index 807a90fb4..5eeafe28e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IBatchProcessor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IBatchProcessor.java @@ -85,7 +85,7 @@ public interface IBatchProcessor { } for (int layer = maxLayer; layer < set.getMaxSectionPosition(); layer++) { if (set.hasSection(layer)) { - if (layer == minLayer) { + if (layer == maxLayer) { char[] arr = set.loadIfPresent(layer); if (arr != null) { int index = ((maxY + 1) & 15) << 8; From cdd546ee5e1a3f010b8daf8674c830925c197a03 Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 20 Jul 2023 16:55:59 +0100 Subject: [PATCH 135/161] fix: correct NBT for spawners (#2362) --- .../worldedit/blocks/MobSpawnerBlock.java | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java index 929354ab9..0420d0994 100644 --- a/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java +++ b/worldedit-core/src/legacy/java/com/sk89q/worldedit/blocks/MobSpawnerBlock.java @@ -134,15 +134,29 @@ public class MobSpawnerBlock extends BaseBlock { values.put("MaxNearbyEntities", new ShortTag(maxNearbyEntities)); values.put("RequiredPlayerRange", new ShortTag(requiredPlayerRange)); if (spawnData == null) { - values.put("SpawnData", new CompoundTag(ImmutableMap.of("id", new StringTag(mobType)))); + values.put( + "SpawnData", + new CompoundTag(ImmutableMap.of("entity", new CompoundTag(ImmutableMap.of("id", new StringTag(mobType))))) + ); } else { values.put("SpawnData", new CompoundTag(spawnData.getValue())); } if (spawnPotentials == null) { - values.put("SpawnPotentials", new ListTag(CompoundTag.class, ImmutableList.of( - new CompoundTag(ImmutableMap.of("Weight", new IntTag(1), "Entity", - new CompoundTag(ImmutableMap.of("id", new StringTag(mobType))) - ))))); + values.put( + "SpawnPotentials", + new ListTag( + CompoundTag.class, + ImmutableList.of(new CompoundTag(ImmutableMap.of( + "weight", + new IntTag(1), + "data", + new CompoundTag(ImmutableMap.of( + "entity", + new CompoundTag(ImmutableMap.of("id", new StringTag(mobType))) + )) + ))) + ) + ); } else { values.put("SpawnPotentials", new ListTag(CompoundTag.class, spawnPotentials.getValue())); } From f65c4743bda5d9cea218c7f7edbf324042a9dcf0 Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 20 Jul 2023 16:56:11 +0100 Subject: [PATCH 136/161] fix: make IdMask thread-safe (#2361) --- .../core/function/mask/IdMask.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/IdMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/IdMask.java index e76c78a89..49c90183a 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/IdMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/mask/IdMask.java @@ -5,9 +5,11 @@ import com.sk89q.worldedit.function.mask.AbstractExtentMask; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.math.BlockVector3; +import java.util.concurrent.atomic.AtomicInteger; + public class IdMask extends AbstractExtentMask implements ResettableMask { - private transient int id = -1; + private final AtomicInteger id = new AtomicInteger(-1); public IdMask(Extent extent) { super(extent); @@ -15,12 +17,9 @@ public class IdMask extends AbstractExtentMask implements ResettableMask { @Override public boolean test(Extent extent, BlockVector3 vector) { - if (id != -1) { - return extent.getBlock(vector).getInternalBlockTypeId() == id; - } else { - id = extent.getBlock(vector).getInternalBlockTypeId(); - return true; - } + int blockID = extent.getBlock(vector).getInternalBlockTypeId(); + int testId = id.compareAndExchange(-1, blockID); + return blockID == testId || testId == -1; } @Override @@ -30,12 +29,12 @@ public class IdMask extends AbstractExtentMask implements ResettableMask { @Override public void reset() { - this.id = -1; + this.id.set(-1); } @Override public Mask copy() { - return new IdMask(getExtent()); + return this; } @Override From fe1859e9d23caba0462593c8d26f90aa9edf9fe4 Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 20 Jul 2023 16:56:30 +0100 Subject: [PATCH 137/161] fix: do not retain clipboards that completed exceptionally (#2358) --- .../worldedit/command/ClipboardCommands.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java index 40ca530c8..e39bbc641 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/ClipboardCommands.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.command; +import com.fastasyncworldedit.core.Fawe; import com.fastasyncworldedit.core.FaweAPI; import com.fastasyncworldedit.core.FaweCache; import com.fastasyncworldedit.core.configuration.Caption; @@ -28,6 +29,7 @@ import com.fastasyncworldedit.core.extent.clipboard.DiskOptimizedClipboard; import com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder; import com.fastasyncworldedit.core.extent.clipboard.ReadOnlyClipboard; import com.fastasyncworldedit.core.extent.clipboard.URIClipboardHolder; +import com.fastasyncworldedit.core.internal.exception.FaweException; import com.fastasyncworldedit.core.internal.io.FastByteArrayOutputStream; import com.fastasyncworldedit.core.limit.FaweLimit; import com.fastasyncworldedit.core.util.ImgurUtility; @@ -160,7 +162,7 @@ public class ClipboardCommands { session.getPlacementPosition(actor)); ForwardExtentCopy copy = new ForwardExtentCopy(editSession, region, clipboard, region.getMinimumPoint()); copy.setCopyingEntities(copyEntities); - createCopy(session, editSession, copyBiomes, mask, clipboard, copy); + createCopy(actor, session, editSession, copyBiomes, mask, clipboard, copy); copy.getStatusMessages().forEach(actor::print); //FAWE end @@ -271,7 +273,7 @@ public class ClipboardCommands { copy.setSourceFunction(new BlockReplace(editSession, leavePattern)); copy.setCopyingEntities(copyEntities); copy.setRemovingEntities(true); - createCopy(session, editSession, copyBiomes, mask, clipboard, copy); + createCopy(actor, session, editSession, copyBiomes, mask, clipboard, copy); if (!actor.hasPermission("fawe.tips")) { actor.print(Caption.of("fawe.tips.tip.lazycut")); @@ -281,6 +283,7 @@ public class ClipboardCommands { } private void createCopy( + final Actor actor, final LocalSession session, final EditSession editSession, final boolean copyBiomes, @@ -311,9 +314,22 @@ public class ClipboardCommands { try { Operations.completeLegacy(copy); - } finally { - clipboard.flush(); + } catch (Exception e) { + DiskOptimizedClipboard doc; + if (clipboard instanceof DiskOptimizedClipboard) { + doc = (DiskOptimizedClipboard) clipboard; + } else if (clipboard instanceof BlockArrayClipboard && ((BlockArrayClipboard) clipboard).getParent() instanceof DiskOptimizedClipboard) { + doc = (DiskOptimizedClipboard) ((BlockArrayClipboard) clipboard).getParent(); + } else { + throw e; + } + Fawe.instance().getClipboardExecutor().submit(actor.getUniqueId(), () -> { + clipboard.close(); + doc.getFile().delete(); + }); + throw e; } + clipboard.flush(); session.setClipboard(new ClipboardHolder(clipboard)); } From 0a8a4792143c692acc4bd3f64273b1767990f06e Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 20 Jul 2023 16:57:29 +0100 Subject: [PATCH 138/161] fix: do not clash ChunkHolder recycling with processors that extend outside the chunk (#2353) --- .../ReentrantWrappedStampedLock.java | 119 ------------------ .../core/queue/IChunkExtent.java | 2 - .../SingleThreadQueueExtent.java | 33 ++--- .../implementation/chunk/ChunkHolder.java | 23 +++- 4 files changed, 34 insertions(+), 143 deletions(-) delete mode 100644 worldedit-core/src/main/java/com/fastasyncworldedit/core/concurrent/ReentrantWrappedStampedLock.java diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/concurrent/ReentrantWrappedStampedLock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/concurrent/ReentrantWrappedStampedLock.java deleted file mode 100644 index b8e726620..000000000 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/concurrent/ReentrantWrappedStampedLock.java +++ /dev/null @@ -1,119 +0,0 @@ -package com.fastasyncworldedit.core.concurrent; - -import org.jetbrains.annotations.NotNull; - -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.Condition; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.StampedLock; - -/** - * Allows for reentrant behaviour of a wrapped {@link StampedLock}. Will not count the number of times it is re-entered. - * - * @since 2.3.0 - */ -public class ReentrantWrappedStampedLock implements Lock { - - private final StampedLock parent = new StampedLock(); - private volatile Thread owner; - private volatile long stamp = 0; - - @Override - public void lock() { - if (Thread.currentThread() == owner) { - return; - } - stamp = parent.writeLock(); - owner = Thread.currentThread(); - } - - @Override - public void lockInterruptibly() throws InterruptedException { - if (Thread.currentThread() == owner) { - return; - } - stamp = parent.writeLockInterruptibly(); - owner = Thread.currentThread(); - } - - @Override - public boolean tryLock() { - if (Thread.currentThread() == owner) { - return true; - } - if (parent.isWriteLocked()) { - return false; - } - stamp = parent.writeLock(); - owner = Thread.currentThread(); - return true; - } - - @Override - public boolean tryLock(final long time, @NotNull final TimeUnit unit) throws InterruptedException { - if (Thread.currentThread() == owner) { - return true; - } - if (!parent.isWriteLocked()) { - stamp = parent.writeLock(); - owner = Thread.currentThread(); - return true; - } - stamp = parent.tryWriteLock(time, unit); - owner = Thread.currentThread(); - return false; - } - - @Override - public void unlock() { - if (owner != Thread.currentThread()) { - throw new IllegalCallerException("The lock should only be unlocked by the owning thread when a stamp is not supplied"); - } - unlock(stamp); - } - - @NotNull - @Override - public Condition newCondition() { - throw new UnsupportedOperationException("Conditions are not supported by StampedLock"); - } - - /** - * Retrieves the stamp associated with the current lock. 0 if the wrapped {@link StampedLock} is not write-locked. This method is - * thread-checking. - * - * @return lock stam[ or 0 if not locked. - * @throws IllegalCallerException if the {@link StampedLock} is write-locked and the calling thread is not the lock owner - * @since 2.3.0 - */ - public long getStampChecked() { - if (stamp != 0 && owner != Thread.currentThread()) { - throw new IllegalCallerException("The stamp should be be acquired by a thread that does not own the lock"); - } - return stamp; - } - - /** - * Unlock the wrapped {@link StampedLock} using the given stamp. This can be called by any thread. - * - * @param stamp Stamp to unlock with - * @throws IllegalMonitorStateException if the given stamp does not match the lock's stamp - * @since 2.3.0 - */ - public void unlock(final long stamp) { - parent.unlockWrite(stamp); - this.stamp = 0; - owner = null; - } - - /** - * Returns true if the lock is currently held. - * - * @return true if the lock is currently held. - * @since 2.3.0 - */ - public boolean isLocked() { - return owner == null && this.stamp == 0 && parent.isWriteLocked(); // Be verbose - } - -} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java index 63c793ebd..ec6162798 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java @@ -2,9 +2,7 @@ package com.fastasyncworldedit.core.queue; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.DoubleTag; -import com.sk89q.jnbt.IntArrayTag; import com.sk89q.jnbt.ListTag; -import com.sk89q.jnbt.LongTag; import com.sk89q.jnbt.NBTUtils; import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.Tag; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java index 59427c8ef..198782ee3 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/SingleThreadQueueExtent.java @@ -83,17 +83,6 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen this.maxY = maxY; } - /** - * Safety check to ensure that the thread being used matches the one being initialized on. - Can - * be removed later - */ - private void checkThread() { - if (Thread.currentThread() != currentThread && currentThread != null) { - throw new UnsupportedOperationException( - "This class must be used from a single thread. Use multiple queues for concurrent operations"); - } - } - @Override public void enableQueue() { enabledQueue = true; @@ -154,10 +143,10 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen return; } if (!this.chunks.isEmpty()) { + getChunkLock.lock(); for (IChunk chunk : this.chunks.values()) { chunk.recycle(); } - getChunkLock.lock(); this.chunks.clear(); getChunkLock.unlock(); } @@ -233,9 +222,21 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen */ private > V submitUnchecked(IQueueChunk chunk) { if (chunk.isEmpty()) { - chunk.recycle(); - Future result = Futures.immediateFuture(null); - return (V) result; + if (chunk instanceof ChunkHolder holder) { + long age = holder.initAge(); + // Ensure we've given time for the chunk to be used - it was likely used for a reason! + if (age < 5) { + try { + Thread.sleep(5 - age); + } catch (InterruptedException ignored) { + } + } + } + if (chunk.isEmpty()) { + chunk.recycle(); + Future result = Futures.immediateFuture(null); + return (V) result; + } } if (Fawe.isMainThread()) { @@ -451,6 +452,7 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen @Override public synchronized void flush() { if (!chunks.isEmpty()) { + getChunkLock.lock(); if (MemUtil.isMemoryLimited()) { for (IQueueChunk chunk : chunks.values()) { final Future future = submitUnchecked(chunk); @@ -467,7 +469,6 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen } } } - getChunkLock.lock(); chunks.clear(); getChunkLock.unlock(); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java index 9172d8b3e..ec556d845 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/chunk/ChunkHolder.java @@ -1,7 +1,6 @@ package com.fastasyncworldedit.core.queue.implementation.chunk; import com.fastasyncworldedit.core.FaweCache; -import com.fastasyncworldedit.core.concurrent.ReentrantWrappedStampedLock; import com.fastasyncworldedit.core.configuration.Settings; import com.fastasyncworldedit.core.extent.filter.block.ChunkFilterBlock; import com.fastasyncworldedit.core.extent.processor.EmptyBatchProcessor; @@ -26,6 +25,8 @@ import java.util.Map; import java.util.Set; import java.util.UUID; import java.util.concurrent.Future; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; /** * An abstract {@link IChunk} class that implements basic get/set blocks. @@ -43,7 +44,7 @@ public class ChunkHolder> implements IQueueChunk { return POOL.poll(); } - private final ReentrantWrappedStampedLock calledLock = new ReentrantWrappedStampedLock(); + private final Lock calledLock = new ReentrantLock(); private volatile IChunkGet chunkExisting; // The existing chunk (e.g. a clipboard, or the world, before changes) private volatile IChunkSet chunkSet; // The blocks to be set to the chunkExisting @@ -55,6 +56,7 @@ public class ChunkHolder> implements IQueueChunk { private int bitMask = -1; // Allow forceful setting of bitmask (for lighting) private boolean isInit = false; // Lighting handles queue differently. It relies on the chunk cache and not doing init. private boolean createCopy = false; + private long initTime = -1L; private ChunkHolder() { this.delegate = NULL; @@ -66,6 +68,7 @@ public class ChunkHolder> implements IQueueChunk { @Override public synchronized void recycle() { + calledLock.lock(); delegate = NULL; if (chunkSet != null) { chunkSet.recycle(); @@ -74,6 +77,11 @@ public class ChunkHolder> implements IQueueChunk { chunkExisting = null; extent = null; POOL.offer(this); + calledLock.unlock(); + } + + public long initAge() { + return System.currentTimeMillis() - initTime; } public synchronized IBlockDelegate getDelegate() { @@ -84,10 +92,10 @@ public class ChunkHolder> implements IQueueChunk { * If the chunk is currently being "called", this method will block until completed. */ private void checkAndWaitOnCalledLock() { - if (calledLock.isLocked()) { + if (!calledLock.tryLock()) { calledLock.lock(); - calledLock.unlock(); } + calledLock.unlock(); } @Override @@ -1024,6 +1032,7 @@ public class ChunkHolder> implements IQueueChunk { @Override public synchronized void init(IQueueExtent extent, int chunkX, int chunkZ) { + this.initTime = System.currentTimeMillis(); this.extent = extent; this.chunkX = chunkX; this.chunkZ = chunkZ; @@ -1040,14 +1049,15 @@ public class ChunkHolder> implements IQueueChunk { @Override public synchronized T call() { calledLock.lock(); - final long stamp = calledLock.getStampChecked(); if (chunkSet != null && !chunkSet.isEmpty()) { this.delegate = GET; chunkSet.setBitMask(bitMask); try { IChunkSet copy = chunkSet.createCopy(); chunkSet = null; - return this.call(copy, () -> calledLock.unlock(stamp)); + return this.call(copy, () -> { + // Do nothing + }); } catch (Throwable t) { calledLock.unlock(); throw t; @@ -1072,6 +1082,7 @@ public class ChunkHolder> implements IQueueChunk { } else { finalizer = finalize; } + calledLock.unlock(); return get.call(set, finalizer); } return null; From 18df87a4e8b2f3da815ecd3ce0e4a4ad36240f37 Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 20 Jul 2023 16:57:48 +0100 Subject: [PATCH 139/161] feat: implement a new "type swap" pattern (#2346) --- .../parser/pattern/TypeSwapPatternParser.java | 54 +++++++++ .../function/pattern/TypeSwapPattern.java | 103 ++++++++++++++++++ .../extension/factory/PatternFactory.java | 2 + 3 files changed, 159 insertions(+) create mode 100644 worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/TypeSwapPatternParser.java create mode 100644 worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/TypeSwapPattern.java diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/TypeSwapPatternParser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/TypeSwapPatternParser.java new file mode 100644 index 000000000..5bf33d3a0 --- /dev/null +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extension/factory/parser/pattern/TypeSwapPatternParser.java @@ -0,0 +1,54 @@ +package com.fastasyncworldedit.core.extension.factory.parser.pattern; + +import com.fastasyncworldedit.core.configuration.Caption; +import com.fastasyncworldedit.core.extension.factory.parser.RichParser; +import com.fastasyncworldedit.core.function.pattern.TypeSwapPattern; +import com.fastasyncworldedit.core.util.Permission; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.extension.input.InputParseException; +import com.sk89q.worldedit.extension.input.ParserContext; +import com.sk89q.worldedit.function.pattern.Pattern; +import com.sk89q.worldedit.util.formatting.text.TextComponent; + +import javax.annotation.Nonnull; +import java.util.List; +import java.util.stream.Stream; + +public class TypeSwapPatternParser extends RichParser { + + private static final List SUGGESTIONS = List.of("oak", "spruce", "stone", "sandstone"); + + /** + * Create a new rich parser with a defined prefix for the result, e.g. {@code #simplex}. + * + * @param worldEdit the worldedit instance. + */ + public TypeSwapPatternParser(WorldEdit worldEdit) { + super(worldEdit, "#typeswap", "#ts", "#swaptype"); + } + + @Override + public Stream getSuggestions(String argumentInput, int index) { + if (index > 2) { + return Stream.empty(); + } + return SUGGESTIONS.stream(); + } + + @Override + public Pattern parseFromInput(@Nonnull String[] input, ParserContext context) throws InputParseException { + if (input.length != 2) { + throw new InputParseException(Caption.of( + "fawe.error.command.syntax", + TextComponent.of(getPrefix() + "[input][output] (e.g. " + getPrefix() + "[spruce][oak])") + )); + } + return new TypeSwapPattern( + context.requireExtent(), + input[0], + input[1], + Permission.hasPermission(context.requireActor(), "fawe.pattern.typeswap.regex") + ); + } + +} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/TypeSwapPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/TypeSwapPattern.java new file mode 100644 index 000000000..89876f658 --- /dev/null +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/TypeSwapPattern.java @@ -0,0 +1,103 @@ +package com.fastasyncworldedit.core.function.pattern; + +import com.fastasyncworldedit.core.extent.filter.block.FilterBlock; +import com.fastasyncworldedit.core.util.StringMan; +import com.sk89q.worldedit.WorldEditException; +import com.sk89q.worldedit.extent.Extent; +import com.sk89q.worldedit.math.BlockVector3; +import com.sk89q.worldedit.world.block.BaseBlock; +import com.sk89q.worldedit.world.block.BlockState; +import com.sk89q.worldedit.world.block.BlockType; +import com.sk89q.worldedit.world.block.BlockTypes; + +import java.util.regex.Pattern; + +/** + * Pattern that replaces blocks based on their ID, matching for an "input" and replacing with an "output" string. The "input" + * string may be regex. Keeps as much of the block state as possible, excluding NBT data. + * + * @since TODO + */ +public class TypeSwapPattern extends AbstractExtentPattern { + + private static final Pattern SPLITTER = Pattern.compile("[|,]"); + + private final String inputString; + private final String outputString; + private final String[] inputs; + private Pattern inputPattern = null; + + /** + * Create a new instance + * + * @param extent extent to use + * @param inputString string to replace. May be regex. + * @param outputString string to replace with + * @param allowRegex if regex should be allowed for input string matching + * @since TODO + */ + public TypeSwapPattern(Extent extent, String inputString, String outputString, boolean allowRegex) { + super(extent); + this.inputString = inputString; + this.outputString = outputString; + if (!StringMan.isAlphanumericUnd(inputString)) { + if (allowRegex) { + this.inputPattern = Pattern.compile(inputString.replace(",", "|")); + inputs = null; + } else { + inputs = SPLITTER.split(inputString); + } + } else { + inputs = null; + } + } + + @Override + public boolean apply(Extent extent, BlockVector3 get, BlockVector3 set) throws WorldEditException { + BlockState existing = get.getBlock(extent); + BlockState newBlock = getNewBlock(existing); + if (newBlock == null) { + return false; + } + return set.setBlock(extent, newBlock); + } + + @Override + public void applyBlock(final FilterBlock block) { + BlockState existing = block.getBlock(); + BlockState newState = getNewBlock(existing); + if (newState != null) { + block.setBlock(newState); + } + } + + @Override + public BaseBlock applyBlock(final BlockVector3 position) { + BaseBlock existing = position.getFullBlock(getExtent()); + BlockState newState = getNewBlock(existing.toBlockState()); + return newState == null ? existing : newState.toBaseBlock(); + } + + private BlockState getNewBlock(BlockState existing) { + String oldId = existing.getBlockType().getId(); + String newId = oldId; + if (inputPattern != null) { + newId = inputPattern.matcher(oldId).replaceAll(outputString); + } else if (inputs != null && inputs.length > 0) { + for (String input : inputs) { + newId = newId.replace(input, outputString); + } + } else { + newId = oldId.replace(inputString, outputString); + } + if (newId.equals(oldId)) { + return null; + } + BlockType newType = BlockTypes.get(newId); + if (newType == null) { + return null; + } + return newType.getDefaultState().withProperties(existing); + } + +} diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java index 420e58d2a..a76759833 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/PatternFactory.java @@ -42,6 +42,7 @@ import com.fastasyncworldedit.core.extension.factory.parser.pattern.OffsetPatter import com.fastasyncworldedit.core.extension.factory.parser.pattern.PerlinPatternParser; import com.fastasyncworldedit.core.extension.factory.parser.pattern.RandomFullClipboardPatternParser; import com.fastasyncworldedit.core.extension.factory.parser.pattern.RandomOffsetPatternParser; +import com.fastasyncworldedit.core.extension.factory.parser.pattern.TypeSwapPatternParser; import com.sk89q.worldedit.extension.factory.parser.pattern.RandomPatternParser; import com.fastasyncworldedit.core.extension.factory.parser.pattern.RelativePatternParser; import com.fastasyncworldedit.core.extension.factory.parser.pattern.RichPatternParser; @@ -133,6 +134,7 @@ public final class PatternFactory extends AbstractFactory { register(new SimplexPatternParser(worldEdit)); register(new SolidRandomOffsetPatternParser(worldEdit)); register(new SurfaceRandomOffsetPatternParser(worldEdit)); + register(new TypeSwapPatternParser(worldEdit)); register(new VoronoiPatternParser(worldEdit)); //FAWE end } From 9543adc776c1afcb81477e2113920f9746ea88a6 Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 20 Jul 2023 16:58:01 +0100 Subject: [PATCH 140/161] Implement async notify queue that submits to a KeyQueuedExecutorService (#2334) --- .../queue/implementation/QueueHandler.java | 26 ++++++ .../core/util/task/AsyncNotifyKeyedQueue.java | 81 +++++++++++++++++++ .../core/util/task/AsyncNotifyQueue.java | 16 +--- .../platform/AbstractNonPlayerActor.java | 7 +- .../platform/AbstractPlayerActor.java | 6 +- 5 files changed, 114 insertions(+), 22 deletions(-) create mode 100644 worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/AsyncNotifyKeyedQueue.java diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java index 7f604a277..bc7f9ddec 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java @@ -27,6 +27,7 @@ import java.util.Queue; import java.util.concurrent.Callable; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinTask; import java.util.concurrent.Future; @@ -52,6 +53,7 @@ public abstract class QueueHandler implements Trimable, Runnable { null, false ); + /** * Secondary queue should be used for "cleanup" tasks that are likely to be shorter in life than those submitted to the * primary queue. They may be IO-bound tasks. @@ -508,4 +510,28 @@ public abstract class QueueHandler implements Trimable, Runnable { return result; } + /** + * Primary queue should be used for tasks that are unlikely to wait on other tasks, IO, etc. (i.e. spend most of their + * time utilising CPU. + *

+ * Internal API usage only. + * + * @since TODO + */ + public ExecutorService getForkJoinPoolPrimary() { + return forkJoinPoolPrimary; + } + + /** + * Secondary queue should be used for "cleanup" tasks that are likely to be shorter in life than those submitted to the + * primary queue. They may be IO-bound tasks. + *

+ * Internal API usage only. + * + * @since TODO + */ + public ExecutorService getForkJoinPoolSecondary() { + return forkJoinPoolSecondary; + } + } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/AsyncNotifyKeyedQueue.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/AsyncNotifyKeyedQueue.java new file mode 100644 index 000000000..9df6b197c --- /dev/null +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/AsyncNotifyKeyedQueue.java @@ -0,0 +1,81 @@ +package com.fastasyncworldedit.core.util.task; + +import com.fastasyncworldedit.core.configuration.Settings; + +import java.io.Closeable; +import java.util.UUID; +import java.util.concurrent.Callable; +import java.util.concurrent.ForkJoinPool; +import java.util.concurrent.Future; +import java.util.function.Supplier; + +/** + * async queue that accepts a {@link Thread.UncaughtExceptionHandler} for exception handling per instance, delegating to a + * parent {@link KeyQueuedExecutorService}. + * + * @since TODO + */ +public class AsyncNotifyKeyedQueue implements Closeable { + + private static final KeyQueuedExecutorService QUEUE_SUBMISSIONS = new KeyQueuedExecutorService<>(new ForkJoinPool( + Settings.settings().QUEUE.PARALLEL_THREADS, + new FaweForkJoinWorkerThreadFactory("AsyncNotifyKeyedQueue - %s"), + null, + false + )); + + private final Thread.UncaughtExceptionHandler handler; + private final Supplier key; + private volatile boolean closed; + + /** + * New instance + * + * @param handler exception handler + * @param key supplier of UUID key + */ + public AsyncNotifyKeyedQueue(Thread.UncaughtExceptionHandler handler, Supplier key) { + this.handler = handler; + this.key = key; + } + + public Thread.UncaughtExceptionHandler getHandler() { + return handler; + } + + public Future run(Runnable task) { + return call(() -> { + task.run(); + return null; + }); + } + + public Future call(Callable task) { + Future[] self = new Future[1]; + Callable wrapped = () -> { + if (!closed) { + try { + return task.call(); + } catch (Throwable e) { + handler.uncaughtException(Thread.currentThread(), e); + } + } + if (self[0] != null) { + self[0].cancel(true); + } + return null; + }; + self[0] = QUEUE_SUBMISSIONS.submit(key.get(), wrapped); + return self[0]; + } + + @Override + public void close() { + closed = true; + } + + public boolean isClosed() { + return closed; + } + +} diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/AsyncNotifyQueue.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/AsyncNotifyQueue.java index 7cd91f87a..9cf9ddef2 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/AsyncNotifyQueue.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/AsyncNotifyQueue.java @@ -1,13 +1,9 @@ package com.fastasyncworldedit.core.util.task; import com.fastasyncworldedit.core.Fawe; -import com.fastasyncworldedit.core.configuration.Settings; -import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.io.Closeable; import java.util.concurrent.Callable; -import java.util.concurrent.Executors; -import java.util.concurrent.ForkJoinPool; import java.util.concurrent.Future; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; @@ -15,13 +11,6 @@ import java.util.function.Supplier; public class AsyncNotifyQueue implements Closeable { - private static final ForkJoinPool QUEUE_SUBMISSIONS = new ForkJoinPool( - Settings.settings().QUEUE.PARALLEL_THREADS, - new FaweForkJoinWorkerThreadFactory("AsyncNotifyQueue - %s"), - null, - false - ); - private final Lock lock = new ReentrantLock(true); private final Thread.UncaughtExceptionHandler handler; private boolean closed; @@ -56,9 +45,6 @@ public class AsyncNotifyQueue implements Closeable { return task.call(); } catch (Throwable e) { handler.uncaughtException(Thread.currentThread(), e); - if (self[0] != null) { - self[0].cancel(true); - } } } } finally { @@ -70,7 +56,7 @@ public class AsyncNotifyQueue implements Closeable { } return null; }; - self[0] = QUEUE_SUBMISSIONS.submit(wrapped); + self[0] = Fawe.instance().getQueueHandler().async(wrapped); return self[0]; } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractNonPlayerActor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractNonPlayerActor.java index 0b8909198..8337a7327 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractNonPlayerActor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractNonPlayerActor.java @@ -19,10 +19,9 @@ package com.sk89q.worldedit.extension.platform; -import com.fastasyncworldedit.core.configuration.Caption; import com.fastasyncworldedit.core.internal.exception.FaweException; import com.fastasyncworldedit.core.util.TaskManager; -import com.fastasyncworldedit.core.util.task.AsyncNotifyQueue; +import com.fastasyncworldedit.core.util.task.AsyncNotifyKeyedQueue; import com.sk89q.worldedit.WorldEditException; import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.util.formatting.text.TextComponent; @@ -68,7 +67,7 @@ public abstract class AbstractNonPlayerActor implements Actor { // Queue for async tasks private final AtomicInteger runningCount = new AtomicInteger(); - private final AsyncNotifyQueue asyncNotifyQueue = new AsyncNotifyQueue((thread, throwable) -> { + private final AsyncNotifyKeyedQueue asyncNotifyQueue = new AsyncNotifyKeyedQueue((thread, throwable) -> { while (throwable.getCause() != null) { throwable = throwable.getCause(); } @@ -82,7 +81,7 @@ public abstract class AbstractNonPlayerActor implements Actor { throwable.printStackTrace(); } } - }); + }, this::getUniqueId); /** * Run a task either async, or on the current thread. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java index 6adf7236c..ae4eb2144 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java @@ -25,7 +25,7 @@ import com.fastasyncworldedit.core.math.MutableBlockVector3; import com.fastasyncworldedit.core.regions.FaweMaskManager; import com.fastasyncworldedit.core.util.TaskManager; import com.fastasyncworldedit.core.util.WEManager; -import com.fastasyncworldedit.core.util.task.AsyncNotifyQueue; +import com.fastasyncworldedit.core.util.task.AsyncNotifyKeyedQueue; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.WorldEdit; @@ -81,7 +81,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { // Queue for async tasks private final AtomicInteger runningCount = new AtomicInteger(); - private final AsyncNotifyQueue asyncNotifyQueue = new AsyncNotifyQueue( + private final AsyncNotifyKeyedQueue asyncNotifyQueue = new AsyncNotifyKeyedQueue( (thread, throwable) -> { while (throwable.getCause() != null) { throwable = throwable.getCause(); @@ -96,7 +96,7 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { throwable.printStackTrace(); } } - }); + }, this::getUniqueId); public AbstractPlayerActor(Map meta) { this.meta = meta; From 4bdcf9a510baf2df82e18f7e69ba3d5d85c8cfdb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 22 Jul 2023 10:00:15 +0000 Subject: [PATCH 141/161] Update dependency com.palmergames.bukkit.towny:towny to v0.99.5.4 (#2372) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index cf04ae8f8..e1d802e37 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,7 +11,7 @@ mapmanager = "1.8.0-SNAPSHOT" griefprevention = "16.18.1" griefdefender = "2.1.0-SNAPSHOT" residence = "4.5._13.1" -towny = "0.99.2.7" +towny = "0.99.5.4" # Third party bstats = "3.0.2" From c91b477e2969239b35bfa84977a75e4fe0c1c8a3 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sat, 22 Jul 2023 12:01:33 +0200 Subject: [PATCH 142/161] Update PlotSquared integration to v7 (#2075) Co-authored-by: dordsor21 --- .github/renovate.json | 2 -- buildSrc/src/main/kotlin/AdapterConfig.kt | 2 +- buildSrc/src/main/kotlin/CommonJavaConfig.kt | 2 +- gradle/libs.versions.toml | 3 +-- worldedit-bukkit/build.gradle.kts | 6 +++--- .../fastasyncworldedit/bukkit/FaweBukkit.java | 13 ++----------- .../FaweDelegateRegionManager.java | 10 ++++------ .../bukkit/regions/plotsquared/FaweTrim.java | 6 ++++-- .../regions/plotsquared/PlotSetBiome.java | 11 ++++++----- .../plotsquared/PlotSquaredFeature.java | 2 +- .../sk89q/wepif/TestOfflinePermissible.java | 19 ++++++++++++++++++- worldedit-core/build.gradle.kts | 5 ++--- 12 files changed, 43 insertions(+), 38 deletions(-) diff --git a/.github/renovate.json b/.github/renovate.json index 787e44030..526af5a60 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -19,8 +19,6 @@ "net.fabricmc:fabric-loader", "net.fabricmc.fabric-api:fabric-api", "com.github.luben:zstd-jni", - "net.kyori", - "net.kyori:adventure-nbt", "org.jetbrains.kotlin.jvm", "log4j" ], diff --git a/buildSrc/src/main/kotlin/AdapterConfig.kt b/buildSrc/src/main/kotlin/AdapterConfig.kt index 21cab4c73..6cad58e3b 100644 --- a/buildSrc/src/main/kotlin/AdapterConfig.kt +++ b/buildSrc/src/main/kotlin/AdapterConfig.kt @@ -15,7 +15,7 @@ fun Project.applyPaperweightAdapterConfiguration() { dependencies { "implementation"(project(":worldedit-bukkit")) - "implementation"(platform("com.intellectualsites.bom:bom-1.18.x:1.31")) + "implementation"(platform("com.intellectualsites.bom:bom-newest:1.33")) } tasks.named("assemble") { diff --git a/buildSrc/src/main/kotlin/CommonJavaConfig.kt b/buildSrc/src/main/kotlin/CommonJavaConfig.kt index 759e45740..73389ce83 100644 --- a/buildSrc/src/main/kotlin/CommonJavaConfig.kt +++ b/buildSrc/src/main/kotlin/CommonJavaConfig.kt @@ -45,7 +45,7 @@ fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, banSlf4j: Boolean "testImplementation"("org.mockito:mockito-core:5.1.1") "testImplementation"("org.mockito:mockito-junit-jupiter:5.1.1") "testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:5.9.2") - "implementation"(platform("com.intellectualsites.bom:bom-1.18.x:1.31")) + "implementation"(platform("com.intellectualsites.bom:bom-newest:1.33")) } // Java 8 turns on doclint which we fail diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e1d802e37..9ff63fb98 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -17,7 +17,7 @@ towny = "0.99.5.4" bstats = "3.0.2" sparsebitset = "1.2" parallelgzip = "1.0.5" -adventure = "4.9.3" +adventure = "4.14.0" truezip = "6.8.4" auto-value = "1.10.2" findbugs = "3.0.2" @@ -30,7 +30,6 @@ jchronic = "0.2.4a" lz4-java = "1.8.0" lz4-stream = "1.0.0" ## Internal -adventure-text-minimessage = "4.2.0-SNAPSHOT" text-adapter = "3.0.6" text = "3.0.4" piston = "0.5.7" diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index 9a9ffd86b..a6d31be03 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -101,8 +101,8 @@ dependencies { compileOnly(libs.griefdefender) { isTransitive = false } compileOnly(libs.residence) { isTransitive = false } compileOnly(libs.towny) { isTransitive = false } - compileOnly("com.plotsquared:PlotSquared-Bukkit") { isTransitive = false } - compileOnly("com.plotsquared:PlotSquared-Core") { isTransitive = false } + compileOnly("com.intellectualsites.plotsquared:plotsquared-bukkit") { isTransitive = false } + compileOnly("com.intellectualsites.plotsquared:plotsquared-core") { isTransitive = false } // Third party implementation("io.papermc:paperlib") @@ -183,7 +183,7 @@ tasks.named("shadowJar") { include(dependency("org.lz4:lz4-java:1.8.0")) } relocate("net.kyori", "com.fastasyncworldedit.core.adventure") { - include(dependency("net.kyori:adventure-nbt:4.9.3")) + include(dependency("net.kyori:adventure-nbt:4.14.0")) } relocate("com.zaxxer", "com.fastasyncworldedit.core.math") { include(dependency("com.zaxxer:SparseBitSet:1.2")) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java index 2e25c8c56..90db4368c 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java @@ -325,18 +325,9 @@ public class FaweBukkit implements IFawe, Listener { if (plotSquared == null) { return; } - if (PlotSquared.get().getVersion().version[0] == 6) { + if (PlotSquared.get().getVersion().version[0] == 7) { WEManager.weManager().addManager(new com.fastasyncworldedit.bukkit.regions.plotsquared.PlotSquaredFeature()); - LOGGER.info("Plugin 'PlotSquared' v6 found. Using it now."); - } else if (PlotSquared.get().getVersion().version[0] == 7) { - WEManager.weManager().addManager(new com.fastasyncworldedit.bukkit.regions.plotsquared.PlotSquaredFeature()); - LOGGER.error("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); - LOGGER.error("!! !!"); - LOGGER.error("!! ERROR: PlotSquared v7 found. This FAWE version does not support PlotSquared V7 !!"); - LOGGER.error("!! Follow the instructions when notified of v7 release candidates and use FAWE from !!"); - LOGGER.error("!! https://ci.athion.net/job/FastAsyncWorldEdit-Pull-Requests/view/change-requests/job/PR-2075/ !!"); - LOGGER.error("!! !!"); - LOGGER.error("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); + LOGGER.info("Plugin 'PlotSquared' v7 found. Using it now."); } else { LOGGER.error("Incompatible version of PlotSquared found. Please use PlotSquared v6."); LOGGER.info("https://www.spigotmc.org/resources/77506/"); diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateRegionManager.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateRegionManager.java index 66a9ef369..4ef1a3d05 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateRegionManager.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweDelegateRegionManager.java @@ -171,13 +171,11 @@ public class FaweDelegateRegionManager { .limitUnlimited() .changeSetNull() .build(); - File schematicFile = new File(hybridPlotWorld.getRoot(), "plot.schem"); + File schematicFile = new File(hybridPlotWorld.getSchematicRoot(), "plot.schem"); if (!schematicFile.exists()) { - schematicFile = new File(hybridPlotWorld.getRoot(), "plot.schematic"); + schematicFile = new File(hybridPlotWorld.getSchematicRoot(), "plot.schematic"); } - BlockVector3 to = plot.getBottomAbs().getBlockVector3().withY(Settings.Schematics.PASTE_ON_TOP - ? hybridPlotWorld.SCHEM_Y - : hybridPlotWorld.getMinBuildHeight()); + BlockVector3 to = plot.getBottomAbs().getBlockVector3().withY(hybridPlotWorld.getPlotYStart()); try { Clipboard clip = ClipboardFormats .findByFile(schematicFile) @@ -215,7 +213,7 @@ public class FaweDelegateRegionManager { ) { TaskManager.taskManager().async(() -> { synchronized (FaweDelegateRegionManager.class) { - //todo because of the following code this should proably be in the Bukkit module + //todo because of the following code this should probably be in the Bukkit module World pos1World = BukkitAdapter.adapt(getWorld(pos1.getWorldName())); World pos3World = BukkitAdapter.adapt(getWorld(swapPos.getWorldName())); EditSession sessionA = WorldEdit.getInstance().newEditSessionBuilder().world(pos1World) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweTrim.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweTrim.java index 8bfab4939..665fa47e4 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweTrim.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/FaweTrim.java @@ -1,13 +1,15 @@ package com.fastasyncworldedit.bukkit.regions.plotsquared; import com.fastasyncworldedit.core.util.TaskManager; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.minimessage.tag.Tag; +import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver; import com.plotsquared.core.PlotSquared; import com.plotsquared.core.command.CommandCategory; import com.plotsquared.core.command.CommandDeclaration; import com.plotsquared.core.command.RequiredType; import com.plotsquared.core.command.SubCommand; import com.plotsquared.core.configuration.caption.StaticCaption; -import com.plotsquared.core.configuration.caption.Templates; import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.player.PlotPlayer; @@ -33,7 +35,7 @@ public class FaweTrim extends SubCommand { return false; } if (!PlotSquared.platform().worldUtil().isWorld(strings[0])) { - plotPlayer.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"), Templates.of("value", strings[0])); + plotPlayer.sendMessage(TranslatableCaption.of("errors.not_valid_plot_world"), TagResolver.resolver("value", Tag.inserting(Component.text(strings[0])))); return false; } ran = true; diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSetBiome.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSetBiome.java index cb007bfb3..ef903b716 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSetBiome.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSetBiome.java @@ -6,11 +6,9 @@ import com.plotsquared.core.command.CommandCategory; import com.plotsquared.core.command.CommandDeclaration; import com.plotsquared.core.command.MainCommand; import com.plotsquared.core.command.RequiredType; -import com.plotsquared.core.configuration.caption.Templates; import com.plotsquared.core.configuration.caption.TranslatableCaption; import com.plotsquared.core.player.PlotPlayer; import com.plotsquared.core.plot.Plot; -import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.StringMan; import com.plotsquared.core.util.task.RunnableVal2; import com.plotsquared.core.util.task.RunnableVal3; @@ -24,6 +22,9 @@ import com.sk89q.worldedit.world.biome.BiomeType; import com.sk89q.worldedit.world.biome.BiomeTypes; import com.sk89q.worldedit.world.biome.Biomes; import com.sk89q.worldedit.world.registry.BiomeRegistry; +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.minimessage.tag.Tag; +import net.kyori.adventure.text.minimessage.tag.resolver.TagResolver; import org.bukkit.Bukkit; import java.util.Collection; @@ -56,7 +57,7 @@ public class PlotSetBiome extends Command { ) throws CommandException { final Plot plot = check(player.getCurrentPlot(), TranslatableCaption.of("errors.not_in_plot")); checkTrue( - plot.isOwner(player.getUUID()) || Permissions.hasPermission(player, "plots.admin.command.generatebiome"), + plot.isOwner(player.getUUID()) || player.hasPermission("plots.admin.command.generatebiome"), TranslatableCaption.of("permission.no_plot_perms") ); if (plot.getRunning() != 0) { @@ -64,7 +65,7 @@ public class PlotSetBiome extends Command { return null; } checkTrue(args.length == 1, TranslatableCaption.of("commandconfig.command_syntax"), - Templates.of("value", getUsage()) + TagResolver.resolver("value", Tag.inserting(Component.text(getUsage()))) ); final Set regions = plot.getRegions(); BiomeRegistry biomeRegistry = @@ -80,7 +81,7 @@ public class PlotSetBiome extends Command { player.sendMessage(TranslatableCaption.of("biome.need_biome")); player.sendMessage( TranslatableCaption.of("commandconfig.subcommand_set_options_header"), - Templates.of("values", biomes) + TagResolver.resolver("value", Tag.inserting(Component.text(biomes))) ); return CompletableFuture.completedFuture(false); } diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java index a34fac51f..e1ac20617 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/regions/plotsquared/PlotSquaredFeature.java @@ -42,7 +42,7 @@ public class PlotSquaredFeature extends FaweMaskManager { if (Settings.FAWE_Components.FAWE_HOOK) { Settings.Enabled_Components.WORLDEDIT_RESTRICTIONS = false; if (Settings.PLATFORM.toLowerCase(Locale.ROOT).startsWith("bukkit")) { - new FaweTrim(); + // new FaweTrim(); } // TODO: revisit this later on /* diff --git a/worldedit-bukkit/src/test/java/com/sk89q/wepif/TestOfflinePermissible.java b/worldedit-bukkit/src/test/java/com/sk89q/wepif/TestOfflinePermissible.java index 9ef3d3894..981812e1b 100644 --- a/worldedit-bukkit/src/test/java/com/sk89q/wepif/TestOfflinePermissible.java +++ b/worldedit-bukkit/src/test/java/com/sk89q/wepif/TestOfflinePermissible.java @@ -19,6 +19,8 @@ package com.sk89q.wepif; +import com.destroystokyo.paper.profile.PlayerProfile; +import org.bukkit.BanEntry; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.OfflinePlayer; @@ -30,10 +32,11 @@ import org.bukkit.permissions.Permission; import org.bukkit.permissions.PermissionAttachment; import org.bukkit.permissions.PermissionAttachmentInfo; import org.bukkit.plugin.Plugin; -import org.bukkit.profile.PlayerProfile; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; import javax.annotation.Nonnull; +import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Locale; @@ -158,6 +161,15 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible { throw new UnsupportedOperationException("Not supported yet."); } + @Override + public @Nullable BanEntry ban( + @Nullable final String reason, + @Nullable final Date expires, + @Nullable final String source + ) { + return null; + } + @Override public boolean isWhitelisted() { throw new UnsupportedOperationException("Not supported yet."); @@ -323,4 +335,9 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible { } + @Override + public @Nullable Location getLastDeathLocation() { + return null; + } + } diff --git a/worldedit-core/build.gradle.kts b/worldedit-core/build.gradle.kts index c9b34d5b1..4e624bd3b 100644 --- a/worldedit-core/build.gradle.kts +++ b/worldedit-core/build.gradle.kts @@ -28,14 +28,13 @@ dependencies { implementation("com.google.code.gson:gson") // Platform expectations - // TODO update bom-newest - implementation("org.yaml:snakeyaml:2.0") + implementation("org.yaml:snakeyaml") // Logging implementation("org.apache.logging.log4j:log4j-api") // Plugins - compileOnly("com.plotsquared:PlotSquared-Core") { isTransitive = false } + compileOnly("com.intellectualsites.plotsquared:plotsquared-core") { isTransitive = false } // ensure this is on the classpath for the AP annotationProcessor(libs.guava) From 34a98a03c1c43440ea93c6042763b7d1bf5f3aa0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 22 Jul 2023 10:02:22 +0000 Subject: [PATCH 143/161] Update dependency gradle to v8.2.1 (#2373) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 62f495dfe..9f4197d5f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME From f58f00e97f30c72f0834d37b2aa0e0b1260af8ef Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 22 Jul 2023 12:21:08 +0200 Subject: [PATCH 144/161] Update plugin com.modrinth.minotaur to v2.8.2 (#2374) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- worldedit-bukkit/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index a6d31be03..1962ff078 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -3,7 +3,7 @@ import io.papermc.paperweight.userdev.attribute.Obfuscation plugins { `java-library` - id("com.modrinth.minotaur") version "2.8.1" + id("com.modrinth.minotaur") version "2.8.2" } project.description = "Bukkit" From 37bfe426bc2661686f146ba5224ad86f4c4467c8 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sat, 22 Jul 2023 12:27:54 +0200 Subject: [PATCH 145/161] Release 2.7.0 --- build.gradle.kts | 4 ++-- .../extent/processor/EntityInBlockRemovingProcessor.java | 2 +- .../core/function/pattern/TypeSwapPattern.java | 4 ++-- .../core/internal/exception/FaweException.java | 4 ++-- .../core/queue/implementation/QueueHandler.java | 4 ++-- .../com/fastasyncworldedit/core/regions/FaweMask.java | 2 +- .../fastasyncworldedit/core/regions/FaweMaskManager.java | 2 +- .../com/fastasyncworldedit/core/util/TaskManager.java | 8 ++++---- .../core/util/task/AsyncNotifyKeyedQueue.java | 2 +- .../java/com/sk89q/worldedit/world/block/BlockType.java | 4 ++-- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index de0d714cc..a0930e8ec 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,7 +34,7 @@ logger.lifecycle(""" ******************************************* """) -var rootVersion by extra("2.6.5") +var rootVersion by extra("2.7.0") var snapshot by extra("SNAPSHOT") var revision: String by extra("") var buildNumber by extra("") @@ -52,7 +52,7 @@ ext { } } -version = String.format("%s-%s", rootVersion, buildNumber) +version = String.format("%s", rootVersion) if (!project.hasProperty("gitCommitHash")) { apply(plugin = "org.ajoberstar.grgit") diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EntityInBlockRemovingProcessor.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EntityInBlockRemovingProcessor.java index 1ffea1266..58baf8633 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EntityInBlockRemovingProcessor.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/processor/EntityInBlockRemovingProcessor.java @@ -15,7 +15,7 @@ import org.jetbrains.annotations.Nullable; /** * Processor that removes existing entities that would not be in air after the edit * - * @since TODO + * @since 2.7.0 */ public class EntityInBlockRemovingProcessor implements IBatchProcessor { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/TypeSwapPattern.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/TypeSwapPattern.java index 89876f658..efc122b5d 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/TypeSwapPattern.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/function/pattern/TypeSwapPattern.java @@ -16,7 +16,7 @@ import java.util.regex.Pattern; * Pattern that replaces blocks based on their ID, matching for an "input" and replacing with an "output" string. The "input" * string may be regex. Keeps as much of the block state as possible, excluding NBT data. * - * @since TODO + * @since 2.7.0 */ public class TypeSwapPattern extends AbstractExtentPattern { @@ -34,7 +34,7 @@ public class TypeSwapPattern extends AbstractExtentPattern { * @param inputString string to replace. May be regex. * @param outputString string to replace with * @param allowRegex if regex should be allowed for input string matching - * @since TODO + * @since 2.7.0 */ public TypeSwapPattern(Extent extent, String inputString, String outputString, boolean allowRegex) { super(extent); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweException.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweException.java index fd74ac5de..7a71b831b 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweException.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/internal/exception/FaweException.java @@ -41,7 +41,7 @@ public class FaweException extends RuntimeException { * New instance of a given {@link FaweException.Type} * * @param ignorable if an edit can continue if this exception is caught, e.g. by {@link com.fastasyncworldedit.core.extent.LimitExtent} - * @since TODO + * @since 2.7.0 */ public FaweException(Component reason, Type type, boolean ignorable) { this.message = reason; @@ -70,7 +70,7 @@ public class FaweException extends RuntimeException { /** * If an edit can continue if this exception is caught, e.g. by {@link com.fastasyncworldedit.core.extent.LimitExtent} * - * @since TODO + * @since 2.7.0 */ public boolean ignorable() { return ignorable; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java index bc7f9ddec..014b94fce 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/implementation/QueueHandler.java @@ -516,7 +516,7 @@ public abstract class QueueHandler implements Trimable, Runnable { *

* Internal API usage only. * - * @since TODO + * @since 2.7.0 */ public ExecutorService getForkJoinPoolPrimary() { return forkJoinPoolPrimary; @@ -528,7 +528,7 @@ public abstract class QueueHandler implements Trimable, Runnable { *

* Internal API usage only. * - * @since TODO + * @since 2.7.0 */ public ExecutorService getForkJoinPoolSecondary() { return forkJoinPoolSecondary; diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMask.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMask.java index 478ac90c9..f50c1a67e 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMask.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMask.java @@ -38,7 +38,7 @@ public class FaweMask implements IDelegateRegion { * @param type type of mask * @param notify if the player should be notified * @return if still valid - * @since TODO + * @since 2.7.0 */ public boolean isValid(Player player, FaweMaskManager.MaskType type, boolean notify) { return isValid(player, type); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMaskManager.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMaskManager.java index c52cc17e7..29136a178 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMaskManager.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/regions/FaweMaskManager.java @@ -30,7 +30,7 @@ public abstract class FaweMaskManager { /** * Get a {@link FaweMask} for the given player and {@link MaskType}. If isWhitelist is false, will return a "blacklist" mask. * - * @since TODO + * @since 2.7.0 */ public FaweMask getMask(final Player player, MaskType type, boolean isWhitelist, boolean notify) { return getMask(player, type, isWhitelist); diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TaskManager.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TaskManager.java index 65025bcd0..176e02673 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TaskManager.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/TaskManager.java @@ -91,7 +91,7 @@ public abstract class TaskManager { * * @deprecated Deprecated without replacement as unused internally, and poor implementation of what it's designed to do. */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "2.7.0") public void parallel(Collection runables) { for (Runnable run : runables) { pool.submit(run); @@ -106,7 +106,7 @@ public abstract class TaskManager { * @param numThreads number of threads (null = config.yml parallel threads) * @deprecated Deprecated without replacement as unused internally, and poor implementation of what it's designed to do. */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "2.7.0") public void parallel(Collection runnables, @Nullable Integer numThreads) { if (runnables == null) { return; @@ -278,7 +278,7 @@ public abstract class TaskManager { /** * @deprecated Deprecated without replacement as unused internally, and poor implementation of what it's designed to do. */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "2.7.0") public void wait(AtomicBoolean running, int timeout) { try { long start = System.currentTimeMillis(); @@ -299,7 +299,7 @@ public abstract class TaskManager { /** * @deprecated Deprecated without replacement as unused internally, and poor implementation of what it's designed to do. */ - @Deprecated(forRemoval = true, since = "TODO") + @Deprecated(forRemoval = true, since = "2.7.0") public void notify(AtomicBoolean running) { running.set(false); synchronized (running) { diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/AsyncNotifyKeyedQueue.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/AsyncNotifyKeyedQueue.java index 9df6b197c..cb6747cd2 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/AsyncNotifyKeyedQueue.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/task/AsyncNotifyKeyedQueue.java @@ -13,7 +13,7 @@ import java.util.function.Supplier; * async queue that accepts a {@link Thread.UncaughtExceptionHandler} for exception handling per instance, delegating to a * parent {@link KeyQueuedExecutorService}. * - * @since TODO + * @since 2.7.0 */ public class AsyncNotifyKeyedQueue implements Closeable { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java index e5a466e29..7762ee532 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java @@ -86,7 +86,7 @@ public class BlockType implements Keyed, Pattern { * a specific requirement to actually create new block types, please contact the FAWE devs to discuss. Use * {@link BlockTypes#get(String)} instead. */ - @Deprecated(since = "TODO") + @Deprecated(since = "2.7.0") //FAWE end public BlockType(String id) { this(id, null); @@ -98,7 +98,7 @@ public class BlockType implements Keyed, Pattern { * a specific requirement to actually create new block types, please contact the FAWE devs to discuss. Use * {@link BlockTypes#get(String)} instead. */ - @Deprecated(since = "TODO") + @Deprecated(since = "2.7.0") //FAWE end public BlockType(String id, Function values) { // If it has no namespace, assume minecraft. From 006ccd6887d06b2de5e96ab15f9f595f5b76d9c8 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Sat, 22 Jul 2023 12:44:37 +0200 Subject: [PATCH 146/161] Back to snapshot for development --- build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index a0930e8ec..3f6169bb7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -34,7 +34,7 @@ logger.lifecycle(""" ******************************************* """) -var rootVersion by extra("2.7.0") +var rootVersion by extra("2.7.1") var snapshot by extra("SNAPSHOT") var revision: String by extra("") var buildNumber by extra("") @@ -52,7 +52,7 @@ ext { } } -version = String.format("%s", rootVersion) +version = String.format("%s-%s", rootVersion, buildNumber) if (!project.hasProperty("gitCommitHash")) { apply(plugin = "org.ajoberstar.grgit") From 2f6de996e3d3cfc542e10b01fc379e1450450623 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sat, 22 Jul 2023 13:14:01 +0100 Subject: [PATCH 147/161] fix: processorExtent can be null in editsession - fixes #2375 --- .../fastasyncworldedit/core/util/ExtentTraverser.java | 3 +++ .../src/main/java/com/sk89q/worldedit/EditSession.java | 10 ++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/ExtentTraverser.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/ExtentTraverser.java index b4822863c..e7038deaa 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/ExtentTraverser.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/ExtentTraverser.java @@ -4,6 +4,7 @@ import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import javax.annotation.Nonnull; +import javax.annotation.Nullable; import java.lang.reflect.Field; public class ExtentTraverser { @@ -24,6 +25,7 @@ public class ExtentTraverser { return root != null; } + @Nullable public T get() { return root; } @@ -50,6 +52,7 @@ public class ExtentTraverser { } @SuppressWarnings("unchecked") + @Nullable public U findAndGet(Class clazz) { ExtentTraverser traverser = find(clazz); return (traverser != null) ? (U) traverser.get() : null; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index f60a1cbf2..983292ca5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -529,10 +529,12 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { //FAWE start - ExtentTraverser & MaskingExtents MaskingExtent maskingExtent = new ExtentTraverser<>(getExtent()).findAndGet(MaskingExtent.class); if (maskingExtent == null) { - ExtentTraverser processorExtent = - new ExtentTraverser<>(getExtent()).find(ExtentBatchProcessorHolder.class); - maskingExtent = - new ProcessorTraverser<>(processorExtent.get().getProcessor()).find(MaskingExtent.class); + ExtentBatchProcessorHolder processorExtent = + new ExtentTraverser<>(getExtent()).findAndGet(ExtentBatchProcessorHolder.class); + if (processorExtent != null) { + maskingExtent = + new ProcessorTraverser<>(processorExtent.getProcessor()).find(MaskingExtent.class); + } } return maskingExtent != null ? maskingExtent.getMask() : null; //FAWE end From 48be6ac94bb559d563eab6f2e5b92b807f2e089e Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sat, 22 Jul 2023 17:44:05 +0100 Subject: [PATCH 148/161] fix: processorExtent can be null when setting masks too - fixes #2379 --- .../src/main/java/com/sk89q/worldedit/EditSession.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java index 983292ca5..ecf859896 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSession.java @@ -631,10 +631,12 @@ public class EditSession extends PassthroughExtent implements AutoCloseable { } MaskingExtent maskingExtent = new ExtentTraverser<>(getExtent()).findAndGet(MaskingExtent.class); if (maskingExtent == null && mask != Masks.alwaysTrue()) { - ExtentTraverser processorExtent = - new ExtentTraverser<>(getExtent()).find(ExtentBatchProcessorHolder.class); - maskingExtent = - new ProcessorTraverser<>(processorExtent.get().getProcessor()).find(MaskingExtent.class); + ExtentBatchProcessorHolder processorExtent = + new ExtentTraverser<>(getExtent()).findAndGet(ExtentBatchProcessorHolder.class); + if (processorExtent != null) { + maskingExtent = + new ProcessorTraverser<>(processorExtent.getProcessor()).find(MaskingExtent.class); + } } if (maskingExtent != null) { Mask oldMask = maskingExtent.getMask(); From 8b39e41a1a11c8ae2b7898da3a586bfca81c5278 Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 27 Jul 2023 09:59:11 +0100 Subject: [PATCH 149/161] fix: don't warn on release build (#2369) --- .../com/fastasyncworldedit/core/util/UpdateNotification.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/UpdateNotification.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/UpdateNotification.java index 13effcc46..73ad01361 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/UpdateNotification.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/util/UpdateNotification.java @@ -59,7 +59,7 @@ public class UpdateNotification { Document doc = db.parse(body); faweVersion = doc.getElementsByTagName("lastSuccessfulBuild").item(0).getFirstChild().getTextContent(); FaweVersion faweVersion = Fawe.instance().getVersion(); - if (faweVersion.build == 0) { + if (faweVersion.build == 0 && !faweVersion.snapshot) { LOGGER.warn("You are using a snapshot or a custom version of FAWE. This is not an official build distributed " + "via https://www.spigotmc.org/resources/13932/"); return; From d42854845acf4c658ac8104cc26df0afe8e4db5a Mon Sep 17 00:00:00 2001 From: Jordan Date: Thu, 27 Jul 2023 10:02:41 +0100 Subject: [PATCH 150/161] fix: disallowed regions can be length 0 (#2368) --- .../com/sk89q/worldedit/EditSessionBuilder.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java index e5c53a45b..ca6f3b6a5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/EditSessionBuilder.java @@ -607,20 +607,17 @@ public final class EditSessionBuilder { } FaweRegionExtent regionExtent = null; - if (disallowedRegions != null) { // Always use MultiRegionExtent if we have blacklist regions + // Always use MultiRegionExtent if we have blacklist regions + if (allowedRegions != null && allowedRegions.length == 0) { + regionExtent = new NullExtent(this.extent, FaweCache.NO_REGION); + } else if (disallowedRegions != null && disallowedRegions.length != 0) { regionExtent = new MultiRegionExtent(this.extent, this.limit, allowedRegions, disallowedRegions); } else if (allowedRegions == null) { allowedRegions = new Region[]{RegionWrapper.GLOBAL()}; + } else if (allowedRegions.length == 1) { + regionExtent = new SingleRegionExtent(this.extent, this.limit, allowedRegions[0]); } else { - if (allowedRegions.length == 0) { - regionExtent = new NullExtent(this.extent, FaweCache.NO_REGION); - } else { - if (allowedRegions.length == 1) { - regionExtent = new SingleRegionExtent(this.extent, this.limit, allowedRegions[0]); - } else { - regionExtent = new MultiRegionExtent(this.extent, this.limit, allowedRegions, null); - } - } + regionExtent = new MultiRegionExtent(this.extent, this.limit, allowedRegions, null); } if (regionExtent != null) { if (placeChunks) { From 9ae04b8d40b3901ee283530a0b51fda659de1f6e Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Mon, 31 Jul 2023 11:44:14 +0200 Subject: [PATCH 151/161] Update v7 notification --- .../src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java index 90db4368c..c8945b625 100644 --- a/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java +++ b/worldedit-bukkit/src/main/java/com/fastasyncworldedit/bukkit/FaweBukkit.java @@ -329,7 +329,7 @@ public class FaweBukkit implements IFawe, Listener { WEManager.weManager().addManager(new com.fastasyncworldedit.bukkit.regions.plotsquared.PlotSquaredFeature()); LOGGER.info("Plugin 'PlotSquared' v7 found. Using it now."); } else { - LOGGER.error("Incompatible version of PlotSquared found. Please use PlotSquared v6."); + LOGGER.error("Incompatible version of PlotSquared found. Please use PlotSquared v7."); LOGGER.info("https://www.spigotmc.org/resources/77506/"); } } From 0dbc0db43f8e4d888263576a1da5ec7150eec58e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 14:07:19 +0200 Subject: [PATCH 152/161] Update plugin com.modrinth.minotaur to v2.8.3 (#2392) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- worldedit-bukkit/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index 1962ff078..1e3bbf4a1 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -3,7 +3,7 @@ import io.papermc.paperweight.userdev.attribute.Obfuscation plugins { `java-library` - id("com.modrinth.minotaur") version "2.8.2" + id("com.modrinth.minotaur") version "2.8.3" } project.description = "Bukkit" From 4ca0a95e1850601db6be9783a6b4c374c0e0c78d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 14:07:27 +0200 Subject: [PATCH 153/161] Update dependency com.sk89q.worldguard:worldguard-bukkit to v7.0.9 (#2391) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9ff63fb98..1a25597c1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ log4j = "2.19.0" # Plugins dummypermscompat = "1.10" -worldguard-bukkit = "7.0.8" +worldguard-bukkit = "7.0.9" mapmanager = "1.8.0-SNAPSHOT" griefprevention = "16.18.1" griefdefender = "2.1.0-SNAPSHOT" From a6f1c6ac82242bb62c665bbd8e721736535b7b17 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 14:07:35 +0200 Subject: [PATCH 154/161] Update dependency com.palmergames.bukkit.towny:towny to v0.99.5.7 (#2390) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1a25597c1..3f463bc9c 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -11,7 +11,7 @@ mapmanager = "1.8.0-SNAPSHOT" griefprevention = "16.18.1" griefdefender = "2.1.0-SNAPSHOT" residence = "4.5._13.1" -towny = "0.99.5.4" +towny = "0.99.5.7" # Third party bstats = "3.0.2" From 50e45f07f096539c9754e2295d6f632f9654a1b2 Mon Sep 17 00:00:00 2001 From: Jeff P Date: Wed, 2 Aug 2023 08:08:58 -0400 Subject: [PATCH 155/161] fix: Do not tab complete if command not owned by FAWE (#2386) --- .../java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index f1edf65f7..e881416c5 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -672,6 +672,13 @@ public class WorldEditPlugin extends JavaPlugin { String label = buffer.substring(0, firstSpace); // Strip leading slash, if present. label = label.startsWith("/") ? label.substring(1) : label; + + // If command not owned by FAWE, do not tab complete + Plugin owner = platform.getDynamicCommands().getCommandOwner(label); + if (owner != WorldEditPlugin.this) { + return; + } + final Optional command = WorldEdit.getInstance().getPlatformManager().getPlatformCommandManager().getCommandManager().getCommand( label); From e81980651e1512e797ffc1beac66acad03ffc5a2 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Wed, 9 Aug 2023 20:52:18 +0200 Subject: [PATCH 156/161] Cleanup dependencies --- buildSrc/src/main/kotlin/AdapterConfig.kt | 1 - buildSrc/src/main/kotlin/CommonJavaConfig.kt | 11 ++++--- gradle/libs.versions.toml | 29 ++++++++++++++++++ .../adapters/adapter-1_17_1/build.gradle.kts | 2 +- .../adapters/adapter-1_18_2/build.gradle.kts | 2 +- .../adapters/adapter-1_19_4/build.gradle.kts | 2 +- .../adapters/adapter-1_20/build.gradle.kts | 2 +- worldedit-bukkit/build.gradle.kts | 30 +++++++++---------- .../sk89q/wepif/TestOfflinePermissible.java | 20 +++++++++++++ worldedit-cli/build.gradle.kts | 8 ++--- worldedit-core/build.gradle.kts | 18 +++++------ 11 files changed, 86 insertions(+), 39 deletions(-) diff --git a/buildSrc/src/main/kotlin/AdapterConfig.kt b/buildSrc/src/main/kotlin/AdapterConfig.kt index 6cad58e3b..60f9a5733 100644 --- a/buildSrc/src/main/kotlin/AdapterConfig.kt +++ b/buildSrc/src/main/kotlin/AdapterConfig.kt @@ -15,7 +15,6 @@ fun Project.applyPaperweightAdapterConfiguration() { dependencies { "implementation"(project(":worldedit-bukkit")) - "implementation"(platform("com.intellectualsites.bom:bom-newest:1.33")) } tasks.named("assemble") { diff --git a/buildSrc/src/main/kotlin/CommonJavaConfig.kt b/buildSrc/src/main/kotlin/CommonJavaConfig.kt index 73389ce83..549a26037 100644 --- a/buildSrc/src/main/kotlin/CommonJavaConfig.kt +++ b/buildSrc/src/main/kotlin/CommonJavaConfig.kt @@ -40,12 +40,11 @@ fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, banSlf4j: Boolean dependencies { "compileOnly"("com.google.code.findbugs:jsr305:3.0.2") - "testImplementation"("org.junit.jupiter:junit-jupiter-api:5.9.2") - "testImplementation"("org.junit.jupiter:junit-jupiter-params:5.9.2") - "testImplementation"("org.mockito:mockito-core:5.1.1") - "testImplementation"("org.mockito:mockito-junit-jupiter:5.1.1") - "testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:5.9.2") - "implementation"(platform("com.intellectualsites.bom:bom-newest:1.33")) + "testImplementation"("org.junit.jupiter:junit-jupiter-api:5.10.0") + "testImplementation"("org.junit.jupiter:junit-jupiter-params:5.10.0") + "testImplementation"("org.mockito:mockito-core:5.4.0") + "testImplementation"("org.mockito:mockito-junit-jupiter:5.4.0") + "testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:5.10.0") } // Java 8 turns on doclint which we fail diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 3f463bc9c..e694c8c8d 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,8 +1,11 @@ [versions] # Minecraft expectations +paper = "1.20.1-R0.1-SNAPSHOT" fastutil = "8.5.9" guava = "31.1-jre" log4j = "2.19.0" +gson = "2.10" +snakeyaml = "2.0" # Plugins dummypermscompat = "1.10" @@ -12,12 +15,15 @@ griefprevention = "16.18.1" griefdefender = "2.1.0-SNAPSHOT" residence = "4.5._13.1" towny = "0.99.5.7" +plotsquared = "7.0.0-rc.4" # Third party bstats = "3.0.2" sparsebitset = "1.2" parallelgzip = "1.0.5" adventure = "4.14.0" +adventure-bukkit = "4.3.0" +checkerqual = "3.37.0" truezip = "6.8.4" auto-value = "1.10.2" findbugs = "3.0.2" @@ -29,6 +35,11 @@ jlibnoise = "1.0.0" jchronic = "0.2.4a" lz4-java = "1.8.0" lz4-stream = "1.0.0" +commons-cli = "1.5.0" +paperlib = "1.0.8" +paster = "1.1.5" +vault = "1.7.1" +serverlib = "2.3.1" ## Internal text-adapter = "3.0.6" text = "3.0.4" @@ -39,12 +50,17 @@ mockito = "5.4.0" # Gradle plugins pluginyml = "0.6.0" +minotaur = "2.8.3" [libraries] # Minecraft expectations +paper = { group = "io.papermc.paper", name = "paper-api", version.ref = "paper" } fastutil = { group = "it.unimi.dsi", name = "fastutil", version.ref = "fastutil" } log4jBom = { group = "org.apache.logging.log4j", name = "log4j-bom", version.ref = "log4j" } +log4jApi = { group = "org.apache.logging.log4j", name = "log4j-api", version.ref = "log4j" } guava = { group = "com.google.guava", name = "guava", version.ref = "guava" } +gson = { group = "com.google.code.gson", name = "gson", version.ref = "gson" } +snakeyaml = { group = "org.yaml", name = "snakeyaml", version.ref = "snakeyaml" } # Plugins dummypermscompat = { group = "com.sk89q", name = "dummypermscompat", version.ref = "dummypermscompat" } @@ -54,9 +70,12 @@ griefprevention = { group = "com.github.TechFortress", name = "GriefPrevention", griefdefender = { group = "com.griefdefender", name = "api", version.ref = "griefdefender" } residence = { group = "com.bekvon.bukkit.residence", name = "Residence", version.ref = "residence" } towny = { group = "com.palmergames.bukkit.towny", name = "towny", version.ref = "towny" } +plotSquaredCore = { group = "com.intellectualsites.plotsquared", name = "plotsquared-core", version.ref = "plotsquared" } +plotSquaredBukkit = { group = "com.intellectualsites.plotsquared", name = "plotsquared-bukkit", version.ref = "plotsquared" } # Third Party bstatsBase = { group = "org.bstats", name = "bstats-base", version.ref = "bstats" } +bstatsBukkit = { group = "org.bstats", name = "bstats-bukkit", version.ref = "bstats" } sparsebitset = { group = "com.zaxxer", name = "SparseBitSet", version.ref = "sparsebitset" } parallelgzip = { group = "org.anarres", name = "parallelgzip", version.ref = "parallelgzip" } adventureNbt = { group = "net.kyori", name = "adventure-nbt", version.ref = "adventure" } @@ -73,6 +92,15 @@ jlibnoise = { group = "com.sk89q.lib", name = "jlibnoise", version.ref = "jlibno jchronic = { group = "com.sk89q", name = "jchronic", version.ref = "jchronic" } lz4Java = { group = "org.lz4", name = "lz4-java", version.ref = "lz4-java" } lz4JavaStream = { group = "net.jpountz", name = "lz4-java-stream", version.ref = "lz4-stream" } +commonsCli = { group = "commons-cli", name = "commons-cli", version.ref = "commons-cli" } +paperlib = { group = "io.papermc", name = "paperlib", version.ref = "paperlib" } +adventureApi = { group = "net.kyori", name = "adventure-api", version.ref = "adventure" } +adventureMiniMessage = { group = "net.kyori", name = "adventure-text-minimessage", version.ref = "adventure" } +adventureBukkit = { group = "net.kyori", name = "adventure-platform-bukkit", version.ref = "adventure-bukkit" } +paster = { group = "com.intellectualsites.paster", name = "Paster", version.ref = "paster" } +vault = { group = "com.github.MilkBowl", name = "VaultAPI", version.ref = "vault" } +serverlib = { group = "dev.notmyfault.serverlib", name = "ServerLib", version.ref = "serverlib" } +checkerqual = { group = "org.checkerframework", name = "checker-qual", version.ref = "checkerqual" } # Internal ## Text @@ -94,3 +122,4 @@ log4jCore = { group = "org.apache.logging.log4j", name = "log4j-core", version.r [plugins] pluginyml = { id = "net.minecrell.plugin-yml.bukkit", version.ref = "pluginyml" } +minotaur = { id = "com.modrinth.minotaur", version.ref = "minotaur" } diff --git a/worldedit-bukkit/adapters/adapter-1_17_1/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_17_1/build.gradle.kts index 940dfcb0b..24c121c3f 100644 --- a/worldedit-bukkit/adapters/adapter-1_17_1/build.gradle.kts +++ b/worldedit-bukkit/adapters/adapter-1_17_1/build.gradle.kts @@ -22,5 +22,5 @@ configurations.all { dependencies { the().paperDevBundle("1.17.1-R0.1-20220414.034903-210") - compileOnly("io.papermc:paperlib") + compileOnly(libs.paperlib) } diff --git a/worldedit-bukkit/adapters/adapter-1_18_2/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_18_2/build.gradle.kts index aaa4643d2..f7f40ce66 100644 --- a/worldedit-bukkit/adapters/adapter-1_18_2/build.gradle.kts +++ b/worldedit-bukkit/adapters/adapter-1_18_2/build.gradle.kts @@ -13,5 +13,5 @@ repositories { dependencies { // https://papermc.io/repo/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/ the().paperDevBundle("1.18.2-R0.1-20220920.010157-167") - compileOnly("io.papermc:paperlib") + compileOnly(libs.paperlib) } diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts index 5e1f312bc..df27ae5d6 100644 --- a/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts +++ b/worldedit-bukkit/adapters/adapter-1_19_4/build.gradle.kts @@ -12,5 +12,5 @@ repositories { dependencies { the().paperDevBundle("1.19.4-R0.1-20230608.201059-104") - compileOnly("io.papermc:paperlib") + compileOnly(libs.paperlib) } diff --git a/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts index cf13348ff..8d116f3bc 100644 --- a/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts +++ b/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts @@ -13,5 +13,5 @@ repositories { dependencies { // https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/ the().paperDevBundle("1.20.1-R0.1-20230623.105806-29") - compileOnly("io.papermc:paperlib") + compileOnly(libs.paperlib) } diff --git a/worldedit-bukkit/build.gradle.kts b/worldedit-bukkit/build.gradle.kts index 1e3bbf4a1..a6e853eef 100644 --- a/worldedit-bukkit/build.gradle.kts +++ b/worldedit-bukkit/build.gradle.kts @@ -3,7 +3,7 @@ import io.papermc.paperweight.userdev.attribute.Obfuscation plugins { `java-library` - id("com.modrinth.minotaur") version "2.8.3" + alias(libs.plugins.minotaur) } project.description = "Bukkit" @@ -74,19 +74,19 @@ dependencies { implementation(libs.fastutil) // Platform expectations - compileOnly("io.papermc.paper:paper-api") { + compileOnly(libs.paper) { exclude("junit", "junit") exclude(group = "org.slf4j", module = "slf4j-api") } // Logging - localImplementation("org.apache.logging.log4j:log4j-api") + localImplementation(libs.log4jApi) localImplementation(libs.log4jBom) { because("Spigot provides Log4J (sort of, not in API, implicitly part of server)") } // Plugins - compileOnly("com.github.MilkBowl:VaultAPI") { isTransitive = false } + compileOnly(libs.vault) { isTransitive = false } compileOnly(libs.dummypermscompat) { exclude("com.github.MilkBowl", "VaultAPI") } @@ -101,26 +101,26 @@ dependencies { compileOnly(libs.griefdefender) { isTransitive = false } compileOnly(libs.residence) { isTransitive = false } compileOnly(libs.towny) { isTransitive = false } - compileOnly("com.intellectualsites.plotsquared:plotsquared-bukkit") { isTransitive = false } - compileOnly("com.intellectualsites.plotsquared:plotsquared-core") { isTransitive = false } + compileOnly(libs.plotSquaredBukkit) { isTransitive = false } + compileOnly(libs.plotSquaredCore) { isTransitive = false } // Third party - implementation("io.papermc:paperlib") - implementation("org.bstats:bstats-bukkit") { isTransitive = false } + implementation(libs.paperlib) + implementation(libs.bstatsBukkit) { isTransitive = false } implementation(libs.bstatsBase) { isTransitive = false } - implementation("dev.notmyfault.serverlib:ServerLib") - implementation("com.intellectualsites.paster:Paster") { isTransitive = false } + implementation(libs.serverlib) + implementation(libs.paster) { isTransitive = false } api(libs.lz4Java) { isTransitive = false } api(libs.sparsebitset) { isTransitive = false } api(libs.parallelgzip) { isTransitive = false } - compileOnly("net.kyori:adventure-api") - compileOnlyApi("org.checkerframework:checker-qual") + compileOnly(libs.adventureApi) + compileOnlyApi(libs.checkerqual) // Tests testImplementation(libs.mockito) - testImplementation("net.kyori:adventure-api") - testImplementation("org.checkerframework:checker-qual") - testImplementation("io.papermc.paper:paper-api") { isTransitive = true } + testImplementation(libs.adventureApi) + testImplementation(libs.checkerqual) + testImplementation(libs.paper) { isTransitive = true } } tasks.named("processResources") { diff --git a/worldedit-bukkit/src/test/java/com/sk89q/wepif/TestOfflinePermissible.java b/worldedit-bukkit/src/test/java/com/sk89q/wepif/TestOfflinePermissible.java index 981812e1b..c63e98663 100644 --- a/worldedit-bukkit/src/test/java/com/sk89q/wepif/TestOfflinePermissible.java +++ b/worldedit-bukkit/src/test/java/com/sk89q/wepif/TestOfflinePermissible.java @@ -36,6 +36,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.annotation.Nonnull; +import java.time.Duration; +import java.time.Instant; import java.util.Date; import java.util.HashMap; import java.util.HashSet; @@ -161,6 +163,24 @@ public class TestOfflinePermissible implements OfflinePlayer, Permissible { throw new UnsupportedOperationException("Not supported yet."); } + @Override + public > @Nullable E ban( + @Nullable final String reason, + @Nullable final Instant expires, + @Nullable final String source + ) { + return null; + } + + @Override + public > @Nullable E ban( + @Nullable final String reason, + @Nullable final Duration duration, + @Nullable final String source + ) { + return null; + } + @Override public @Nullable BanEntry ban( @Nullable final String reason, diff --git a/worldedit-cli/build.gradle.kts b/worldedit-cli/build.gradle.kts index ff0c9b5c1..6f0335e0e 100644 --- a/worldedit-cli/build.gradle.kts +++ b/worldedit-cli/build.gradle.kts @@ -27,16 +27,16 @@ dependencies { // Minecraft expectations annotationProcessor(libs.guava) - implementation("com.google.guava:guava") - implementation("com.google.code.gson:gson") + implementation(libs.guava) + implementation(libs.gson) // Logging implementation(libs.log4jBom) { because("We control Log4J on this platform") } - implementation("org.apache.logging.log4j:log4j-api") + implementation(libs.log4jApi) implementation(libs.log4jCore) - implementation("commons-cli:commons-cli:1.5.0") + implementation(libs.commonsCli) api(libs.parallelgzip) { isTransitive = false } api(libs.lz4Java) } diff --git a/worldedit-core/build.gradle.kts b/worldedit-core/build.gradle.kts index 4e624bd3b..a58230b2c 100644 --- a/worldedit-core/build.gradle.kts +++ b/worldedit-core/build.gradle.kts @@ -11,7 +11,7 @@ applyPlatformAndCoreConfiguration() dependencies { constraints { - implementation("org.yaml:snakeyaml") { + implementation(libs.snakeyaml) { version { strictly("2.0") } because("Bukkit provides SnakeYaml") } @@ -24,17 +24,17 @@ dependencies { // Minecraft expectations implementation(libs.fastutil) - implementation("com.google.guava:guava") - implementation("com.google.code.gson:gson") + implementation(libs.guava) + implementation(libs.gson) // Platform expectations - implementation("org.yaml:snakeyaml") + implementation(libs.snakeyaml) // Logging - implementation("org.apache.logging.log4j:log4j-api") + implementation(libs.log4jApi) // Plugins - compileOnly("com.intellectualsites.plotsquared:plotsquared-core") { isTransitive = false } + compileOnly(libs.plotSquaredCore) { isTransitive = false } // ensure this is on the classpath for the AP annotationProcessor(libs.guava) @@ -45,11 +45,11 @@ dependencies { compileOnly(libs.truezip) implementation(libs.findbugs) implementation(libs.rhino) - compileOnly("net.kyori:adventure-api") + compileOnly(libs.adventureApi) compileOnlyApi(libs.adventureNbt) - compileOnlyApi("net.kyori:adventure-text-minimessage") + compileOnlyApi(libs.adventureMiniMessage) implementation(libs.zstd) { isTransitive = false } - compileOnly("com.intellectualsites.paster:Paster") + compileOnly(libs.paster) compileOnly(libs.lz4Java) { isTransitive = false } compileOnly(libs.sparsebitset) compileOnly(libs.parallelgzip) { isTransitive = false } From a3e855882c5fb5c5a0c9fe5a49f7d0bb716b2678 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Wed, 9 Aug 2023 20:54:46 +0200 Subject: [PATCH 157/161] [ci skip] Ignore snakeyaml updates --- .github/renovate.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/renovate.json b/.github/renovate.json index 526af5a60..c4f38d66b 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -20,7 +20,8 @@ "net.fabricmc.fabric-api:fabric-api", "com.github.luben:zstd-jni", "org.jetbrains.kotlin.jvm", - "log4j" + "org.apache.logging.log4j:log4j-api", + "org.yaml:snakeyaml" ], "labels": ["Renovate"], "rebaseWhen": "conflicted", From 7b3c674e1c9baadc2a4c853f006b1b12e4b7e323 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Wed, 9 Aug 2023 20:56:15 +0200 Subject: [PATCH 158/161] [ci skip] Ignore snakeyaml updates --- .github/renovate.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/renovate.json b/.github/renovate.json index c4f38d66b..314458a6d 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -20,7 +20,12 @@ "net.fabricmc.fabric-api:fabric-api", "com.github.luben:zstd-jni", "org.jetbrains.kotlin.jvm", + "log4j", "org.apache.logging.log4j:log4j-api", + "org.apache.logging.log4j:log4j-bom", + "org.apache.logging.log4j:log4j-slf4j-impl", + "org.bstats:bstats-sponge", + "org.spongepowered:spongeapi", "org.yaml:snakeyaml" ], "labels": ["Renovate"], From acb79469fb28ba7a15734b461586378eba7bc391 Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Wed, 9 Aug 2023 20:59:27 +0200 Subject: [PATCH 159/161] [ci skip] Update towny --- .github/renovate.json | 1 + gradle/libs.versions.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/renovate.json b/.github/renovate.json index 314458a6d..d0e59d791 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -24,6 +24,7 @@ "org.apache.logging.log4j:log4j-api", "org.apache.logging.log4j:log4j-bom", "org.apache.logging.log4j:log4j-slf4j-impl", + "org.apache.logging.log4j:log4j-core", "org.bstats:bstats-sponge", "org.spongepowered:spongeapi", "org.yaml:snakeyaml" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e694c8c8d..2172a6189 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -14,7 +14,7 @@ mapmanager = "1.8.0-SNAPSHOT" griefprevention = "16.18.1" griefdefender = "2.1.0-SNAPSHOT" residence = "4.5._13.1" -towny = "0.99.5.7" +towny = "0.99.5.10" plotsquared = "7.0.0-rc.4" # Third party From a088e6a96b7caf5e959b23ea84faae990467dfb6 Mon Sep 17 00:00:00 2001 From: Maddy Miller Date: Wed, 9 Aug 2023 18:32:37 -0400 Subject: [PATCH 160/161] Remove the Bukkit legacy data folder migration code from 11 years ago (#2383) (cherry picked from commit EngineHub/WorldEdit@7f81aad028f2b8244351764b56d7e9f1e9f3d1ec) --- .../worldedit/bukkit/BukkitConfiguration.java | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitConfiguration.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitConfiguration.java index eaa592395..46ca0bb55 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitConfiguration.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitConfiguration.java @@ -25,7 +25,6 @@ import com.sk89q.worldedit.util.YAMLConfiguration; import com.sk89q.worldedit.util.report.Unreported; import org.apache.logging.log4j.LogManager; -import java.io.File; import java.nio.file.Path; /** @@ -53,26 +52,6 @@ public class BukkitConfiguration extends YAMLConfiguration { WorldEdit.logger.warn("Editing without a Bukkit adapter has been enabled. You will not receive support " + "for any issues that arise as a result."); } - migrateLegacyFolders(); - } - - private void migrateLegacyFolders() { - migrate(scriptsDir, "craftscripts"); - migrate(saveDir, "schematics"); - migrate("drawings", "draw.js images"); - } - - private void migrate(String file, String name) { - File fromDir = new File(".", file); - File toDir = new File(getWorkingDirectoryPath().toFile(), file); - if (fromDir.exists() & !toDir.exists()) { - if (fromDir.renameTo(toDir)) { - plugin.getLogger().info("Migrated " + name + " folder '" + file - + "' from server root to plugin data folder."); - } else { - plugin.getLogger().warning("Error while migrating " + name + " folder!"); - } - } } @Override From fe33be5795ad26b17a17b508e93de37b66e7a01c Mon Sep 17 00:00:00 2001 From: Alexander Brandes Date: Fri, 18 Aug 2023 13:40:16 +0200 Subject: [PATCH 161/161] Update userdev --- worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts | 2 +- .../bukkit/adapter/ext/fawe/v1_20_R1/PaperweightAdapter.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts b/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts index 8d116f3bc..2f65af4ce 100644 --- a/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts +++ b/worldedit-bukkit/adapters/adapter-1_20/build.gradle.kts @@ -12,6 +12,6 @@ repositories { dependencies { // https://repo.papermc.io/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/ - the().paperDevBundle("1.20.1-R0.1-20230623.105806-29") + the().paperDevBundle("1.20.1-R0.1-20230818.021330-113") compileOnly(libs.paperlib) } diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightAdapter.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightAdapter.java index e495a078c..428176c5f 100644 --- a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightAdapter.java +++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/ext/fawe/v1_20_R1/PaperweightAdapter.java @@ -637,7 +637,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter