feat: Add support for 1.19 (#1783)

* feat: Add support for 1.19

* build: Update paperweight version

* fix: obfuscated names, invalid method signatures

* avoid NPE on config access

* build: Update paperweight

* implement no-op light engine to avoid stalled tasks that never complete

* Apply DelegateSemaphore fixes to 1.19 (#1782)

* Apply DelegateSemaphore fixes to 1.19

* Fixes

* Avoid using PalettedContainerRO#recreate as much as possible. Show an error or warning when we're forced to use it to help fix (#1784)

Co-authored-by: Pierre Maurice Schwang <mail@pschwang.eu>
Co-authored-by: SirYwell <hannesgreule@outlook.de>
Co-authored-by: Jordan <dordsor21@gmail.com>
This commit is contained in:
Alexander Brandes 2022-06-10 23:22:06 +02:00 committed by GitHub
parent da3fc2e6ea
commit aa94612b70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 646 additions and 231 deletions

View File

@ -2,16 +2,14 @@ rootProject.name = "FastAsyncWorldEdit"
include("worldedit-libs")
include("worldedit-bukkit:adapters:adapter-legacy")
include("worldedit-bukkit:adapters:adapter-1_17_1")
include("worldedit-bukkit:adapters:adapter-1_18")
include("worldedit-bukkit:adapters:adapter-1_18_2")
listOf("legacy", "1_17_1", "1_18_2", "1_19").forEach {
include("worldedit-bukkit:adapters:adapter-$it")
}
listOf("bukkit", "core", "cli").forEach {
include("worldedit-libs:$it")
include("worldedit-$it")
}
// include("worldedit-mod")
include("worldedit-libs:core:ap")
dependencyResolutionManagement {

View File

@ -13,6 +13,6 @@ repositories {
dependencies {
// https://papermc.io/repo/service/rest/repository/browse/maven-public/io/papermc/paper/dev-bundle/
paperDevBundle("1.18.2-R0.1-20220424.184034-95")
paperDevBundle("1.18.2-R0.1-20220607.005826-161")
compileOnly("io.papermc:paperlib")
}

View File

@ -12,6 +12,6 @@ repositories {
}
dependencies {
paperDevBundle("1.18.1-R0.1-20220228.153921-147")
paperDevBundle("1.19-R0.1-20220610.160059-2")
compileOnly("io.papermc:paperlib")
}

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_18_R1;
package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_19_R1;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
@ -35,7 +35,7 @@ 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_18_R1.PaperweightFaweAdapter;
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;
@ -125,13 +125,13 @@ import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World.Environment;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_18_R1.CraftServer;
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_18_R1.block.data.CraftBlockData;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_18_R1.util.CraftMagicNumbers;
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;
@ -183,8 +183,8 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
CraftServer.class.cast(Bukkit.getServer());
int dataVersion = CraftMagicNumbers.INSTANCE.getDataVersion();
if (dataVersion != 2860 && dataVersion != 2865) {
throw new UnsupportedClassVersionError("Not 1.18 or 1.18.1!");
if (dataVersion != 3105) {
throw new UnsupportedClassVersionError("Not 1.19!");
}
worldsField = CraftServer.class.getDeclaredField("worlds");
@ -197,11 +197,11 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
getChunkFutureMainThreadMethod.setAccessible(true);
mainThreadProcessorField = ServerChunkCache.class.getDeclaredField(
Refraction.pickName("mainThreadProcessor", "h")
Refraction.pickName("mainThreadProcessor", "g")
);
mainThreadProcessorField.setAccessible(true);
new PaperweightDataConverters(CraftMagicNumbers.INSTANCE.getDataVersion(), this).build(ForkJoinPool.commonPool());
new PaperweightDataConverters(CraftMagicNumbers.INSTANCE.getDataVersion(), this).buildUnoptimized();
Watchdog watchdog;
try {
@ -639,14 +639,17 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
originalWorld.getServer().executor,
session, newWorldData,
originalWorld.dimension(),
originalWorld.dimensionType(),
new LevelStem(
originalWorld.dimensionTypeRegistration(),
newOpts.dimensions().get(worldDimKey).generator()
),
new NoOpWorldLoadListener(),
newOpts.dimensions().get(worldDimKey).generator(),
originalWorld.isDebug(),
seed,
ImmutableList.of(),
false,
env, gen,
env,
gen,
bukkitWorld.getBiomeProvider()
);
try {
@ -717,7 +720,7 @@ public final class PaperweightAdapter implements BukkitImplAdapter<net.minecraft
}
extent.setBlock(vec, state.toBaseBlock());
if (options.shouldRegenBiomes()) {
Biome origBiome = chunk.getNoiseBiome(vec.getX(), vec.getY(), vec.getZ());
Biome origBiome = chunk.getNoiseBiome(vec.getX(), vec.getY(), vec.getZ()).value();
BiomeType adaptedBiome = adapt(serverWorld, origBiome);
if (adaptedBiome != null) {
extent.setBiome(vec, adaptedBiome);

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_18_R1;
package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_19_R1;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
@ -39,7 +39,6 @@ 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.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.GsonHelper;
import net.minecraft.util.StringUtil;
@ -225,10 +224,15 @@ class PaperweightDataConverters extends DataFixerBuilder implements com.sk89q.wo
// Called after fixers are built and ready for FIXING
@Override
public DataFixer build(final Executor executor) {
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 {
@ -844,8 +848,6 @@ class PaperweightDataConverters extends DataFixerBuilder implements com.sk89q.wo
private static class DataInspectorEntity implements DataInspector {
private static final Logger a = LogManager.getLogger(PaperweightDataConverters.class);
DataInspectorEntity() {
}
@ -1991,39 +1993,36 @@ class PaperweightDataConverters extends DataFixerBuilder implements com.sk89q.wo
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 = new TextComponent(s);
object = Component.literal(s);
} else {
try {
object = GsonHelper.fromJson(DataConverterSignText.a, s, Component.class, true);
if (object == null) {
object = new TextComponent("");
object = Component.literal("");
}
} catch (JsonParseException jsonparseexception) {
;
} catch (JsonParseException ignored) {
}
if (object == null) {
try {
object = Component.Serializer.fromJson(s);
} catch (JsonParseException jsonparseexception1) {
;
} catch (JsonParseException ignored) {
}
}
if (object == null) {
try {
object = Component.Serializer.fromJsonLenient(s);
} catch (JsonParseException jsonparseexception2) {
;
} catch (JsonParseException ignored) {
}
}
if (object == null) {
object = new TextComponent(s);
object = Component.literal(s);
}
}
} else {
object = new TextComponent("");
object = Component.literal("");
}
nbttaglist.set(i, net.minecraft.nbt.StringTag.valueOf(Component.Serializer.toJson(object)));
@ -2621,14 +2620,12 @@ class PaperweightDataConverters extends DataFixerBuilder implements com.sk89q.wo
MutableComponent a(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws
JsonParseException {
if (jsonelement.isJsonPrimitive()) {
return new TextComponent(jsonelement.getAsString());
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();
for (final JsonElement jsonelement1 : jsonarray) {
MutableComponent ichatbasecomponent1 = this.a(
jsonelement1,
jsonelement1.getClass(),
@ -2681,39 +2678,36 @@ class PaperweightDataConverters extends DataFixerBuilder implements com.sk89q.wo
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 = new TextComponent(s1);
object = Component.literal(s1);
} else {
try {
object = GsonHelper.fromJson(DataConverterSignText.a, s1, Component.class, true);
if (object == null) {
object = new TextComponent("");
object = Component.literal("");
}
} catch (JsonParseException jsonparseexception) {
;
} catch (JsonParseException ignored) {
}
if (object == null) {
try {
object = Component.Serializer.fromJson(s1);
} catch (JsonParseException jsonparseexception1) {
;
} catch (JsonParseException ignored) {
}
}
if (object == null) {
try {
object = Component.Serializer.fromJsonLenient(s1);
} catch (JsonParseException jsonparseexception2) {
;
} catch (JsonParseException ignored) {
}
}
if (object == null) {
object = new TextComponent(s1);
object = Component.literal(s1);
}
}
} else {
object = new TextComponent("");
object = Component.literal("");
}
nbttagcompound.putString(s, Component.Serializer.toJson(object));

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_18_R1;
package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_19_R1;
import com.mojang.authlib.GameProfile;
import net.minecraft.network.chat.ChatType;
@ -45,7 +45,7 @@ class PaperweightFakePlayer extends ServerPlayer {
private static final Vec3 ORIGIN = new Vec3(0.0D, 0.0D, 0.0D);
PaperweightFakePlayer(ServerLevel world) {
super(world.getServer(), world, FAKE_WORLDEDIT_PROFILE);
super(world.getServer(), world, FAKE_WORLDEDIT_PROFILE, null);
}
@Override
@ -79,10 +79,6 @@ class PaperweightFakePlayer extends ServerPlayer {
public void displayClientMessage(Component message, boolean actionBar) {
}
@Override
public void sendMessage(Component message, ChatType type, UUID sender) {
}
@Override
public void awardStat(Stat<?> stat, int amount) {
}

View File

@ -17,7 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_18_R1;
package com.sk89q.worldedit.bukkit.adapter.ext.fawe.v1_19_R1;
import com.sk89q.worldedit.bukkit.BukkitAdapter;
import com.sk89q.worldedit.internal.block.BlockStateIdAccess;
@ -31,8 +31,8 @@ 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_18_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_18_R1.block.data.CraftBlockData;
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;
@ -162,6 +162,7 @@ public class PaperweightWorldNativeAccess implements
}
}
@SuppressWarnings("deprecation")
private void fireNeighborChanged(BlockPos pos, ServerLevel world, Block block, BlockPos neighborPos) {
world.getBlockState(neighborPos).neighborChanged(world, neighborPos, block, pos, false);
}

View File

@ -1,10 +1,10 @@
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_18_R1;
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_18_R1.nbt.PaperweightLazyCompoundTag;
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;
@ -15,7 +15,7 @@ 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_18_R1.block.data.CraftBlockData;
import org.bukkit.craftbukkit.v1_19_R1.block.data.CraftBlockData;
public class PaperweightBlockMaterial implements BlockMaterial {
@ -39,7 +39,7 @@ public class PaperweightBlockMaterial implements BlockMaterial {
this.craftBlockData = CraftBlockData.fromData(blockState);
this.craftMaterial = craftBlockData.getMaterial();
BlockBehaviour.Properties blockInfo = ReflectionUtil.getField(BlockBehaviour.class, block, Refraction.pickName(
"properties", "aP"));
"properties", "aO"));
this.isTranslucent = !(boolean) ReflectionUtil.getField(BlockBehaviour.Properties.class, blockInfo,
Refraction.pickName("canOcclude", "n")
);

View File

@ -1,4 +1,4 @@
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_18_R1;
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1;
import com.fastasyncworldedit.bukkit.adapter.CachedBukkitAdapter;
import com.fastasyncworldedit.bukkit.adapter.IDelegateBukkitImplAdapter;
@ -20,9 +20,9 @@ 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_18_R1.PaperweightAdapter;
import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_18_R1.nbt.PaperweightLazyCompoundTag;
import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_18_R1.regen.PaperweightRegen;
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;
@ -82,15 +82,15 @@ import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.TreeType;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.v1_18_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_18_R1.CraftServer;
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_18_R1.block.CraftBlockState;
import org.bukkit.craftbukkit.v1_18_R1.block.data.CraftBlockData;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_18_R1.inventory.CraftItemStack;
import org.bukkit.craftbukkit.v1_18_R1.util.CraftNamespacedKey;
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;
@ -102,6 +102,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;
@ -637,13 +638,13 @@ public final class PaperweightFaweAdapter extends CachedBukkitAdapter implements
@Override
public Iterable<NamespacedKey> getRegisteredBiomes() {
WritableRegistry<Biome> biomeRegistry = ((CraftServer) Bukkit.getServer())
WritableRegistry<Biome> biomeRegistry = (WritableRegistry<Biome>) ((CraftServer) Bukkit.getServer())
.getServer()
.registryAccess()
.ownedRegistryOrThrow(
Registry.BIOME_REGISTRY);
return biomeRegistry.stream()
.map(biomeRegistry::getKey)
.map(biomeRegistry::getKey).filter(Objects::nonNull)
.map(CraftNamespacedKey::fromMinecraft)
.collect(Collectors.toList());
}

View File

@ -1,4 +1,4 @@
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_18_R1;
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1;
import com.fastasyncworldedit.core.Fawe;
import com.fastasyncworldedit.core.math.IntPair;
@ -21,8 +21,8 @@ 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_18_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_18_R1.block.data.CraftBlockData;
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;

View File

@ -1,4 +1,4 @@
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_18_R1;
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1;
import com.fastasyncworldedit.bukkit.adapter.BukkitGetBlocks;
import com.fastasyncworldedit.bukkit.adapter.DelegateSemaphore;
@ -21,19 +21,21 @@ 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_18_R1.nbt.PaperweightLazyCompoundTag;
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.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.BitStorage;
@ -42,7 +44,6 @@ 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.biome.Biomes;
import net.minecraft.world.level.block.entity.BeaconBlockEntity;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState;
@ -53,12 +54,13 @@ 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_18_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_18_R1.block.CraftBlock;
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;
@ -101,6 +103,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
private final int minSectionPosition;
private final int maxSectionPosition;
private final Registry<Biome> biomeRegistry;
private final IdMap<Holder<Biome>> biomeHolderIdMap;
private LevelChunkSection[] sections;
private LevelChunk levelChunk;
private DataLayer[] blockLight;
@ -126,6 +129,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
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() {
@ -198,7 +202,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
@Override
public BiomeType getBiomeType(int x, int y, int z) {
LevelChunkSection section = getSections(false)[(y >> 4) - getMinSectionPosition()];
Biome biomes = section.getNoiseBiome(x >> 2, (y & 15) >> 2, z >> 2);
Holder<Biome> biomes = section.getNoiseBiome(x >> 2, (y & 15) >> 2, z >> 2);
return PaperweightPlatformAdapter.adapt(biomes, serverLevel);
}
@ -461,13 +465,13 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
synchronized (super.sectionLocks[getSectionIndex]) {
LevelChunkSection existingSection = levelChunkSections[getSectionIndex];
if (createCopy && existingSection != null) {
copy.storeBiomes(getSectionIndex, existingSection.getBiomes().copy());
copy.storeBiomes(getSectionIndex, existingSection.getBiomes());
}
if (existingSection == null) {
PalettedContainer<Biome> biomeData = PaperweightPlatformAdapter.getBiomePalettedContainer(
PalettedContainer<Holder<Biome>> biomeData = PaperweightPlatformAdapter.getBiomePalettedContainer(
biomes[setSectionIndex],
biomeRegistry
biomeHolderIdMap
);
LevelChunkSection newSection = PaperweightPlatformAdapter.newChunkSection(
layerNo,
@ -476,7 +480,12 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
biomeRegistry,
biomeData
);
if (PaperweightPlatformAdapter.setSectionAtomic(levelChunkSections, null, newSection, getSectionIndex)) {
if (PaperweightPlatformAdapter.setSectionAtomic(
levelChunkSections,
null,
newSection,
getSectionIndex
)) {
updateGet(nmsChunk, levelChunkSections, newSection, new char[4096], getSectionIndex);
continue;
} else {
@ -489,8 +498,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
}
}
} else {
PalettedContainer<Biome> biomeData = existingSection.getBiomes();
setBiomesToPalettedContainer(biomes[setSectionIndex], biomeData);
setBiomesToPalettedContainer(biomes, setSectionIndex, existingSection.getBiomes());
}
}
}
@ -499,7 +507,6 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
bitMask |= 1 << getSectionIndex;
// 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);
@ -524,17 +531,21 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
System.arraycopy(tmpLoad, 0, copyArr, 0, 4096);
copy.storeSection(getSectionIndex, copyArr);
if (biomes != null && existingSection != null) {
copy.storeBiomes(getSectionIndex, existingSection.getBiomes().copy());
copy.storeBiomes(getSectionIndex, existingSection.getBiomes());
}
}
if (existingSection == null) {
PalettedContainer<Biome> biomeData = biomes == null ? new PalettedContainer<>(
biomeRegistry,
biomeRegistry.getOrThrow(Biomes.PLAINS),
PalettedContainer<Holder<Biome>> biomeData = biomes == null ? new PalettedContainer<>(
biomeHolderIdMap,
biomeHolderIdMap.byIdOrThrow(WorldEditPlugin
.getInstance()
.getBukkitImplAdapter()
.getInternalBiomeId(
BiomeTypes.PLAINS)),
PalettedContainer.Strategy.SECTION_BIOMES,
null
) : PaperweightPlatformAdapter.getBiomePalettedContainer(biomes[setSectionIndex], biomeRegistry);
) : PaperweightPlatformAdapter.getBiomePalettedContainer(biomes[setSectionIndex], biomeHolderIdMap);
newSection = PaperweightPlatformAdapter.newChunkSection(
layerNo,
setArr,
@ -542,7 +553,12 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
biomeRegistry,
biomeData
);
if (PaperweightPlatformAdapter.setSectionAtomic(levelChunkSections, null, newSection, getSectionIndex)) {
if (PaperweightPlatformAdapter.setSectionAtomic(
levelChunkSections,
null,
newSection,
getSectionIndex
)) {
updateGet(nmsChunk, levelChunkSections, newSection, setArr, getSectionIndex);
continue;
} else {
@ -576,7 +592,10 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
} else if (existingSection != getSections(false)[getSectionIndex]) {
this.sections[getSectionIndex] = existingSection;
this.reset();
} else if (!Arrays.equals(update(getSectionIndex, new char[4096], true), loadPrivately(layerNo))) {
} else if (!Arrays.equals(
update(getSectionIndex, new char[4096], true),
loadPrivately(layerNo)
)) {
this.reset(layerNo);
/*} else if (lock.isModified()) {
this.reset(layerNo);*/
@ -585,11 +604,11 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
sectionLock.writeLock().unlock();
}
PalettedContainer<Biome> biomeData = existingSection.getBiomes();
if (biomes != null && biomes[setSectionIndex] != null) {
setBiomesToPalettedContainer(biomes[setSectionIndex], biomeData);
}
PalettedContainer<Holder<Biome>> biomeData = setBiomesToPalettedContainer(
biomes,
setSectionIndex,
existingSection.getBiomes()
);
newSection =
PaperweightPlatformAdapter.newChunkSection(
@ -904,7 +923,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
try {
lock.acquire();
final PalettedContainer<net.minecraft.world.level.block.state.BlockState> blocks = section.getStates();
final PalettedContainer<BlockState> blocks = section.getStates();
final Object dataObject = PaperweightPlatformAdapter.fieldData.get(blocks);
final BitStorage bits = (BitStorage) PaperweightPlatformAdapter.fieldStorage.get(dataObject);
@ -968,7 +987,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
}
}
private char ordinal(net.minecraft.world.level.block.state.BlockState ibd, PaperweightFaweAdapter adapter) {
private char ordinal(BlockState ibd, PaperweightFaweAdapter adapter) {
if (ibd == null) {
return BlockTypesCache.ReservedIDs.AIR;
} else {
@ -1045,30 +1064,47 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
}
}
private void setBiomesToPalettedContainer(
final BiomeType[] biomes,
PalettedContainer<Biome> data
private PalettedContainer<Holder<Biome>> setBiomesToPalettedContainer(
final BiomeType[][] biomes,
final int sectionIndex,
final PalettedContainerRO<Holder<Biome>> data
) {
int index = 0;
if (biomes == null) {
return;
PalettedContainer<Holder<Biome>> biomeData;
if (data instanceof PalettedContainer<Holder<Biome>> 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();
}
for (int y = 0; y < 4; y++) {
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 = biomes[index];
BiomeType biomeType = sectionBiomes[index];
if (biomeType == null) {
continue;
}
data.set(
biomeData.set(
x,
y,
z,
biomeRegistry.getOptional(ResourceLocation.tryParse(biomeType.getId())).orElseThrow()
biomeHolderIdMap.byIdOrThrow(WorldEditPlugin
.getInstance()
.getBukkitImplAdapter()
.getInternalBiomeId(biomeType))
);
}
}
}
return biomeData;
}
@Override
@ -1099,7 +1135,7 @@ public class PaperweightGetBlocks extends CharGetBlocks implements BukkitGetBloc
}
LevelChunkSection existing = getSections(true)[layer];
try {
final PalettedContainer<net.minecraft.world.level.block.state.BlockState> blocksExisting = existing.getStates();
final PalettedContainer<BlockState> blocksExisting = existing.getStates();
final Object dataObject = PaperweightPlatformAdapter.fieldData.get(blocksExisting);
final Palette<BlockState> palette = (Palette<BlockState>) PaperweightPlatformAdapter.fieldPalette.get(

View File

@ -1,4 +1,4 @@
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_18_R1;
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;
@ -8,18 +8,22 @@ 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_18_R1.nbt.PaperweightLazyCompoundTag;
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;
@ -31,6 +35,8 @@ import java.util.concurrent.Future;
public class PaperweightGetBlocks_Copy implements IChunkGet {
private static final Logger LOGGER = LogManagerCompat.getLogger();
private final Map<BlockVector3, CompoundTag> tiles = new HashMap<>();
private final Set<CompoundTag> entities = new HashSet<>();
private final char[][] blocks;
@ -38,7 +44,7 @@ public class PaperweightGetBlocks_Copy implements IChunkGet {
private final int maxHeight;
final ServerLevel serverLevel;
final LevelChunk levelChunk;
private PalettedContainer<Biome>[] biomes = null;
private PalettedContainer<Holder<Biome>>[] biomes = null;
protected PaperweightGetBlocks_Copy(LevelChunk levelChunk) {
this.levelChunk = levelChunk;
@ -146,8 +152,8 @@ public class PaperweightGetBlocks_Copy implements IChunkGet {
@Override
public BiomeType getBiomeType(int x, int y, int z) {
Biome biome = biomes[(y >> 4) - getMinSectionPosition()].get(x >> 2, (y & 15) >> 2, z >> 2);
return biome != null ? PaperweightPlatformAdapter.adapt(biome, serverLevel) : null;
Holder<Biome> biome = biomes[(y >> 4) - getMinSectionPosition()].get(x >> 2, (y & 15) >> 2, z >> 2);
return PaperweightPlatformAdapter.adapt(biome, serverLevel);
}
@Override
@ -173,11 +179,19 @@ public class PaperweightGetBlocks_Copy implements IChunkGet {
blocks[layer] = data;
}
protected void storeBiomes(int layer, PalettedContainer<Biome> biomeData) {
protected void storeBiomes(int layer, PalettedContainerRO<Holder<Biome>> biomeData) {
if (biomes == null) {
biomes = new PalettedContainer[getSectionCount()];
}
biomes[layer] = biomeData;
if (biomeData instanceof PalettedContainer<Holder<Biome>> palettedContainer) {
biomes[layer] = palettedContainer;
} else {
LOGGER.error(
"Cannot correctly save biomes to history. Expected class type {} but got {}",
PalettedContainer.class.getSimpleName(),
biomeData.getClass().getSimpleName()
);
}
}
@Override

View File

@ -1,4 +1,4 @@
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_18_R1;
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1;
import com.fastasyncworldedit.bukkit.adapter.MapChunkUtil;
import com.sk89q.worldedit.bukkit.adapter.Refraction;

View File

@ -1,4 +1,4 @@
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_18_R1;
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1;
import com.fastasyncworldedit.bukkit.adapter.CachedBukkitAdapter;
import com.fastasyncworldedit.bukkit.adapter.DelegateSemaphore;
@ -10,6 +10,8 @@ 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;
@ -18,11 +20,11 @@ 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.resources.ResourceLocation;
import net.minecraft.server.level.ChunkHolder;
import net.minecraft.server.level.ChunkMap;
import net.minecraft.server.level.ServerLevel;
@ -34,7 +36,6 @@ import net.minecraft.util.ZeroBitStorage;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.Biomes;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.EntityBlock;
@ -49,7 +50,7 @@ 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.bukkit.craftbukkit.v1_18_R1.CraftChunk;
import org.bukkit.craftbukkit.v1_19_R1.CraftChunk;
import sun.misc.Unsafe;
import javax.annotation.Nonnull;
@ -67,7 +68,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
@ -83,7 +83,6 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
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;
@ -154,7 +153,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
Method removeBlockEntityTicker = LevelChunk.class.getDeclaredMethod(
Refraction.pickName(
"removeBlockEntityTicker",
"m"
"l"
), BlockPos.class
);
removeBlockEntityTicker.setAccessible(true);
@ -202,8 +201,10 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
synchronized (section) {
Unsafe unsafe = ReflectionUtils.getUnsafe();
PalettedContainer<net.minecraft.world.level.block.state.BlockState> blocks = section.getStates();
ThreadingDetector currentThreadingDetector = (ThreadingDetector) unsafe.getObject(blocks,
fieldThreadingDetectorOffset) ;
ThreadingDetector currentThreadingDetector = (ThreadingDetector) unsafe.getObject(
blocks,
fieldThreadingDetectorOffset
);
synchronized (currentThreadingDetector) {
Semaphore currentLock = (Semaphore) unsafe.getObject(currentThreadingDetector, fieldLockOffset);
if (currentLock instanceof DelegateSemaphore delegateSemaphore) {
@ -320,7 +321,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
final char[] blocks,
CachedBukkitAdapter adapter,
Registry<Biome> biomeRegistry,
@Nullable PalettedContainer<Biome> biomes
@Nullable PalettedContainer<Holder<Biome>> biomes
) {
return newChunkSection(layer, null, blocks, adapter, biomeRegistry, biomes);
}
@ -331,7 +332,7 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
char[] set,
CachedBukkitAdapter adapter,
Registry<Biome> biomeRegistry,
@Nullable PalettedContainer<Biome> biomes
@Nullable PalettedContainer<Holder<Biome>> biomes
) {
if (set == null) {
return newChunkSection(layer, biomeRegistry, biomes);
@ -398,18 +399,21 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
nmsBits,
palette
);
LevelChunkSection levelChunkSection;
if (biomes == null) {
IdMap<Holder<Biome>> biomeHolderIdMap = biomeRegistry.asHolderIdMap();
biomes = new PalettedContainer<>(
biomeRegistry,
biomeRegistry.getOrThrow(Biomes.PLAINS),
biomeHolderIdMap,
biomeHolderIdMap.byIdOrThrow(WorldEditPlugin
.getInstance()
.getBukkitImplAdapter()
.getInternalBiomeId(
BiomeTypes.PLAINS)),
PalettedContainer.Strategy.SECTION_BIOMES,
null
);
}
levelChunkSection = new LevelChunkSection(layer, blockStatePalettedContainer, biomes);
return levelChunkSection;
return new LevelChunkSection(layer, blockStatePalettedContainer, biomes);
} catch (final Throwable e) {
throw e;
} finally {
@ -422,8 +426,9 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
@SuppressWarnings("deprecation") // Only deprecated in paper
private static LevelChunkSection newChunkSection(
int layer, Registry<Biome> biomeRegistry,
@Nullable PalettedContainer<Biome> biomes
int layer,
Registry<Biome> biomeRegistry,
@Nullable PalettedContainer<Holder<Biome>> biomes
) {
if (biomes == null) {
return new LevelChunkSection(layer, biomeRegistry);
@ -440,18 +445,22 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
/**
* Create a new {@link PalettedContainer<Biome>}. Should only be used if no biome container existed beforehand.
*/
public static PalettedContainer<Biome> getBiomePalettedContainer(BiomeType[] biomes, Registry<Biome> biomeRegistry) {
public static PalettedContainer<Holder<Biome>> getBiomePalettedContainer(
BiomeType[] biomes,
IdMap<Holder<Biome>> 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<BiomeType, Biome> palette = new HashMap<>();
Map<BiomeType, Holder<Biome>> palette = new HashMap<>();
for (BiomeType biomeType : new LinkedList<>(Arrays.asList(biomes))) {
Biome biome;
Holder<Biome> biome;
if (biomeType == null) {
biome = biomeRegistry.getOrThrow(Biomes.PLAINS);
biome = biomeRegistry.byId(adapter.getInternalBiomeId(BiomeTypes.PLAINS));
} else {
biome = biomeRegistry.get(ResourceLocation.tryParse(biomeType.getId()));
biome = biomeRegistry.byId(adapter.getInternalBiomeId(biomeType));
}
palette.put(biomeType, biome);
}
@ -464,14 +473,14 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
if (bitsPerEntry > 3) {
bitsPerEntry = MathMan.log2nlz(biomeRegistry.size() - 1);
}
PalettedContainer<Biome> biomePalettedContainer = new PalettedContainer<>(
PalettedContainer<Holder<Biome>> biomePalettedContainer = new PalettedContainer<>(
biomeRegistry,
biomeRegistry.getOrThrow(Biomes.PLAINS),
biomeRegistry.byIdOrThrow(adapter.getInternalBiomeId(BiomeTypes.PLAINS)),
PalettedContainer.Strategy.SECTION_BIOMES,
null
);
final Palette<Biome> biomePalette;
final Palette<Holder<Biome>> biomePalette;
if (bitsPerEntry == 0) {
biomePalette = new SingleValuePalette<>(
biomePalettedContainer.registry,
@ -523,7 +532,10 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
if (biomeType == null) {
continue;
}
Biome biome = biomeRegistry.get(ResourceLocation.tryParse(biomeType.getId()));
Holder<Biome> biome = biomeRegistry.byId(WorldEditPlugin
.getInstance()
.getBukkitImplAdapter()
.getInternalBiomeId(biomeType));
if (biome == null) {
continue;
}
@ -542,15 +554,13 @@ public final class PaperweightPlatformAdapter extends NMSAdapter {
fieldTickingBlockCount.setShort(section, (short) 0);
}
public static BiomeType adapt(Biome biome, LevelAccessor levelAccessor) {
ResourceLocation resourceLocation = levelAccessor.registryAccess().ownedRegistryOrThrow(Registry.BIOME_REGISTRY).getKey(
biome);
if (resourceLocation == null) {
return levelAccessor.registryAccess().ownedRegistryOrThrow(Registry.BIOME_REGISTRY).getId(biome) == -1
? BiomeTypes.OCEAN
public static BiomeType adapt(Holder<Biome> biome, LevelAccessor levelAccessor) {
final Registry<Biome> 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(resourceLocation.toString().toLowerCase(Locale.ROOT));
return BiomeTypes.get(biome.unwrapKey().orElseThrow().location().toString());
}
@SuppressWarnings("unchecked")

View File

@ -1,4 +1,4 @@
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_18_R1;
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1;
import com.fastasyncworldedit.core.configuration.Settings;
import com.fastasyncworldedit.core.extent.processor.ProcessorScope;

View File

@ -1,4 +1,4 @@
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_18_R1;
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;

View File

@ -1,4 +1,4 @@
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_18_R1;
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;
@ -8,7 +8,7 @@ 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_18_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_19_R1.CraftWorld;
import javax.annotation.Nonnull;

View File

@ -1,4 +1,4 @@
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_18_R1.nbt;
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1.nbt;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.LazyCompoundTag;

View File

@ -1,4 +1,4 @@
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_18_R1.regen;
package com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_19_R1.regen;
import com.fastasyncworldedit.bukkit.adapter.Regenerator;
import com.fastasyncworldedit.core.Fawe;
@ -9,24 +9,27 @@ 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.ext.fawe.v1_18_R1.PaperweightAdapter;
import com.sk89q.worldedit.bukkit.adapter.impl.fawe.v1_18_R1.PaperweightGetBlocks;
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 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.resources.ResourceLocation;
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;
@ -46,14 +49,14 @@ 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.templatesystem.StructureManager;
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_18_R1.CraftServer;
import org.bukkit.craftbukkit.v1_18_R1.CraftWorld;
import org.bukkit.craftbukkit.v1_18_R1.generator.CustomChunkGenerator;
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.BlockPopulator;
import javax.annotation.Nullable;
@ -128,10 +131,10 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
flatBedrockField = tmpFlatBedrockField;
generatorSettingBaseSupplierField = NoiseBasedChunkGenerator.class.getDeclaredField(Refraction.pickName(
"settings", "f"));
"settings", "g"));
generatorSettingBaseSupplierField.setAccessible(true);
generatorSettingFlatField = FlatLevelSource.class.getDeclaredField(Refraction.pickName("settings", "e"));
generatorSettingFlatField = FlatLevelSource.class.getDeclaredField(Refraction.pickName("settings", "f"));
generatorSettingFlatField.setAccessible(true);
delegateField = CustomChunkGenerator.class.getDeclaredField("delegate");
@ -150,7 +153,7 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
private ServerLevel freshWorld;
private ServerChunkCache freshChunkProvider;
private LevelStorageSource.LevelStorageAccess session;
private StructureManager structureManager;
private StructureTemplateManager structureTemplateManager;
private ThreadedLevelLightEngine threadedLevelLightEngine;
private ChunkGenerator chunkGenerator;
@ -222,10 +225,8 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
session,
newWorldData,
originalServerWorld.dimension(),
originalServerWorld.dimensionType(),
newOpts.dimensions().getOrThrow(levelStemResourceKey),
new RegenNoOpWorldLoadListener(),
// placeholder. Required for new ChunkProviderServer, but we create and then set it later
newOpts.dimensions().get(levelStemResourceKey).generator(),
originalServerWorld.isDebug(),
seed,
ImmutableList.of(),
@ -234,22 +235,21 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
generator,
originalBukkitWorld.getBiomeProvider()
) {
private final Biome singleBiome = options.hasBiomeType() ? BuiltinRegistries.BIOME.get(ResourceLocation.tryParse(
options
.getBiomeType()
.getId())) : null;
private final Holder<Biome> singleBiome = options.hasBiomeType() ? BuiltinRegistries.BIOME.asHolderIdMap().byId(
WorldEditPlugin.getInstance().getBukkitImplAdapter().getInternalBiomeId(options.getBiomeType())
) : null;
@Override
public void tick(BooleanSupplier shouldKeepTicking) { //no ticking
}
@Override
public Biome getUncachedNoiseBiome(int biomeX, int biomeY, int biomeZ) {
public Holder<Biome> getUncachedNoiseBiome(int biomeX, int biomeY, int biomeZ) {
if (options.hasBiomeType()) {
return singleBiome;
}
return PaperweightRegen.this.chunkGenerator.getBiomeSource().getNoiseBiome(biomeX, biomeY, biomeZ,
PaperweightRegen.this.chunkGenerator.climateSampler()
return PaperweightRegen.this.chunkGenerator.getBiomeSource().getNoiseBiome(
biomeX, biomeY, biomeZ, getChunkSource().randomState().sampler()
);
}
}).get();
@ -257,18 +257,24 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
removeWorldFromWorldsMap();
newWorldData.checkName(originalServerWorld.serverLevelData.getLevelName()); //rename to original world name
if (paperConfigField != null) {
paperConfigField.set(freshWorld, originalServerWorld.paperConfig);
paperConfigField.set(freshWorld, originalServerWorld.paperConfig());
}
//generator
// TODO figure out if this is needed. We can probably use
// chunkGenerator = newOpts.dimensions().getOrThrow(levelStemResourceKey).generator();
// instead.
if (originalChunkProvider.getGenerator() instanceof FlatLevelSource flatLevelSource) {
FlatLevelGeneratorSettings generatorSettingFlat = flatLevelSource.settings();
chunkGenerator = new FlatLevelSource(generatorSettingFlat);
chunkGenerator = new FlatLevelSource(originalChunkProvider.getGenerator().structureSets, generatorSettingFlat);
} else if (originalChunkProvider.getGenerator() instanceof NoiseBasedChunkGenerator noiseBasedChunkGenerator) {
Supplier<NoiseGeneratorSettings> generatorSettingBaseSupplier = (Supplier<NoiseGeneratorSettings>) generatorSettingBaseSupplierField
Holder<NoiseGeneratorSettings> generatorSettingBaseSupplier =
(Holder<NoiseGeneratorSettings>) generatorSettingBaseSupplierField
.get(originalChunkProvider.getGenerator());
BiomeSource biomeSource = originalChunkProvider.getGenerator().getBiomeSource();
chunkGenerator = new NoiseBasedChunkGenerator(noiseBasedChunkGenerator.noises, biomeSource, seed,
chunkGenerator = new NoiseBasedChunkGenerator(originalChunkProvider.getGenerator().structureSets,
noiseBasedChunkGenerator.noises,
biomeSource,
generatorSettingBaseSupplier
);
} else if (originalChunkProvider.getGenerator() instanceof CustomChunkGenerator customChunkGenerator) {
@ -281,6 +287,7 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
chunkGenerator = new CustomChunkGenerator(freshWorld, chunkGenerator, generator);
generateConcurrent = generator.isParallelCapable();
}
chunkGenerator.conf = freshWorld.spigotConfig;
freshChunkProvider = new ServerChunkCache(
freshWorld,
@ -310,8 +317,8 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
ReflectionUtils.unsafeSet(chunkSourceField, freshWorld, freshChunkProvider);
//let's start then
structureManager = server.getStructureManager();
threadedLevelLightEngine = freshChunkProvider.getLightEngine();
structureTemplateManager = server.getStructureManager();
threadedLevelLightEngine = new NoOpLightEngine(freshChunkProvider);
return true;
}
@ -491,7 +498,7 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
Runnable::run, // TODO revisit, we might profit from this somehow?
freshWorld,
chunkGenerator,
structureManager,
structureTemplateManager,
threadedLevelLightEngine,
c -> CompletableFuture.completedFuture(Either.left(c)),
accessibleChunks,
@ -501,4 +508,27 @@ public class PaperweightRegen extends Regenerator<ChunkAccess, ProtoChunk, Level
}
/**
* 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<Runnable> MAILBOX = ProcessorMailbox.create(task -> {}, "fawe-no-op");
private static final ProcessorHandle<Message<Runnable>> HANDLE = ProcessorHandle.of("fawe-no-op", m -> {});
public NoOpLightEngine(final ServerChunkCache chunkProvider) {
super(chunkProvider, chunkProvider.chunkMap, false, MAILBOX, HANDLE);
}
@Override
public CompletableFuture<ChunkAccess> retainData(final ChunkAccess chunk) {
return CompletableFuture.completedFuture(chunk);
}
@Override
public CompletableFuture<ChunkAccess> lightChunk(final ChunkAccess chunk, final boolean excludeBlocks) {
return CompletableFuture.completedFuture(chunk);
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -30,6 +30,7 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.util.collection.BlockMap;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockCategories;
import com.sk89q.worldedit.world.block.BlockCategory;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
@ -60,7 +61,11 @@ public class MultiStageReorder extends AbstractBufferingExtent implements Reorde
BlockCategories.BUTTONS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.LAST));
BlockCategories.ANVIL.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.LAST));
BlockCategories.WOODEN_PRESSURE_PLATES.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.LAST));
BlockCategories.CARPETS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.LAST));
// Keeping CARPETS for pre-1.19 compatibility
@SuppressWarnings("deprecation")
BlockCategory carpets = BlockCategories.CARPETS;
carpets.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.LAST));
BlockCategories.WOOL_CARPETS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.LAST));
BlockCategories.RAILS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.LAST));
BlockCategories.BEDS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.LAST));
BlockCategories.SMALL_FLOWERS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.LAST));
@ -132,6 +137,7 @@ public class MultiStageReorder extends AbstractBufferingExtent implements Reorde
BlockCategories.DOORS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.FINAL));
BlockCategories.BANNERS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.FINAL));
BlockCategories.SIGNS.getAll().forEach(type -> priorityMap.put(type, PlacementPriority.FINAL));
// Keeping sign and wall_sign for 1.13 compatibility
@SuppressWarnings("deprecation")
BlockType sign = BlockTypes.SIGN;
priorityMap.put(sign, PlacementPriority.FINAL);

View File

@ -76,4 +76,9 @@ public final class Constants {
*/
public static final int DATA_VERSION_MC_1_18 = 2860;
/**
* The DataVersion for Minecraft 1.19
*/
public static final int DATA_VERSION_MC_1_19 = 3105;
}

View File

@ -33,10 +33,12 @@ public final class BiomeTypes {
@Nullable
public static final BiomeType BADLANDS = get("minecraft:badlands");
@Nullable
@Deprecated
public static final BiomeType BADLANDS_PLATEAU = get("minecraft:badlands_plateau");
@Nullable
public static final BiomeType BAMBOO_JUNGLE = get("minecraft:bamboo_jungle");
@Nullable
@Deprecated
public static final BiomeType BAMBOO_JUNGLE_HILLS = get("minecraft:bamboo_jungle_hills");
@Nullable
public static final BiomeType BASALT_DELTAS = get("minecraft:basalt_deltas");
@ -45,6 +47,7 @@ public final class BiomeTypes {
@Nullable
public static final BiomeType BIRCH_FOREST = get("minecraft:birch_forest");
@Nullable
@Deprecated
public static final BiomeType BIRCH_FOREST_HILLS = get("minecraft:birch_forest_hills");
@Nullable
public static final BiomeType COLD_OCEAN = get("minecraft:cold_ocean");
@ -53,22 +56,28 @@ public final class BiomeTypes {
@Nullable
public static final BiomeType DARK_FOREST = get("minecraft:dark_forest");
@Nullable
@Deprecated
public static final BiomeType DARK_FOREST_HILLS = get("minecraft:dark_forest_hills");
@Nullable
public static final BiomeType DEEP_COLD_OCEAN = get("minecraft:deep_cold_ocean");
@Nullable
public static final BiomeType DEEP_DARK = get("minecraft:deep_dark");
@Nullable
public static final BiomeType DEEP_FROZEN_OCEAN = get("minecraft:deep_frozen_ocean");
@Nullable
public static final BiomeType DEEP_LUKEWARM_OCEAN = get("minecraft:deep_lukewarm_ocean");
@Nullable
public static final BiomeType DEEP_OCEAN = get("minecraft:deep_ocean");
@Nullable
@Deprecated
public static final BiomeType DEEP_WARM_OCEAN = get("minecraft:deep_warm_ocean");
@Nullable
public static final BiomeType DESERT = get("minecraft:desert");
@Nullable
@Deprecated
public static final BiomeType DESERT_HILLS = get("minecraft:desert_hills");
@Nullable
@Deprecated
public static final BiomeType DESERT_LAKES = get("minecraft:desert_lakes");
@Nullable
public static final BiomeType DRIPSTONE_CAVES = get("minecraft:dripstone_caves");
@ -89,42 +98,65 @@ public final class BiomeTypes {
@Nullable
public static final BiomeType FROZEN_RIVER = get("minecraft:frozen_river");
@Nullable
@Deprecated
public static final BiomeType GIANT_SPRUCE_TAIGA = get("minecraft:giant_spruce_taiga");
@Nullable
@Deprecated
public static final BiomeType GIANT_SPRUCE_TAIGA_HILLS = get("minecraft:giant_spruce_taiga_hills");
@Nullable
@Deprecated
public static final BiomeType GIANT_TREE_TAIGA = get("minecraft:giant_tree_taiga");
@Nullable
@Deprecated
public static final BiomeType GIANT_TREE_TAIGA_HILLS = get("minecraft:giant_tree_taiga_hills");
@Nullable
@Deprecated
public static final BiomeType GRAVELLY_MOUNTAINS = get("minecraft:gravelly_mountains");
@Nullable
public static final BiomeType GROVE = get("minecraft:grove");
@Nullable
public static final BiomeType ICE_SPIKES = get("minecraft:ice_spikes");
@Nullable
public static final BiomeType JAGGED_PEAKS = get("minecraft:jagged_peaks");
@Nullable
public static final BiomeType JUNGLE = get("minecraft:jungle");
@Nullable
@Deprecated
public static final BiomeType JUNGLE_EDGE = get("minecraft:jungle_edge");
@Nullable
@Deprecated
public static final BiomeType JUNGLE_HILLS = get("minecraft:jungle_hills");
@Nullable
public static final BiomeType LUKEWARM_OCEAN = get("minecraft:lukewarm_ocean");
@Nullable
public static final BiomeType LUSH_CAVES = get("minecraft:lush_caves");
@Nullable
public static final BiomeType MANGROVE_SWAMP = get("minecraft:mangrove_swamp");
@Nullable
public static final BiomeType MEADOW = get("minecraft:meadow");
@Nullable
@Deprecated
public static final BiomeType MODIFIED_BADLANDS_PLATEAU = get("minecraft:modified_badlands_plateau");
@Nullable
@Deprecated
public static final BiomeType MODIFIED_GRAVELLY_MOUNTAINS = get("minecraft:modified_gravelly_mountains");
@Nullable
@Deprecated
public static final BiomeType MODIFIED_JUNGLE = get("minecraft:modified_jungle");
@Nullable
@Deprecated
public static final BiomeType MODIFIED_JUNGLE_EDGE = get("minecraft:modified_jungle_edge");
@Nullable
@Deprecated
public static final BiomeType MODIFIED_WOODED_BADLANDS_PLATEAU = get("minecraft:modified_wooded_badlands_plateau");
@Nullable
@Deprecated
public static final BiomeType MOUNTAIN_EDGE = get("minecraft:mountain_edge");
@Nullable
@Deprecated
public static final BiomeType MOUNTAINS = get("minecraft:mountains");
@Nullable
@Deprecated
public static final BiomeType MUSHROOM_FIELD_SHORE = get("minecraft:mushroom_field_shore");
@Nullable
public static final BiomeType MUSHROOM_FIELDS = get("minecraft:mushroom_fields");
@ -136,6 +168,12 @@ public final class BiomeTypes {
@Nullable
public static final BiomeType OCEAN = get("minecraft:ocean");
@Nullable
public static final BiomeType OLD_GROWTH_BIRCH_FOREST = get("minecraft:old_growth_birch_forest");
@Nullable
public static final BiomeType OLD_GROWTH_PINE_TAIGA = get("minecraft:old_growth_pine_taiga");
@Nullable
public static final BiomeType OLD_GROWTH_SPRUCE_TAIGA = get("minecraft:old_growth_spruce_taiga");
@Nullable
public static final BiomeType PLAINS = get("minecraft:plains");
@Nullable
public static final BiomeType RIVER = get("minecraft:river");
@ -144,42 +182,64 @@ public final class BiomeTypes {
@Nullable
public static final BiomeType SAVANNA_PLATEAU = get("minecraft:savanna_plateau");
@Nullable
@Deprecated
public static final BiomeType SHATTERED_SAVANNA = get("minecraft:shattered_savanna");
@Nullable
@Deprecated
public static final BiomeType SHATTERED_SAVANNA_PLATEAU = get("minecraft:shattered_savanna_plateau");
@Nullable
public static final BiomeType SMALL_END_ISLANDS = get("minecraft:small_end_islands");
@Nullable
public static final BiomeType SNOWY_BEACH = get("minecraft:snowy_beach");
@Nullable
@Deprecated
public static final BiomeType SNOWY_MOUNTAINS = get("minecraft:snowy_mountains");
@Nullable
public static final BiomeType SNOWY_PLAINS = get("minecraft:snowy_plains");
@Nullable
public static final BiomeType SNOWY_SLOPES = get("minecraft:snowy_slopes");
@Nullable
public static final BiomeType SNOWY_TAIGA = get("minecraft:snowy_taiga");
@Nullable
@Deprecated
public static final BiomeType SNOWY_TAIGA_HILLS = get("minecraft:snowy_taiga_hills");
@Nullable
@Deprecated
public static final BiomeType SNOWY_TAIGA_MOUNTAINS = get("minecraft:snowy_taiga_mountains");
@Nullable
@Deprecated
public static final BiomeType SNOWY_TUNDRA = get("minecraft:snowy_tundra");
@Nullable
public static final BiomeType SOUL_SAND_VALLEY = get("minecraft:soul_sand_valley");
@Nullable
public static final BiomeType SPARSE_JUNGLE = get("minecraft:sparse_jungle");
@Nullable
@Deprecated
public static final BiomeType STONE_SHORE = get("minecraft:stone_shore");
@Nullable
public static final BiomeType STONY_PEAKS = get("minecraft:stony_peaks");
@Nullable
public static final BiomeType STONY_SHORE = get("minecraft:stony_shore");
@Nullable
public static final BiomeType SUNFLOWER_PLAINS = get("minecraft:sunflower_plains");
@Nullable
public static final BiomeType SWAMP = get("minecraft:swamp");
@Nullable
@Deprecated
public static final BiomeType SWAMP_HILLS = get("minecraft:swamp_hills");
@Nullable
public static final BiomeType TAIGA = get("minecraft:taiga");
@Nullable
@Deprecated
public static final BiomeType TAIGA_HILLS = get("minecraft:taiga_hills");
@Nullable
@Deprecated
public static final BiomeType TAIGA_MOUNTAINS = get("minecraft:taiga_mountains");
@Nullable
@Deprecated
public static final BiomeType TALL_BIRCH_FOREST = get("minecraft:tall_birch_forest");
@Nullable
@Deprecated
public static final BiomeType TALL_BIRCH_HILLS = get("minecraft:tall_birch_hills");
@Nullable
public static final BiomeType THE_END = get("minecraft:the_end");
@ -190,10 +250,23 @@ public final class BiomeTypes {
@Nullable
public static final BiomeType WARPED_FOREST = get("minecraft:warped_forest");
@Nullable
public static final BiomeType WINDSWEPT_FOREST = get("minecraft:windswept_forest");
@Nullable
public static final BiomeType WINDSWEPT_GRAVELLY_HILLS = get("minecraft:windswept_gravelly_hills");
@Nullable
public static final BiomeType WINDSWEPT_HILLS = get("minecraft:windswept_hills");
@Nullable
public static final BiomeType WINDSWEPT_SAVANNA = get("minecraft:windswept_savanna");
@Nullable
public static final BiomeType WOODED_BADLANDS = get("minecraft:wooded_badlands");
@Nullable
@Deprecated
public static final BiomeType WOODED_BADLANDS_PLATEAU = get("minecraft:wooded_badlands_plateau");
@Nullable
@Deprecated
public static final BiomeType WOODED_HILLS = get("minecraft:wooded_hills");
@Nullable
@Deprecated
public static final BiomeType WOODED_MOUNTAINS = get("minecraft:wooded_mountains");
private BiomeTypes() {

View File

@ -28,7 +28,12 @@ package com.sk89q.worldedit.world.block;
public final class BlockCategories {
public static final BlockCategory ACACIA_LOGS = get("minecraft:acacia_logs");
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_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");
@ -37,16 +42,19 @@ public final class BlockCategories {
public static final BlockCategory BEDS = get("minecraft:beds");
public static final BlockCategory BEE_GROWABLES = get("minecraft:bee_growables");
public static final BlockCategory BEEHIVES = get("minecraft:beehives");
public static final BlockCategory BIG_DRIPLEAF_PLACEABLE = get("minecraft:big_dripleaf_placeable");
public static final BlockCategory BIRCH_LOGS = get("minecraft:birch_logs");
public static final BlockCategory BUTTONS = get("minecraft:buttons");
public static final BlockCategory CAMPFIRES = get("minecraft:campfires");
public static final BlockCategory CANDLE_CAKES = get("minecraft:candle_cakes");
public static final BlockCategory CANDLES = get("minecraft:candles");
public static final BlockCategory CARPETS = get("minecraft:carpets");
@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 CLIMBABLE = get("minecraft:climbable");
public static final BlockCategory COAL_ORES = get("minecraft:coal_ores");
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");
public static final BlockCategory CORAL_BLOCKS = get("minecraft:coral_blocks");
public static final BlockCategory CORAL_PLANTS = get("minecraft:coral_plants");
@ -54,7 +62,9 @@ public final class BlockCategories {
public static final BlockCategory CRIMSON_STEMS = get("minecraft:crimson_stems");
public static final BlockCategory CROPS = get("minecraft:crops");
public static final BlockCategory CRYSTAL_SOUND_BLOCKS = get("minecraft:crystal_sound_blocks");
public static final BlockCategory DAMPENS_VIBRATIONS = get("minecraft:dampens_vibrations");
public static final BlockCategory DARK_OAK_LOGS = get("minecraft:dark_oak_logs");
public static final BlockCategory DEAD_BUSH_MAY_PLACE_ON = get("minecraft:dead_bush_may_place_on");
public static final BlockCategory DEEPSLATE_ORE_REPLACEABLES = get("minecraft:deepslate_ore_replaceables");
public static final BlockCategory DIAMOND_ORES = get("minecraft:diamond_ores");
public static final BlockCategory DIRT = get("minecraft:dirt");
@ -62,15 +72,21 @@ public final class BlockCategories {
public static final BlockCategory DIRT_LIKE = get("minecraft:dirt_like");
public static final BlockCategory DOORS = get("minecraft:doors");
public static final BlockCategory DRAGON_IMMUNE = get("minecraft:dragon_immune");
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 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");
public static final BlockCategory FENCE_GATES = get("minecraft:fence_gates");
public static final BlockCategory FENCES = get("minecraft:fences");
public static final BlockCategory FIRE = get("minecraft:fire");
public static final BlockCategory FLOWER_POTS = get("minecraft:flower_pots");
public static final BlockCategory FLOWERS = get("minecraft:flowers");
public static final BlockCategory FOXES_SPAWNABLE_ON = get("minecraft:foxes_spawnable_on");
public static final BlockCategory FROG_PREFER_JUMP_TO = get("minecraft:frog_prefer_jump_to");
public static final BlockCategory FROGS_SPAWNABLE_ON = get("minecraft:frogs_spawnable_on");
public static final BlockCategory GOATS_SPAWNABLE_ON = get("minecraft:goats_spawnable_on");
public static final BlockCategory GEODE_INVALID_BLOCKS = get("minecraft:geode_invalid_blocks");
public static final BlockCategory GOLD_ORES = get("minecraft:gold_ores");
public static final BlockCategory GUARDED_BY_PIGLINS = get("minecraft:guarded_by_piglins");
@ -84,39 +100,56 @@ public final class BlockCategories {
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");
public static final BlockCategory LAVA_POOL_STONE_REPLACEABLES = get("minecraft:lava_pool_stone_replaceables");
public static final BlockCategory LAVA_POOL_STONE_CANNOT_REPLACE = get("minecraft:lava_pool_stone_cannot_replace");
@Deprecated public static final BlockCategory LAVA_POOL_STONE_REPLACEABLES = get("minecraft:lava_pool_stone_replaceables");
public static final BlockCategory LEAVES = get("minecraft:leaves");
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 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");
public static final BlockCategory MINEABLE_AXE = get("minecraft:mineable/axe");
public static final BlockCategory MINEABLE_HOE = get("minecraft:mineable/hoe");
public static final BlockCategory MINEABLE_PICKAXE = get("minecraft:mineable/pickaxe");
public static final BlockCategory MINEABLE_SHOVEL = get("minecraft:mineable/shovel");
public static final BlockCategory MOOSHROOMS_SPAWNABLE_ON = get("minecraft:mooshrooms_spawnable_on");
public static final BlockCategory MOSS_REPLACEABLE = get("minecraft:moss_replaceable");
public static final BlockCategory MUSHROOM_GROW_BLOCK = get("minecraft:mushroom_grow_block");
public static final BlockCategory NEEDS_DIAMOND_TOOL = get("minecraft:needs_diamond_tool");
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");
public static final BlockCategory OVERWORLD_CARVER_REPLACEABLES = get("minecraft:overworld_carver_replaceables");
public static final BlockCategory OVERWORLD_NATURAL_LOGS = get("minecraft:overworld_natural_logs");
public static final BlockCategory PARROTS_SPAWNABLE_ON = get("minecraft:parrots_spawnable_on");
public static final BlockCategory PIGLIN_REPELLENTS = get("minecraft:piglin_repellents");
public static final BlockCategory PLANKS = get("minecraft:planks");
public static final BlockCategory POLAR_BEARS_SPAWNABLE_ON_ALTERNATE = get("minecraft:polar_bears_spawnable_on_alternate");
public static final BlockCategory PORTALS = get("minecraft:portals");
public static final BlockCategory PRESSURE_PLATES = get("minecraft:pressure_plates");
public static final BlockCategory PREVENT_MOB_SPAWNING_INSIDE = get("minecraft:prevent_mob_spawning_inside");
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 SAND = get("minecraft:sand");
public static final BlockCategory SAPLINGS = get("minecraft:saplings");
public static final BlockCategory SCULK_REPLACEABLE = get("minecraft:sculk_replaceable");
public static final BlockCategory SCULK_REPLACEABLE_WORLD_GEN = get("minecraft:sculk_replaceable_world_gen");
public static final BlockCategory SHULKER_BOXES = get("minecraft:shulker_boxes");
public static final BlockCategory SIGNS = get("minecraft:signs");
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 SNAPS_GOAT_HORN = get("minecraft:snaps_goat_horn");
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");
public static final BlockCategory SOUL_FIRE_BASE_BLOCKS = get("minecraft:soul_fire_base_blocks");
public static final BlockCategory SOUL_SPEED_BLOCKS = get("minecraft:soul_speed_blocks");
public static final BlockCategory SPRUCE_LOGS = get("minecraft:spruce_logs");
@ -127,6 +160,7 @@ public final class BlockCategories {
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 TALL_FLOWERS = get("minecraft:tall_flowers");
public static final BlockCategory TERRACOTTA = get("minecraft:terracotta");
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");
@ -139,6 +173,7 @@ public final class BlockCategories {
public static final BlockCategory WART_BLOCKS = get("minecraft:wart_blocks");
public static final BlockCategory WITHER_IMMUNE = get("minecraft:wither_immune");
public static final BlockCategory WITHER_SUMMON_BASE_BLOCKS = get("minecraft:wither_summon_base_blocks");
public static final BlockCategory WOLVES_SPAWNABLE_ON = get("minecraft:wolves_spawnable_on");
public static final BlockCategory WOODEN_BUTTONS = get("minecraft:wooden_buttons");
public static final BlockCategory WOODEN_DOORS = get("minecraft:wooden_doors");
public static final BlockCategory WOODEN_FENCES = get("minecraft:wooden_fences");
@ -147,6 +182,7 @@ public final class BlockCategories {
public static final BlockCategory WOODEN_STAIRS = get("minecraft:wooden_stairs");
public static final BlockCategory WOODEN_TRAPDOORS = get("minecraft:wooden_trapdoors");
public static final BlockCategory WOOL = get("minecraft:wool");
public static final BlockCategory WOOL_CARPETS = get("minecraft:wool_carpets");
private BlockCategories() {
}

View File

@ -687,6 +687,8 @@ public final class BlockTypes {
@Nullable
public static final BlockType FLOWERING_AZALEA_LEAVES = init();
@Nullable
public static final BlockType FROGSPAWN = init();
@Nullable
public static final BlockType FLOWER_POT = init();
@Nullable
public static final BlockType FROSTED_ICE = init();
@ -1015,6 +1017,38 @@ public final class BlockTypes {
@Nullable
public static final BlockType MAGMA_BLOCK = init();
@Nullable
public static final BlockType MANGROVE_BUTTON = init();
@Nullable
public static final BlockType MANGROVE_DOOR = init();
@Nullable
public static final BlockType MANGROVE_FENCE = init();
@Nullable
public static final BlockType MANGROVE_FENCE_GATE = init();
@Nullable
public static final BlockType MANGROVE_LEAVES = init();
@Nullable
public static final BlockType MANGROVE_LOG = init();
@Nullable
public static final BlockType MANGROVE_PLANKS = init();
@Nullable
public static final BlockType MANGROVE_PRESSURE_PLATE = init();
@Nullable
public static final BlockType MANGROVE_PROPAGULE = init();
@Nullable
public static final BlockType MANGROVE_ROOTS = init();
@Nullable
public static final BlockType MANGROVE_SIGN = init();
@Nullable
public static final BlockType MANGROVE_SLAB = init();
@Nullable
public static final BlockType MANGROVE_STAIRS = init();
@Nullable
public static final BlockType MANGROVE_TRAPDOOR = init();
@Nullable
public static final BlockType MANGROVE_WALL_SIGN = init();
@Nullable
public static final BlockType MANGROVE_WOOD = init();
@Nullable
public static final BlockType MEDIUM_AMETHYST_BUD = init();
@Nullable
public static final BlockType MELON = init();
@ -1043,6 +1077,18 @@ public final class BlockTypes {
@Nullable
public static final BlockType MOVING_PISTON = init();
@Nullable
public static final BlockType MUD = init();
@Nullable
public static final BlockType MUD_BRICK_SLAB = init();
@Nullable
public static final BlockType MUD_BRICK_STAIRS = init();
@Nullable
public static final BlockType MUD_BRICK_WALL = init();
@Nullable
public static final BlockType MUD_BRICKS = init();
@Nullable
public static final BlockType MUDDY_MANGROVE_ROOTS = init();
@Nullable
public static final BlockType MUSHROOM_STEM = init();
@Nullable
public static final BlockType MYCELIUM = init();
@ -1109,6 +1155,8 @@ public final class BlockTypes {
@Nullable
public static final BlockType OBSIDIAN = init();
@Nullable
public static final BlockType OCHRE_FROGLIGHT = init();
@Nullable
public static final BlockType ORANGE_BANNER = init();
@Nullable
public static final BlockType ORANGE_BED = init();
@ -1151,6 +1199,10 @@ public final class BlockTypes {
@Nullable
public static final BlockType PACKED_ICE = init();
@Nullable
public static final BlockType PACKED_MUD = init();
@Nullable
public static final BlockType PEARLESCENT_FROGLIGHT = init();
@Nullable
public static final BlockType PEONY = init();
@Nullable
public static final BlockType PETRIFIED_OAK_SLAB = init();
@ -1293,6 +1345,8 @@ public final class BlockTypes {
@Nullable
public static final BlockType POTTED_LILY_OF_THE_VALLEY = init();
@Nullable
public static final BlockType POTTED_MANGROVE_PROPAGULE = init();
@Nullable
public static final BlockType POTTED_OAK_SAPLING = init();
@Nullable
public static final BlockType POTTED_ORANGE_TULIP = init();
@ -1407,6 +1461,8 @@ public final class BlockTypes {
@Nullable
public static final BlockType REDSTONE_WIRE = init();
@Nullable
public static final BlockType REINFORCED_DEEPSLATE = init();
@Nullable
public static final BlockType RED_BANNER = init();
@Nullable
public static final BlockType RED_BED = init();
@ -1481,8 +1537,16 @@ public final class BlockTypes {
@Nullable
public static final BlockType SCAFFOLDING = init();
@Nullable
public static final BlockType SCULK = init();
@Nullable
public static final BlockType SCULK_CATALYST = init();
@Nullable
public static final BlockType SCULK_SENSOR = init();
@Nullable
public static final BlockType SCULK_SHRIEKER = init();
@Nullable
public static final BlockType SCULK_VEIN = init();
@Nullable
public static final BlockType SEAGRASS = init();
@Nullable
public static final BlockType SEA_LANTERN = init();
@ -1630,6 +1694,10 @@ public final class BlockTypes {
@Nullable
public static final BlockType STRIPPED_JUNGLE_WOOD = init();
@Nullable
public static final BlockType STRIPPED_MANGROVE_LOG = init();
@Nullable
public static final BlockType STRIPPED_MANGROVE_WOOD = init();
@Nullable
public static final BlockType STRIPPED_OAK_LOG = init();
@Nullable
public static final BlockType STRIPPED_OAK_WOOD = init();
@ -1686,6 +1754,8 @@ public final class BlockTypes {
@Nullable
public static final BlockType TWISTING_VINES = init();
@Nullable
public static final BlockType VERDANT_FROGLIGHT = init();
@Nullable
public static final BlockType TWISTING_VINES_PLANT = init();
@Nullable
public static final BlockType VINE = init();

View File

@ -30,6 +30,8 @@ import java.util.Locale;
@SuppressWarnings("unused")
public final class EntityTypes {
@Nullable
public static final EntityType ALLAY = get("minecraft:allay");
@Nullable
public static final EntityType AREA_EFFECT_CLOUD = get("minecraft:area_effect_cloud");
@Nullable
@ -51,6 +53,8 @@ public final class EntityTypes {
@Nullable
public static final EntityType CAVE_SPIDER = get("minecraft:cave_spider");
@Nullable
public static final EntityType CHEST_BOAT = get("minecraft:chest_boat");
@Nullable
public static final EntityType CHEST_MINECART = get("minecraft:chest_minecart");
@Nullable
public static final EntityType CHICKEN = get("minecraft:chicken");
@ -105,6 +109,8 @@ public final class EntityTypes {
@Nullable
public static final EntityType FOX = get("minecraft:fox");
@Nullable
public static final EntityType FROG = get("minecraft:frog");
@Nullable
public static final EntityType FURNACE_MINECART = get("minecraft:furnace_minecart");
@Nullable
public static final EntityType GHAST = get("minecraft:ghast");
@ -217,6 +223,8 @@ public final class EntityTypes {
@Nullable
public static final EntityType STRIDER = get("minecraft:strider");
@Nullable
public static final EntityType TADPOLE = get("minecraft:tadpole");
@Nullable
public static final EntityType TNT = get("minecraft:tnt");
@Nullable
public static final EntityType TNT_MINECART = get("minecraft:tnt_minecart");
@ -237,6 +245,8 @@ public final class EntityTypes {
@Nullable
public static final EntityType WANDERING_TRADER = get("minecraft:wandering_trader");
@Nullable
public static final EntityType WARDEN = get("minecraft:warden");
@Nullable
public static final EntityType WITCH = get("minecraft:witch");
@Nullable
public static final EntityType WITHER = get("minecraft:wither");

View File

@ -38,15 +38,20 @@ public final class ItemCategories {
public static final ItemCategory BOATS = get("minecraft:boats");
public static final ItemCategory BUTTONS = get("minecraft:buttons");
public static final ItemCategory CANDLES = get("minecraft:candles");
public static final ItemCategory CARPETS = get("minecraft:carpets");
@Deprecated public static final ItemCategory CARPETS = get("minecraft:carpets");
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");
public static final ItemCategory COALS = get("minecraft:coals");
public static final ItemCategory COMPASSES = get("minecraft:compasses");
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 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 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 FENCES = get("minecraft:fences");
@ -65,10 +70,12 @@ public final class ItemCategories {
public static final ItemCategory LECTERN_BOOKS = get("minecraft:lectern_books");
public static final ItemCategory LOGS = get("minecraft:logs");
public static final ItemCategory LOGS_THAT_BURN = get("minecraft:logs_that_burn");
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 OAK_LOGS = get("minecraft:oak_logs");
public static final ItemCategory OCCLUDES_VIBRATION_SIGNALS = get("minecraft:occludes_vibration_signals");
@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");
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");
@ -87,9 +94,11 @@ public final class ItemCategories {
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 TALL_FLOWERS = get("minecraft:tall_flowers");
public static final ItemCategory TERRACOTTA = get("minecraft:terracotta");
public static final ItemCategory TRAPDOORS = get("minecraft:trapdoors");
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");
public static final ItemCategory WOODEN_BUTTONS = get("minecraft:wooden_buttons");
public static final ItemCategory WOODEN_DOORS = get("minecraft:wooden_doors");
public static final ItemCategory WOODEN_FENCES = get("minecraft:wooden_fences");
@ -98,6 +107,7 @@ public final class ItemCategories {
public static final ItemCategory WOODEN_STAIRS = get("minecraft:wooden_stairs");
public static final ItemCategory WOODEN_TRAPDOORS = get("minecraft:wooden_trapdoors");
public static final ItemCategory WOOL = get("minecraft:wool");
public static final ItemCategory WOOL_CARPETS = get("minecraft:wool_carpets");
private ItemCategories() {
}

View File

@ -42,6 +42,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType ACACIA_BUTTON = init();
@Nullable
public static final ItemType ACACIA_CHEST_BOAT = init();
@Nullable
public static final ItemType ACACIA_DOOR = init();
@Nullable
public static final ItemType ACACIA_FENCE = init();
@ -72,6 +74,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType AIR = init();
@Nullable
public static final ItemType ALLAY_SPAWN_EGG = init();
@Nullable
public static final ItemType ALLIUM = init();
@Nullable
public static final ItemType AMETHYST_BLOCK = init();
@ -146,6 +150,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType BIRCH_BUTTON = init();
@Nullable
public static final ItemType BIRCH_CHEST_BOAT = init();
@Nullable
public static final ItemType BIRCH_DOOR = init();
@Nullable
public static final ItemType BIRCH_FENCE = init();
@ -572,6 +578,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType DARK_OAK_BUTTON = init();
@Nullable
public static final ItemType DARK_OAK_CHEST_BOAT = init();
@Nullable
public static final ItemType DARK_OAK_DOOR = init();
@Nullable
public static final ItemType DARK_OAK_FENCE = init();
@ -714,6 +722,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType DIRT_PATH = init();
@Nullable
public static final ItemType DISC_FRAGMENT_5 = init();
@Nullable
public static final ItemType DISPENSER = init();
@Nullable
public static final ItemType DOLPHIN_SPAWN_EGG = init();
@ -736,6 +746,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType DROWNED_SPAWN_EGG = init();
@Nullable
public static final ItemType ECHO_SHARD = init();
@Nullable
public static final ItemType EGG = init();
@Nullable
public static final ItemType ELDER_GUARDIAN_SPAWN_EGG = init();
@ -832,6 +844,10 @@ public final class ItemTypes {
@Nullable
public static final ItemType FOX_SPAWN_EGG = init();
@Nullable
public static final ItemType FROG_SPAWN_EGG = init();
@Nullable
public static final ItemType FROGSPAWN = init();
@Nullable
public static final ItemType FURNACE = init();
@Nullable
public static final ItemType FURNACE_MINECART = init();
@ -866,6 +882,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType GLOWSTONE_DUST = init();
@Nullable
public static final ItemType GOAT_HORN = init();
@Nullable
public static final ItemType GOAT_SPAWN_EGG = init();
@Nullable
public static final ItemType GOLD_BLOCK = init();
@ -1071,6 +1089,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType JUNGLE_BUTTON = init();
@Nullable
public static final ItemType JUNGLE_CHEST_BOAT = init();
@Nullable
public static final ItemType JUNGLE_DOOR = init();
@Nullable
public static final ItemType JUNGLE_FENCE = init();
@ -1265,6 +1285,40 @@ public final class ItemTypes {
@Nullable
public static final ItemType MAGMA_CUBE_SPAWN_EGG = init();
@Nullable
public static final ItemType MANGROVE_BOAT = init();
@Nullable
public static final ItemType MANGROVE_BUTTON = init();
@Nullable
public static final ItemType MANGROVE_CHEST_BOAT = init();
@Nullable
public static final ItemType MANGROVE_DOOR = init();
@Nullable
public static final ItemType MANGROVE_FENCE = init();
@Nullable
public static final ItemType MANGROVE_FENCE_GATE = init();
@Nullable
public static final ItemType MANGROVE_LEAVES = init();
@Nullable
public static final ItemType MANGROVE_LOG = init();
@Nullable
public static final ItemType MANGROVE_PLANKS = init();
@Nullable
public static final ItemType MANGROVE_PRESSURE_PLATE = init();
@Nullable
public static final ItemType MANGROVE_PROPAGULE = init();
@Nullable
public static final ItemType MANGROVE_ROOTS = init();
@Nullable
public static final ItemType MANGROVE_SIGN = init();
@Nullable
public static final ItemType MANGROVE_SLAB = init();
@Nullable
public static final ItemType MANGROVE_STAIRS = init();
@Nullable
public static final ItemType MANGROVE_TRAPDOOR = init();
@Nullable
public static final ItemType MANGROVE_WOOD = init();
@Nullable
public static final ItemType MAP = init();
@Nullable
public static final ItemType MEDIUM_AMETHYST_BUD = init();
@ -1303,6 +1357,18 @@ public final class ItemTypes {
@Nullable
public static final ItemType MOSSY_STONE_BRICKS = init();
@Nullable
public static final ItemType MUD = init();
@Nullable
public static final ItemType MUD_BRICK_SLAB = init();
@Nullable
public static final ItemType MUD_BRICK_STAIRS = init();
@Nullable
public static final ItemType MUD_BRICK_WALL = init();
@Nullable
public static final ItemType MUD_BRICKS = init();
@Nullable
public static final ItemType MUDDY_MANGROVE_ROOTS = init();
@Nullable
public static final ItemType MULE_SPAWN_EGG = init();
@Nullable
public static final ItemType MUSHROOM_STEM = init();
@ -1313,6 +1379,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType MUSIC_DISC_13 = init();
@Nullable
public static final ItemType MUSIC_DISC_5 = init();
@Nullable
public static final ItemType MUSIC_DISC_BLOCKS = init();
@Nullable
public static final ItemType MUSIC_DISC_CAT = init();
@ -1325,6 +1393,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType MUSIC_DISC_MELLOHI = init();
@Nullable
public static final ItemType MUSIC_DISC_OTHERSIDE = init();
@Nullable
public static final ItemType MUSIC_DISC_PIGSTEP = init();
@Nullable
public static final ItemType MUSIC_DISC_STAL = init();
@ -1399,6 +1469,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType OAK_BUTTON = init();
@Nullable
public static final ItemType OAK_CHEST_BOAT = init();
@Nullable
public static final ItemType OAK_DOOR = init();
@Nullable
public static final ItemType OAK_FENCE = init();
@ -1431,6 +1503,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType OCELOT_SPAWN_EGG = init();
@Nullable
public static final ItemType OCHRE_FROGLIGHT = init();
@Nullable
public static final ItemType ORANGE_BANNER = init();
@Nullable
public static final ItemType ORANGE_BED = init();
@ -1471,6 +1545,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType PACKED_ICE = init();
@Nullable
public static final ItemType PACKED_MUD = init();
@Nullable
public static final ItemType PAINTING = init();
@Nullable
public static final ItemType PANDA_SPAWN_EGG = init();
@ -1479,6 +1555,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType PARROT_SPAWN_EGG = init();
@Nullable
public static final ItemType PEARLESCENT_FROGLIGHT = init();
@Nullable
public static final ItemType PEONY = init();
@Nullable
public static final ItemType PETRIFIED_OAK_SLAB = init();
@ -1699,6 +1777,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType RAW_IRON_BLOCK = init();
@Nullable
public static final ItemType RECOVERY_COMPASS = init();
@Nullable
public static final ItemType RED_BANNER = init();
@Nullable
public static final ItemType RED_BED = init();
@ -1759,6 +1839,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType REDSTONE_TORCH = init();
@Nullable
public static final ItemType REINFORCED_DEEPSLATE = init();
@Nullable
public static final ItemType REPEATER = init();
@Nullable
public static final ItemType REPEATING_COMMAND_BLOCK = init();
@ -1794,8 +1876,16 @@ public final class ItemTypes {
@Nullable
public static final ItemType SCAFFOLDING = init();
@Nullable
public static final ItemType SCULK = init();
@Nullable
public static final ItemType SCULK_CATALYST = init();
@Nullable
public static final ItemType SCULK_SENSOR = init();
@Nullable
public static final ItemType SCULK_SHRIEKER = init();
@Nullable
public static final ItemType SCULK_VEIN = init();
@Nullable
public static final ItemType SCUTE = init();
@Nullable
public static final ItemType SEA_LANTERN = init();
@ -1901,6 +1991,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType SPRUCE_BOAT = init();
@Nullable
public static final ItemType SPRUCE_CHEST_BOAT = init();
@Nullable
public static final ItemType SPRUCE_BUTTON = init();
@Nullable
public static final ItemType SPRUCE_DOOR = init();
@ -1993,6 +2085,10 @@ public final class ItemTypes {
@Nullable
public static final ItemType STRIPPED_JUNGLE_WOOD = init();
@Nullable
public static final ItemType STRIPPED_MANGROVE_LOG = init();
@Nullable
public static final ItemType STRIPPED_MANGROVE_WOOD = init();
@Nullable
public static final ItemType STRIPPED_OAK_LOG = init();
@Nullable
public static final ItemType STRIPPED_OAK_WOOD = init();
@ -2019,6 +2115,10 @@ public final class ItemTypes {
@Nullable
public static final ItemType SWEET_BERRIES = init();
@Nullable
public static final ItemType TADPOLE_BUCKET = init();
@Nullable
public static final ItemType TADPOLE_SPAWN_EGG = init();
@Nullable
public static final ItemType TALL_GRASS = init();
@Nullable
public static final ItemType TARGET = init();
@ -2067,6 +2167,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType TWISTING_VINES = init();
@Nullable
public static final ItemType VERDANT_FROGLIGHT = init();
@Nullable
public static final ItemType VEX_SPAWN_EGG = init();
@Nullable
public static final ItemType VILLAGER_SPAWN_EGG = init();
@ -2077,6 +2179,8 @@ public final class ItemTypes {
@Nullable
public static final ItemType WANDERING_TRADER_SPAWN_EGG = init();
@Nullable
public static final ItemType WARDEN_SPAWN_EGG = init();
@Nullable
public static final ItemType WARPED_BUTTON = init();
@Nullable
public static final ItemType WARPED_DOOR = init();

View File

@ -57,7 +57,6 @@ public final class BundledBlockData {
private static final Logger LOGGER = LogManagerCompat.getLogger();
private static BundledBlockData INSTANCE;
private final ResourceLoader resourceLoader;
private final Map<String, BlockEntry> idMap = new HashMap<>();
@ -65,12 +64,6 @@ public final class BundledBlockData {
* Create a new instance.
*/
private BundledBlockData() {
this.resourceLoader = WorldEdit
.getInstance()
.getPlatformManager()
.queryCapability(Capability.CONFIGURATION)
.getResourceLoader();
try {
loadFromResource();
} catch (Throwable e) {
@ -100,25 +93,7 @@ public final class BundledBlockData {
});
//FAWE end
Gson gson = gsonBuilder.create();
URL url = null;
final int dataVersion = WorldEdit
.getInstance()
.getPlatformManager()
.queryCapability(Capability.WORLD_EDITING)
.getDataVersion();
if (dataVersion >= Constants.DATA_VERSION_MC_1_17) {
url = resourceLoader.getResource(BundledBlockData.class, "blocks.117.json");
} else if (dataVersion >= Constants.DATA_VERSION_MC_1_16) {
url = resourceLoader.getResource(BundledBlockData.class, "blocks.116.json");
} else if (dataVersion >= Constants.DATA_VERSION_MC_1_15) {
url = resourceLoader.getResource(BundledBlockData.class, "blocks.115.json");
}
if (url == null) {
url = resourceLoader.getResource(BundledBlockData.class, "blocks.json");
}
if (url == null) {
throw new IOException("Could not find blocks.json");
}
URL url = BundledRegistries.loadRegistry("blocks");
String data = Resources.toString(url, Charset.defaultCharset());
List<BlockEntry> entries = gson.fromJson(data, new TypeToken<List<BlockEntry>>() {
}.getType());

View File

@ -19,6 +19,18 @@
package com.sk89q.worldedit.world.registry;
import com.google.common.collect.ImmutableRangeMap;
import com.google.common.collect.Range;
import com.google.common.collect.RangeMap;
import com.google.common.collect.TreeRangeMap;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.extension.platform.Capability;
import com.sk89q.worldedit.internal.Constants;
import com.sk89q.worldedit.util.io.ResourceLoader;
import java.io.IOException;
import java.net.URL;
/**
* An implementation of {@link Registries} that converts legacy numeric IDs and
* a contains a built-in block and item database.
@ -26,6 +38,34 @@ package com.sk89q.worldedit.world.registry;
public class BundledRegistries implements Registries {
private static final BundledRegistries INSTANCE = new BundledRegistries();
private static final RangeMap<Integer, String> VERSION_MAP;
static {
TreeRangeMap<Integer, String> versionMap = TreeRangeMap.create();
versionMap.put(Range.atLeast(Constants.DATA_VERSION_MC_1_16), "116");
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");
VERSION_MAP = ImmutableRangeMap.copyOf(versionMap);
}
static URL loadRegistry(String name) throws IOException {
ResourceLoader resourceLoader = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.CONFIGURATION)
.getResourceLoader();
int dataVersion = WorldEdit.getInstance().getPlatformManager().queryCapability(Capability.WORLD_EDITING)
.getDataVersion();
String version = VERSION_MAP.get(dataVersion);
URL url = resourceLoader.getResource(BundledRegistries.class, name + "." + version + ".json");
if (url == null) {
url = resourceLoader.getResource(BundledRegistries.class, name + ".json");
}
if (url == null) {
throw new IOException("Could not find " + name + ".json");
}
return url;
}
private final BundledBlockRegistry blockRegistry = new BundledBlockRegistry();
private final BundledItemRegistry itemRegistry = new BundledItemRegistry();
private final NullEntityRegistry entityRegistry = new NullEntityRegistry();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long