mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2025-04-12 14:40:42 +08:00
Merge branch 'version/7.2.x'
This commit is contained in:
commit
b8a9c0070c
4
.github/workflows/gradle.yml
vendored
4
.github/workflows/gradle.yml
vendored
@ -12,10 +12,10 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK 1.8
|
||||
- name: Set up JDK 16
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
java-version: 16
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build -s
|
||||
- uses: actions/upload-artifact@v2
|
||||
|
@ -1,5 +1,18 @@
|
||||
import org.ajoberstar.grgit.Grgit
|
||||
|
||||
// needed for fabric to know where FF executor is....
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = "Fabric"
|
||||
url = uri("https://maven.fabricmc.net/")
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath("net.fabricmc:fabric-loom:${versions.loom}")
|
||||
}
|
||||
}
|
||||
plugins {
|
||||
id("org.enginehub.codecov")
|
||||
jacoco
|
||||
|
@ -8,10 +8,6 @@ plugins {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
name = "Forge Maven"
|
||||
url = uri("https://maven.minecraftforge.net/")
|
||||
}
|
||||
maven {
|
||||
name = "Fabric"
|
||||
url = uri("https://maven.fabricmc.net/")
|
||||
@ -24,6 +20,13 @@ repositories {
|
||||
name = "EngineHub Repository"
|
||||
url = uri("https://maven.enginehub.org/repo/")
|
||||
}
|
||||
maven {
|
||||
name = "Forge Maven"
|
||||
url = uri("https://maven.minecraftforge.net/")
|
||||
content {
|
||||
includeGroupByRegex("net\\.minecraftforge\\..*")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val properties = Properties().also { props ->
|
||||
@ -41,7 +44,7 @@ dependencies {
|
||||
implementation("com.github.jengelman.gradle.plugins:shadow:6.1.0")
|
||||
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.21.0")
|
||||
implementation("org.spongepowered:SpongeGradle:0.11.5")
|
||||
implementation("net.minecraftforge.gradle:ForgeGradle:4.1.12")
|
||||
implementation("net.minecraftforge.gradle:ForgeGradle:5.0.9")
|
||||
implementation("net.fabricmc:fabric-loom:$loomVersion")
|
||||
implementation("net.fabricmc:sponge-mixin:$mixinVersion")
|
||||
implementation("org.enginehub.gradle:gradle-codecov-plugin:0.1.0")
|
||||
|
@ -34,7 +34,7 @@ fun Project.applyCommonConfiguration() {
|
||||
|
||||
plugins.withId("java") {
|
||||
the<JavaPluginExtension>().toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(8))
|
||||
languageVersion.set(JavaLanguageVersion.of(16))
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,15 +46,15 @@ fun Project.applyCommonConfiguration() {
|
||||
continue
|
||||
}
|
||||
add(conf.name, "com.google.guava:guava") {
|
||||
version { strictly(Versions.GUAVA) }
|
||||
version { require(Versions.GUAVA) }
|
||||
because("Mojang provides Guava")
|
||||
}
|
||||
add(conf.name, "com.google.code.gson:gson") {
|
||||
version { strictly(Versions.GSON) }
|
||||
version { require(Versions.GSON) }
|
||||
because("Mojang provides Gson")
|
||||
}
|
||||
add(conf.name, "it.unimi.dsi:fastutil") {
|
||||
version { strictly(Versions.FAST_UTIL) }
|
||||
version { require(Versions.FAST_UTIL) }
|
||||
because("Mojang provides FastUtil")
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.component.AdhocComponentWithVariants
|
||||
import org.gradle.api.plugins.JavaPluginExtension
|
||||
import org.gradle.api.plugins.quality.CheckstyleExtension
|
||||
import org.gradle.api.publish.PublishingExtension
|
||||
@ -32,7 +33,6 @@ fun Project.applyPlatformAndCoreConfiguration() {
|
||||
apply(plugin = "idea")
|
||||
apply(plugin = "maven-publish")
|
||||
apply(plugin = "checkstyle")
|
||||
apply(plugin = "com.github.johnrengelman.shadow")
|
||||
apply(plugin = "com.jfrog.artifactory")
|
||||
|
||||
ext["internalVersion"] = "$version+${rootProject.ext["gitCommitHash"]}"
|
||||
@ -44,6 +44,7 @@ fun Project.applyPlatformAndCoreConfiguration() {
|
||||
val disabledLint = listOf(
|
||||
"processing", "path", "fallthrough", "serial"
|
||||
)
|
||||
options.release.set(8)
|
||||
options.compilerArgs.addAll(listOf("-Xlint:all") + disabledLint.map { "-Xlint:-$it" })
|
||||
options.isDeprecation = true
|
||||
options.encoding = "UTF-8"
|
||||
@ -81,7 +82,7 @@ fun Project.applyPlatformAndCoreConfiguration() {
|
||||
|
||||
the<JavaPluginExtension>().withJavadocJar()
|
||||
|
||||
if (name == "worldedit-core" || name == "worldedit-bukkit") {
|
||||
if (name in setOf("worldedit-core", "worldedit-bukkit", "worldedit-fabric")) {
|
||||
the<JavaPluginExtension>().withSourcesJar()
|
||||
}
|
||||
|
||||
@ -92,7 +93,6 @@ fun Project.applyPlatformAndCoreConfiguration() {
|
||||
configure<PublishingExtension> {
|
||||
publications {
|
||||
register<MavenPublication>("maven") {
|
||||
from(components["java"])
|
||||
versionMapping {
|
||||
usage("java-api") {
|
||||
fromResolutionOf("runtimeClasspath")
|
||||
@ -109,6 +109,7 @@ fun Project.applyPlatformAndCoreConfiguration() {
|
||||
}
|
||||
|
||||
fun Project.applyShadowConfiguration() {
|
||||
apply(plugin = "com.github.johnrengelman.shadow")
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
archiveClassifier.set("dist")
|
||||
dependencies {
|
||||
@ -123,6 +124,11 @@ fun Project.applyShadowConfiguration() {
|
||||
exclude("META-INF/maven/**")
|
||||
minimize()
|
||||
}
|
||||
val javaComponent = components["java"] as AdhocComponentWithVariants
|
||||
// I don't think we want this published (it's the shadow jar)
|
||||
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
|
||||
skip()
|
||||
}
|
||||
}
|
||||
|
||||
private val CLASSPATH = listOf("truezip", "truevfs", "js")
|
||||
|
@ -2,7 +2,7 @@
|
||||
set -e
|
||||
|
||||
# For snapshots, please specify the full version (with date and time)
|
||||
cdist_version="0.1.0-20201128.225038-7"
|
||||
cdist_version="0.1.0-20210612.072458-9"
|
||||
cdist_path_version="$cdist_version"
|
||||
|
||||
if [ -n "${cdist_version#*-}" ]; then
|
||||
@ -20,5 +20,5 @@ export CROWDIN_DISTRIBUTOR_MODULE="worldedit-lang"
|
||||
## Full path to the source file, will be uploaded to crowdin, must already have uploaded at least once (will not create a new file)
|
||||
export CROWDIN_DISTRIBUTOR_SOURCE_FILE="./worldedit-core/src/main/resources/lang/strings.json"
|
||||
# Artifactory & Build Number is set by CI
|
||||
export CROWDIN_DISTRIBUTOR_OPTS="--enable-preview"
|
||||
export CROWDIN_DISTRIBUTOR_OPTS=""
|
||||
"./build/crowdin-distributor-$cdist_path_version/bin/crowdin-distributor"
|
||||
|
@ -4,5 +4,5 @@ version=7.3.0-SNAPSHOT
|
||||
org.gradle.jvmargs=-Xmx1512M
|
||||
org.gradle.parallel=true
|
||||
|
||||
loom.version=0.7.19
|
||||
loom.version=0.8.5
|
||||
mixin.version=0.9.2+mixin.0.8.2
|
||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
@ -2,7 +2,7 @@ rootProject.name = "worldedit"
|
||||
|
||||
include("worldedit-libs")
|
||||
|
||||
listOf("bukkit", "core", "forge", "sponge", "fabric", "cli").forEach {
|
||||
listOf("bukkit", "core", "sponge", "fabric", "forge", "cli").forEach {
|
||||
include("worldedit-libs:$it")
|
||||
include("worldedit-$it")
|
||||
}
|
||||
|
@ -18,18 +18,27 @@ configurations.all {
|
||||
}
|
||||
}
|
||||
|
||||
val localImplementation = configurations.create("localImplementation") {
|
||||
description = "Dependencies used locally, but provided by the runtime Bukkit implementation"
|
||||
isCanBeConsumed = false
|
||||
isCanBeResolved = false
|
||||
}
|
||||
configurations["compileOnly"].extendsFrom(localImplementation)
|
||||
configurations["testImplementation"].extendsFrom(localImplementation)
|
||||
|
||||
dependencies {
|
||||
"api"(project(":worldedit-core"))
|
||||
"api"(project(":worldedit-libs:bukkit"))
|
||||
"api"("org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT") {
|
||||
// Technically this is api, but everyone should already have some form of the bukkit API
|
||||
// Avoid pulling in another one, especially one so outdated.
|
||||
"localImplementation"("org.spigotmc:spigot-api:1.16.1-R0.1-SNAPSHOT") {
|
||||
exclude("junit", "junit")
|
||||
}
|
||||
|
||||
"implementation"(enforcedPlatform("org.apache.logging.log4j:log4j-bom:2.8.1") {
|
||||
// Note: Paper will bump to 2.11.2, but we should only depend on 2.8 APIs for compatibility.
|
||||
"localImplementation"(platform("org.apache.logging.log4j:log4j-bom:2.14.1") {
|
||||
because("Spigot provides Log4J (sort of, not in API, implicitly part of server)")
|
||||
})
|
||||
"implementation"("org.apache.logging.log4j:log4j-api")
|
||||
"localImplementation"("org.apache.logging.log4j:log4j-api")
|
||||
|
||||
"compileOnly"("org.jetbrains:annotations:20.1.0")
|
||||
"compileOnly"("com.destroystokyo.paper:paper-api:1.16.1-R0.1-SNAPSHOT") {
|
||||
@ -82,3 +91,9 @@ tasks.named<ShadowJar>("shadowJar") {
|
||||
tasks.named("assemble").configure {
|
||||
dependsOn("shadowJar")
|
||||
}
|
||||
|
||||
configure<PublishingExtension> {
|
||||
publications.named<MavenPublication>("maven") {
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import com.sk89q.worldedit.NotABlockException;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.WorldEditException;
|
||||
import com.sk89q.worldedit.blocks.BaseItemStack;
|
||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||
import com.sk89q.worldedit.entity.Entity;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
@ -443,7 +444,8 @@ public class BukkitAdapter {
|
||||
public static BlockState adapt(BlockData blockData) {
|
||||
checkNotNull(blockData);
|
||||
|
||||
if (WorldEditPlugin.getInstance().getBukkitImplAdapter() == null) {
|
||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||
if (adapter == null) {
|
||||
return blockStateStringCache.computeIfAbsent(blockData.getAsString(), input -> {
|
||||
try {
|
||||
return WorldEdit.getInstance().getBlockFactory().parseFromInput(input, TO_BLOCK_CONTEXT).toImmutableState();
|
||||
@ -454,7 +456,7 @@ public class BukkitAdapter {
|
||||
});
|
||||
} else {
|
||||
return blockStateCache.computeIfAbsent(
|
||||
WorldEditPlugin.getInstance().getBukkitImplAdapter().getInternalBlockStateId(blockData).orElseGet(
|
||||
adapter.getInternalBlockStateId(blockData).orElseGet(
|
||||
() -> blockData.getAsString().hashCode()
|
||||
),
|
||||
input -> {
|
||||
@ -509,8 +511,9 @@ public class BukkitAdapter {
|
||||
*/
|
||||
public static BaseItemStack adapt(ItemStack itemStack) {
|
||||
checkNotNull(itemStack);
|
||||
if (WorldEditPlugin.getInstance().getBukkitImplAdapter() != null) {
|
||||
return WorldEditPlugin.getInstance().getBukkitImplAdapter().adapt(itemStack);
|
||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||
if (adapter != null) {
|
||||
return adapter.adapt(itemStack);
|
||||
}
|
||||
return new BaseItemStack(ItemTypes.get(itemStack.getType().getKey().toString()), itemStack.getAmount());
|
||||
}
|
||||
@ -523,8 +526,9 @@ public class BukkitAdapter {
|
||||
*/
|
||||
public static ItemStack adapt(BaseItemStack item) {
|
||||
checkNotNull(item);
|
||||
if (WorldEditPlugin.getInstance().getBukkitImplAdapter() != null) {
|
||||
return WorldEditPlugin.getInstance().getBukkitImplAdapter().adapt(item);
|
||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||
if (adapter != null) {
|
||||
return adapter.adapt(item);
|
||||
}
|
||||
return new ItemStack(adapt(item.getType()), item.getAmount());
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ public class BukkitPlayer extends AbstractPlayerActor {
|
||||
|
||||
@Override
|
||||
public void sendAnnouncements() {
|
||||
if (WorldEditPlugin.getInstance().getBukkitImplAdapter() == null) {
|
||||
if (WorldEditPlugin.getInstance().getLifecycledBukkitImplAdapter() == null) {
|
||||
printError(TranslatableComponent.of("worldedit.version.bukkit.unsupported-adapter",
|
||||
TextComponent.of("https://enginehub.org/worldedit/#downloads", TextColor.AQUA)
|
||||
.clickEvent(ClickEvent.openUrl("https://enginehub.org/worldedit/#downloads"))));
|
||||
|
@ -24,6 +24,7 @@ import com.sk89q.bukkit.util.CommandInfo;
|
||||
import com.sk89q.bukkit.util.CommandRegistration;
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter;
|
||||
import com.sk89q.worldedit.command.util.PermissionCondition;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.AbstractPlatform;
|
||||
@ -33,7 +34,7 @@ import com.sk89q.worldedit.extension.platform.MultiUserPlatform;
|
||||
import com.sk89q.worldedit.extension.platform.Preference;
|
||||
import com.sk89q.worldedit.extension.platform.Watchdog;
|
||||
import com.sk89q.worldedit.util.SideEffect;
|
||||
import com.sk89q.worldedit.util.concurrency.LazyReference;
|
||||
import com.sk89q.worldedit.util.lifecycle.Lifecycled;
|
||||
import com.sk89q.worldedit.world.DataFixer;
|
||||
import com.sk89q.worldedit.world.registry.Registries;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -59,21 +60,16 @@ public class BukkitServerInterface extends AbstractPlatform implements MultiUser
|
||||
public final Server server;
|
||||
public final WorldEditPlugin plugin;
|
||||
private final CommandRegistration dynamicCommands;
|
||||
private final LazyReference<Watchdog> watchdog;
|
||||
private final Lifecycled<Watchdog> watchdog;
|
||||
private boolean hookingEvents;
|
||||
|
||||
public BukkitServerInterface(WorldEditPlugin plugin, Server server) {
|
||||
this.plugin = plugin;
|
||||
this.server = server;
|
||||
this.dynamicCommands = new CommandRegistration(plugin);
|
||||
this.watchdog = LazyReference.from(() -> {
|
||||
if (plugin.getBukkitImplAdapter() != null) {
|
||||
return plugin.getBukkitImplAdapter().supportsWatchdog()
|
||||
? new BukkitWatchdog(plugin.getBukkitImplAdapter())
|
||||
: null;
|
||||
}
|
||||
return null;
|
||||
});
|
||||
this.watchdog = plugin.getLifecycledBukkitImplAdapter()
|
||||
.filter(BukkitImplAdapter::supportsWatchdog)
|
||||
.map(BukkitWatchdog::new);
|
||||
}
|
||||
|
||||
CommandRegistration getDynamicCommands() {
|
||||
@ -92,7 +88,7 @@ public class BukkitServerInterface extends AbstractPlatform implements MultiUser
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public int getDataVersion() {
|
||||
if (plugin.getBukkitImplAdapter() != null) {
|
||||
if (plugin.getLifecycledBukkitImplAdapter() != null) {
|
||||
return Bukkit.getUnsafe().getDataVersion();
|
||||
}
|
||||
return -1;
|
||||
@ -129,7 +125,7 @@ public class BukkitServerInterface extends AbstractPlatform implements MultiUser
|
||||
|
||||
@Override
|
||||
public Watchdog getWatchdog() {
|
||||
return watchdog.getValue();
|
||||
return watchdog.value().orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -190,8 +186,8 @@ public class BukkitServerInterface extends AbstractPlatform implements MultiUser
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerGameHooks() {
|
||||
hookingEvents = true;
|
||||
public void setGameHooksEnabled(boolean enabled) {
|
||||
this.hookingEvents = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,6 +59,8 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
@ -76,6 +78,9 @@ public class BukkitWorld extends AbstractWorld {
|
||||
private static final Logger LOGGER = LogManagerCompat.getLogger();
|
||||
|
||||
private static final boolean HAS_3D_BIOMES;
|
||||
private static final boolean HAS_MIN_Y;
|
||||
private static final Method GET_MIN_Y;
|
||||
private int minY;
|
||||
|
||||
private static final Map<Integer, Effect> effects = new HashMap<>();
|
||||
|
||||
@ -94,6 +99,16 @@ public class BukkitWorld extends AbstractWorld {
|
||||
temp = false;
|
||||
}
|
||||
HAS_3D_BIOMES = temp;
|
||||
Method tempGetMinY;
|
||||
try {
|
||||
tempGetMinY = World.class.getMethod("getMinHeight");
|
||||
temp = true;
|
||||
} catch (NoSuchMethodException e) {
|
||||
tempGetMinY = null;
|
||||
temp = false;
|
||||
}
|
||||
GET_MIN_Y = tempGetMinY;
|
||||
HAS_MIN_Y = temp;
|
||||
}
|
||||
|
||||
private final WeakReference<World> worldRef;
|
||||
@ -112,6 +127,13 @@ public class BukkitWorld extends AbstractWorld {
|
||||
} else {
|
||||
this.worldNativeAccess = null;
|
||||
}
|
||||
if (HAS_MIN_Y) {
|
||||
try {
|
||||
minY = (int) GET_MIN_Y.invoke(world);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
minY = super.getMinY();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -350,6 +372,15 @@ public class BukkitWorld extends AbstractWorld {
|
||||
return getWorld().getMaxHeight() - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinY() {
|
||||
/*if (HAS_MIN_Y) {
|
||||
return getWorld().getMinHeight();
|
||||
}
|
||||
return super.getMinY();*/
|
||||
return minY;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void fixAfterFastMode(Iterable<BlockVector2> chunks) {
|
||||
|
@ -33,6 +33,8 @@ import com.sk89q.worldedit.bukkit.adapter.BukkitImplLoader;
|
||||
import com.sk89q.worldedit.event.platform.CommandEvent;
|
||||
import com.sk89q.worldedit.event.platform.CommandSuggestionEvent;
|
||||
import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
|
||||
import com.sk89q.worldedit.event.platform.PlatformUnreadyEvent;
|
||||
import com.sk89q.worldedit.event.platform.PlatformsRegisteredEvent;
|
||||
import com.sk89q.worldedit.extension.input.InputParseException;
|
||||
import com.sk89q.worldedit.extension.input.ParserContext;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
@ -43,6 +45,8 @@ import com.sk89q.worldedit.internal.anvil.ChunkDeleter;
|
||||
import com.sk89q.worldedit.internal.command.CommandUtil;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.util.lifecycle.Lifecycled;
|
||||
import com.sk89q.worldedit.util.lifecycle.SimpleLifecycled;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||
@ -87,7 +91,6 @@ import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.logging.Level;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.internal.anvil.ChunkDeleter.DELCHUNKS_FILE_NAME;
|
||||
@ -115,8 +118,9 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
|
||||
private static WorldEditPlugin INSTANCE;
|
||||
private static final int BSTATS_PLUGIN_ID = 3328;
|
||||
|
||||
private BukkitImplAdapter bukkitAdapter;
|
||||
private BukkitServerInterface server;
|
||||
private final SimpleLifecycled<BukkitImplAdapter> adapter =
|
||||
SimpleLifecycled.invalid();
|
||||
private BukkitServerInterface platform;
|
||||
private BukkitConfiguration config;
|
||||
|
||||
@Override
|
||||
@ -129,8 +133,12 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
|
||||
WorldEdit worldEdit = WorldEdit.getInstance();
|
||||
|
||||
// Setup platform
|
||||
server = new BukkitServerInterface(this, getServer());
|
||||
worldEdit.getPlatformManager().register(server);
|
||||
platform = new BukkitServerInterface(this, getServer());
|
||||
worldEdit.getPlatformManager().register(platform);
|
||||
|
||||
createDefaultConfiguration("config.yml"); // Create the default configuration file
|
||||
|
||||
config = new BukkitConfiguration(new YAMLProcessor(new File(getDataFolder(), "config.yml"), true), this);
|
||||
|
||||
Path delChunks = Paths.get(getDataFolder().getPath(), DELCHUNKS_FILE_NAME);
|
||||
if (Files.exists(delChunks)) {
|
||||
@ -149,6 +157,8 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
|
||||
ClassSourceValidator verifier = new ClassSourceValidator(this);
|
||||
verifier.reportMismatches(ImmutableList.of(World.class, CommandManager.class, EditSession.class, Actor.class));
|
||||
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformsRegisteredEvent());
|
||||
|
||||
PermissionsResolverManager.initialize(this); // Setup permission resolver
|
||||
|
||||
// Register CUI
|
||||
@ -184,14 +194,16 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
|
||||
|
||||
private void setupPreWorldData() {
|
||||
loadAdapter();
|
||||
loadConfig();
|
||||
config.load();
|
||||
WorldEdit.getInstance().loadMappings();
|
||||
}
|
||||
|
||||
private void setupWorldData() {
|
||||
setupTags(); // datapacks aren't loaded until just before the world is, and bukkit has no event for this
|
||||
// datapacks aren't loaded until just before the world is, and bukkit has no event for this
|
||||
// so the earliest we can do this is in WorldInit
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent());
|
||||
setupTags();
|
||||
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent(platform));
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "deprecation", "unchecked" })
|
||||
@ -257,13 +269,6 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
|
||||
}
|
||||
}
|
||||
|
||||
private void loadConfig() {
|
||||
createDefaultConfiguration("config.yml"); // Create the default configuration file
|
||||
|
||||
config = new BukkitConfiguration(new YAMLProcessor(new File(getDataFolder(), "config.yml"), true), this);
|
||||
config.load();
|
||||
}
|
||||
|
||||
private void loadAdapter() {
|
||||
WorldEdit worldEdit = WorldEdit.getInstance();
|
||||
|
||||
@ -282,8 +287,9 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
|
||||
LOGGER.warn("Failed to search " + getFile() + " for Bukkit adapters", e);
|
||||
}
|
||||
try {
|
||||
bukkitAdapter = adapterLoader.loadAdapter();
|
||||
BukkitImplAdapter bukkitAdapter = adapterLoader.loadAdapter();
|
||||
LOGGER.info("Using " + bukkitAdapter.getClass().getCanonicalName() + " as the Bukkit adapter");
|
||||
this.adapter.newValue(bukkitAdapter);
|
||||
} catch (AdapterLoadException e) {
|
||||
Platform platform = worldEdit.getPlatformManager().queryCapability(Capability.WORLD_EDITING);
|
||||
if (platform instanceof BukkitServerInterface) {
|
||||
@ -293,6 +299,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
|
||||
+ "but it seems that you have another implementation of WorldEdit installed (" + platform.getPlatformName() + ") "
|
||||
+ "that handles the world editing.");
|
||||
}
|
||||
this.adapter.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,13 +310,14 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
|
||||
public void onDisable() {
|
||||
WorldEdit worldEdit = WorldEdit.getInstance();
|
||||
worldEdit.getSessionManager().unload();
|
||||
worldEdit.getPlatformManager().unregister(server);
|
||||
if (platform != null) {
|
||||
worldEdit.getEventBus().post(new PlatformUnreadyEvent(platform));
|
||||
worldEdit.getPlatformManager().unregister(platform);
|
||||
platform.unregisterCommands();
|
||||
}
|
||||
if (config != null) {
|
||||
config.unload();
|
||||
}
|
||||
if (server != null) {
|
||||
server.unregisterCommands();
|
||||
}
|
||||
this.getServer().getScheduler().cancelTasks(this);
|
||||
}
|
||||
|
||||
@ -471,7 +479,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
|
||||
}
|
||||
|
||||
BukkitServerInterface getInternalPlatform() {
|
||||
return server;
|
||||
return platform;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -498,9 +506,12 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
|
||||
*
|
||||
* @return the adapter
|
||||
*/
|
||||
@Nullable
|
||||
Lifecycled<BukkitImplAdapter> getLifecycledBukkitImplAdapter() {
|
||||
return adapter;
|
||||
}
|
||||
|
||||
BukkitImplAdapter getBukkitImplAdapter() {
|
||||
return bukkitAdapter;
|
||||
return adapter.value().orElse(null);
|
||||
}
|
||||
|
||||
private class WorldInitListener implements Listener {
|
||||
@ -533,7 +544,7 @@ public class WorldEditPlugin extends JavaPlugin implements TabCompleter {
|
||||
return;
|
||||
}
|
||||
String label = buffer.substring(1, firstSpace);
|
||||
Plugin owner = server.getDynamicCommands().getCommandOwner(label);
|
||||
Plugin owner = platform.getDynamicCommands().getCommandOwner(label);
|
||||
if (owner != WorldEditPlugin.this) {
|
||||
return;
|
||||
}
|
||||
|
Binary file not shown.
@ -122,7 +122,7 @@ class CLIPlatform extends AbstractPlatform {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerGameHooks() {
|
||||
public void setGameHooksEnabled(boolean enabled) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -45,7 +45,6 @@ import com.sk89q.worldedit.world.item.ItemType;
|
||||
import org.apache.commons.cli.CommandLine;
|
||||
import org.apache.commons.cli.DefaultParser;
|
||||
import org.apache.commons.cli.Options;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@ -176,7 +175,7 @@ public class CLIWorldEdit {
|
||||
config = new CLIConfiguration(this);
|
||||
config.load();
|
||||
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent());
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent(platform));
|
||||
}
|
||||
|
||||
public void onStopped() {
|
||||
|
File diff suppressed because one or more lines are too long
@ -29,7 +29,7 @@ configurations {
|
||||
dependencies {
|
||||
constraints {
|
||||
"implementation"( "org.yaml:snakeyaml") {
|
||||
version { strictly("1.26") }
|
||||
version { require("1.26") }
|
||||
because("Bukkit provides SnakeYaml")
|
||||
}
|
||||
}
|
||||
@ -37,13 +37,13 @@ dependencies {
|
||||
"api"(project(":worldedit-libs:core"))
|
||||
"implementation"("de.schlichtherle:truezip:6.8.4")
|
||||
"implementation"("org.mozilla:rhino-runtime:1.7.13")
|
||||
"implementation"("org.yaml:snakeyaml")
|
||||
"implementation"("org.yaml:snakeyaml:1.26")
|
||||
"implementation"("com.google.guava:guava")
|
||||
"implementation"("com.google.code.findbugs:jsr305:1.3.9")
|
||||
"implementation"("com.google.code.gson:gson")
|
||||
|
||||
"implementation"("org.apache.logging.log4j:log4j-api:2.8.1") {
|
||||
because("Mojang provides Log4J 2.8.1")
|
||||
"implementation"("org.apache.logging.log4j:log4j-api:2.14.1") {
|
||||
because("Mojang provides Log4J 2.14.1")
|
||||
}
|
||||
|
||||
"implementation"("it.unimi.dsi:fastutil")
|
||||
@ -59,9 +59,9 @@ dependencies {
|
||||
"compileOnly"("com.google.auto.value:auto-value-annotations:${Versions.AUTO_VALUE}")
|
||||
"annotationProcessor"("com.google.auto.value:auto-value:${Versions.AUTO_VALUE}")
|
||||
|
||||
"languageFiles"("${project.group}:worldedit-lang:7.2.1:68@zip")
|
||||
"languageFiles"("${project.group}:worldedit-lang:7.2.6:289@zip")
|
||||
|
||||
"testRuntimeOnly"("org.apache.logging.log4j:log4j-core:2.8.1")
|
||||
"testRuntimeOnly"("org.apache.logging.log4j:log4j-core:2.14.1")
|
||||
}
|
||||
|
||||
tasks.named<Test>("test") {
|
||||
@ -120,3 +120,10 @@ tasks.named<Copy>("processResources") {
|
||||
into("lang")
|
||||
}
|
||||
}
|
||||
|
||||
configure<PublishingExtension> {
|
||||
publications.named<MavenPublication>("maven") {
|
||||
artifactId = the<BasePluginConvention>().archivesBaseName
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ class DocumentationPlatform : AbstractPlatform() {
|
||||
|
||||
override fun registerCommands(commandManager: CommandManager?) = error("Documentation does not provide this")
|
||||
|
||||
override fun registerGameHooks() = error("Documentation does not provide this")
|
||||
override fun setGameHooksEnabled(enabled: Boolean) = error("Documentation does not provide this")
|
||||
|
||||
override fun getCapabilities() = error("Documentation does not provide this")
|
||||
|
||||
|
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.event.platform;
|
||||
|
||||
import com.sk89q.worldedit.event.Event;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
|
||||
public abstract class PlatformEvent extends Event {
|
||||
private final Platform platform;
|
||||
|
||||
protected PlatformEvent(Platform platform) {
|
||||
this.platform = platform;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the platform for this event.
|
||||
*
|
||||
* @return the platform
|
||||
*/
|
||||
public Platform getPlatform() {
|
||||
return platform;
|
||||
}
|
||||
}
|
@ -19,11 +19,13 @@
|
||||
|
||||
package com.sk89q.worldedit.event.platform;
|
||||
|
||||
import com.sk89q.worldedit.event.Event;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
|
||||
/**
|
||||
* Raised when a platform thinks that all the platforms have had a chance to
|
||||
* register themselves.
|
||||
* Raised when a platform has finished loading its data.
|
||||
*/
|
||||
public class PlatformReadyEvent extends Event {
|
||||
public class PlatformReadyEvent extends PlatformEvent {
|
||||
public PlatformReadyEvent(Platform platform) {
|
||||
super(platform);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.event.platform;
|
||||
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
|
||||
/**
|
||||
* Raised when a platform needs to retract all registered data, e.g. due to a reload.
|
||||
*/
|
||||
public class PlatformUnreadyEvent extends PlatformEvent {
|
||||
public PlatformUnreadyEvent(Platform platform) {
|
||||
super(platform);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.event.platform;
|
||||
|
||||
import com.sk89q.worldedit.event.Event;
|
||||
|
||||
/**
|
||||
* Fired by a platform when it believes all available platforms should be registered.
|
||||
*/
|
||||
public class PlatformsRegisteredEvent extends Event {
|
||||
}
|
@ -37,11 +37,12 @@ public enum Capability {
|
||||
GAME_HOOKS {
|
||||
@Override
|
||||
void initialize(PlatformManager platformManager, Platform platform) {
|
||||
platform.registerGameHooks();
|
||||
platform.setGameHooksEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
void unload(PlatformManager platformManager, Platform platform) {
|
||||
void uninitialize(PlatformManager platformManager, Platform platform) {
|
||||
platform.setGameHooksEnabled(false);
|
||||
}
|
||||
},
|
||||
|
||||
@ -53,6 +54,11 @@ public enum Capability {
|
||||
void initialize(PlatformManager platformManager, Platform platform) {
|
||||
WorldEdit.getInstance().getAssetLoaders().init();
|
||||
}
|
||||
|
||||
@Override
|
||||
void uninitialize(PlatformManager platformManager, Platform platform) {
|
||||
WorldEdit.getInstance().getAssetLoaders().uninit();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -65,7 +71,7 @@ public enum Capability {
|
||||
}
|
||||
|
||||
@Override
|
||||
void unload(PlatformManager platformManager, Platform platform) {
|
||||
void uninitialize(PlatformManager platformManager, Platform platform) {
|
||||
platformManager.getPlatformCommandManager().removeCommands();
|
||||
}
|
||||
},
|
||||
@ -86,7 +92,7 @@ public enum Capability {
|
||||
*/
|
||||
WORLD_EDITING {
|
||||
@Override
|
||||
void initialize(PlatformManager platformManager, Platform platform) {
|
||||
void ready(PlatformManager platformManager, Platform platform) {
|
||||
BlockRegistry blockRegistry = platform.getRegistries().getBlockRegistry();
|
||||
for (BlockType type : BlockType.REGISTRY) {
|
||||
for (BlockState state : type.getAllStates()) {
|
||||
@ -98,17 +104,33 @@ public enum Capability {
|
||||
}
|
||||
|
||||
@Override
|
||||
void unload(PlatformManager platformManager, Platform platform) {
|
||||
void unready(PlatformManager platformManager, Platform platform) {
|
||||
BlockStateIdAccess.clear();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize platform-wide state.
|
||||
*/
|
||||
void initialize(PlatformManager platformManager, Platform platform) {
|
||||
|
||||
}
|
||||
|
||||
void unload(PlatformManager platformManager, Platform platform) {
|
||||
/**
|
||||
* Un-initialize platform-wide state.
|
||||
*/
|
||||
void uninitialize(PlatformManager platformManager, Platform platform) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize per-level state.
|
||||
*/
|
||||
void ready(PlatformManager platformManager, Platform platform) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Un-initialize per-level state.
|
||||
*/
|
||||
void unready(PlatformManager platformManager, Platform platform) {
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -138,14 +138,28 @@ public interface Platform extends Keyed {
|
||||
/**
|
||||
* Register the commands contained within the given command manager.
|
||||
*
|
||||
* <p>
|
||||
* This method should be ignored if the platform offers a command registration event.
|
||||
* </p>
|
||||
*
|
||||
* @param commandManager the command manager
|
||||
*/
|
||||
void registerCommands(CommandManager commandManager);
|
||||
|
||||
/**
|
||||
* Register game hooks.
|
||||
*
|
||||
* @deprecated Call {@link #setGameHooksEnabled(boolean)} with {@code true} instead
|
||||
*/
|
||||
void registerGameHooks();
|
||||
@Deprecated
|
||||
default void registerGameHooks() {
|
||||
setGameHooksEnabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if the game hooks are enabled for this platform.
|
||||
*/
|
||||
void setGameHooksEnabled(boolean enabled);
|
||||
|
||||
/**
|
||||
* Get the configuration from this platform.
|
||||
|
@ -33,6 +33,8 @@ import com.sk89q.worldedit.event.platform.ConfigurationLoadEvent;
|
||||
import com.sk89q.worldedit.event.platform.Interaction;
|
||||
import com.sk89q.worldedit.event.platform.PlatformInitializeEvent;
|
||||
import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
|
||||
import com.sk89q.worldedit.event.platform.PlatformUnreadyEvent;
|
||||
import com.sk89q.worldedit.event.platform.PlatformsRegisteredEvent;
|
||||
import com.sk89q.worldedit.event.platform.PlayerInputEvent;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.session.request.Request;
|
||||
@ -137,7 +139,7 @@ public class PlatformManager {
|
||||
while (it.hasNext()) {
|
||||
Entry<Capability, Platform> entry = it.next();
|
||||
if (entry.getValue().equals(platform)) {
|
||||
entry.getKey().unload(this, entry.getValue());
|
||||
entry.getKey().uninitialize(this, entry.getValue());
|
||||
it.remove();
|
||||
choosePreferred = true; // Have to choose new favorites
|
||||
}
|
||||
@ -152,8 +154,7 @@ public class PlatformManager {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the preferred platform for handling a certain capability. Returns
|
||||
* null if none is available.
|
||||
* Get the preferred platform for handling a certain capability. Throws if none are available.
|
||||
*
|
||||
* @param capability the capability
|
||||
* @return the platform
|
||||
@ -165,12 +166,11 @@ public class PlatformManager {
|
||||
return platform;
|
||||
} else {
|
||||
if (preferences.isEmpty()) {
|
||||
// Use the first available if preferences have not been decided yet.
|
||||
if (platforms.isEmpty()) {
|
||||
// No platforms registered, this is being called too early!
|
||||
throw new NoCapablePlatformException("No platforms have been registered yet! Please wait until WorldEdit is initialized.");
|
||||
}
|
||||
return platforms.get(0);
|
||||
// Not all platforms registered, this is being called too early!
|
||||
throw new NoCapablePlatformException(
|
||||
"Not all platforms have been registered yet!"
|
||||
+ " Please wait until WorldEdit is initialized."
|
||||
);
|
||||
}
|
||||
throw new NoCapablePlatformException("No platform was found supporting " + capability.name());
|
||||
}
|
||||
@ -183,8 +183,15 @@ public class PlatformManager {
|
||||
for (Capability capability : Capability.values()) {
|
||||
Platform preferred = findMostPreferred(capability);
|
||||
if (preferred != null) {
|
||||
preferences.put(capability, preferred);
|
||||
capability.initialize(this, preferred);
|
||||
Platform oldPreferred = preferences.put(capability, preferred);
|
||||
// only (re)initialize if it changed
|
||||
if (preferred != oldPreferred) {
|
||||
// uninitialize if needed
|
||||
if (oldPreferred != null) {
|
||||
capability.uninitialize(this, oldPreferred);
|
||||
}
|
||||
capability.initialize(this, preferred);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -295,14 +302,42 @@ public class PlatformManager {
|
||||
return queryCapability(Capability.WORLD_EDITING).getSupportedSideEffects();
|
||||
}
|
||||
|
||||
/**
|
||||
* You shouldn't have been calling this anyways, but this is now deprecated. Either don't
|
||||
* fire this event at all, or fire the new event via the event bus if you're a platform.
|
||||
*/
|
||||
@Deprecated
|
||||
public void handlePlatformReady(@SuppressWarnings("unused") PlatformReadyEvent event) {
|
||||
handlePlatformsRegistered(new PlatformsRegisteredEvent());
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal, do not call.
|
||||
*/
|
||||
@Subscribe
|
||||
public void handlePlatformReady(PlatformReadyEvent event) {
|
||||
public void handlePlatformsRegistered(PlatformsRegisteredEvent event) {
|
||||
choosePreferred();
|
||||
if (initialized.compareAndSet(false, true)) {
|
||||
worldEdit.getEventBus().post(new PlatformInitializeEvent());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal, do not call.
|
||||
*/
|
||||
@Subscribe
|
||||
public void handleNewPlatformReady(PlatformReadyEvent event) {
|
||||
preferences.forEach((cap, platform) -> cap.ready(this, platform));
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal, do not call.
|
||||
*/
|
||||
@Subscribe
|
||||
public void handleNewPlatformUnready(PlatformUnreadyEvent event) {
|
||||
preferences.forEach((cap, platform) -> cap.unready(this, platform));
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void handleBlockInteract(BlockInteractEvent event) {
|
||||
// Create a proxy actor with a potentially different world for
|
||||
|
@ -67,4 +67,9 @@ public final class Constants {
|
||||
*/
|
||||
public static final int DATA_VERSION_MC_1_16 = 2566;
|
||||
|
||||
/**
|
||||
* The DataVersion for Minecraft 1.17
|
||||
*/
|
||||
public static final int DATA_VERSION_MC_1_17 = 2724;
|
||||
|
||||
}
|
||||
|
@ -68,7 +68,8 @@ public final class BlockVector3 {
|
||||
}
|
||||
|
||||
private static final int WORLD_XZ_MINMAX = 30_000_000;
|
||||
private static final int WORLD_Y_MAX = 4095;
|
||||
private static final int WORLD_Y_MIN = -2048;
|
||||
private static final int WORLD_Y_MAX = 2047;
|
||||
|
||||
private static boolean isHorizontallyInBounds(int h) {
|
||||
return -WORLD_XZ_MINMAX <= h && h <= WORLD_XZ_MINMAX;
|
||||
@ -77,7 +78,7 @@ public final class BlockVector3 {
|
||||
public static boolean isLongPackable(BlockVector3 location) {
|
||||
return isHorizontallyInBounds(location.getX())
|
||||
&& isHorizontallyInBounds(location.getZ())
|
||||
&& 0 <= location.getY() && location.getY() <= WORLD_Y_MAX;
|
||||
&& WORLD_Y_MIN <= location.getY() && location.getY() <= WORLD_Y_MAX;
|
||||
}
|
||||
|
||||
public static void checkLongPackable(BlockVector3 location) {
|
||||
|
@ -55,6 +55,8 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion {
|
||||
|
||||
protected static final transient NumberFormat NUMBER_FORMAT;
|
||||
protected transient CylinderRegion region;
|
||||
protected transient boolean selectedCenter;
|
||||
protected transient boolean selectedRadius;
|
||||
|
||||
static {
|
||||
NUMBER_FORMAT = (NumberFormat) NumberFormat.getInstance().clone();
|
||||
@ -89,6 +91,8 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion {
|
||||
final CylinderRegionSelector cylSelector = (CylinderRegionSelector) oldSelector;
|
||||
|
||||
region = new CylinderRegion(cylSelector.region);
|
||||
selectedCenter = cylSelector.selectedCenter;
|
||||
selectedRadius = cylSelector.selectedRadius;
|
||||
} else {
|
||||
final Region oldRegion;
|
||||
try {
|
||||
@ -106,6 +110,9 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion {
|
||||
|
||||
region.setMaximumY(Math.max(pos1.getBlockY(), pos2.getBlockY()));
|
||||
region.setMinimumY(Math.min(pos1.getBlockY(), pos2.getBlockY()));
|
||||
|
||||
selectedCenter = true;
|
||||
selectedRadius = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,6 +133,9 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion {
|
||||
|
||||
region.setMinimumY(Math.min(minY, maxY));
|
||||
region.setMaximumY(Math.max(minY, maxY));
|
||||
|
||||
selectedCenter = true;
|
||||
selectedRadius = true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -141,7 +151,7 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion {
|
||||
|
||||
@Override
|
||||
public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) {
|
||||
if (!region.getCenter().equals(Vector3.ZERO) && position.equals(region.getCenter().toBlockPoint())) {
|
||||
if (selectedCenter && position.equals(region.getCenter().toBlockPoint()) && !selectedRadius) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -149,22 +159,26 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion {
|
||||
region.setCenter(position.toBlockVector2());
|
||||
region.setY(position.getBlockY());
|
||||
|
||||
selectedCenter = true;
|
||||
selectedRadius = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean selectSecondary(BlockVector3 position, SelectorLimits limits) {
|
||||
Vector3 center = region.getCenter();
|
||||
if (center.equals(Vector3.ZERO)) {
|
||||
if (!selectedCenter) {
|
||||
return true;
|
||||
}
|
||||
|
||||
final Vector2 diff = position.toVector3().subtract(center).toVector2();
|
||||
final Vector2 diff = position.toVector3().subtract(region.getCenter()).toVector2();
|
||||
final Vector2 minRadius = diff.getMaximum(diff.multiply(-1.0));
|
||||
region.extendRadius(minRadius);
|
||||
|
||||
region.setY(position.getBlockY());
|
||||
|
||||
selectedRadius = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -177,9 +191,7 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion {
|
||||
|
||||
@Override
|
||||
public void explainSecondarySelection(Actor player, LocalSession session, BlockVector3 pos) {
|
||||
Vector3 center = region.getCenter();
|
||||
|
||||
if (!center.equals(Vector3.ZERO)) {
|
||||
if (selectedCenter) {
|
||||
player.printInfo(TranslatableComponent.of(
|
||||
"worldedit.selection.cylinder.explain.secondary",
|
||||
TextComponent.of(NUMBER_FORMAT.format(region.getRadius().getX())),
|
||||
@ -224,7 +236,8 @@ public class CylinderRegionSelector implements RegionSelector, CUIRegion {
|
||||
|
||||
@Override
|
||||
public boolean isDefined() {
|
||||
return !region.getRadius().equals(Vector2.ZERO);
|
||||
// selectedCenter is implied by selectedRadius
|
||||
return selectedRadius;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -51,6 +51,7 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion {
|
||||
|
||||
protected transient EllipsoidRegion region;
|
||||
protected transient boolean started = false;
|
||||
protected transient boolean selectedRadius = false;
|
||||
|
||||
/**
|
||||
* Create a new selector with a {@code null} world.
|
||||
@ -80,6 +81,7 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion {
|
||||
|
||||
region = new EllipsoidRegion(ellipsoidRegionSelector.getIncompleteRegion());
|
||||
started = ellipsoidRegionSelector.started;
|
||||
selectedRadius = ellipsoidRegionSelector.selectedRadius;
|
||||
} else {
|
||||
Region oldRegion;
|
||||
try {
|
||||
@ -95,6 +97,7 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion {
|
||||
region.setCenter(center);
|
||||
region.setRadius(pos2.subtract(center).toVector3());
|
||||
started = true;
|
||||
selectedRadius = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,6 +113,9 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion {
|
||||
|
||||
region.setCenter(center);
|
||||
region.setRadius(radius);
|
||||
|
||||
started = true;
|
||||
selectedRadius = true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -125,13 +131,14 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion {
|
||||
|
||||
@Override
|
||||
public boolean selectPrimary(BlockVector3 position, SelectorLimits limits) {
|
||||
if (position.equals(region.getCenter().toBlockPoint()) && region.getRadius().lengthSq() == 0) {
|
||||
if (started && position.equals(region.getCenter().toBlockPoint()) && !selectedRadius) {
|
||||
return false;
|
||||
}
|
||||
|
||||
region.setCenter(position);
|
||||
region.setRadius(Vector3.ZERO);
|
||||
started = true;
|
||||
selectedRadius = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -145,6 +152,9 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion {
|
||||
final Vector3 diff = position.toVector3().subtract(region.getCenter());
|
||||
final Vector3 minRadius = diff.getMaximum(diff.multiply(-1.0));
|
||||
region.extendRadius(minRadius);
|
||||
|
||||
selectedRadius = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -191,7 +201,8 @@ public class EllipsoidRegionSelector implements RegionSelector, CUIRegion {
|
||||
|
||||
@Override
|
||||
public boolean isDefined() {
|
||||
return started && region.getRadius().lengthSq() > 0;
|
||||
// started implied by selectedRadius
|
||||
return selectedRadius;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,9 +59,11 @@ public class SphereRegionSelector extends EllipsoidRegionSelector {
|
||||
*/
|
||||
public SphereRegionSelector(RegionSelector oldSelector) {
|
||||
super(oldSelector);
|
||||
final Vector3 radius = region.getRadius();
|
||||
final double radiusScalar = Math.max(Math.max(radius.getX(), radius.getY()), radius.getZ());
|
||||
region.setRadius(Vector3.at(radiusScalar, radiusScalar, radiusScalar));
|
||||
if (selectedRadius) {
|
||||
final Vector3 radius = region.getRadius();
|
||||
final double radiusScalar = Math.max(Math.max(radius.getX(), radius.getY()), radius.getZ());
|
||||
region.setRadius(Vector3.at(radiusScalar, radiusScalar, radiusScalar));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -84,6 +86,8 @@ public class SphereRegionSelector extends EllipsoidRegionSelector {
|
||||
final double radiusScalar = Math.ceil(position.toVector3().distance(region.getCenter()));
|
||||
region.setRadius(Vector3.at(radiusScalar, radiusScalar, radiusScalar));
|
||||
|
||||
selectedRadius = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -75,6 +75,11 @@ public class AssetLoaders {
|
||||
registerAssetLoader(new ImageHeightmapLoader(worldEdit, this.assetsDir), ImageHeightmap.class);
|
||||
}
|
||||
|
||||
public void uninit() {
|
||||
this.assetsDir = null;
|
||||
assetLoaderRegistration.clear();
|
||||
}
|
||||
|
||||
public <T> void registerAssetLoader(AssetLoader<T> loader, Class<T> assetClass) {
|
||||
assetLoaders.add(loader);
|
||||
for (String extension : loader.getAllowedExtensions()) {
|
||||
|
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.util.lifecycle;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
/**
|
||||
* A {@link Lifecycled} that never invalidates.
|
||||
*/
|
||||
public final class ConstantLifecycled<T> implements Lifecycled<T> {
|
||||
private final T value;
|
||||
|
||||
public ConstantLifecycled(T value) {
|
||||
this.value = Objects.requireNonNull(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<T> value() {
|
||||
return Optional.of(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Events<T> events() {
|
||||
// Simple implementation, we just need to call onNewValue
|
||||
return new Events<T>() {
|
||||
@Override
|
||||
public <O> void onNewValue(O owner, BiConsumer<O, ? super Lifecycled<T>> callback) {
|
||||
callback.accept(owner, ConstantLifecycled.this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <O> void onInvalidated(O owner, BiConsumer<O, ? super Lifecycled<T>> callback) {
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.util.lifecycle;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
class FlatMapLifecycled<T, U> implements Lifecycled<U> {
|
||||
private final LifecycledCallbackHandler<U> events = new LifecycledCallbackHandler<>(this);
|
||||
private Lifecycled<U> mapped;
|
||||
private Token<FlatMapLifecycled<T, U>> mappedToken;
|
||||
@Nullable
|
||||
private U value;
|
||||
|
||||
FlatMapLifecycled(Lifecycled<T> upstream, Function<T, Lifecycled<U>> mapper) {
|
||||
upstream.events().onInvalidated(this, (this$, up) -> {
|
||||
boolean fire = this$.value != null;
|
||||
this$.value = null;
|
||||
// drop `mapped` hooks if needed
|
||||
this$.mappedToken = null;
|
||||
this$.mapped = null;
|
||||
if (fire) {
|
||||
this$.events.fireInvalidated();
|
||||
}
|
||||
});
|
||||
upstream.events().onNewValue(this, (this$, up) -> {
|
||||
this$.mapped = mapper.apply(up.valueOrThrow());
|
||||
this$.mappedToken = new Token<>(this$);
|
||||
mapped.events().onInvalidated(this$.mappedToken, (token, mapped$) -> {
|
||||
boolean fire = token.inner.value != null;
|
||||
token.inner.value = null;
|
||||
// note we do not drop the token here, onNewValue may be called again
|
||||
if (fire) {
|
||||
this$.events.fireInvalidated();
|
||||
}
|
||||
});
|
||||
mapped.events().onNewValue(this$.mappedToken, (token, mapped$) -> {
|
||||
U newValue = mapped$.valueOrThrow();
|
||||
boolean fire = token.inner.value != newValue;
|
||||
token.inner.value = newValue;
|
||||
if (fire) {
|
||||
this$.events.fireOnNewValue();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<U> value() {
|
||||
return Optional.ofNullable(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return value != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Events<U> events() {
|
||||
return events;
|
||||
}
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.util.lifecycle;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
/**
|
||||
* Represents an object with a simple valid/invalid lifecycle.
|
||||
*
|
||||
* <p>
|
||||
* A lifecycled object will start with no value, then trigger
|
||||
* {@link Events#onNewValue(Object, BiConsumer)} callbacks when it gets one, and
|
||||
* {@link Events#onInvalidated(Object, BiConsumer)} callbacks when it loses it. A full
|
||||
* invalidated->new value cycle is called a "reload".
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Downstream lifecycled objects can be derived using functional methods, and share some
|
||||
* common rules. They will apply the operation sometime before the result is needed, either
|
||||
* eagerly or lazily. They will re-do the operation after the upstream {@link Lifecycled} is
|
||||
* reloaded.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* Unless specified, {@link Lifecycled} objects are <em>not</em> thread-safe. However, the
|
||||
* {@link Events} objects are, and callbacks may be added from any thread.
|
||||
* </p>
|
||||
*
|
||||
* @param <T> the value type
|
||||
*/
|
||||
public interface Lifecycled<T> {
|
||||
|
||||
interface Events<T> {
|
||||
/**
|
||||
* Add a callback for when this lifecycled is given a new value. Will be called immediately
|
||||
* if this lifecycled is currently valid.
|
||||
*
|
||||
* <p>
|
||||
* The callback should not reference the owner, it must only access it via the parameter.
|
||||
* This ensures that the owner will be GC-able, otherwise it may be stuck in a reference
|
||||
* loop.
|
||||
* </p>
|
||||
*
|
||||
* @param owner when the owner is GC'd, the callback is removed
|
||||
* @param callback the callback, will be passed the lifecycled object
|
||||
*/
|
||||
<O> void onNewValue(O owner, BiConsumer<O, ? super Lifecycled<T>> callback);
|
||||
|
||||
/**
|
||||
* Add a callback for when this lifecycled is invalidated. Will be called immediately if
|
||||
* this lifecycled is currently invalid.
|
||||
*
|
||||
* <p>
|
||||
* The callback should not reference the owner, it must only access it via the parameter.
|
||||
* This ensures that the owner will be GC-able, otherwise it may be stuck in a reference
|
||||
* loop.
|
||||
* </p>
|
||||
*
|
||||
* @param owner when the owner is GC'd, the callback is removed
|
||||
* @param callback the callback, will be passed the lifecycled object
|
||||
*/
|
||||
<O> void onInvalidated(O owner, BiConsumer<O, ? super Lifecycled<T>> callback);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value or {@link Optional#empty()}.
|
||||
*
|
||||
* @return the value
|
||||
*/
|
||||
Optional<T> value();
|
||||
|
||||
/**
|
||||
* Get the value or throw.
|
||||
*
|
||||
* @return the value
|
||||
* @throws IllegalStateException if there is no value
|
||||
*/
|
||||
default T valueOrThrow() throws IllegalStateException {
|
||||
return value().orElseThrow(() -> new IllegalStateException("Currently invalid"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check for validity, usually without triggering computation.
|
||||
*
|
||||
* @return if this lifecycled's {@link #value()} is valid
|
||||
*/
|
||||
default boolean isValid() {
|
||||
return value().isPresent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the event manager for this lifecycled object.
|
||||
*
|
||||
* @return the event manager
|
||||
*/
|
||||
Events<T> events();
|
||||
|
||||
/**
|
||||
* Map the value.
|
||||
*
|
||||
* @param mapper the mapper function
|
||||
* @param <U> the new type
|
||||
* @return the downstream lifecycled
|
||||
*/
|
||||
default <U> Lifecycled<U> map(Function<T, U> mapper) {
|
||||
return new MapLifecycled<>(this, mapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the value. In other words, create a new lifecycled object where validity is ANDed
|
||||
* with the result of calling the filter function.
|
||||
*
|
||||
* @param filterer the filter function
|
||||
* @return the downstream lifecycled
|
||||
*/
|
||||
default Lifecycled<T> filter(Predicate<T> filterer) {
|
||||
SimpleLifecycled<T> downstream = SimpleLifecycled.invalid();
|
||||
events().onInvalidated(downstream, (d, lifecycled) -> d.invalidate());
|
||||
events().onNewValue(downstream, (d, lifecycled) -> {
|
||||
T value = lifecycled.valueOrThrow();
|
||||
if (filterer.test(value)) {
|
||||
d.newValue(value);
|
||||
}
|
||||
});
|
||||
return downstream;
|
||||
}
|
||||
|
||||
default <U> Lifecycled<U> flatMap(Function<T, Lifecycled<U>> mapper) {
|
||||
return new FlatMapLifecycled<>(this, mapper);
|
||||
}
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.util.lifecycle;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
/**
|
||||
* Convenience class for implementing the callbacks of {@link Lifecycled}.
|
||||
*/
|
||||
public class LifecycledCallbackHandler<T> implements Lifecycled.Events<T> {
|
||||
private final Lifecycled<T> lifecycled;
|
||||
private final Lock lock = new ReentrantLock();
|
||||
private final Map<Object, BiConsumer<?, ? super Lifecycled<T>>> onInvalidatedCallbacks =
|
||||
new WeakHashMap<>();
|
||||
private final Map<Object, BiConsumer<?, ? super Lifecycled<T>>> onNewValueCallbacks =
|
||||
new WeakHashMap<>();
|
||||
|
||||
public LifecycledCallbackHandler(Lifecycled<T> lifecycled) {
|
||||
this.lifecycled = lifecycled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <O> void onInvalidated(O owner, BiConsumer<O, ? super Lifecycled<T>> callback) {
|
||||
lock.lock();
|
||||
try {
|
||||
onInvalidatedCallbacks.put(owner, callback);
|
||||
if (!lifecycled.isValid()) {
|
||||
callback.accept(owner, lifecycled);
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <O> void onNewValue(O owner, BiConsumer<O, ? super Lifecycled<T>> callback) {
|
||||
lock.lock();
|
||||
try {
|
||||
onNewValueCallbacks.put(owner, callback);
|
||||
if (lifecycled.isValid()) {
|
||||
callback.accept(owner, lifecycled);
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fire {@link #onInvalidated(Object, BiConsumer)} callbacks.
|
||||
*/
|
||||
public void fireInvalidated() {
|
||||
lock.lock();
|
||||
try {
|
||||
for (Map.Entry<Object, BiConsumer<?, ? super Lifecycled<T>>> callback : onInvalidatedCallbacks.entrySet()) {
|
||||
Object owner = callback.getKey();
|
||||
if (owner == null) {
|
||||
// GC'd, continue
|
||||
continue;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
BiConsumer<Object, ? super Lifecycled<T>> cast =
|
||||
(BiConsumer<Object, ? super Lifecycled<T>>) callback.getValue();
|
||||
cast.accept(owner, lifecycled);
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fire {@link #onNewValue(Object, BiConsumer)} callbacks, the {@link Lifecycled#value()} must
|
||||
* be available.
|
||||
*/
|
||||
public void fireOnNewValue() {
|
||||
lock.lock();
|
||||
try {
|
||||
for (Map.Entry<Object, BiConsumer<?, ? super Lifecycled<T>>> callback : onNewValueCallbacks.entrySet()) {
|
||||
Object owner = callback.getKey();
|
||||
if (owner == null) {
|
||||
// GC'd, continue
|
||||
continue;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
BiConsumer<Object, ? super Lifecycled<T>> cast =
|
||||
(BiConsumer<Object, ? super Lifecycled<T>>) callback.getValue();
|
||||
cast.accept(owner, lifecycled);
|
||||
}
|
||||
} finally {
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.util.lifecycle;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
class MapLifecycled<T, U> implements Lifecycled<U> {
|
||||
private final LifecycledCallbackHandler<U> events = new LifecycledCallbackHandler<>(this);
|
||||
private final Lifecycled<T> upstream;
|
||||
private final Function<T, U> mapper;
|
||||
@Nullable
|
||||
private U cache;
|
||||
private boolean computable;
|
||||
|
||||
MapLifecycled(Lifecycled<T> upstream, Function<T, U> mapper) {
|
||||
this.upstream = upstream;
|
||||
this.mapper = mapper;
|
||||
upstream.events().onInvalidated(this, (this$, __) -> {
|
||||
boolean fire = this$.computable;
|
||||
this$.cache = null;
|
||||
this$.computable = false;
|
||||
if (fire) {
|
||||
this$.events.fireInvalidated();
|
||||
}
|
||||
});
|
||||
upstream.events().onNewValue(this, (this$, __) -> {
|
||||
boolean fire = !this$.computable;
|
||||
this$.computable = true;
|
||||
if (fire) {
|
||||
this$.events.fireOnNewValue();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void compute() {
|
||||
T value = upstream.value().orElseThrow(() ->
|
||||
new AssertionError("Upstream lost value without calling onInvalidated event")
|
||||
);
|
||||
this.cache = Objects.requireNonNull(mapper.apply(value), "Mapper cannot produce null");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<U> value() {
|
||||
if (!computable) {
|
||||
return Optional.empty();
|
||||
}
|
||||
if (cache == null) {
|
||||
compute();
|
||||
}
|
||||
return Optional.of(cache);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return computable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Events<U> events() {
|
||||
return events;
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.util.lifecycle;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A {@link Lifecycled} that can be directly called to {@linkplain #invalidate() invalidate} it or
|
||||
* set a {@linkplain #newValue(Object) new value}.
|
||||
*/
|
||||
public final class SimpleLifecycled<T> implements Lifecycled<T> {
|
||||
public static <T> SimpleLifecycled<T> valid(T value) {
|
||||
return new SimpleLifecycled<>(Objects.requireNonNull(value));
|
||||
}
|
||||
|
||||
public static <T> SimpleLifecycled<T> invalid() {
|
||||
return new SimpleLifecycled<>(null);
|
||||
}
|
||||
|
||||
private final LifecycledCallbackHandler<T> events = new LifecycledCallbackHandler<>(this);
|
||||
@Nullable
|
||||
private T value;
|
||||
|
||||
private SimpleLifecycled(@Nullable T value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of this lifecycled and fire the new value event.
|
||||
*
|
||||
* @param value the value
|
||||
*/
|
||||
public void newValue(T value) {
|
||||
// Ensure lifecycle constraints are upheld.
|
||||
invalidate();
|
||||
this.value = Objects.requireNonNull(value);
|
||||
events.fireOnNewValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the value of this lifecycled and fire the invalidated event.
|
||||
*/
|
||||
public void invalidate() {
|
||||
boolean fire = this.value != null;
|
||||
this.value = null;
|
||||
if (fire) {
|
||||
events.fireInvalidated();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<T> value() {
|
||||
return Optional.ofNullable(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Events<T> events() {
|
||||
return events;
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.util.lifecycle;
|
||||
|
||||
/**
|
||||
* Used to create a new strong reference to an object that can be separately dropped.
|
||||
*
|
||||
* @param <T> the inner object
|
||||
*/
|
||||
class Token<T> {
|
||||
final T inner;
|
||||
|
||||
Token(T inner) {
|
||||
this.inner = inner;
|
||||
}
|
||||
}
|
@ -48,6 +48,7 @@ public final class BiomeTypes {
|
||||
@Nullable public static final BiomeType DESERT = get("minecraft:desert");
|
||||
@Nullable public static final BiomeType DESERT_HILLS = get("minecraft:desert_hills");
|
||||
@Nullable public static final BiomeType DESERT_LAKES = get("minecraft:desert_lakes");
|
||||
@Nullable public static final BiomeType DRIPSTONE_CAVES = get("minecraft:dripstone_caves");
|
||||
@Nullable public static final BiomeType END_BARRENS = get("minecraft:end_barrens");
|
||||
@Nullable public static final BiomeType END_HIGHLANDS = get("minecraft:end_highlands");
|
||||
@Nullable public static final BiomeType END_MIDLANDS = get("minecraft:end_midlands");
|
||||
@ -66,6 +67,7 @@ public final class BiomeTypes {
|
||||
@Nullable public static final BiomeType JUNGLE_EDGE = get("minecraft:jungle_edge");
|
||||
@Nullable 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 MODIFIED_BADLANDS_PLATEAU = get("minecraft:modified_badlands_plateau");
|
||||
@Nullable public static final BiomeType MODIFIED_GRAVELLY_MOUNTAINS = get("minecraft:modified_gravelly_mountains");
|
||||
@Nullable public static final BiomeType MODIFIED_JUNGLE = get("minecraft:modified_jungle");
|
||||
|
@ -39,23 +39,37 @@ public final class BlockCategories {
|
||||
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");
|
||||
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 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");
|
||||
public static final BlockCategory CORALS = get("minecraft:corals");
|
||||
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 DARK_OAK_LOGS = get("minecraft:dark_oak_logs");
|
||||
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");
|
||||
@Deprecated 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 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 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 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");
|
||||
public static final BlockCategory HOGLIN_REPELLENTS = get("minecraft:hoglin_repellents");
|
||||
@ -64,32 +78,50 @@ public final class BlockCategories {
|
||||
public static final BlockCategory INFINIBURN_END = get("minecraft:infiniburn_end");
|
||||
public static final BlockCategory INFINIBURN_NETHER = get("minecraft:infiniburn_nether");
|
||||
public static final BlockCategory INFINIBURN_OVERWORLD = get("minecraft:infiniburn_overworld");
|
||||
public static final BlockCategory INSIDE_STEP_SOUND_BLOCKS = get("minecraft:inside_step_sound_blocks");
|
||||
public static final BlockCategory 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 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 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 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 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 PIGLIN_REPELLENTS = get("minecraft:piglin_repellents");
|
||||
public static final BlockCategory PLANKS = get("minecraft:planks");
|
||||
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 RAILS = get("minecraft:rails");
|
||||
public static final BlockCategory REDSTONE_ORES = get("minecraft:redstone_ores");
|
||||
public static final BlockCategory SAND = get("minecraft:sand");
|
||||
public static final BlockCategory SAPLINGS = get("minecraft:saplings");
|
||||
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 SNOW = get("minecraft:snow");
|
||||
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");
|
||||
public static final BlockCategory STAIRS = get("minecraft:stairs");
|
||||
public static final BlockCategory STANDING_SIGNS = get("minecraft:standing_signs");
|
||||
public static final BlockCategory STONE_BRICKS = get("minecraft:stone_bricks");
|
||||
public static final BlockCategory STONE_ORE_REPLACEABLES = get("minecraft:stone_ore_replaceables");
|
||||
public static final BlockCategory STONE_PRESSURE_PLATES = get("minecraft:stone_pressure_plates");
|
||||
public static final BlockCategory STRIDER_WARM_BLOCKS = get("minecraft:strider_warm_blocks");
|
||||
public static final BlockCategory TALL_FLOWERS = get("minecraft:tall_flowers");
|
||||
|
@ -46,6 +46,8 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType ACTIVATOR_RAIL = get("minecraft:activator_rail");
|
||||
@Nullable public static final BlockType AIR = get("minecraft:air");
|
||||
@Nullable public static final BlockType ALLIUM = get("minecraft:allium");
|
||||
@Nullable public static final BlockType AMETHYST_BLOCK = get("minecraft:amethyst_block");
|
||||
@Nullable public static final BlockType AMETHYST_CLUSTER = get("minecraft:amethyst_cluster");
|
||||
@Nullable public static final BlockType ANCIENT_DEBRIS = get("minecraft:ancient_debris");
|
||||
@Nullable public static final BlockType ANDESITE = get("minecraft:andesite");
|
||||
@Nullable public static final BlockType ANDESITE_SLAB = get("minecraft:andesite_slab");
|
||||
@ -54,6 +56,8 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType ANVIL = get("minecraft:anvil");
|
||||
@Nullable public static final BlockType ATTACHED_MELON_STEM = get("minecraft:attached_melon_stem");
|
||||
@Nullable public static final BlockType ATTACHED_PUMPKIN_STEM = get("minecraft:attached_pumpkin_stem");
|
||||
@Nullable public static final BlockType AZALEA = get("minecraft:azalea");
|
||||
@Nullable public static final BlockType AZALEA_LEAVES = get("minecraft:azalea_leaves");
|
||||
@Nullable public static final BlockType AZURE_BLUET = get("minecraft:azure_bluet");
|
||||
@Nullable public static final BlockType BAMBOO = get("minecraft:bamboo");
|
||||
@Nullable public static final BlockType BAMBOO_SAPLING = get("minecraft:bamboo_sapling");
|
||||
@ -66,6 +70,8 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType BEEHIVE = get("minecraft:beehive");
|
||||
@Nullable public static final BlockType BEETROOTS = get("minecraft:beetroots");
|
||||
@Nullable public static final BlockType BELL = get("minecraft:bell");
|
||||
@Nullable public static final BlockType BIG_DRIPLEAF = get("minecraft:big_dripleaf");
|
||||
@Nullable public static final BlockType BIG_DRIPLEAF_STEM = get("minecraft:big_dripleaf_stem");
|
||||
@Nullable public static final BlockType BIRCH_BUTTON = get("minecraft:birch_button");
|
||||
@Nullable public static final BlockType BIRCH_DOOR = get("minecraft:birch_door");
|
||||
@Nullable public static final BlockType BIRCH_FENCE = get("minecraft:birch_fence");
|
||||
@ -83,6 +89,8 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType BIRCH_WOOD = get("minecraft:birch_wood");
|
||||
@Nullable public static final BlockType BLACK_BANNER = get("minecraft:black_banner");
|
||||
@Nullable public static final BlockType BLACK_BED = get("minecraft:black_bed");
|
||||
@Nullable public static final BlockType BLACK_CANDLE = get("minecraft:black_candle");
|
||||
@Nullable public static final BlockType BLACK_CANDLE_CAKE = get("minecraft:black_candle_cake");
|
||||
@Nullable public static final BlockType BLACK_CARPET = get("minecraft:black_carpet");
|
||||
@Nullable public static final BlockType BLACK_CONCRETE = get("minecraft:black_concrete");
|
||||
@Nullable public static final BlockType BLACK_CONCRETE_POWDER = get("minecraft:black_concrete_powder");
|
||||
@ -100,6 +108,8 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType BLAST_FURNACE = get("minecraft:blast_furnace");
|
||||
@Nullable public static final BlockType BLUE_BANNER = get("minecraft:blue_banner");
|
||||
@Nullable public static final BlockType BLUE_BED = get("minecraft:blue_bed");
|
||||
@Nullable public static final BlockType BLUE_CANDLE = get("minecraft:blue_candle");
|
||||
@Nullable public static final BlockType BLUE_CANDLE_CAKE = get("minecraft:blue_candle_cake");
|
||||
@Nullable public static final BlockType BLUE_CARPET = get("minecraft:blue_carpet");
|
||||
@Nullable public static final BlockType BLUE_CONCRETE = get("minecraft:blue_concrete");
|
||||
@Nullable public static final BlockType BLUE_CONCRETE_POWDER = get("minecraft:blue_concrete_powder");
|
||||
@ -125,6 +135,8 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType BRICKS = get("minecraft:bricks");
|
||||
@Nullable public static final BlockType BROWN_BANNER = get("minecraft:brown_banner");
|
||||
@Nullable public static final BlockType BROWN_BED = get("minecraft:brown_bed");
|
||||
@Nullable public static final BlockType BROWN_CANDLE = get("minecraft:brown_candle");
|
||||
@Nullable public static final BlockType BROWN_CANDLE_CAKE = get("minecraft:brown_candle_cake");
|
||||
@Nullable public static final BlockType BROWN_CARPET = get("minecraft:brown_carpet");
|
||||
@Nullable public static final BlockType BROWN_CONCRETE = get("minecraft:brown_concrete");
|
||||
@Nullable public static final BlockType BROWN_CONCRETE_POWDER = get("minecraft:brown_concrete_powder");
|
||||
@ -142,18 +154,25 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType BUBBLE_CORAL_BLOCK = get("minecraft:bubble_coral_block");
|
||||
@Nullable public static final BlockType BUBBLE_CORAL_FAN = get("minecraft:bubble_coral_fan");
|
||||
@Nullable public static final BlockType BUBBLE_CORAL_WALL_FAN = get("minecraft:bubble_coral_wall_fan");
|
||||
@Nullable public static final BlockType BUDDING_AMETHYST = get("minecraft:budding_amethyst");
|
||||
@Nullable public static final BlockType CACTUS = get("minecraft:cactus");
|
||||
@Nullable public static final BlockType CAKE = get("minecraft:cake");
|
||||
@Nullable public static final BlockType CALCITE = get("minecraft:calcite");
|
||||
@Nullable public static final BlockType CAMPFIRE = get("minecraft:campfire");
|
||||
@Nullable public static final BlockType CANDLE = get("minecraft:candle");
|
||||
@Nullable public static final BlockType CANDLE_CAKE = get("minecraft:candle_cake");
|
||||
@Nullable public static final BlockType CARROTS = get("minecraft:carrots");
|
||||
@Nullable public static final BlockType CARTOGRAPHY_TABLE = get("minecraft:cartography_table");
|
||||
@Nullable public static final BlockType CARVED_PUMPKIN = get("minecraft:carved_pumpkin");
|
||||
@Nullable public static final BlockType CAULDRON = get("minecraft:cauldron");
|
||||
@Nullable public static final BlockType CAVE_AIR = get("minecraft:cave_air");
|
||||
@Nullable public static final BlockType CAVE_VINES = get("minecraft:cave_vines");
|
||||
@Nullable public static final BlockType CAVE_VINES_PLANT = get("minecraft:cave_vines_plant");
|
||||
@Nullable public static final BlockType CHAIN = get("minecraft:chain");
|
||||
@Nullable public static final BlockType CHAIN_COMMAND_BLOCK = get("minecraft:chain_command_block");
|
||||
@Nullable public static final BlockType CHEST = get("minecraft:chest");
|
||||
@Nullable public static final BlockType CHIPPED_ANVIL = get("minecraft:chipped_anvil");
|
||||
@Nullable public static final BlockType CHISELED_DEEPSLATE = get("minecraft:chiseled_deepslate");
|
||||
@Nullable public static final BlockType CHISELED_NETHER_BRICKS = get("minecraft:chiseled_nether_bricks");
|
||||
@Nullable public static final BlockType CHISELED_POLISHED_BLACKSTONE = get("minecraft:chiseled_polished_blackstone");
|
||||
@Nullable public static final BlockType CHISELED_QUARTZ_BLOCK = get("minecraft:chiseled_quartz_block");
|
||||
@ -166,6 +185,10 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType COAL_BLOCK = get("minecraft:coal_block");
|
||||
@Nullable public static final BlockType COAL_ORE = get("minecraft:coal_ore");
|
||||
@Nullable public static final BlockType COARSE_DIRT = get("minecraft:coarse_dirt");
|
||||
@Nullable public static final BlockType COBBLED_DEEPSLATE = get("minecraft:cobbled_deepslate");
|
||||
@Nullable public static final BlockType COBBLED_DEEPSLATE_SLAB = get("minecraft:cobbled_deepslate_slab");
|
||||
@Nullable public static final BlockType COBBLED_DEEPSLATE_STAIRS = get("minecraft:cobbled_deepslate_stairs");
|
||||
@Nullable public static final BlockType COBBLED_DEEPSLATE_WALL = get("minecraft:cobbled_deepslate_wall");
|
||||
@Nullable public static final BlockType COBBLESTONE = get("minecraft:cobblestone");
|
||||
@Nullable public static final BlockType COBBLESTONE_SLAB = get("minecraft:cobblestone_slab");
|
||||
@Nullable public static final BlockType COBBLESTONE_STAIRS = get("minecraft:cobblestone_stairs");
|
||||
@ -176,7 +199,11 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType COMPARATOR = get("minecraft:comparator");
|
||||
@Nullable public static final BlockType COMPOSTER = get("minecraft:composter");
|
||||
@Nullable public static final BlockType CONDUIT = get("minecraft:conduit");
|
||||
@Nullable public static final BlockType COPPER_BLOCK = get("minecraft:copper_block");
|
||||
@Nullable public static final BlockType COPPER_ORE = get("minecraft:copper_ore");
|
||||
@Nullable public static final BlockType CORNFLOWER = get("minecraft:cornflower");
|
||||
@Nullable public static final BlockType CRACKED_DEEPSLATE_BRICKS = get("minecraft:cracked_deepslate_bricks");
|
||||
@Nullable public static final BlockType CRACKED_DEEPSLATE_TILES = get("minecraft:cracked_deepslate_tiles");
|
||||
@Nullable public static final BlockType CRACKED_NETHER_BRICKS = get("minecraft:cracked_nether_bricks");
|
||||
@Nullable public static final BlockType CRACKED_POLISHED_BLACKSTONE_BRICKS = get("minecraft:cracked_polished_blackstone_bricks");
|
||||
@Nullable public static final BlockType CRACKED_STONE_BRICKS = get("minecraft:cracked_stone_bricks");
|
||||
@ -200,12 +227,17 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType CRIMSON_TRAPDOOR = get("minecraft:crimson_trapdoor");
|
||||
@Nullable public static final BlockType CRIMSON_WALL_SIGN = get("minecraft:crimson_wall_sign");
|
||||
@Nullable public static final BlockType CRYING_OBSIDIAN = get("minecraft:crying_obsidian");
|
||||
@Nullable public static final BlockType CUT_COPPER = get("minecraft:cut_copper");
|
||||
@Nullable public static final BlockType CUT_COPPER_SLAB = get("minecraft:cut_copper_slab");
|
||||
@Nullable public static final BlockType CUT_COPPER_STAIRS = get("minecraft:cut_copper_stairs");
|
||||
@Nullable public static final BlockType CUT_RED_SANDSTONE = get("minecraft:cut_red_sandstone");
|
||||
@Nullable public static final BlockType CUT_RED_SANDSTONE_SLAB = get("minecraft:cut_red_sandstone_slab");
|
||||
@Nullable public static final BlockType CUT_SANDSTONE = get("minecraft:cut_sandstone");
|
||||
@Nullable public static final BlockType CUT_SANDSTONE_SLAB = get("minecraft:cut_sandstone_slab");
|
||||
@Nullable public static final BlockType CYAN_BANNER = get("minecraft:cyan_banner");
|
||||
@Nullable public static final BlockType CYAN_BED = get("minecraft:cyan_bed");
|
||||
@Nullable public static final BlockType CYAN_CANDLE = get("minecraft:cyan_candle");
|
||||
@Nullable public static final BlockType CYAN_CANDLE_CAKE = get("minecraft:cyan_candle_cake");
|
||||
@Nullable public static final BlockType CYAN_CARPET = get("minecraft:cyan_carpet");
|
||||
@Nullable public static final BlockType CYAN_CONCRETE = get("minecraft:cyan_concrete");
|
||||
@Nullable public static final BlockType CYAN_CONCRETE_POWDER = get("minecraft:cyan_concrete_powder");
|
||||
@ -258,6 +290,23 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType DEAD_TUBE_CORAL_BLOCK = get("minecraft:dead_tube_coral_block");
|
||||
@Nullable public static final BlockType DEAD_TUBE_CORAL_FAN = get("minecraft:dead_tube_coral_fan");
|
||||
@Nullable public static final BlockType DEAD_TUBE_CORAL_WALL_FAN = get("minecraft:dead_tube_coral_wall_fan");
|
||||
@Nullable public static final BlockType DEEPSLATE = get("minecraft:deepslate");
|
||||
@Nullable public static final BlockType DEEPSLATE_BRICK_SLAB = get("minecraft:deepslate_brick_slab");
|
||||
@Nullable public static final BlockType DEEPSLATE_BRICK_STAIRS = get("minecraft:deepslate_brick_stairs");
|
||||
@Nullable public static final BlockType DEEPSLATE_BRICK_WALL = get("minecraft:deepslate_brick_wall");
|
||||
@Nullable public static final BlockType DEEPSLATE_BRICKS = get("minecraft:deepslate_bricks");
|
||||
@Nullable public static final BlockType DEEPSLATE_COAL_ORE = get("minecraft:deepslate_coal_ore");
|
||||
@Nullable public static final BlockType DEEPSLATE_COPPER_ORE = get("minecraft:deepslate_copper_ore");
|
||||
@Nullable public static final BlockType DEEPSLATE_DIAMOND_ORE = get("minecraft:deepslate_diamond_ore");
|
||||
@Nullable public static final BlockType DEEPSLATE_EMERALD_ORE = get("minecraft:deepslate_emerald_ore");
|
||||
@Nullable public static final BlockType DEEPSLATE_GOLD_ORE = get("minecraft:deepslate_gold_ore");
|
||||
@Nullable public static final BlockType DEEPSLATE_IRON_ORE = get("minecraft:deepslate_iron_ore");
|
||||
@Nullable public static final BlockType DEEPSLATE_LAPIS_ORE = get("minecraft:deepslate_lapis_ore");
|
||||
@Nullable public static final BlockType DEEPSLATE_REDSTONE_ORE = get("minecraft:deepslate_redstone_ore");
|
||||
@Nullable public static final BlockType DEEPSLATE_TILE_SLAB = get("minecraft:deepslate_tile_slab");
|
||||
@Nullable public static final BlockType DEEPSLATE_TILE_STAIRS = get("minecraft:deepslate_tile_stairs");
|
||||
@Nullable public static final BlockType DEEPSLATE_TILE_WALL = get("minecraft:deepslate_tile_wall");
|
||||
@Nullable public static final BlockType DEEPSLATE_TILES = get("minecraft:deepslate_tiles");
|
||||
@Nullable public static final BlockType DETECTOR_RAIL = get("minecraft:detector_rail");
|
||||
@Nullable public static final BlockType DIAMOND_BLOCK = get("minecraft:diamond_block");
|
||||
@Nullable public static final BlockType DIAMOND_ORE = get("minecraft:diamond_ore");
|
||||
@ -266,11 +315,13 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType DIORITE_STAIRS = get("minecraft:diorite_stairs");
|
||||
@Nullable public static final BlockType DIORITE_WALL = get("minecraft:diorite_wall");
|
||||
@Nullable public static final BlockType DIRT = get("minecraft:dirt");
|
||||
@Nullable public static final BlockType DIRT_PATH = get("minecraft:dirt_path");
|
||||
@Nullable public static final BlockType DISPENSER = get("minecraft:dispenser");
|
||||
@Nullable public static final BlockType DRAGON_EGG = get("minecraft:dragon_egg");
|
||||
@Nullable public static final BlockType DRAGON_HEAD = get("minecraft:dragon_head");
|
||||
@Nullable public static final BlockType DRAGON_WALL_HEAD = get("minecraft:dragon_wall_head");
|
||||
@Nullable public static final BlockType DRIED_KELP_BLOCK = get("minecraft:dried_kelp_block");
|
||||
@Nullable public static final BlockType DRIPSTONE_BLOCK = get("minecraft:dripstone_block");
|
||||
@Nullable public static final BlockType DROPPER = get("minecraft:dropper");
|
||||
@Nullable public static final BlockType EMERALD_BLOCK = get("minecraft:emerald_block");
|
||||
@Nullable public static final BlockType EMERALD_ORE = get("minecraft:emerald_ore");
|
||||
@ -285,6 +336,10 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType END_STONE_BRICK_WALL = get("minecraft:end_stone_brick_wall");
|
||||
@Nullable public static final BlockType END_STONE_BRICKS = get("minecraft:end_stone_bricks");
|
||||
@Nullable public static final BlockType ENDER_CHEST = get("minecraft:ender_chest");
|
||||
@Nullable public static final BlockType EXPOSED_COPPER = get("minecraft:exposed_copper");
|
||||
@Nullable public static final BlockType EXPOSED_CUT_COPPER = get("minecraft:exposed_cut_copper");
|
||||
@Nullable public static final BlockType EXPOSED_CUT_COPPER_SLAB = get("minecraft:exposed_cut_copper_slab");
|
||||
@Nullable public static final BlockType EXPOSED_CUT_COPPER_STAIRS = get("minecraft:exposed_cut_copper_stairs");
|
||||
@Nullable public static final BlockType FARMLAND = get("minecraft:farmland");
|
||||
@Nullable public static final BlockType FERN = get("minecraft:fern");
|
||||
@Nullable public static final BlockType FIRE = get("minecraft:fire");
|
||||
@ -294,11 +349,14 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType FIRE_CORAL_WALL_FAN = get("minecraft:fire_coral_wall_fan");
|
||||
@Nullable public static final BlockType FLETCHING_TABLE = get("minecraft:fletching_table");
|
||||
@Nullable public static final BlockType FLOWER_POT = get("minecraft:flower_pot");
|
||||
@Nullable public static final BlockType FLOWERING_AZALEA = get("minecraft:flowering_azalea");
|
||||
@Nullable public static final BlockType FLOWERING_AZALEA_LEAVES = get("minecraft:flowering_azalea_leaves");
|
||||
@Nullable public static final BlockType FROSTED_ICE = get("minecraft:frosted_ice");
|
||||
@Nullable public static final BlockType FURNACE = get("minecraft:furnace");
|
||||
@Nullable public static final BlockType GILDED_BLACKSTONE = get("minecraft:gilded_blackstone");
|
||||
@Nullable public static final BlockType GLASS = get("minecraft:glass");
|
||||
@Nullable public static final BlockType GLASS_PANE = get("minecraft:glass_pane");
|
||||
@Nullable public static final BlockType GLOW_LICHEN = get("minecraft:glow_lichen");
|
||||
@Nullable public static final BlockType GLOWSTONE = get("minecraft:glowstone");
|
||||
@Nullable public static final BlockType GOLD_BLOCK = get("minecraft:gold_block");
|
||||
@Nullable public static final BlockType GOLD_ORE = get("minecraft:gold_ore");
|
||||
@ -308,10 +366,12 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType GRANITE_WALL = get("minecraft:granite_wall");
|
||||
@Nullable public static final BlockType GRASS = get("minecraft:grass");
|
||||
@Nullable public static final BlockType GRASS_BLOCK = get("minecraft:grass_block");
|
||||
@Nullable public static final BlockType GRASS_PATH = get("minecraft:grass_path");
|
||||
@Deprecated @Nullable public static final BlockType GRASS_PATH = get("minecraft:grass_path");
|
||||
@Nullable public static final BlockType GRAVEL = get("minecraft:gravel");
|
||||
@Nullable public static final BlockType GRAY_BANNER = get("minecraft:gray_banner");
|
||||
@Nullable public static final BlockType GRAY_BED = get("minecraft:gray_bed");
|
||||
@Nullable public static final BlockType GRAY_CANDLE = get("minecraft:gray_candle");
|
||||
@Nullable public static final BlockType GRAY_CANDLE_CAKE = get("minecraft:gray_candle_cake");
|
||||
@Nullable public static final BlockType GRAY_CARPET = get("minecraft:gray_carpet");
|
||||
@Nullable public static final BlockType GRAY_CONCRETE = get("minecraft:gray_concrete");
|
||||
@Nullable public static final BlockType GRAY_CONCRETE_POWDER = get("minecraft:gray_concrete_powder");
|
||||
@ -324,6 +384,8 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType GRAY_WOOL = get("minecraft:gray_wool");
|
||||
@Nullable public static final BlockType GREEN_BANNER = get("minecraft:green_banner");
|
||||
@Nullable public static final BlockType GREEN_BED = get("minecraft:green_bed");
|
||||
@Nullable public static final BlockType GREEN_CANDLE = get("minecraft:green_candle");
|
||||
@Nullable public static final BlockType GREEN_CANDLE_CAKE = get("minecraft:green_candle_cake");
|
||||
@Nullable public static final BlockType GREEN_CARPET = get("minecraft:green_carpet");
|
||||
@Nullable public static final BlockType GREEN_CONCRETE = get("minecraft:green_concrete");
|
||||
@Nullable public static final BlockType GREEN_CONCRETE_POWDER = get("minecraft:green_concrete_powder");
|
||||
@ -335,6 +397,7 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType GREEN_WALL_BANNER = get("minecraft:green_wall_banner");
|
||||
@Nullable public static final BlockType GREEN_WOOL = get("minecraft:green_wool");
|
||||
@Nullable public static final BlockType GRINDSTONE = get("minecraft:grindstone");
|
||||
@Nullable public static final BlockType HANGING_ROOTS = get("minecraft:hanging_roots");
|
||||
@Nullable public static final BlockType HAY_BLOCK = get("minecraft:hay_block");
|
||||
@Nullable public static final BlockType HEAVY_WEIGHTED_PRESSURE_PLATE = get("minecraft:heavy_weighted_pressure_plate");
|
||||
@Nullable public static final BlockType HONEY_BLOCK = get("minecraft:honey_block");
|
||||
@ -348,6 +411,7 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType INFESTED_CHISELED_STONE_BRICKS = get("minecraft:infested_chiseled_stone_bricks");
|
||||
@Nullable public static final BlockType INFESTED_COBBLESTONE = get("minecraft:infested_cobblestone");
|
||||
@Nullable public static final BlockType INFESTED_CRACKED_STONE_BRICKS = get("minecraft:infested_cracked_stone_bricks");
|
||||
@Nullable public static final BlockType INFESTED_DEEPSLATE = get("minecraft:infested_deepslate");
|
||||
@Nullable public static final BlockType INFESTED_MOSSY_STONE_BRICKS = get("minecraft:infested_mossy_stone_bricks");
|
||||
@Nullable public static final BlockType INFESTED_STONE = get("minecraft:infested_stone");
|
||||
@Nullable public static final BlockType INFESTED_STONE_BRICKS = get("minecraft:infested_stone_bricks");
|
||||
@ -380,12 +444,17 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType LANTERN = get("minecraft:lantern");
|
||||
@Nullable public static final BlockType LAPIS_BLOCK = get("minecraft:lapis_block");
|
||||
@Nullable public static final BlockType LAPIS_ORE = get("minecraft:lapis_ore");
|
||||
@Nullable public static final BlockType LARGE_AMETHYST_BUD = get("minecraft:large_amethyst_bud");
|
||||
@Nullable public static final BlockType LARGE_FERN = get("minecraft:large_fern");
|
||||
@Nullable public static final BlockType LAVA = get("minecraft:lava");
|
||||
@Nullable public static final BlockType LAVA_CAULDRON = get("minecraft:lava_cauldron");
|
||||
@Nullable public static final BlockType LECTERN = get("minecraft:lectern");
|
||||
@Nullable public static final BlockType LEVER = get("minecraft:lever");
|
||||
@Nullable public static final BlockType LIGHT = get("minecraft:light");
|
||||
@Nullable public static final BlockType LIGHT_BLUE_BANNER = get("minecraft:light_blue_banner");
|
||||
@Nullable public static final BlockType LIGHT_BLUE_BED = get("minecraft:light_blue_bed");
|
||||
@Nullable public static final BlockType LIGHT_BLUE_CANDLE = get("minecraft:light_blue_candle");
|
||||
@Nullable public static final BlockType LIGHT_BLUE_CANDLE_CAKE = get("minecraft:light_blue_candle_cake");
|
||||
@Nullable public static final BlockType LIGHT_BLUE_CARPET = get("minecraft:light_blue_carpet");
|
||||
@Nullable public static final BlockType LIGHT_BLUE_CONCRETE = get("minecraft:light_blue_concrete");
|
||||
@Nullable public static final BlockType LIGHT_BLUE_CONCRETE_POWDER = get("minecraft:light_blue_concrete_powder");
|
||||
@ -398,6 +467,8 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType LIGHT_BLUE_WOOL = get("minecraft:light_blue_wool");
|
||||
@Nullable public static final BlockType LIGHT_GRAY_BANNER = get("minecraft:light_gray_banner");
|
||||
@Nullable public static final BlockType LIGHT_GRAY_BED = get("minecraft:light_gray_bed");
|
||||
@Nullable public static final BlockType LIGHT_GRAY_CANDLE = get("minecraft:light_gray_candle");
|
||||
@Nullable public static final BlockType LIGHT_GRAY_CANDLE_CAKE = get("minecraft:light_gray_candle_cake");
|
||||
@Nullable public static final BlockType LIGHT_GRAY_CARPET = get("minecraft:light_gray_carpet");
|
||||
@Nullable public static final BlockType LIGHT_GRAY_CONCRETE = get("minecraft:light_gray_concrete");
|
||||
@Nullable public static final BlockType LIGHT_GRAY_CONCRETE_POWDER = get("minecraft:light_gray_concrete_powder");
|
||||
@ -409,11 +480,14 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType LIGHT_GRAY_WALL_BANNER = get("minecraft:light_gray_wall_banner");
|
||||
@Nullable public static final BlockType LIGHT_GRAY_WOOL = get("minecraft:light_gray_wool");
|
||||
@Nullable public static final BlockType LIGHT_WEIGHTED_PRESSURE_PLATE = get("minecraft:light_weighted_pressure_plate");
|
||||
@Nullable public static final BlockType LIGHTNING_ROD = get("minecraft:lightning_rod");
|
||||
@Nullable public static final BlockType LILAC = get("minecraft:lilac");
|
||||
@Nullable public static final BlockType LILY_OF_THE_VALLEY = get("minecraft:lily_of_the_valley");
|
||||
@Nullable public static final BlockType LILY_PAD = get("minecraft:lily_pad");
|
||||
@Nullable public static final BlockType LIME_BANNER = get("minecraft:lime_banner");
|
||||
@Nullable public static final BlockType LIME_BED = get("minecraft:lime_bed");
|
||||
@Nullable public static final BlockType LIME_CANDLE = get("minecraft:lime_candle");
|
||||
@Nullable public static final BlockType LIME_CANDLE_CAKE = get("minecraft:lime_candle_cake");
|
||||
@Nullable public static final BlockType LIME_CARPET = get("minecraft:lime_carpet");
|
||||
@Nullable public static final BlockType LIME_CONCRETE = get("minecraft:lime_concrete");
|
||||
@Nullable public static final BlockType LIME_CONCRETE_POWDER = get("minecraft:lime_concrete_powder");
|
||||
@ -428,6 +502,8 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType LOOM = get("minecraft:loom");
|
||||
@Nullable public static final BlockType MAGENTA_BANNER = get("minecraft:magenta_banner");
|
||||
@Nullable public static final BlockType MAGENTA_BED = get("minecraft:magenta_bed");
|
||||
@Nullable public static final BlockType MAGENTA_CANDLE = get("minecraft:magenta_candle");
|
||||
@Nullable public static final BlockType MAGENTA_CANDLE_CAKE = get("minecraft:magenta_candle_cake");
|
||||
@Nullable public static final BlockType MAGENTA_CARPET = get("minecraft:magenta_carpet");
|
||||
@Nullable public static final BlockType MAGENTA_CONCRETE = get("minecraft:magenta_concrete");
|
||||
@Nullable public static final BlockType MAGENTA_CONCRETE_POWDER = get("minecraft:magenta_concrete_powder");
|
||||
@ -439,8 +515,11 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType MAGENTA_WALL_BANNER = get("minecraft:magenta_wall_banner");
|
||||
@Nullable public static final BlockType MAGENTA_WOOL = get("minecraft:magenta_wool");
|
||||
@Nullable public static final BlockType MAGMA_BLOCK = get("minecraft:magma_block");
|
||||
@Nullable public static final BlockType MEDIUM_AMETHYST_BUD = get("minecraft:medium_amethyst_bud");
|
||||
@Nullable public static final BlockType MELON = get("minecraft:melon");
|
||||
@Nullable public static final BlockType MELON_STEM = get("minecraft:melon_stem");
|
||||
@Nullable public static final BlockType MOSS_BLOCK = get("minecraft:moss_block");
|
||||
@Nullable public static final BlockType MOSS_CARPET = get("minecraft:moss_carpet");
|
||||
@Nullable public static final BlockType MOSSY_COBBLESTONE = get("minecraft:mossy_cobblestone");
|
||||
@Nullable public static final BlockType MOSSY_COBBLESTONE_SLAB = get("minecraft:mossy_cobblestone_slab");
|
||||
@Nullable public static final BlockType MOSSY_COBBLESTONE_STAIRS = get("minecraft:mossy_cobblestone_stairs");
|
||||
@ -485,6 +564,8 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType OBSIDIAN = get("minecraft:obsidian");
|
||||
@Nullable public static final BlockType ORANGE_BANNER = get("minecraft:orange_banner");
|
||||
@Nullable public static final BlockType ORANGE_BED = get("minecraft:orange_bed");
|
||||
@Nullable public static final BlockType ORANGE_CANDLE = get("minecraft:orange_candle");
|
||||
@Nullable public static final BlockType ORANGE_CANDLE_CAKE = get("minecraft:orange_candle_cake");
|
||||
@Nullable public static final BlockType ORANGE_CARPET = get("minecraft:orange_carpet");
|
||||
@Nullable public static final BlockType ORANGE_CONCRETE = get("minecraft:orange_concrete");
|
||||
@Nullable public static final BlockType ORANGE_CONCRETE_POWDER = get("minecraft:orange_concrete_powder");
|
||||
@ -497,11 +578,17 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType ORANGE_WALL_BANNER = get("minecraft:orange_wall_banner");
|
||||
@Nullable public static final BlockType ORANGE_WOOL = get("minecraft:orange_wool");
|
||||
@Nullable public static final BlockType OXEYE_DAISY = get("minecraft:oxeye_daisy");
|
||||
@Nullable public static final BlockType OXIDIZED_COPPER = get("minecraft:oxidized_copper");
|
||||
@Nullable public static final BlockType OXIDIZED_CUT_COPPER = get("minecraft:oxidized_cut_copper");
|
||||
@Nullable public static final BlockType OXIDIZED_CUT_COPPER_SLAB = get("minecraft:oxidized_cut_copper_slab");
|
||||
@Nullable public static final BlockType OXIDIZED_CUT_COPPER_STAIRS = get("minecraft:oxidized_cut_copper_stairs");
|
||||
@Nullable public static final BlockType PACKED_ICE = get("minecraft:packed_ice");
|
||||
@Nullable public static final BlockType PEONY = get("minecraft:peony");
|
||||
@Nullable public static final BlockType PETRIFIED_OAK_SLAB = get("minecraft:petrified_oak_slab");
|
||||
@Nullable public static final BlockType PINK_BANNER = get("minecraft:pink_banner");
|
||||
@Nullable public static final BlockType PINK_BED = get("minecraft:pink_bed");
|
||||
@Nullable public static final BlockType PINK_CANDLE = get("minecraft:pink_candle");
|
||||
@Nullable public static final BlockType PINK_CANDLE_CAKE = get("minecraft:pink_candle_cake");
|
||||
@Nullable public static final BlockType PINK_CARPET = get("minecraft:pink_carpet");
|
||||
@Nullable public static final BlockType PINK_CONCRETE = get("minecraft:pink_concrete");
|
||||
@Nullable public static final BlockType PINK_CONCRETE_POWDER = get("minecraft:pink_concrete_powder");
|
||||
@ -518,6 +605,7 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType PLAYER_HEAD = get("minecraft:player_head");
|
||||
@Nullable public static final BlockType PLAYER_WALL_HEAD = get("minecraft:player_wall_head");
|
||||
@Nullable public static final BlockType PODZOL = get("minecraft:podzol");
|
||||
@Nullable public static final BlockType POINTED_DRIPSTONE = get("minecraft:pointed_dripstone");
|
||||
@Nullable public static final BlockType POLISHED_ANDESITE = get("minecraft:polished_andesite");
|
||||
@Nullable public static final BlockType POLISHED_ANDESITE_SLAB = get("minecraft:polished_andesite_slab");
|
||||
@Nullable public static final BlockType POLISHED_ANDESITE_STAIRS = get("minecraft:polished_andesite_stairs");
|
||||
@ -532,6 +620,10 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType POLISHED_BLACKSTONE_SLAB = get("minecraft:polished_blackstone_slab");
|
||||
@Nullable public static final BlockType POLISHED_BLACKSTONE_STAIRS = get("minecraft:polished_blackstone_stairs");
|
||||
@Nullable public static final BlockType POLISHED_BLACKSTONE_WALL = get("minecraft:polished_blackstone_wall");
|
||||
@Nullable public static final BlockType POLISHED_DEEPSLATE = get("minecraft:polished_deepslate");
|
||||
@Nullable public static final BlockType POLISHED_DEEPSLATE_SLAB = get("minecraft:polished_deepslate_slab");
|
||||
@Nullable public static final BlockType POLISHED_DEEPSLATE_STAIRS = get("minecraft:polished_deepslate_stairs");
|
||||
@Nullable public static final BlockType POLISHED_DEEPSLATE_WALL = get("minecraft:polished_deepslate_wall");
|
||||
@Nullable public static final BlockType POLISHED_DIORITE = get("minecraft:polished_diorite");
|
||||
@Nullable public static final BlockType POLISHED_DIORITE_SLAB = get("minecraft:polished_diorite_slab");
|
||||
@Nullable public static final BlockType POLISHED_DIORITE_STAIRS = get("minecraft:polished_diorite_stairs");
|
||||
@ -542,6 +634,7 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType POTATOES = get("minecraft:potatoes");
|
||||
@Nullable public static final BlockType POTTED_ACACIA_SAPLING = get("minecraft:potted_acacia_sapling");
|
||||
@Nullable public static final BlockType POTTED_ALLIUM = get("minecraft:potted_allium");
|
||||
@Nullable public static final BlockType POTTED_AZALEA_BUSH = get("minecraft:potted_azalea_bush");
|
||||
@Nullable public static final BlockType POTTED_AZURE_BLUET = get("minecraft:potted_azure_bluet");
|
||||
@Nullable public static final BlockType POTTED_BAMBOO = get("minecraft:potted_bamboo");
|
||||
@Nullable public static final BlockType POTTED_BIRCH_SAPLING = get("minecraft:potted_birch_sapling");
|
||||
@ -555,6 +648,7 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType POTTED_DARK_OAK_SAPLING = get("minecraft:potted_dark_oak_sapling");
|
||||
@Nullable public static final BlockType POTTED_DEAD_BUSH = get("minecraft:potted_dead_bush");
|
||||
@Nullable public static final BlockType POTTED_FERN = get("minecraft:potted_fern");
|
||||
@Nullable public static final BlockType POTTED_FLOWERING_AZALEA_BUSH = get("minecraft:potted_flowering_azalea_bush");
|
||||
@Nullable public static final BlockType POTTED_JUNGLE_SAPLING = get("minecraft:potted_jungle_sapling");
|
||||
@Nullable public static final BlockType POTTED_LILY_OF_THE_VALLEY = get("minecraft:potted_lily_of_the_valley");
|
||||
@Nullable public static final BlockType POTTED_OAK_SAPLING = get("minecraft:potted_oak_sapling");
|
||||
@ -569,6 +663,8 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType POTTED_WARPED_ROOTS = get("minecraft:potted_warped_roots");
|
||||
@Nullable public static final BlockType POTTED_WHITE_TULIP = get("minecraft:potted_white_tulip");
|
||||
@Nullable public static final BlockType POTTED_WITHER_ROSE = get("minecraft:potted_wither_rose");
|
||||
@Nullable public static final BlockType POWDER_SNOW = get("minecraft:powder_snow");
|
||||
@Nullable public static final BlockType POWDER_SNOW_CAULDRON = get("minecraft:powder_snow_cauldron");
|
||||
@Nullable public static final BlockType POWERED_RAIL = get("minecraft:powered_rail");
|
||||
@Nullable public static final BlockType PRISMARINE = get("minecraft:prismarine");
|
||||
@Nullable public static final BlockType PRISMARINE_BRICK_SLAB = get("minecraft:prismarine_brick_slab");
|
||||
@ -581,6 +677,8 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType PUMPKIN_STEM = get("minecraft:pumpkin_stem");
|
||||
@Nullable public static final BlockType PURPLE_BANNER = get("minecraft:purple_banner");
|
||||
@Nullable public static final BlockType PURPLE_BED = get("minecraft:purple_bed");
|
||||
@Nullable public static final BlockType PURPLE_CANDLE = get("minecraft:purple_candle");
|
||||
@Nullable public static final BlockType PURPLE_CANDLE_CAKE = get("minecraft:purple_candle_cake");
|
||||
@Nullable public static final BlockType PURPLE_CARPET = get("minecraft:purple_carpet");
|
||||
@Nullable public static final BlockType PURPLE_CONCRETE = get("minecraft:purple_concrete");
|
||||
@Nullable public static final BlockType PURPLE_CONCRETE_POWDER = get("minecraft:purple_concrete_powder");
|
||||
@ -601,8 +699,13 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType QUARTZ_SLAB = get("minecraft:quartz_slab");
|
||||
@Nullable public static final BlockType QUARTZ_STAIRS = get("minecraft:quartz_stairs");
|
||||
@Nullable public static final BlockType RAIL = get("minecraft:rail");
|
||||
@Nullable public static final BlockType RAW_COPPER_BLOCK = get("minecraft:raw_copper_block");
|
||||
@Nullable public static final BlockType RAW_GOLD_BLOCK = get("minecraft:raw_gold_block");
|
||||
@Nullable public static final BlockType RAW_IRON_BLOCK = get("minecraft:raw_iron_block");
|
||||
@Nullable public static final BlockType RED_BANNER = get("minecraft:red_banner");
|
||||
@Nullable public static final BlockType RED_BED = get("minecraft:red_bed");
|
||||
@Nullable public static final BlockType RED_CANDLE = get("minecraft:red_candle");
|
||||
@Nullable public static final BlockType RED_CANDLE_CAKE = get("minecraft:red_candle_cake");
|
||||
@Nullable public static final BlockType RED_CARPET = get("minecraft:red_carpet");
|
||||
@Nullable public static final BlockType RED_CONCRETE = get("minecraft:red_concrete");
|
||||
@Nullable public static final BlockType RED_CONCRETE_POWDER = get("minecraft:red_concrete_powder");
|
||||
@ -634,6 +737,7 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType REPEATER = get("minecraft:repeater");
|
||||
@Nullable public static final BlockType REPEATING_COMMAND_BLOCK = get("minecraft:repeating_command_block");
|
||||
@Nullable public static final BlockType RESPAWN_ANCHOR = get("minecraft:respawn_anchor");
|
||||
@Nullable public static final BlockType ROOTED_DIRT = get("minecraft:rooted_dirt");
|
||||
@Nullable public static final BlockType ROSE_BUSH = get("minecraft:rose_bush");
|
||||
@Nullable public static final BlockType SAND = get("minecraft:sand");
|
||||
@Nullable public static final BlockType SANDSTONE = get("minecraft:sandstone");
|
||||
@ -641,6 +745,7 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType SANDSTONE_STAIRS = get("minecraft:sandstone_stairs");
|
||||
@Nullable public static final BlockType SANDSTONE_WALL = get("minecraft:sandstone_wall");
|
||||
@Nullable public static final BlockType SCAFFOLDING = get("minecraft:scaffolding");
|
||||
@Nullable public static final BlockType SCULK_SENSOR = get("minecraft:sculk_sensor");
|
||||
@Nullable public static final BlockType SEA_LANTERN = get("minecraft:sea_lantern");
|
||||
@Nullable public static final BlockType SEA_PICKLE = get("minecraft:sea_pickle");
|
||||
@Nullable public static final BlockType SEAGRASS = get("minecraft:seagrass");
|
||||
@ -650,8 +755,11 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType SKELETON_SKULL = get("minecraft:skeleton_skull");
|
||||
@Nullable public static final BlockType SKELETON_WALL_SKULL = get("minecraft:skeleton_wall_skull");
|
||||
@Nullable public static final BlockType SLIME_BLOCK = get("minecraft:slime_block");
|
||||
@Nullable public static final BlockType SMALL_AMETHYST_BUD = get("minecraft:small_amethyst_bud");
|
||||
@Nullable public static final BlockType SMALL_DRIPLEAF = get("minecraft:small_dripleaf");
|
||||
@Nullable public static final BlockType SMITHING_TABLE = get("minecraft:smithing_table");
|
||||
@Nullable public static final BlockType SMOKER = get("minecraft:smoker");
|
||||
@Nullable public static final BlockType SMOOTH_BASALT = get("minecraft:smooth_basalt");
|
||||
@Nullable public static final BlockType SMOOTH_QUARTZ = get("minecraft:smooth_quartz");
|
||||
@Nullable public static final BlockType SMOOTH_QUARTZ_SLAB = get("minecraft:smooth_quartz_slab");
|
||||
@Nullable public static final BlockType SMOOTH_QUARTZ_STAIRS = get("minecraft:smooth_quartz_stairs");
|
||||
@ -674,6 +782,7 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType SOUL_WALL_TORCH = get("minecraft:soul_wall_torch");
|
||||
@Nullable public static final BlockType SPAWNER = get("minecraft:spawner");
|
||||
@Nullable public static final BlockType SPONGE = get("minecraft:sponge");
|
||||
@Nullable public static final BlockType SPORE_BLOSSOM = get("minecraft:spore_blossom");
|
||||
@Nullable public static final BlockType SPRUCE_BUTTON = get("minecraft:spruce_button");
|
||||
@Nullable public static final BlockType SPRUCE_DOOR = get("minecraft:spruce_door");
|
||||
@Nullable public static final BlockType SPRUCE_FENCE = get("minecraft:spruce_fence");
|
||||
@ -725,6 +834,7 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType TALL_SEAGRASS = get("minecraft:tall_seagrass");
|
||||
@Nullable public static final BlockType TARGET = get("minecraft:target");
|
||||
@Nullable public static final BlockType TERRACOTTA = get("minecraft:terracotta");
|
||||
@Nullable public static final BlockType TINTED_GLASS = get("minecraft:tinted_glass");
|
||||
@Nullable public static final BlockType TNT = get("minecraft:tnt");
|
||||
@Nullable public static final BlockType TORCH = get("minecraft:torch");
|
||||
@Nullable public static final BlockType TRAPPED_CHEST = get("minecraft:trapped_chest");
|
||||
@ -734,6 +844,7 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType TUBE_CORAL_BLOCK = get("minecraft:tube_coral_block");
|
||||
@Nullable public static final BlockType TUBE_CORAL_FAN = get("minecraft:tube_coral_fan");
|
||||
@Nullable public static final BlockType TUBE_CORAL_WALL_FAN = get("minecraft:tube_coral_wall_fan");
|
||||
@Nullable public static final BlockType TUFF = get("minecraft:tuff");
|
||||
@Nullable public static final BlockType TURTLE_EGG = get("minecraft:turtle_egg");
|
||||
@Nullable public static final BlockType TWISTING_VINES = get("minecraft:twisting_vines");
|
||||
@Nullable public static final BlockType TWISTING_VINES_PLANT = get("minecraft:twisting_vines_plant");
|
||||
@ -759,12 +870,35 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType WARPED_WALL_SIGN = get("minecraft:warped_wall_sign");
|
||||
@Nullable public static final BlockType WARPED_WART_BLOCK = get("minecraft:warped_wart_block");
|
||||
@Nullable public static final BlockType WATER = get("minecraft:water");
|
||||
@Nullable public static final BlockType WATER_CAULDRON = get("minecraft:water_cauldron");
|
||||
@Nullable public static final BlockType WAXED_COPPER_BLOCK = get("minecraft:waxed_copper_block");
|
||||
@Nullable public static final BlockType WAXED_CUT_COPPER = get("minecraft:waxed_cut_copper");
|
||||
@Nullable public static final BlockType WAXED_CUT_COPPER_SLAB = get("minecraft:waxed_cut_copper_slab");
|
||||
@Nullable public static final BlockType WAXED_CUT_COPPER_STAIRS = get("minecraft:waxed_cut_copper_stairs");
|
||||
@Nullable public static final BlockType WAXED_EXPOSED_COPPER = get("minecraft:waxed_exposed_copper");
|
||||
@Nullable public static final BlockType WAXED_EXPOSED_CUT_COPPER = get("minecraft:waxed_exposed_cut_copper");
|
||||
@Nullable public static final BlockType WAXED_EXPOSED_CUT_COPPER_SLAB = get("minecraft:waxed_exposed_cut_copper_slab");
|
||||
@Nullable public static final BlockType WAXED_EXPOSED_CUT_COPPER_STAIRS = get("minecraft:waxed_exposed_cut_copper_stairs");
|
||||
@Nullable public static final BlockType WAXED_OXIDIZED_COPPER = get("minecraft:waxed_oxidized_copper");
|
||||
@Nullable public static final BlockType WAXED_OXIDIZED_CUT_COPPER = get("minecraft:waxed_oxidized_cut_copper");
|
||||
@Nullable public static final BlockType WAXED_OXIDIZED_CUT_COPPER_SLAB = get("minecraft:waxed_oxidized_cut_copper_slab");
|
||||
@Nullable public static final BlockType WAXED_OXIDIZED_CUT_COPPER_STAIRS = get("minecraft:waxed_oxidized_cut_copper_stairs");
|
||||
@Nullable public static final BlockType WAXED_WEATHERED_COPPER = get("minecraft:waxed_weathered_copper");
|
||||
@Nullable public static final BlockType WAXED_WEATHERED_CUT_COPPER = get("minecraft:waxed_weathered_cut_copper");
|
||||
@Nullable public static final BlockType WAXED_WEATHERED_CUT_COPPER_SLAB = get("minecraft:waxed_weathered_cut_copper_slab");
|
||||
@Nullable public static final BlockType WAXED_WEATHERED_CUT_COPPER_STAIRS = get("minecraft:waxed_weathered_cut_copper_stairs");
|
||||
@Nullable public static final BlockType WEATHERED_COPPER = get("minecraft:weathered_copper");
|
||||
@Nullable public static final BlockType WEATHERED_CUT_COPPER = get("minecraft:weathered_cut_copper");
|
||||
@Nullable public static final BlockType WEATHERED_CUT_COPPER_SLAB = get("minecraft:weathered_cut_copper_slab");
|
||||
@Nullable public static final BlockType WEATHERED_CUT_COPPER_STAIRS = get("minecraft:weathered_cut_copper_stairs");
|
||||
@Nullable public static final BlockType WEEPING_VINES = get("minecraft:weeping_vines");
|
||||
@Nullable public static final BlockType WEEPING_VINES_PLANT = get("minecraft:weeping_vines_plant");
|
||||
@Nullable public static final BlockType WET_SPONGE = get("minecraft:wet_sponge");
|
||||
@Nullable public static final BlockType WHEAT = get("minecraft:wheat");
|
||||
@Nullable public static final BlockType WHITE_BANNER = get("minecraft:white_banner");
|
||||
@Nullable public static final BlockType WHITE_BED = get("minecraft:white_bed");
|
||||
@Nullable public static final BlockType WHITE_CANDLE = get("minecraft:white_candle");
|
||||
@Nullable public static final BlockType WHITE_CANDLE_CAKE = get("minecraft:white_candle_cake");
|
||||
@Nullable public static final BlockType WHITE_CARPET = get("minecraft:white_carpet");
|
||||
@Nullable public static final BlockType WHITE_CONCRETE = get("minecraft:white_concrete");
|
||||
@Nullable public static final BlockType WHITE_CONCRETE_POWDER = get("minecraft:white_concrete_powder");
|
||||
@ -781,6 +915,8 @@ public final class BlockTypes {
|
||||
@Nullable public static final BlockType WITHER_SKELETON_WALL_SKULL = get("minecraft:wither_skeleton_wall_skull");
|
||||
@Nullable public static final BlockType YELLOW_BANNER = get("minecraft:yellow_banner");
|
||||
@Nullable public static final BlockType YELLOW_BED = get("minecraft:yellow_bed");
|
||||
@Nullable public static final BlockType YELLOW_CANDLE = get("minecraft:yellow_candle");
|
||||
@Nullable public static final BlockType YELLOW_CANDLE_CAKE = get("minecraft:yellow_candle_cake");
|
||||
@Nullable public static final BlockType YELLOW_CARPET = get("minecraft:yellow_carpet");
|
||||
@Nullable public static final BlockType YELLOW_CONCRETE = get("minecraft:yellow_concrete");
|
||||
@Nullable public static final BlockType YELLOW_CONCRETE_POWDER = get("minecraft:yellow_concrete_powder");
|
||||
|
@ -31,6 +31,7 @@ public final class EntityTypes {
|
||||
@Nullable public static final EntityType AREA_EFFECT_CLOUD = get("minecraft:area_effect_cloud");
|
||||
@Nullable public static final EntityType ARMOR_STAND = get("minecraft:armor_stand");
|
||||
@Nullable public static final EntityType ARROW = get("minecraft:arrow");
|
||||
@Nullable public static final EntityType AXOLOTL = get("minecraft:axolotl");
|
||||
@Nullable public static final EntityType BAT = get("minecraft:bat");
|
||||
@Nullable public static final EntityType BEE = get("minecraft:bee");
|
||||
@Nullable public static final EntityType BLAZE = get("minecraft:blaze");
|
||||
@ -67,6 +68,9 @@ public final class EntityTypes {
|
||||
@Nullable public static final EntityType FURNACE_MINECART = get("minecraft:furnace_minecart");
|
||||
@Nullable public static final EntityType GHAST = get("minecraft:ghast");
|
||||
@Nullable public static final EntityType GIANT = get("minecraft:giant");
|
||||
@Nullable public static final EntityType GLOW_ITEM_FRAME = get("minecraft:glow_item_frame");
|
||||
@Nullable public static final EntityType GLOW_SQUID = get("minecraft:glow_squid");
|
||||
@Nullable public static final EntityType GOAT = get("minecraft:goat");
|
||||
@Nullable public static final EntityType GUARDIAN = get("minecraft:guardian");
|
||||
@Nullable public static final EntityType HOGLIN = get("minecraft:hoglin");
|
||||
@Nullable public static final EntityType HOPPER_MINECART = get("minecraft:hopper_minecart");
|
||||
@ -81,6 +85,7 @@ public final class EntityTypes {
|
||||
@Nullable public static final EntityType LLAMA = get("minecraft:llama");
|
||||
@Nullable public static final EntityType LLAMA_SPIT = get("minecraft:llama_spit");
|
||||
@Nullable public static final EntityType MAGMA_CUBE = get("minecraft:magma_cube");
|
||||
@Nullable public static final EntityType MARKER = get("minecraft:marker");
|
||||
@Nullable public static final EntityType MINECART = get("minecraft:minecart");
|
||||
@Nullable public static final EntityType MOOSHROOM = get("minecraft:mooshroom");
|
||||
@Nullable public static final EntityType MULE = get("minecraft:mule");
|
||||
|
@ -29,24 +29,36 @@ public final class ItemCategories {
|
||||
public static final ItemCategory ACACIA_LOGS = get("minecraft:acacia_logs");
|
||||
public static final ItemCategory ANVIL = get("minecraft:anvil");
|
||||
public static final ItemCategory ARROWS = get("minecraft:arrows");
|
||||
public static final ItemCategory AXOLOTL_TEMPT_ITEMS = get("minecraft:axolotl_tempt_items");
|
||||
public static final ItemCategory BANNERS = get("minecraft:banners");
|
||||
public static final ItemCategory BEACON_PAYMENT_ITEMS = get("minecraft:beacon_payment_items");
|
||||
public static final ItemCategory BEDS = get("minecraft:beds");
|
||||
public static final ItemCategory BIRCH_LOGS = get("minecraft:birch_logs");
|
||||
public static final ItemCategory BOATS = get("minecraft:boats");
|
||||
public static final ItemCategory BUTTONS = get("minecraft:buttons");
|
||||
public static final ItemCategory CANDLES = get("minecraft:candles");
|
||||
public static final ItemCategory CARPETS = get("minecraft:carpets");
|
||||
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 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 DARK_OAK_LOGS = get("minecraft:dark_oak_logs");
|
||||
public static final ItemCategory DIAMOND_ORES = get("minecraft:diamond_ores");
|
||||
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");
|
||||
public static final ItemCategory FISHES = get("minecraft:fishes");
|
||||
public static final ItemCategory FLOWERS = get("minecraft:flowers");
|
||||
public static final ItemCategory FOX_FOOD = get("minecraft:fox_food");
|
||||
public static final ItemCategory FREEZE_IMMUNE_WEARABLES = get("minecraft:freeze_immune_wearables");
|
||||
@Deprecated public static final ItemCategory FURNACE_MATERIALS = get("minecraft:furnace_materials");
|
||||
public static final ItemCategory GOLD_ORES = get("minecraft:gold_ores");
|
||||
public static final ItemCategory IGNORED_BY_PIGLIN_BABIES = get("minecraft:ignored_by_piglin_babies");
|
||||
public static final ItemCategory IRON_ORES = get("minecraft:iron_ores");
|
||||
public static final ItemCategory JUNGLE_LOGS = get("minecraft:jungle_logs");
|
||||
public static final ItemCategory LAPIS_ORES = get("minecraft:lapis_ores");
|
||||
public static final ItemCategory LEAVES = get("minecraft:leaves");
|
||||
public static final ItemCategory LECTERN_BOOKS = get("minecraft:lectern_books");
|
||||
public static final ItemCategory LOGS = get("minecraft:logs");
|
||||
@ -54,10 +66,13 @@ public final class ItemCategories {
|
||||
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");
|
||||
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");
|
||||
public static final ItemCategory PLANKS = get("minecraft:planks");
|
||||
public static final ItemCategory RAILS = get("minecraft:rails");
|
||||
public static final ItemCategory REDSTONE_ORES = get("minecraft:redstone_ores");
|
||||
public static final ItemCategory SAND = get("minecraft:sand");
|
||||
public static final ItemCategory SAPLINGS = get("minecraft:saplings");
|
||||
public static final ItemCategory SIGNS = get("minecraft:signs");
|
||||
|
@ -46,6 +46,9 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType ACTIVATOR_RAIL = get("minecraft:activator_rail");
|
||||
@Nullable public static final ItemType AIR = get("minecraft:air");
|
||||
@Nullable public static final ItemType ALLIUM = get("minecraft:allium");
|
||||
@Nullable public static final ItemType AMETHYST_BLOCK = get("minecraft:amethyst_block");
|
||||
@Nullable public static final ItemType AMETHYST_CLUSTER = get("minecraft:amethyst_cluster");
|
||||
@Nullable public static final ItemType AMETHYST_SHARD = get("minecraft:amethyst_shard");
|
||||
@Nullable public static final ItemType ANCIENT_DEBRIS = get("minecraft:ancient_debris");
|
||||
@Nullable public static final ItemType ANDESITE = get("minecraft:andesite");
|
||||
@Nullable public static final ItemType ANDESITE_SLAB = get("minecraft:andesite_slab");
|
||||
@ -55,6 +58,10 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType APPLE = get("minecraft:apple");
|
||||
@Nullable public static final ItemType ARMOR_STAND = get("minecraft:armor_stand");
|
||||
@Nullable public static final ItemType ARROW = get("minecraft:arrow");
|
||||
@Nullable public static final ItemType AXOLOTL_BUCKET = get("minecraft:axolotl_bucket");
|
||||
@Nullable public static final ItemType AXOLOTL_SPAWN_EGG = get("minecraft:axolotl_spawn_egg");
|
||||
@Nullable public static final ItemType AZALEA = get("minecraft:azalea");
|
||||
@Nullable public static final ItemType AZALEA_LEAVES = get("minecraft:azalea_leaves");
|
||||
@Nullable public static final ItemType AZURE_BLUET = get("minecraft:azure_bluet");
|
||||
@Nullable public static final ItemType BAKED_POTATO = get("minecraft:baked_potato");
|
||||
@Nullable public static final ItemType BAMBOO = get("minecraft:bamboo");
|
||||
@ -72,6 +79,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType BEETROOT_SEEDS = get("minecraft:beetroot_seeds");
|
||||
@Nullable public static final ItemType BEETROOT_SOUP = get("minecraft:beetroot_soup");
|
||||
@Nullable public static final ItemType BELL = get("minecraft:bell");
|
||||
@Nullable public static final ItemType BIG_DRIPLEAF = get("minecraft:big_dripleaf");
|
||||
@Nullable public static final ItemType BIRCH_BOAT = get("minecraft:birch_boat");
|
||||
@Nullable public static final ItemType BIRCH_BUTTON = get("minecraft:birch_button");
|
||||
@Nullable public static final ItemType BIRCH_DOOR = get("minecraft:birch_door");
|
||||
@ -89,6 +97,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType BIRCH_WOOD = get("minecraft:birch_wood");
|
||||
@Nullable public static final ItemType BLACK_BANNER = get("minecraft:black_banner");
|
||||
@Nullable public static final ItemType BLACK_BED = get("minecraft:black_bed");
|
||||
@Nullable public static final ItemType BLACK_CANDLE = get("minecraft:black_candle");
|
||||
@Nullable public static final ItemType BLACK_CARPET = get("minecraft:black_carpet");
|
||||
@Nullable public static final ItemType BLACK_CONCRETE = get("minecraft:black_concrete");
|
||||
@Nullable public static final ItemType BLACK_CONCRETE_POWDER = get("minecraft:black_concrete_powder");
|
||||
@ -109,6 +118,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType BLAZE_SPAWN_EGG = get("minecraft:blaze_spawn_egg");
|
||||
@Nullable public static final ItemType BLUE_BANNER = get("minecraft:blue_banner");
|
||||
@Nullable public static final ItemType BLUE_BED = get("minecraft:blue_bed");
|
||||
@Nullable public static final ItemType BLUE_CANDLE = get("minecraft:blue_candle");
|
||||
@Nullable public static final ItemType BLUE_CARPET = get("minecraft:blue_carpet");
|
||||
@Nullable public static final ItemType BLUE_CONCRETE = get("minecraft:blue_concrete");
|
||||
@Nullable public static final ItemType BLUE_CONCRETE_POWDER = get("minecraft:blue_concrete_powder");
|
||||
@ -140,6 +150,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType BRICKS = get("minecraft:bricks");
|
||||
@Nullable public static final ItemType BROWN_BANNER = get("minecraft:brown_banner");
|
||||
@Nullable public static final ItemType BROWN_BED = get("minecraft:brown_bed");
|
||||
@Nullable public static final ItemType BROWN_CANDLE = get("minecraft:brown_candle");
|
||||
@Nullable public static final ItemType BROWN_CARPET = get("minecraft:brown_carpet");
|
||||
@Nullable public static final ItemType BROWN_CONCRETE = get("minecraft:brown_concrete");
|
||||
@Nullable public static final ItemType BROWN_CONCRETE_POWDER = get("minecraft:brown_concrete_powder");
|
||||
@ -156,10 +167,14 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType BUBBLE_CORAL_BLOCK = get("minecraft:bubble_coral_block");
|
||||
@Nullable public static final ItemType BUBBLE_CORAL_FAN = get("minecraft:bubble_coral_fan");
|
||||
@Nullable public static final ItemType BUCKET = get("minecraft:bucket");
|
||||
@Nullable public static final ItemType BUDDING_AMETHYST = get("minecraft:budding_amethyst");
|
||||
@Nullable public static final ItemType BUNDLE = get("minecraft:bundle");
|
||||
@Nullable public static final ItemType CACTUS = get("minecraft:cactus");
|
||||
@Deprecated @Nullable public static final ItemType CACTUS_GREEN = get("minecraft:cactus_green");
|
||||
@Nullable public static final ItemType CAKE = get("minecraft:cake");
|
||||
@Nullable public static final ItemType CALCITE = get("minecraft:calcite");
|
||||
@Nullable public static final ItemType CAMPFIRE = get("minecraft:campfire");
|
||||
@Nullable public static final ItemType CANDLE = get("minecraft:candle");
|
||||
@Nullable public static final ItemType CARROT = get("minecraft:carrot");
|
||||
@Nullable public static final ItemType CARROT_ON_A_STICK = get("minecraft:carrot_on_a_stick");
|
||||
@Nullable public static final ItemType CARTOGRAPHY_TABLE = get("minecraft:cartography_table");
|
||||
@ -179,6 +194,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType CHICKEN = get("minecraft:chicken");
|
||||
@Nullable public static final ItemType CHICKEN_SPAWN_EGG = get("minecraft:chicken_spawn_egg");
|
||||
@Nullable public static final ItemType CHIPPED_ANVIL = get("minecraft:chipped_anvil");
|
||||
@Nullable public static final ItemType CHISELED_DEEPSLATE = get("minecraft:chiseled_deepslate");
|
||||
@Nullable public static final ItemType CHISELED_NETHER_BRICKS = get("minecraft:chiseled_nether_bricks");
|
||||
@Nullable public static final ItemType CHISELED_POLISHED_BLACKSTONE = get("minecraft:chiseled_polished_blackstone");
|
||||
@Nullable public static final ItemType CHISELED_QUARTZ_BLOCK = get("minecraft:chiseled_quartz_block");
|
||||
@ -195,6 +211,10 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType COAL_BLOCK = get("minecraft:coal_block");
|
||||
@Nullable public static final ItemType COAL_ORE = get("minecraft:coal_ore");
|
||||
@Nullable public static final ItemType COARSE_DIRT = get("minecraft:coarse_dirt");
|
||||
@Nullable public static final ItemType COBBLED_DEEPSLATE = get("minecraft:cobbled_deepslate");
|
||||
@Nullable public static final ItemType COBBLED_DEEPSLATE_SLAB = get("minecraft:cobbled_deepslate_slab");
|
||||
@Nullable public static final ItemType COBBLED_DEEPSLATE_STAIRS = get("minecraft:cobbled_deepslate_stairs");
|
||||
@Nullable public static final ItemType COBBLED_DEEPSLATE_WALL = get("minecraft:cobbled_deepslate_wall");
|
||||
@Nullable public static final ItemType COBBLESTONE = get("minecraft:cobblestone");
|
||||
@Nullable public static final ItemType COBBLESTONE_SLAB = get("minecraft:cobblestone_slab");
|
||||
@Nullable public static final ItemType COBBLESTONE_STAIRS = get("minecraft:cobblestone_stairs");
|
||||
@ -218,8 +238,13 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType COOKED_RABBIT = get("minecraft:cooked_rabbit");
|
||||
@Nullable public static final ItemType COOKED_SALMON = get("minecraft:cooked_salmon");
|
||||
@Nullable public static final ItemType COOKIE = get("minecraft:cookie");
|
||||
@Nullable public static final ItemType COPPER_BLOCK = get("minecraft:copper_block");
|
||||
@Nullable public static final ItemType COPPER_INGOT = get("minecraft:copper_ingot");
|
||||
@Nullable public static final ItemType COPPER_ORE = get("minecraft:copper_ore");
|
||||
@Nullable public static final ItemType CORNFLOWER = get("minecraft:cornflower");
|
||||
@Nullable public static final ItemType COW_SPAWN_EGG = get("minecraft:cow_spawn_egg");
|
||||
@Nullable public static final ItemType CRACKED_DEEPSLATE_BRICKS = get("minecraft:cracked_deepslate_bricks");
|
||||
@Nullable public static final ItemType CRACKED_DEEPSLATE_TILES = get("minecraft:cracked_deepslate_tiles");
|
||||
@Nullable public static final ItemType CRACKED_NETHER_BRICKS = get("minecraft:cracked_nether_bricks");
|
||||
@Nullable public static final ItemType CRACKED_POLISHED_BLACKSTONE_BRICKS = get("minecraft:cracked_polished_blackstone_bricks");
|
||||
@Nullable public static final ItemType CRACKED_STONE_BRICKS = get("minecraft:cracked_stone_bricks");
|
||||
@ -244,12 +269,16 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType CRIMSON_TRAPDOOR = get("minecraft:crimson_trapdoor");
|
||||
@Nullable public static final ItemType CROSSBOW = get("minecraft:crossbow");
|
||||
@Nullable public static final ItemType CRYING_OBSIDIAN = get("minecraft:crying_obsidian");
|
||||
@Nullable public static final ItemType CUT_COPPER = get("minecraft:cut_copper");
|
||||
@Nullable public static final ItemType CUT_COPPER_SLAB = get("minecraft:cut_copper_slab");
|
||||
@Nullable public static final ItemType CUT_COPPER_STAIRS = get("minecraft:cut_copper_stairs");
|
||||
@Nullable public static final ItemType CUT_RED_SANDSTONE = get("minecraft:cut_red_sandstone");
|
||||
@Nullable public static final ItemType CUT_RED_SANDSTONE_SLAB = get("minecraft:cut_red_sandstone_slab");
|
||||
@Nullable public static final ItemType CUT_SANDSTONE = get("minecraft:cut_sandstone");
|
||||
@Nullable public static final ItemType CUT_SANDSTONE_SLAB = get("minecraft:cut_sandstone_slab");
|
||||
@Nullable public static final ItemType CYAN_BANNER = get("minecraft:cyan_banner");
|
||||
@Nullable public static final ItemType CYAN_BED = get("minecraft:cyan_bed");
|
||||
@Nullable public static final ItemType CYAN_CANDLE = get("minecraft:cyan_candle");
|
||||
@Nullable public static final ItemType CYAN_CARPET = get("minecraft:cyan_carpet");
|
||||
@Nullable public static final ItemType CYAN_CONCRETE = get("minecraft:cyan_concrete");
|
||||
@Nullable public static final ItemType CYAN_CONCRETE_POWDER = get("minecraft:cyan_concrete_powder");
|
||||
@ -299,6 +328,23 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType DEAD_TUBE_CORAL_BLOCK = get("minecraft:dead_tube_coral_block");
|
||||
@Nullable public static final ItemType DEAD_TUBE_CORAL_FAN = get("minecraft:dead_tube_coral_fan");
|
||||
@Nullable public static final ItemType DEBUG_STICK = get("minecraft:debug_stick");
|
||||
@Nullable public static final ItemType DEEPSLATE = get("minecraft:deepslate");
|
||||
@Nullable public static final ItemType DEEPSLATE_BRICK_SLAB = get("minecraft:deepslate_brick_slab");
|
||||
@Nullable public static final ItemType DEEPSLATE_BRICK_STAIRS = get("minecraft:deepslate_brick_stairs");
|
||||
@Nullable public static final ItemType DEEPSLATE_BRICK_WALL = get("minecraft:deepslate_brick_wall");
|
||||
@Nullable public static final ItemType DEEPSLATE_BRICKS = get("minecraft:deepslate_bricks");
|
||||
@Nullable public static final ItemType DEEPSLATE_COAL_ORE = get("minecraft:deepslate_coal_ore");
|
||||
@Nullable public static final ItemType DEEPSLATE_COPPER_ORE = get("minecraft:deepslate_copper_ore");
|
||||
@Nullable public static final ItemType DEEPSLATE_DIAMOND_ORE = get("minecraft:deepslate_diamond_ore");
|
||||
@Nullable public static final ItemType DEEPSLATE_EMERALD_ORE = get("minecraft:deepslate_emerald_ore");
|
||||
@Nullable public static final ItemType DEEPSLATE_GOLD_ORE = get("minecraft:deepslate_gold_ore");
|
||||
@Nullable public static final ItemType DEEPSLATE_IRON_ORE = get("minecraft:deepslate_iron_ore");
|
||||
@Nullable public static final ItemType DEEPSLATE_LAPIS_ORE = get("minecraft:deepslate_lapis_ore");
|
||||
@Nullable public static final ItemType DEEPSLATE_REDSTONE_ORE = get("minecraft:deepslate_redstone_ore");
|
||||
@Nullable public static final ItemType DEEPSLATE_TILE_SLAB = get("minecraft:deepslate_tile_slab");
|
||||
@Nullable public static final ItemType DEEPSLATE_TILE_STAIRS = get("minecraft:deepslate_tile_stairs");
|
||||
@Nullable public static final ItemType DEEPSLATE_TILE_WALL = get("minecraft:deepslate_tile_wall");
|
||||
@Nullable public static final ItemType DEEPSLATE_TILES = get("minecraft:deepslate_tiles");
|
||||
@Nullable public static final ItemType DETECTOR_RAIL = get("minecraft:detector_rail");
|
||||
@Nullable public static final ItemType DIAMOND = get("minecraft:diamond");
|
||||
@Nullable public static final ItemType DIAMOND_AXE = get("minecraft:diamond_axe");
|
||||
@ -318,6 +364,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType DIORITE_STAIRS = get("minecraft:diorite_stairs");
|
||||
@Nullable public static final ItemType DIORITE_WALL = get("minecraft:diorite_wall");
|
||||
@Nullable public static final ItemType DIRT = get("minecraft:dirt");
|
||||
@Nullable public static final ItemType DIRT_PATH = get("minecraft:dirt_path");
|
||||
@Nullable public static final ItemType DISPENSER = get("minecraft:dispenser");
|
||||
@Nullable public static final ItemType DOLPHIN_SPAWN_EGG = get("minecraft:dolphin_spawn_egg");
|
||||
@Nullable public static final ItemType DONKEY_SPAWN_EGG = get("minecraft:donkey_spawn_egg");
|
||||
@ -326,6 +373,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType DRAGON_HEAD = get("minecraft:dragon_head");
|
||||
@Nullable public static final ItemType DRIED_KELP = get("minecraft:dried_kelp");
|
||||
@Nullable public static final ItemType DRIED_KELP_BLOCK = get("minecraft:dried_kelp_block");
|
||||
@Nullable public static final ItemType DRIPSTONE_BLOCK = get("minecraft:dripstone_block");
|
||||
@Nullable public static final ItemType DROPPER = get("minecraft:dropper");
|
||||
@Nullable public static final ItemType DROWNED_SPAWN_EGG = get("minecraft:drowned_spawn_egg");
|
||||
@Nullable public static final ItemType EGG = get("minecraft:egg");
|
||||
@ -352,6 +400,10 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType ENDERMITE_SPAWN_EGG = get("minecraft:endermite_spawn_egg");
|
||||
@Nullable public static final ItemType EVOKER_SPAWN_EGG = get("minecraft:evoker_spawn_egg");
|
||||
@Nullable public static final ItemType EXPERIENCE_BOTTLE = get("minecraft:experience_bottle");
|
||||
@Nullable public static final ItemType EXPOSED_COPPER = get("minecraft:exposed_copper");
|
||||
@Nullable public static final ItemType EXPOSED_CUT_COPPER = get("minecraft:exposed_cut_copper");
|
||||
@Nullable public static final ItemType EXPOSED_CUT_COPPER_SLAB = get("minecraft:exposed_cut_copper_slab");
|
||||
@Nullable public static final ItemType EXPOSED_CUT_COPPER_STAIRS = get("minecraft:exposed_cut_copper_stairs");
|
||||
@Nullable public static final ItemType FARMLAND = get("minecraft:farmland");
|
||||
@Nullable public static final ItemType FEATHER = get("minecraft:feather");
|
||||
@Nullable public static final ItemType FERMENTED_SPIDER_EYE = get("minecraft:fermented_spider_eye");
|
||||
@ -369,6 +421,8 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType FLINT_AND_STEEL = get("minecraft:flint_and_steel");
|
||||
@Nullable public static final ItemType FLOWER_BANNER_PATTERN = get("minecraft:flower_banner_pattern");
|
||||
@Nullable public static final ItemType FLOWER_POT = get("minecraft:flower_pot");
|
||||
@Nullable public static final ItemType FLOWERING_AZALEA = get("minecraft:flowering_azalea");
|
||||
@Nullable public static final ItemType FLOWERING_AZALEA_LEAVES = get("minecraft:flowering_azalea_leaves");
|
||||
@Nullable public static final ItemType FOX_SPAWN_EGG = get("minecraft:fox_spawn_egg");
|
||||
@Nullable public static final ItemType FURNACE = get("minecraft:furnace");
|
||||
@Nullable public static final ItemType FURNACE_MINECART = get("minecraft:furnace_minecart");
|
||||
@ -380,8 +434,14 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType GLASS_PANE = get("minecraft:glass_pane");
|
||||
@Nullable public static final ItemType GLISTERING_MELON_SLICE = get("minecraft:glistering_melon_slice");
|
||||
@Nullable public static final ItemType GLOBE_BANNER_PATTERN = get("minecraft:globe_banner_pattern");
|
||||
@Nullable public static final ItemType GLOW_BERRIES = get("minecraft:glow_berries");
|
||||
@Nullable public static final ItemType GLOW_INK_SAC = get("minecraft:glow_ink_sac");
|
||||
@Nullable public static final ItemType GLOW_ITEM_FRAME = get("minecraft:glow_item_frame");
|
||||
@Nullable public static final ItemType GLOW_LICHEN = get("minecraft:glow_lichen");
|
||||
@Nullable public static final ItemType GLOW_SQUID_SPAWN_EGG = get("minecraft:glow_squid_spawn_egg");
|
||||
@Nullable public static final ItemType GLOWSTONE = get("minecraft:glowstone");
|
||||
@Nullable public static final ItemType GLOWSTONE_DUST = get("minecraft:glowstone_dust");
|
||||
@Nullable public static final ItemType GOAT_SPAWN_EGG = get("minecraft:goat_spawn_egg");
|
||||
@Nullable public static final ItemType GOLD_BLOCK = get("minecraft:gold_block");
|
||||
@Nullable public static final ItemType GOLD_INGOT = get("minecraft:gold_ingot");
|
||||
@Nullable public static final ItemType GOLD_NUGGET = get("minecraft:gold_nugget");
|
||||
@ -404,10 +464,11 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType GRANITE_WALL = get("minecraft:granite_wall");
|
||||
@Nullable public static final ItemType GRASS = get("minecraft:grass");
|
||||
@Nullable public static final ItemType GRASS_BLOCK = get("minecraft:grass_block");
|
||||
@Nullable public static final ItemType GRASS_PATH = get("minecraft:grass_path");
|
||||
@Deprecated @Nullable public static final ItemType GRASS_PATH = get("minecraft:grass_path");
|
||||
@Nullable public static final ItemType GRAVEL = get("minecraft:gravel");
|
||||
@Nullable public static final ItemType GRAY_BANNER = get("minecraft:gray_banner");
|
||||
@Nullable public static final ItemType GRAY_BED = get("minecraft:gray_bed");
|
||||
@Nullable public static final ItemType GRAY_CANDLE = get("minecraft:gray_candle");
|
||||
@Nullable public static final ItemType GRAY_CARPET = get("minecraft:gray_carpet");
|
||||
@Nullable public static final ItemType GRAY_CONCRETE = get("minecraft:gray_concrete");
|
||||
@Nullable public static final ItemType GRAY_CONCRETE_POWDER = get("minecraft:gray_concrete_powder");
|
||||
@ -420,6 +481,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType GRAY_WOOL = get("minecraft:gray_wool");
|
||||
@Nullable public static final ItemType GREEN_BANNER = get("minecraft:green_banner");
|
||||
@Nullable public static final ItemType GREEN_BED = get("minecraft:green_bed");
|
||||
@Nullable public static final ItemType GREEN_CANDLE = get("minecraft:green_candle");
|
||||
@Nullable public static final ItemType GREEN_CARPET = get("minecraft:green_carpet");
|
||||
@Nullable public static final ItemType GREEN_CONCRETE = get("minecraft:green_concrete");
|
||||
@Nullable public static final ItemType GREEN_CONCRETE_POWDER = get("minecraft:green_concrete_powder");
|
||||
@ -433,6 +495,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType GRINDSTONE = get("minecraft:grindstone");
|
||||
@Nullable public static final ItemType GUARDIAN_SPAWN_EGG = get("minecraft:guardian_spawn_egg");
|
||||
@Nullable public static final ItemType GUNPOWDER = get("minecraft:gunpowder");
|
||||
@Nullable public static final ItemType HANGING_ROOTS = get("minecraft:hanging_roots");
|
||||
@Nullable public static final ItemType HAY_BLOCK = get("minecraft:hay_block");
|
||||
@Nullable public static final ItemType HEART_OF_THE_SEA = get("minecraft:heart_of_the_sea");
|
||||
@Nullable public static final ItemType HEAVY_WEIGHTED_PRESSURE_PLATE = get("minecraft:heavy_weighted_pressure_plate");
|
||||
@ -452,6 +515,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType INFESTED_CHISELED_STONE_BRICKS = get("minecraft:infested_chiseled_stone_bricks");
|
||||
@Nullable public static final ItemType INFESTED_COBBLESTONE = get("minecraft:infested_cobblestone");
|
||||
@Nullable public static final ItemType INFESTED_CRACKED_STONE_BRICKS = get("minecraft:infested_cracked_stone_bricks");
|
||||
@Nullable public static final ItemType INFESTED_DEEPSLATE = get("minecraft:infested_deepslate");
|
||||
@Nullable public static final ItemType INFESTED_MOSSY_STONE_BRICKS = get("minecraft:infested_mossy_stone_bricks");
|
||||
@Nullable public static final ItemType INFESTED_STONE = get("minecraft:infested_stone");
|
||||
@Nullable public static final ItemType INFESTED_STONE_BRICKS = get("minecraft:infested_stone_bricks");
|
||||
@ -499,6 +563,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType LAPIS_BLOCK = get("minecraft:lapis_block");
|
||||
@Nullable public static final ItemType LAPIS_LAZULI = get("minecraft:lapis_lazuli");
|
||||
@Nullable public static final ItemType LAPIS_ORE = get("minecraft:lapis_ore");
|
||||
@Nullable public static final ItemType LARGE_AMETHYST_BUD = get("minecraft:large_amethyst_bud");
|
||||
@Nullable public static final ItemType LARGE_FERN = get("minecraft:large_fern");
|
||||
@Nullable public static final ItemType LAVA_BUCKET = get("minecraft:lava_bucket");
|
||||
@Nullable public static final ItemType LEAD = get("minecraft:lead");
|
||||
@ -510,8 +575,10 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType LEATHER_LEGGINGS = get("minecraft:leather_leggings");
|
||||
@Nullable public static final ItemType LECTERN = get("minecraft:lectern");
|
||||
@Nullable public static final ItemType LEVER = get("minecraft:lever");
|
||||
@Nullable public static final ItemType LIGHT = get("minecraft:light");
|
||||
@Nullable public static final ItemType LIGHT_BLUE_BANNER = get("minecraft:light_blue_banner");
|
||||
@Nullable public static final ItemType LIGHT_BLUE_BED = get("minecraft:light_blue_bed");
|
||||
@Nullable public static final ItemType LIGHT_BLUE_CANDLE = get("minecraft:light_blue_candle");
|
||||
@Nullable public static final ItemType LIGHT_BLUE_CARPET = get("minecraft:light_blue_carpet");
|
||||
@Nullable public static final ItemType LIGHT_BLUE_CONCRETE = get("minecraft:light_blue_concrete");
|
||||
@Nullable public static final ItemType LIGHT_BLUE_CONCRETE_POWDER = get("minecraft:light_blue_concrete_powder");
|
||||
@ -524,6 +591,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType LIGHT_BLUE_WOOL = get("minecraft:light_blue_wool");
|
||||
@Nullable public static final ItemType LIGHT_GRAY_BANNER = get("minecraft:light_gray_banner");
|
||||
@Nullable public static final ItemType LIGHT_GRAY_BED = get("minecraft:light_gray_bed");
|
||||
@Nullable public static final ItemType LIGHT_GRAY_CANDLE = get("minecraft:light_gray_candle");
|
||||
@Nullable public static final ItemType LIGHT_GRAY_CARPET = get("minecraft:light_gray_carpet");
|
||||
@Nullable public static final ItemType LIGHT_GRAY_CONCRETE = get("minecraft:light_gray_concrete");
|
||||
@Nullable public static final ItemType LIGHT_GRAY_CONCRETE_POWDER = get("minecraft:light_gray_concrete_powder");
|
||||
@ -535,11 +603,13 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType LIGHT_GRAY_TERRACOTTA = get("minecraft:light_gray_terracotta");
|
||||
@Nullable public static final ItemType LIGHT_GRAY_WOOL = get("minecraft:light_gray_wool");
|
||||
@Nullable public static final ItemType LIGHT_WEIGHTED_PRESSURE_PLATE = get("minecraft:light_weighted_pressure_plate");
|
||||
@Nullable public static final ItemType LIGHTNING_ROD = get("minecraft:lightning_rod");
|
||||
@Nullable public static final ItemType LILAC = get("minecraft:lilac");
|
||||
@Nullable public static final ItemType LILY_OF_THE_VALLEY = get("minecraft:lily_of_the_valley");
|
||||
@Nullable public static final ItemType LILY_PAD = get("minecraft:lily_pad");
|
||||
@Nullable public static final ItemType LIME_BANNER = get("minecraft:lime_banner");
|
||||
@Nullable public static final ItemType LIME_BED = get("minecraft:lime_bed");
|
||||
@Nullable public static final ItemType LIME_CANDLE = get("minecraft:lime_candle");
|
||||
@Nullable public static final ItemType LIME_CARPET = get("minecraft:lime_carpet");
|
||||
@Nullable public static final ItemType LIME_CONCRETE = get("minecraft:lime_concrete");
|
||||
@Nullable public static final ItemType LIME_CONCRETE_POWDER = get("minecraft:lime_concrete_powder");
|
||||
@ -556,6 +626,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType LOOM = get("minecraft:loom");
|
||||
@Nullable public static final ItemType MAGENTA_BANNER = get("minecraft:magenta_banner");
|
||||
@Nullable public static final ItemType MAGENTA_BED = get("minecraft:magenta_bed");
|
||||
@Nullable public static final ItemType MAGENTA_CANDLE = get("minecraft:magenta_candle");
|
||||
@Nullable public static final ItemType MAGENTA_CARPET = get("minecraft:magenta_carpet");
|
||||
@Nullable public static final ItemType MAGENTA_CONCRETE = get("minecraft:magenta_concrete");
|
||||
@Nullable public static final ItemType MAGENTA_CONCRETE_POWDER = get("minecraft:magenta_concrete_powder");
|
||||
@ -570,6 +641,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType MAGMA_CREAM = get("minecraft:magma_cream");
|
||||
@Nullable public static final ItemType MAGMA_CUBE_SPAWN_EGG = get("minecraft:magma_cube_spawn_egg");
|
||||
@Nullable public static final ItemType MAP = get("minecraft:map");
|
||||
@Nullable public static final ItemType MEDIUM_AMETHYST_BUD = get("minecraft:medium_amethyst_bud");
|
||||
@Nullable public static final ItemType MELON = get("minecraft:melon");
|
||||
@Nullable public static final ItemType MELON_SEEDS = get("minecraft:melon_seeds");
|
||||
@Nullable public static final ItemType MELON_SLICE = get("minecraft:melon_slice");
|
||||
@ -577,6 +649,8 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType MINECART = get("minecraft:minecart");
|
||||
@Nullable public static final ItemType MOJANG_BANNER_PATTERN = get("minecraft:mojang_banner_pattern");
|
||||
@Nullable public static final ItemType MOOSHROOM_SPAWN_EGG = get("minecraft:mooshroom_spawn_egg");
|
||||
@Nullable public static final ItemType MOSS_BLOCK = get("minecraft:moss_block");
|
||||
@Nullable public static final ItemType MOSS_CARPET = get("minecraft:moss_carpet");
|
||||
@Nullable public static final ItemType MOSSY_COBBLESTONE = get("minecraft:mossy_cobblestone");
|
||||
@Nullable public static final ItemType MOSSY_COBBLESTONE_SLAB = get("minecraft:mossy_cobblestone_slab");
|
||||
@Nullable public static final ItemType MOSSY_COBBLESTONE_STAIRS = get("minecraft:mossy_cobblestone_stairs");
|
||||
@ -651,6 +725,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType OCELOT_SPAWN_EGG = get("minecraft:ocelot_spawn_egg");
|
||||
@Nullable public static final ItemType ORANGE_BANNER = get("minecraft:orange_banner");
|
||||
@Nullable public static final ItemType ORANGE_BED = get("minecraft:orange_bed");
|
||||
@Nullable public static final ItemType ORANGE_CANDLE = get("minecraft:orange_candle");
|
||||
@Nullable public static final ItemType ORANGE_CARPET = get("minecraft:orange_carpet");
|
||||
@Nullable public static final ItemType ORANGE_CONCRETE = get("minecraft:orange_concrete");
|
||||
@Nullable public static final ItemType ORANGE_CONCRETE_POWDER = get("minecraft:orange_concrete_powder");
|
||||
@ -663,6 +738,10 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType ORANGE_TULIP = get("minecraft:orange_tulip");
|
||||
@Nullable public static final ItemType ORANGE_WOOL = get("minecraft:orange_wool");
|
||||
@Nullable public static final ItemType OXEYE_DAISY = get("minecraft:oxeye_daisy");
|
||||
@Nullable public static final ItemType OXIDIZED_COPPER = get("minecraft:oxidized_copper");
|
||||
@Nullable public static final ItemType OXIDIZED_CUT_COPPER = get("minecraft:oxidized_cut_copper");
|
||||
@Nullable public static final ItemType OXIDIZED_CUT_COPPER_SLAB = get("minecraft:oxidized_cut_copper_slab");
|
||||
@Nullable public static final ItemType OXIDIZED_CUT_COPPER_STAIRS = get("minecraft:oxidized_cut_copper_stairs");
|
||||
@Nullable public static final ItemType PACKED_ICE = get("minecraft:packed_ice");
|
||||
@Nullable public static final ItemType PAINTING = get("minecraft:painting");
|
||||
@Nullable public static final ItemType PANDA_SPAWN_EGG = get("minecraft:panda_spawn_egg");
|
||||
@ -679,6 +758,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType PILLAGER_SPAWN_EGG = get("minecraft:pillager_spawn_egg");
|
||||
@Nullable public static final ItemType PINK_BANNER = get("minecraft:pink_banner");
|
||||
@Nullable public static final ItemType PINK_BED = get("minecraft:pink_bed");
|
||||
@Nullable public static final ItemType PINK_CANDLE = get("minecraft:pink_candle");
|
||||
@Nullable public static final ItemType PINK_CARPET = get("minecraft:pink_carpet");
|
||||
@Nullable public static final ItemType PINK_CONCRETE = get("minecraft:pink_concrete");
|
||||
@Nullable public static final ItemType PINK_CONCRETE_POWDER = get("minecraft:pink_concrete_powder");
|
||||
@ -693,6 +773,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType PISTON = get("minecraft:piston");
|
||||
@Nullable public static final ItemType PLAYER_HEAD = get("minecraft:player_head");
|
||||
@Nullable public static final ItemType PODZOL = get("minecraft:podzol");
|
||||
@Nullable public static final ItemType POINTED_DRIPSTONE = get("minecraft:pointed_dripstone");
|
||||
@Nullable public static final ItemType POISONOUS_POTATO = get("minecraft:poisonous_potato");
|
||||
@Nullable public static final ItemType POLAR_BEAR_SPAWN_EGG = get("minecraft:polar_bear_spawn_egg");
|
||||
@Nullable public static final ItemType POLISHED_ANDESITE = get("minecraft:polished_andesite");
|
||||
@ -709,6 +790,10 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType POLISHED_BLACKSTONE_SLAB = get("minecraft:polished_blackstone_slab");
|
||||
@Nullable public static final ItemType POLISHED_BLACKSTONE_STAIRS = get("minecraft:polished_blackstone_stairs");
|
||||
@Nullable public static final ItemType POLISHED_BLACKSTONE_WALL = get("minecraft:polished_blackstone_wall");
|
||||
@Nullable public static final ItemType POLISHED_DEEPSLATE = get("minecraft:polished_deepslate");
|
||||
@Nullable public static final ItemType POLISHED_DEEPSLATE_SLAB = get("minecraft:polished_deepslate_slab");
|
||||
@Nullable public static final ItemType POLISHED_DEEPSLATE_STAIRS = get("minecraft:polished_deepslate_stairs");
|
||||
@Nullable public static final ItemType POLISHED_DEEPSLATE_WALL = get("minecraft:polished_deepslate_wall");
|
||||
@Nullable public static final ItemType POLISHED_DIORITE = get("minecraft:polished_diorite");
|
||||
@Nullable public static final ItemType POLISHED_DIORITE_SLAB = get("minecraft:polished_diorite_slab");
|
||||
@Nullable public static final ItemType POLISHED_DIORITE_STAIRS = get("minecraft:polished_diorite_stairs");
|
||||
@ -720,6 +805,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType PORKCHOP = get("minecraft:porkchop");
|
||||
@Nullable public static final ItemType POTATO = get("minecraft:potato");
|
||||
@Nullable public static final ItemType POTION = get("minecraft:potion");
|
||||
@Nullable public static final ItemType POWDER_SNOW_BUCKET = get("minecraft:powder_snow_bucket");
|
||||
@Nullable public static final ItemType POWERED_RAIL = get("minecraft:powered_rail");
|
||||
@Nullable public static final ItemType PRISMARINE = get("minecraft:prismarine");
|
||||
@Nullable public static final ItemType PRISMARINE_BRICK_SLAB = get("minecraft:prismarine_brick_slab");
|
||||
@ -738,6 +824,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType PUMPKIN_SEEDS = get("minecraft:pumpkin_seeds");
|
||||
@Nullable public static final ItemType PURPLE_BANNER = get("minecraft:purple_banner");
|
||||
@Nullable public static final ItemType PURPLE_BED = get("minecraft:purple_bed");
|
||||
@Nullable public static final ItemType PURPLE_CANDLE = get("minecraft:purple_candle");
|
||||
@Nullable public static final ItemType PURPLE_CARPET = get("minecraft:purple_carpet");
|
||||
@Nullable public static final ItemType PURPLE_CONCRETE = get("minecraft:purple_concrete");
|
||||
@Nullable public static final ItemType PURPLE_CONCRETE_POWDER = get("minecraft:purple_concrete_powder");
|
||||
@ -765,8 +852,15 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType RABBIT_STEW = get("minecraft:rabbit_stew");
|
||||
@Nullable public static final ItemType RAIL = get("minecraft:rail");
|
||||
@Nullable public static final ItemType RAVAGER_SPAWN_EGG = get("minecraft:ravager_spawn_egg");
|
||||
@Nullable public static final ItemType RAW_COPPER = get("minecraft:raw_copper");
|
||||
@Nullable public static final ItemType RAW_COPPER_BLOCK = get("minecraft:raw_copper_block");
|
||||
@Nullable public static final ItemType RAW_GOLD = get("minecraft:raw_gold");
|
||||
@Nullable public static final ItemType RAW_GOLD_BLOCK = get("minecraft:raw_gold_block");
|
||||
@Nullable public static final ItemType RAW_IRON = get("minecraft:raw_iron");
|
||||
@Nullable public static final ItemType RAW_IRON_BLOCK = get("minecraft:raw_iron_block");
|
||||
@Nullable public static final ItemType RED_BANNER = get("minecraft:red_banner");
|
||||
@Nullable public static final ItemType RED_BED = get("minecraft:red_bed");
|
||||
@Nullable public static final ItemType RED_CANDLE = get("minecraft:red_candle");
|
||||
@Nullable public static final ItemType RED_CARPET = get("minecraft:red_carpet");
|
||||
@Nullable public static final ItemType RED_CONCRETE = get("minecraft:red_concrete");
|
||||
@Nullable public static final ItemType RED_CONCRETE_POWDER = get("minecraft:red_concrete_powder");
|
||||
@ -797,6 +891,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType REPEATER = get("minecraft:repeater");
|
||||
@Nullable public static final ItemType REPEATING_COMMAND_BLOCK = get("minecraft:repeating_command_block");
|
||||
@Nullable public static final ItemType RESPAWN_ANCHOR = get("minecraft:respawn_anchor");
|
||||
@Nullable public static final ItemType ROOTED_DIRT = get("minecraft:rooted_dirt");
|
||||
@Nullable public static final ItemType ROSE_BUSH = get("minecraft:rose_bush");
|
||||
@Deprecated @Nullable public static final ItemType ROSE_RED = get("minecraft:rose_red");
|
||||
@Nullable public static final ItemType ROTTEN_FLESH = get("minecraft:rotten_flesh");
|
||||
@ -810,6 +905,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType SANDSTONE_STAIRS = get("minecraft:sandstone_stairs");
|
||||
@Nullable public static final ItemType SANDSTONE_WALL = get("minecraft:sandstone_wall");
|
||||
@Nullable public static final ItemType SCAFFOLDING = get("minecraft:scaffolding");
|
||||
@Nullable public static final ItemType SCULK_SENSOR = get("minecraft:sculk_sensor");
|
||||
@Nullable public static final ItemType SCUTE = get("minecraft:scute");
|
||||
@Nullable public static final ItemType SEA_LANTERN = get("minecraft:sea_lantern");
|
||||
@Nullable public static final ItemType SEA_PICKLE = get("minecraft:sea_pickle");
|
||||
@ -830,8 +926,11 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType SLIME_BALL = get("minecraft:slime_ball");
|
||||
@Nullable public static final ItemType SLIME_BLOCK = get("minecraft:slime_block");
|
||||
@Nullable public static final ItemType SLIME_SPAWN_EGG = get("minecraft:slime_spawn_egg");
|
||||
@Nullable public static final ItemType SMALL_AMETHYST_BUD = get("minecraft:small_amethyst_bud");
|
||||
@Nullable public static final ItemType SMALL_DRIPLEAF = get("minecraft:small_dripleaf");
|
||||
@Nullable public static final ItemType SMITHING_TABLE = get("minecraft:smithing_table");
|
||||
@Nullable public static final ItemType SMOKER = get("minecraft:smoker");
|
||||
@Nullable public static final ItemType SMOOTH_BASALT = get("minecraft:smooth_basalt");
|
||||
@Nullable public static final ItemType SMOOTH_QUARTZ = get("minecraft:smooth_quartz");
|
||||
@Nullable public static final ItemType SMOOTH_QUARTZ_SLAB = get("minecraft:smooth_quartz_slab");
|
||||
@Nullable public static final ItemType SMOOTH_QUARTZ_STAIRS = get("minecraft:smooth_quartz_stairs");
|
||||
@ -857,6 +956,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType SPIDER_SPAWN_EGG = get("minecraft:spider_spawn_egg");
|
||||
@Nullable public static final ItemType SPLASH_POTION = get("minecraft:splash_potion");
|
||||
@Nullable public static final ItemType SPONGE = get("minecraft:sponge");
|
||||
@Nullable public static final ItemType SPORE_BLOSSOM = get("minecraft:spore_blossom");
|
||||
@Nullable public static final ItemType SPRUCE_BOAT = get("minecraft:spruce_boat");
|
||||
@Nullable public static final ItemType SPRUCE_BUTTON = get("minecraft:spruce_button");
|
||||
@Nullable public static final ItemType SPRUCE_DOOR = get("minecraft:spruce_door");
|
||||
@ -872,6 +972,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType SPRUCE_STAIRS = get("minecraft:spruce_stairs");
|
||||
@Nullable public static final ItemType SPRUCE_TRAPDOOR = get("minecraft:spruce_trapdoor");
|
||||
@Nullable public static final ItemType SPRUCE_WOOD = get("minecraft:spruce_wood");
|
||||
@Nullable public static final ItemType SPYGLASS = get("minecraft:spyglass");
|
||||
@Nullable public static final ItemType SQUID_SPAWN_EGG = get("minecraft:squid_spawn_egg");
|
||||
@Nullable public static final ItemType STICK = get("minecraft:stick");
|
||||
@Nullable public static final ItemType STICKY_PISTON = get("minecraft:sticky_piston");
|
||||
@ -919,6 +1020,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType TALL_GRASS = get("minecraft:tall_grass");
|
||||
@Nullable public static final ItemType TARGET = get("minecraft:target");
|
||||
@Nullable public static final ItemType TERRACOTTA = get("minecraft:terracotta");
|
||||
@Nullable public static final ItemType TINTED_GLASS = get("minecraft:tinted_glass");
|
||||
@Nullable public static final ItemType TIPPED_ARROW = get("minecraft:tipped_arrow");
|
||||
@Nullable public static final ItemType TNT = get("minecraft:tnt");
|
||||
@Nullable public static final ItemType TNT_MINECART = get("minecraft:tnt_minecart");
|
||||
@ -934,6 +1036,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType TUBE_CORAL = get("minecraft:tube_coral");
|
||||
@Nullable public static final ItemType TUBE_CORAL_BLOCK = get("minecraft:tube_coral_block");
|
||||
@Nullable public static final ItemType TUBE_CORAL_FAN = get("minecraft:tube_coral_fan");
|
||||
@Nullable public static final ItemType TUFF = get("minecraft:tuff");
|
||||
@Nullable public static final ItemType TURTLE_EGG = get("minecraft:turtle_egg");
|
||||
@Nullable public static final ItemType TURTLE_HELMET = get("minecraft:turtle_helmet");
|
||||
@Nullable public static final ItemType TURTLE_SPAWN_EGG = get("minecraft:turtle_spawn_egg");
|
||||
@ -961,12 +1064,33 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType WARPED_TRAPDOOR = get("minecraft:warped_trapdoor");
|
||||
@Nullable public static final ItemType WARPED_WART_BLOCK = get("minecraft:warped_wart_block");
|
||||
@Nullable public static final ItemType WATER_BUCKET = get("minecraft:water_bucket");
|
||||
@Nullable public static final ItemType WAXED_COPPER_BLOCK = get("minecraft:waxed_copper_block");
|
||||
@Nullable public static final ItemType WAXED_CUT_COPPER = get("minecraft:waxed_cut_copper");
|
||||
@Nullable public static final ItemType WAXED_CUT_COPPER_SLAB = get("minecraft:waxed_cut_copper_slab");
|
||||
@Nullable public static final ItemType WAXED_CUT_COPPER_STAIRS = get("minecraft:waxed_cut_copper_stairs");
|
||||
@Nullable public static final ItemType WAXED_EXPOSED_COPPER = get("minecraft:waxed_exposed_copper");
|
||||
@Nullable public static final ItemType WAXED_EXPOSED_CUT_COPPER = get("minecraft:waxed_exposed_cut_copper");
|
||||
@Nullable public static final ItemType WAXED_EXPOSED_CUT_COPPER_SLAB = get("minecraft:waxed_exposed_cut_copper_slab");
|
||||
@Nullable public static final ItemType WAXED_EXPOSED_CUT_COPPER_STAIRS = get("minecraft:waxed_exposed_cut_copper_stairs");
|
||||
@Nullable public static final ItemType WAXED_OXIDIZED_COPPER = get("minecraft:waxed_oxidized_copper");
|
||||
@Nullable public static final ItemType WAXED_OXIDIZED_CUT_COPPER = get("minecraft:waxed_oxidized_cut_copper");
|
||||
@Nullable public static final ItemType WAXED_OXIDIZED_CUT_COPPER_SLAB = get("minecraft:waxed_oxidized_cut_copper_slab");
|
||||
@Nullable public static final ItemType WAXED_OXIDIZED_CUT_COPPER_STAIRS = get("minecraft:waxed_oxidized_cut_copper_stairs");
|
||||
@Nullable public static final ItemType WAXED_WEATHERED_COPPER = get("minecraft:waxed_weathered_copper");
|
||||
@Nullable public static final ItemType WAXED_WEATHERED_CUT_COPPER = get("minecraft:waxed_weathered_cut_copper");
|
||||
@Nullable public static final ItemType WAXED_WEATHERED_CUT_COPPER_SLAB = get("minecraft:waxed_weathered_cut_copper_slab");
|
||||
@Nullable public static final ItemType WAXED_WEATHERED_CUT_COPPER_STAIRS = get("minecraft:waxed_weathered_cut_copper_stairs");
|
||||
@Nullable public static final ItemType WEATHERED_COPPER = get("minecraft:weathered_copper");
|
||||
@Nullable public static final ItemType WEATHERED_CUT_COPPER = get("minecraft:weathered_cut_copper");
|
||||
@Nullable public static final ItemType WEATHERED_CUT_COPPER_SLAB = get("minecraft:weathered_cut_copper_slab");
|
||||
@Nullable public static final ItemType WEATHERED_CUT_COPPER_STAIRS = get("minecraft:weathered_cut_copper_stairs");
|
||||
@Nullable public static final ItemType WEEPING_VINES = get("minecraft:weeping_vines");
|
||||
@Nullable public static final ItemType WET_SPONGE = get("minecraft:wet_sponge");
|
||||
@Nullable public static final ItemType WHEAT = get("minecraft:wheat");
|
||||
@Nullable public static final ItemType WHEAT_SEEDS = get("minecraft:wheat_seeds");
|
||||
@Nullable public static final ItemType WHITE_BANNER = get("minecraft:white_banner");
|
||||
@Nullable public static final ItemType WHITE_BED = get("minecraft:white_bed");
|
||||
@Nullable public static final ItemType WHITE_CANDLE = get("minecraft:white_candle");
|
||||
@Nullable public static final ItemType WHITE_CARPET = get("minecraft:white_carpet");
|
||||
@Nullable public static final ItemType WHITE_CONCRETE = get("minecraft:white_concrete");
|
||||
@Nullable public static final ItemType WHITE_CONCRETE_POWDER = get("minecraft:white_concrete_powder");
|
||||
@ -992,6 +1116,7 @@ public final class ItemTypes {
|
||||
@Nullable public static final ItemType WRITTEN_BOOK = get("minecraft:written_book");
|
||||
@Nullable public static final ItemType YELLOW_BANNER = get("minecraft:yellow_banner");
|
||||
@Nullable public static final ItemType YELLOW_BED = get("minecraft:yellow_bed");
|
||||
@Nullable public static final ItemType YELLOW_CANDLE = get("minecraft:yellow_candle");
|
||||
@Nullable public static final ItemType YELLOW_CARPET = get("minecraft:yellow_carpet");
|
||||
@Nullable public static final ItemType YELLOW_CONCRETE = get("minecraft:yellow_concrete");
|
||||
@Nullable public static final ItemType YELLOW_CONCRETE_POWDER = get("minecraft:yellow_concrete_powder");
|
||||
|
@ -83,7 +83,9 @@ public final class BundledBlockData {
|
||||
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_16) {
|
||||
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");
|
||||
|
@ -83,7 +83,9 @@ public final class BundledItemData {
|
||||
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_16) {
|
||||
if (dataVersion >= Constants.DATA_VERSION_MC_1_17) {
|
||||
url = resourceLoader.getResource(BundledBlockData.class, "items.117.json");
|
||||
} else if (dataVersion >= Constants.DATA_VERSION_MC_1_16) {
|
||||
url = resourceLoader.getResource(BundledBlockData.class, "items.116.json");
|
||||
} else if (dataVersion >= Constants.DATA_VERSION_MC_1_15) {
|
||||
url = resourceLoader.getResource(BundledBlockData.class, "items.115.json");
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -21,9 +21,18 @@ package com.sk89q.worldedit.internal.expression;
|
||||
|
||||
import com.sk89q.worldedit.LocalConfiguration;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.event.platform.PlatformsRegisteredEvent;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.extension.platform.Preference;
|
||||
import com.sk89q.worldedit.util.test.ResourceLockKeys;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.parallel.ResourceLock;
|
||||
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.Mockito.mock;
|
||||
@ -32,6 +41,7 @@ import static org.mockito.Mockito.when;
|
||||
/**
|
||||
* Common setup code for expression tests.
|
||||
*/
|
||||
@ResourceLock(ResourceLockKeys.WORLDEDIT_PLATFORM)
|
||||
class BaseExpressionTest {
|
||||
|
||||
static double readSlot(Expression expr, String name) {
|
||||
@ -42,12 +52,17 @@ class BaseExpressionTest {
|
||||
|
||||
@BeforeEach
|
||||
void setup() {
|
||||
when(mockPlat.getCapabilities()).thenReturn(
|
||||
Stream.of(Capability.values())
|
||||
.collect(Collectors.toMap(Function.identity(), __ -> Preference.NORMAL))
|
||||
);
|
||||
when(mockPlat.getConfiguration()).thenReturn(new LocalConfiguration() {
|
||||
@Override
|
||||
public void load() {
|
||||
}
|
||||
});
|
||||
WorldEdit.getInstance().getPlatformManager().register(mockPlat);
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformsRegisteredEvent());
|
||||
WorldEdit.getInstance().getConfiguration().calculationTimeout = 1_000;
|
||||
}
|
||||
|
||||
|
@ -19,18 +19,25 @@
|
||||
|
||||
package com.sk89q.worldedit.math;
|
||||
|
||||
import com.sk89q.worldedit.util.test.VariedVectors;
|
||||
import com.sk89q.worldedit.util.test.VariedVectorGenerator;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
@DisplayName("A 3D block vector")
|
||||
public class BlockVector3Test {
|
||||
|
||||
@VariedVectors.Test(capToVanilla = true, divisionsXZ = 25, divisionsY = 25)
|
||||
@Test
|
||||
@DisplayName("survives a round-trip through long-packing")
|
||||
void longPackingRoundTrip(BlockVector3 vec) {
|
||||
assertEquals(vec, BlockVector3.fromLongPackedForm(vec.toLongPackedForm()));
|
||||
void longPackingRoundTrip() {
|
||||
new VariedVectorGenerator(true, 25, 25).makeVectorsStream()
|
||||
.forEach(vec ->
|
||||
assertEquals(
|
||||
vec,
|
||||
BlockVector3.fromLongPackedForm(vec.toLongPackedForm())
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,14 +21,15 @@ package com.sk89q.worldedit.util.collection;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.event.platform.PlatformsRegisteredEvent;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformManager;
|
||||
import com.sk89q.worldedit.extension.platform.Preference;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.registry.Registry;
|
||||
import com.sk89q.worldedit.util.test.ResourceLockKeys;
|
||||
import com.sk89q.worldedit.util.test.VariedVectorGenerator;
|
||||
import com.sk89q.worldedit.util.test.VariedVectors;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
@ -40,6 +41,9 @@ import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Nested;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.parallel.Execution;
|
||||
import org.junit.jupiter.api.parallel.ExecutionMode;
|
||||
import org.junit.jupiter.api.parallel.ResourceLock;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
@ -50,7 +54,9 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
@ -65,6 +71,8 @@ import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
@Execution(ExecutionMode.CONCURRENT)
|
||||
@ResourceLock(ResourceLockKeys.WORLDEDIT_PLATFORM)
|
||||
@DisplayName("An ordered block map")
|
||||
class BlockMapTest {
|
||||
|
||||
@ -74,12 +82,13 @@ class BlockMapTest {
|
||||
static void setupFakePlatform() {
|
||||
when(MOCKED_PLATFORM.getRegistries()).thenReturn(new BundledRegistries() {
|
||||
});
|
||||
when(MOCKED_PLATFORM.getCapabilities()).thenReturn(ImmutableMap.of(
|
||||
Capability.WORLD_EDITING, Preference.PREFERRED,
|
||||
Capability.GAME_HOOKS, Preference.PREFERRED
|
||||
));
|
||||
when(MOCKED_PLATFORM.getCapabilities()).thenReturn(
|
||||
Stream.of(Capability.values())
|
||||
.collect(Collectors.toMap(Function.identity(), __ -> Preference.NORMAL))
|
||||
);
|
||||
PlatformManager platformManager = WorldEdit.getInstance().getPlatformManager();
|
||||
platformManager.register(MOCKED_PLATFORM);
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformsRegisteredEvent());
|
||||
|
||||
registerBlock("minecraft:air");
|
||||
registerBlock("minecraft:oak_wood");
|
||||
@ -107,21 +116,22 @@ class BlockMapTest {
|
||||
private final BaseBlock air = checkNotNull(BlockTypes.AIR).getDefaultState().toBaseBlock();
|
||||
private final BaseBlock oakWood = checkNotNull(BlockTypes.OAK_WOOD).getDefaultState().toBaseBlock();
|
||||
|
||||
private final BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
private AutoCloseable mocks;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
MockitoAnnotations.initMocks(this);
|
||||
mocks = MockitoAnnotations.openMocks(this);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
void tearDown() {
|
||||
map.clear();
|
||||
void tearDown() throws Exception {
|
||||
mocks.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("throws ClassCastException if invalid argument to get")
|
||||
void throwsFromGetOnInvalidArgument() {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
assertThrows(ClassCastException.class, () -> map.get(""));
|
||||
}
|
||||
|
||||
@ -132,30 +142,35 @@ class BlockMapTest {
|
||||
@Test
|
||||
@DisplayName("is empty")
|
||||
void isEmpty() {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
assertEquals(0, map.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("is equal to another empty map")
|
||||
void isEqualToEmptyMap() {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
assertEquals(ImmutableMap.of(), map);
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("has the same hashCode as another empty map")
|
||||
void isHashCodeEqualToEmptyMap() {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
assertEquals(ImmutableMap.of().hashCode(), map.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("returns `null` from get")
|
||||
void returnsNullFromGet() {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
assertNull(map.get(BlockVector3.ZERO));
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("contains no keys")
|
||||
void containsNoKeys() {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
assertEquals(0, map.keySet().size());
|
||||
assertFalse(map.containsKey(BlockVector3.ZERO));
|
||||
}
|
||||
@ -163,6 +178,7 @@ class BlockMapTest {
|
||||
@Test
|
||||
@DisplayName("contains no values")
|
||||
void containsNoValues() {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
assertEquals(0, map.values().size());
|
||||
assertFalse(map.containsValue(air));
|
||||
}
|
||||
@ -170,32 +186,41 @@ class BlockMapTest {
|
||||
@Test
|
||||
@DisplayName("contains no entries")
|
||||
void containsNoEntries() {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
assertEquals(0, map.entrySet().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("returns the default value from getOrDefault")
|
||||
void returnsDefaultFromGetOrDefault() {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
assertEquals(air, map.getOrDefault(BlockVector3.ZERO, air));
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("never calls the forEach action")
|
||||
void neverCallsForEachAction() {
|
||||
map.forEach(biConsumer);
|
||||
verifyNoMoreInteractions(biConsumer);
|
||||
void neverCallsForEachAction() throws Exception {
|
||||
try (AutoCloseable ignored = MockitoAnnotations.openMocks(this)) {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.forEach(biConsumer);
|
||||
verifyNoMoreInteractions(biConsumer);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("never calls the replaceAll function")
|
||||
void neverCallsReplaceAllFunction() {
|
||||
map.replaceAll(biFunction);
|
||||
verifyNoMoreInteractions(biFunction);
|
||||
void neverCallsReplaceAllFunction() throws Exception {
|
||||
try (AutoCloseable ignored = MockitoAnnotations.openMocks(this)) {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.replaceAll(biFunction);
|
||||
verifyNoMoreInteractions(biFunction);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("inserts on putIfAbsent")
|
||||
void insertOnPutIfAbsent() {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
assertNull(map.putIfAbsent(BlockVector3.ZERO, air));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(air, map.get(BlockVector3.ZERO));
|
||||
@ -204,18 +229,21 @@ class BlockMapTest {
|
||||
@Test
|
||||
@DisplayName("remove(key) returns null")
|
||||
void removeKeyReturnsNull() {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
assertNull(map.remove(BlockVector3.ZERO));
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("remove(key, value) returns false")
|
||||
void removeKeyValueReturnsFalse() {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
assertFalse(map.remove(BlockVector3.ZERO, air));
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("does nothing on replace")
|
||||
void doesNothingOnReplace() {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
assertNull(map.replace(BlockVector3.ZERO, air));
|
||||
assertEquals(0, map.size());
|
||||
assertFalse(map.replace(BlockVector3.ZERO, null, air));
|
||||
@ -225,6 +253,7 @@ class BlockMapTest {
|
||||
@Test
|
||||
@DisplayName("inserts on computeIfAbsent")
|
||||
void insertOnComputeIfAbsent() {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
assertEquals(air, map.computeIfAbsent(BlockVector3.ZERO, k -> air));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(air, map.get(BlockVector3.ZERO));
|
||||
@ -233,6 +262,7 @@ class BlockMapTest {
|
||||
@Test
|
||||
@DisplayName("inserts on compute")
|
||||
void insertOnCompute() {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
assertEquals(air, map.compute(BlockVector3.ZERO, (k, v) -> air));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(air, map.get(BlockVector3.ZERO));
|
||||
@ -241,17 +271,21 @@ class BlockMapTest {
|
||||
@Test
|
||||
@DisplayName("does nothing on computeIfPresent")
|
||||
void doesNothingOnComputeIfPresent() {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
assertNull(map.computeIfPresent(BlockVector3.ZERO, (k, v) -> air));
|
||||
assertEquals(0, map.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("inserts on merge, without calling merge function")
|
||||
void insertsOnMerge() {
|
||||
assertEquals(air, map.merge(BlockVector3.ZERO, air, mergeFunction));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(air, map.get(BlockVector3.ZERO));
|
||||
verifyNoMoreInteractions(mergeFunction);
|
||||
void insertsOnMerge() throws Exception {
|
||||
try (AutoCloseable ignored = MockitoAnnotations.openMocks(this)) {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
assertEquals(air, map.merge(BlockVector3.ZERO, air, mergeFunction));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(air, map.get(BlockVector3.ZERO));
|
||||
verifyNoMoreInteractions(mergeFunction);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -260,328 +294,450 @@ class BlockMapTest {
|
||||
@DisplayName("after having an entry added")
|
||||
class AfterEntryAdded {
|
||||
|
||||
// Note: This section of tests would really benefit from
|
||||
// being able to parameterize classes. It's not part of JUnit
|
||||
// yet though: https://github.com/junit-team/junit5/issues/878
|
||||
private final VariedVectorGenerator generator = new VariedVectorGenerator();
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("has a size of one")
|
||||
void hasSizeOne(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertEquals(1, map.size());
|
||||
void hasSizeOne() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertEquals(1, map.size());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("is equal to another map with the same entry")
|
||||
void isEqualToSimilarMap(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertEquals(ImmutableMap.of(vec, air), map);
|
||||
void isEqualToSimilarMap() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertEquals(ImmutableMap.of(vec, air), map);
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test(provideNonMatching = true)
|
||||
@Test
|
||||
@DisplayName("is not equal to another map with a different key")
|
||||
void isNotEqualToDifferentKeyMap(BlockVector3 vec, BlockVector3 nonMatch) {
|
||||
map.put(vec, air);
|
||||
assertNotEquals(ImmutableMap.of(nonMatch, air), map);
|
||||
void isNotEqualToDifferentKeyMap() {
|
||||
generator.makePairedVectorsStream().forEach(pair -> {
|
||||
BlockVector3 vec = pair.first;
|
||||
BlockVector3 nonMatch = pair.second;
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertNotEquals(ImmutableMap.of(nonMatch, air), map);
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("is not equal to another map with a different value")
|
||||
void isNotEqualToDifferentValueMap(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertNotEquals(ImmutableMap.of(vec, oakWood), map);
|
||||
void isNotEqualToDifferentValueMap() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertNotEquals(ImmutableMap.of(vec, oakWood), map);
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("is not equal to an empty map")
|
||||
void isNotEqualToEmptyMap(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertNotEquals(ImmutableMap.of(), map);
|
||||
void isNotEqualToEmptyMap() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertNotEquals(ImmutableMap.of(), map);
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("has the same hashCode as another map with the same entry")
|
||||
void isHashCodeEqualToSimilarMap(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertEquals(ImmutableMap.of(vec, air).hashCode(), map.hashCode());
|
||||
void isHashCodeEqualToSimilarMap() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertEquals(ImmutableMap.of(vec, air).hashCode(), map.hashCode());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test(provideNonMatching = true)
|
||||
@Test
|
||||
@DisplayName("has a different hashCode from another map with a different key")
|
||||
void isHashCodeNotEqualToDifferentKeyMap(BlockVector3 vec, BlockVector3 nonMatch) {
|
||||
assumeFalse(vec.hashCode() == nonMatch.hashCode(),
|
||||
"Vectors have equivalent hashCodes, maps will too.");
|
||||
map.put(vec, air);
|
||||
assertNotEquals(ImmutableMap.of(nonMatch, air).hashCode(), map.hashCode());
|
||||
void isHashCodeNotEqualToDifferentKeyMap() {
|
||||
generator.makePairedVectorsStream().forEach(pair -> {
|
||||
BlockVector3 vec = pair.first;
|
||||
BlockVector3 nonMatch = pair.second;
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
assumeFalse(vec.hashCode() == nonMatch.hashCode(),
|
||||
"Vectors have equivalent hashCodes, maps will too.");
|
||||
map.put(vec, air);
|
||||
assertNotEquals(ImmutableMap.of(nonMatch, air).hashCode(), map.hashCode());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("has a different hashCode from another map with a different value")
|
||||
void isHashCodeNotEqualToDifferentValueMap(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertNotEquals(ImmutableMap.of(vec, oakWood).hashCode(), map.hashCode());
|
||||
void isHashCodeNotEqualToDifferentValueMap() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertNotEquals(ImmutableMap.of(vec, oakWood).hashCode(), map.hashCode());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("has a different hashCode from an empty map")
|
||||
void isHashCodeNotEqualToEmptyMap(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertNotEquals(ImmutableMap.of().hashCode(), map.hashCode());
|
||||
void isHashCodeNotEqualToEmptyMap() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertNotEquals(ImmutableMap.of().hashCode(), map.hashCode());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("returns value from get")
|
||||
void returnsValueFromGet(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertEquals(air, map.get(vec));
|
||||
void returnsValueFromGet() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertEquals(air, map.get(vec));
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test(provideNonMatching = true)
|
||||
@Test
|
||||
@DisplayName("returns `null` from get with different key")
|
||||
void returnsValueFromGet(BlockVector3 vec, BlockVector3 nonMatch) {
|
||||
map.put(vec, air);
|
||||
assertNotEquals(air, map.get(nonMatch));
|
||||
void returnsValueFromGetDifferentKey() {
|
||||
generator.makePairedVectorsStream().forEach(pair -> {
|
||||
BlockVector3 vec = pair.first;
|
||||
BlockVector3 nonMatch = pair.second;
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertNotEquals(air, map.get(nonMatch));
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("contains the key")
|
||||
void containsTheKey(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertEquals(1, map.keySet().size());
|
||||
assertTrue(map.keySet().contains(vec));
|
||||
assertTrue(map.containsKey(vec));
|
||||
void containsTheKey() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertEquals(1, map.keySet().size());
|
||||
assertTrue(map.keySet().contains(vec));
|
||||
assertTrue(map.containsKey(vec));
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("contains the value")
|
||||
void containsTheValue(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertEquals(1, map.values().size());
|
||||
assertTrue(map.values().contains(air));
|
||||
assertTrue(map.containsValue(air));
|
||||
void containsTheValue() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertEquals(1, map.values().size());
|
||||
assertTrue(map.values().contains(air));
|
||||
assertTrue(map.containsValue(air));
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("contains the entry")
|
||||
void containsTheEntry(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertEquals(1, map.entrySet().size());
|
||||
assertEquals(new AbstractMap.SimpleImmutableEntry<>(vec, air), map.entrySet().iterator().next());
|
||||
void containsTheEntry() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertEquals(1, map.entrySet().size());
|
||||
assertEquals(new AbstractMap.SimpleImmutableEntry<>(vec, air), map.entrySet().iterator().next());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("returns the provided value from getOrDefault")
|
||||
void returnsProvidedFromGetOrDefault(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertEquals(air, map.getOrDefault(vec, oakWood));
|
||||
void returnsProvidedFromGetOrDefault() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertEquals(air, map.getOrDefault(vec, oakWood));
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test(provideNonMatching = true)
|
||||
@Test
|
||||
@DisplayName("returns the default value from getOrDefault with a different key")
|
||||
void returnsDefaultFromGetOrDefaultWrongKey(BlockVector3 vec, BlockVector3 nonMatch) {
|
||||
map.put(vec, air);
|
||||
assertEquals(oakWood, map.getOrDefault(nonMatch, oakWood));
|
||||
void returnsDefaultFromGetOrDefaultWrongKey() {
|
||||
generator.makePairedVectorsStream().forEach(pair -> {
|
||||
BlockVector3 vec = pair.first;
|
||||
BlockVector3 nonMatch = pair.second;
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertEquals(oakWood, map.getOrDefault(nonMatch, oakWood));
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("calls the forEach action once")
|
||||
void neverCallsForEachAction(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
map.forEach(biConsumer);
|
||||
verify(biConsumer).accept(vec, air);
|
||||
verifyNoMoreInteractions(biConsumer);
|
||||
void neverCallsForEachAction() {
|
||||
generator.makeVectorsStream().sequential().forEach(vec -> {
|
||||
try (AutoCloseable ignored = MockitoAnnotations.openMocks(this)) {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
map.forEach(biConsumer);
|
||||
verify(biConsumer).accept(vec, air);
|
||||
verifyNoMoreInteractions(biConsumer);
|
||||
} catch (Exception e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("replaces value using replaceAll")
|
||||
void neverCallsReplaceAllFunction(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
map.replaceAll((v, b) -> oakWood);
|
||||
assertEquals(oakWood, map.get(vec));
|
||||
void neverCallsReplaceAllFunction() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
map.replaceAll((v, b) -> oakWood);
|
||||
assertEquals(oakWood, map.get(vec));
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("does not insert on `putIfAbsent`")
|
||||
void noInsertOnPutIfAbsent(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertEquals(air, map.putIfAbsent(vec, oakWood));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(air, map.get(vec));
|
||||
void noInsertOnPutIfAbsent() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertEquals(air, map.putIfAbsent(vec, oakWood));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(air, map.get(vec));
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test(provideNonMatching = true)
|
||||
@Test
|
||||
@DisplayName("inserts on `putIfAbsent` to a different key")
|
||||
void insertOnPutIfAbsentDifferentKey(BlockVector3 vec, BlockVector3 nonMatch) {
|
||||
map.put(vec, air);
|
||||
assertNull(map.putIfAbsent(nonMatch, oakWood));
|
||||
assertEquals(2, map.size());
|
||||
assertEquals(air, map.get(vec));
|
||||
assertEquals(oakWood, map.get(nonMatch));
|
||||
void insertOnPutIfAbsentDifferentKey() {
|
||||
generator.makePairedVectorsStream().forEach(pair -> {
|
||||
BlockVector3 vec = pair.first;
|
||||
BlockVector3 nonMatch = pair.second;
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertNull(map.putIfAbsent(nonMatch, oakWood));
|
||||
assertEquals(2, map.size());
|
||||
assertEquals(air, map.get(vec));
|
||||
assertEquals(oakWood, map.get(nonMatch));
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("remove(key) returns the old value")
|
||||
void removeKeyReturnsOldValue(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertEquals(air, map.remove(vec));
|
||||
assertEquals(0, map.size());
|
||||
void removeKeyReturnsOldValue() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertEquals(air, map.remove(vec));
|
||||
assertEquals(0, map.size());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("keySet().remove(key) removes the entry from the map")
|
||||
void keySetRemovePassesThrough(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertTrue(map.keySet().remove(vec));
|
||||
assertEquals(0, map.size());
|
||||
void keySetRemovePassesThrough() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertTrue(map.keySet().remove(vec));
|
||||
assertEquals(0, map.size());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("entrySet().iterator().remove() removes the entry from the map")
|
||||
void entrySetIteratorRemovePassesThrough(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
Iterator<Map.Entry<BlockVector3, BaseBlock>> iterator = map.entrySet().iterator();
|
||||
assertTrue(iterator.hasNext());
|
||||
Map.Entry<BlockVector3, BaseBlock> entry = iterator.next();
|
||||
assertEquals(entry.getKey(), vec);
|
||||
iterator.remove();
|
||||
assertEquals(0, map.size());
|
||||
void entrySetIteratorRemovePassesThrough() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
Iterator<Map.Entry<BlockVector3, BaseBlock>> iterator = map.entrySet().iterator();
|
||||
assertTrue(iterator.hasNext());
|
||||
Map.Entry<BlockVector3, BaseBlock> entry = iterator.next();
|
||||
assertEquals(entry.getKey(), vec);
|
||||
iterator.remove();
|
||||
assertEquals(0, map.size());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test(provideNonMatching = true)
|
||||
@Test
|
||||
@DisplayName("remove(nonMatch) returns null")
|
||||
void removeNonMatchingKeyReturnsNull(BlockVector3 vec, BlockVector3 nonMatch) {
|
||||
map.put(vec, air);
|
||||
assertNull(map.remove(nonMatch));
|
||||
assertEquals(1, map.size());
|
||||
void removeNonMatchingKeyReturnsNull() {
|
||||
generator.makePairedVectorsStream().forEach(pair -> {
|
||||
BlockVector3 vec = pair.first;
|
||||
BlockVector3 nonMatch = pair.second;
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertNull(map.remove(nonMatch));
|
||||
assertEquals(1, map.size());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("remove(key, value) returns true")
|
||||
void removeKeyValueReturnsTrue(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertTrue(map.remove(vec, air));
|
||||
assertEquals(0, map.size());
|
||||
void removeKeyValueReturnsTrue() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertTrue(map.remove(vec, air));
|
||||
assertEquals(0, map.size());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("remove(key, value) returns false for wrong value")
|
||||
void removeKeyValueReturnsFalseWrongValue(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertFalse(map.remove(vec, oakWood));
|
||||
assertEquals(1, map.size());
|
||||
void removeKeyValueReturnsFalseWrongValue() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertFalse(map.remove(vec, oakWood));
|
||||
assertEquals(1, map.size());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("replaces value at key")
|
||||
void replacesValueAtKey(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
void replacesValueAtKey() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
|
||||
assertEquals(air, map.replace(vec, oakWood));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(oakWood, map.get(vec));
|
||||
assertEquals(air, map.replace(vec, oakWood));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(oakWood, map.get(vec));
|
||||
|
||||
assertTrue(map.replace(vec, oakWood, air));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(air, map.get(vec));
|
||||
assertTrue(map.replace(vec, oakWood, air));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(air, map.get(vec));
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test(provideNonMatching = true)
|
||||
@Test
|
||||
@DisplayName("does not replace value at different key")
|
||||
void doesNotReplaceAtDifferentKey(BlockVector3 vec, BlockVector3 nonMatch) {
|
||||
map.put(vec, air);
|
||||
void doesNotReplaceAtDifferentKey() {
|
||||
generator.makePairedVectorsStream().forEach(pair -> {
|
||||
BlockVector3 vec = pair.first;
|
||||
BlockVector3 nonMatch = pair.second;
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
|
||||
assertNull(map.replace(nonMatch, oakWood));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(air, map.get(vec));
|
||||
assertNull(map.replace(nonMatch, oakWood));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(air, map.get(vec));
|
||||
|
||||
assertFalse(map.replace(nonMatch, air, oakWood));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(air, map.get(vec));
|
||||
assertFalse(map.replace(nonMatch, air, oakWood));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(air, map.get(vec));
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("does not insert on computeIfAbsent")
|
||||
void doesNotInsertComputeIfAbsent(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertEquals(air, map.computeIfAbsent(vec, k -> {
|
||||
assertEquals(vec, k);
|
||||
return oakWood;
|
||||
}));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(air, map.get(vec));
|
||||
void doesNotInsertComputeIfAbsent() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertEquals(air, map.computeIfAbsent(vec, k -> {
|
||||
assertEquals(vec, k);
|
||||
return oakWood;
|
||||
}));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(air, map.get(vec));
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test(provideNonMatching = true)
|
||||
@Test
|
||||
@DisplayName("inserts on computeIfAbsent with different key")
|
||||
void insertsOnComputeIfAbsentDifferentKey(BlockVector3 vec, BlockVector3 nonMatch) {
|
||||
map.put(vec, air);
|
||||
assertEquals(oakWood, map.computeIfAbsent(nonMatch, k -> {
|
||||
assertEquals(nonMatch, k);
|
||||
return oakWood;
|
||||
}));
|
||||
assertEquals(2, map.size());
|
||||
assertEquals(air, map.get(vec));
|
||||
assertEquals(oakWood, map.get(nonMatch));
|
||||
void insertsOnComputeIfAbsentDifferentKey() {
|
||||
generator.makePairedVectorsStream().forEach(pair -> {
|
||||
BlockVector3 vec = pair.first;
|
||||
BlockVector3 nonMatch = pair.second;
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertEquals(oakWood, map.computeIfAbsent(nonMatch, k -> {
|
||||
assertEquals(nonMatch, k);
|
||||
return oakWood;
|
||||
}));
|
||||
assertEquals(2, map.size());
|
||||
assertEquals(air, map.get(vec));
|
||||
assertEquals(oakWood, map.get(nonMatch));
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("replaces on compute")
|
||||
void replaceOnCompute(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertEquals(oakWood, map.compute(vec, (k, v) -> {
|
||||
assertEquals(vec, k);
|
||||
assertEquals(air, v);
|
||||
return oakWood;
|
||||
}));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(oakWood, map.get(vec));
|
||||
assertNull(map.compute(vec, (k, v) -> null));
|
||||
assertEquals(0, map.size());
|
||||
void replaceOnCompute() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertEquals(oakWood, map.compute(vec, (k, v) -> {
|
||||
assertEquals(vec, k);
|
||||
assertEquals(air, v);
|
||||
return oakWood;
|
||||
}));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(oakWood, map.get(vec));
|
||||
assertNull(map.compute(vec, (k, v) -> null));
|
||||
assertEquals(0, map.size());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test(provideNonMatching = true)
|
||||
@Test
|
||||
@DisplayName("inserts on compute with different key")
|
||||
void insertOnComputeDifferentKey(BlockVector3 vec, BlockVector3 nonMatch) {
|
||||
map.put(vec, air);
|
||||
assertEquals(oakWood, map.compute(nonMatch, (k, v) -> {
|
||||
assertEquals(nonMatch, k);
|
||||
assertNull(v);
|
||||
return oakWood;
|
||||
}));
|
||||
assertEquals(2, map.size());
|
||||
assertEquals(air, map.get(vec));
|
||||
assertEquals(oakWood, map.get(nonMatch));
|
||||
assertNull(map.compute(nonMatch, (k, v) -> null));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(air, map.get(vec));
|
||||
void insertOnComputeDifferentKey() {
|
||||
generator.makePairedVectorsStream().forEach(pair -> {
|
||||
BlockVector3 vec = pair.first;
|
||||
BlockVector3 nonMatch = pair.second;
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertEquals(oakWood, map.compute(nonMatch, (k, v) -> {
|
||||
assertEquals(nonMatch, k);
|
||||
assertNull(v);
|
||||
return oakWood;
|
||||
}));
|
||||
assertEquals(2, map.size());
|
||||
assertEquals(air, map.get(vec));
|
||||
assertEquals(oakWood, map.get(nonMatch));
|
||||
assertNull(map.compute(nonMatch, (k, v) -> null));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(air, map.get(vec));
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("replaces on computeIfPresent")
|
||||
void replacesOnComputeIfPresent(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertEquals(oakWood, map.computeIfPresent(vec, (k, v) -> {
|
||||
assertEquals(vec, k);
|
||||
assertEquals(air, v);
|
||||
return oakWood;
|
||||
}));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(oakWood, map.get(vec));
|
||||
assertNull(map.computeIfPresent(vec, (k, v) -> null));
|
||||
assertEquals(0, map.size());
|
||||
void replacesOnComputeIfPresent() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertEquals(oakWood, map.computeIfPresent(vec, (k, v) -> {
|
||||
assertEquals(vec, k);
|
||||
assertEquals(air, v);
|
||||
return oakWood;
|
||||
}));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(oakWood, map.get(vec));
|
||||
assertNull(map.computeIfPresent(vec, (k, v) -> null));
|
||||
assertEquals(0, map.size());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test
|
||||
@Test
|
||||
@DisplayName("inserts on merge, with call to merge function")
|
||||
void insertsOnMerge(BlockVector3 vec) {
|
||||
map.put(vec, air);
|
||||
assertEquals(oakWood, map.merge(vec, oakWood, (o, n) -> {
|
||||
assertEquals(air, o);
|
||||
assertEquals(oakWood, n);
|
||||
return n;
|
||||
}));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(oakWood, map.get(vec));
|
||||
void insertsOnMerge() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
map.put(vec, air);
|
||||
assertEquals(oakWood, map.merge(vec, oakWood, (o, n) -> {
|
||||
assertEquals(air, o);
|
||||
assertEquals(oakWood, n);
|
||||
return n;
|
||||
}));
|
||||
assertEquals(1, map.size());
|
||||
assertEquals(oakWood, map.get(vec));
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@ -589,6 +745,7 @@ class BlockMapTest {
|
||||
@Test
|
||||
@DisplayName("contains all inserted vectors")
|
||||
void containsAllInsertedVectors() {
|
||||
BlockMap<BaseBlock> map = BlockMap.createForBaseBlock();
|
||||
Set<BlockVector3> allVectors = new VariedVectorGenerator()
|
||||
.makeVectorsStream()
|
||||
.collect(Collectors.toSet());
|
||||
|
@ -19,9 +19,9 @@
|
||||
|
||||
package com.sk89q.worldedit.util.collection;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.util.test.VariedVectors;
|
||||
import com.sk89q.worldedit.util.test.VariedVectorGenerator;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
@ -29,70 +29,91 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
abstract class PositionListTest {
|
||||
|
||||
static class Long extends PositionListTest {
|
||||
protected Long() {
|
||||
super(new LongPositionList());
|
||||
@Override
|
||||
protected PositionList createPositionList() {
|
||||
return new LongPositionList();
|
||||
}
|
||||
}
|
||||
|
||||
static class Vector extends PositionListTest {
|
||||
protected Vector() {
|
||||
super(new VectorPositionList());
|
||||
@Override
|
||||
protected PositionList createPositionList() {
|
||||
return new VectorPositionList();
|
||||
}
|
||||
}
|
||||
|
||||
private final PositionList positionList;
|
||||
private final VariedVectorGenerator generator = new VariedVectorGenerator(true);
|
||||
|
||||
protected PositionListTest(PositionList positionList) {
|
||||
this.positionList = positionList;
|
||||
}
|
||||
protected abstract PositionList createPositionList();
|
||||
|
||||
@VariedVectors.Test(capToVanilla = true)
|
||||
@Test
|
||||
@DisplayName("calling add(vec) increases size by 1")
|
||||
void addIncreasesSizeByOne(BlockVector3 vec) {
|
||||
positionList.add(vec);
|
||||
assertEquals(1, positionList.size());
|
||||
void addIncreasesSizeByOne() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
PositionList positionList = createPositionList();
|
||||
positionList.add(vec);
|
||||
assertEquals(1, positionList.size());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test(capToVanilla = true)
|
||||
@Test
|
||||
@DisplayName("calling get(0) after add(vec) returns vec")
|
||||
void canGetVectorAfterAdd(BlockVector3 vec) {
|
||||
positionList.add(vec);
|
||||
assertEquals(vec, positionList.get(0));
|
||||
void canGetVectorAfterAdd() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
PositionList positionList = createPositionList();
|
||||
positionList.add(vec);
|
||||
assertEquals(vec, positionList.get(0));
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test(capToVanilla = true)
|
||||
@Test
|
||||
@DisplayName("calling iterator().hasNext() after add(vec) returns true")
|
||||
void hasNextAfterAdd(BlockVector3 vec) {
|
||||
positionList.add(vec);
|
||||
assertTrue(positionList.iterator().hasNext());
|
||||
void hasNextAfterAdd() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
PositionList positionList = createPositionList();
|
||||
positionList.add(vec);
|
||||
assertTrue(positionList.iterator().hasNext());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test(capToVanilla = true)
|
||||
@Test
|
||||
@DisplayName("calling iterator().next() after add(vec) returns vec")
|
||||
void nextAfterAdd(BlockVector3 vec) {
|
||||
positionList.add(vec);
|
||||
assertEquals(vec, positionList.iterator().next());
|
||||
void nextAfterAdd() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
PositionList positionList = createPositionList();
|
||||
positionList.add(vec);
|
||||
assertEquals(vec, positionList.iterator().next());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test(capToVanilla = true)
|
||||
@Test
|
||||
@DisplayName("calling reverseIterator().hasNext() after add(vec) returns true")
|
||||
void reverseHasNextAfterAdd(BlockVector3 vec) {
|
||||
positionList.add(vec);
|
||||
assertTrue(positionList.reverseIterator().hasNext());
|
||||
void reverseHasNextAfterAdd() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
PositionList positionList = createPositionList();
|
||||
positionList.add(vec);
|
||||
assertTrue(positionList.reverseIterator().hasNext());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test(capToVanilla = true)
|
||||
@Test
|
||||
@DisplayName("calling reverseIterator().next() after add(vec) returns vec")
|
||||
void reverseNextAfterAdd(BlockVector3 vec) {
|
||||
positionList.add(vec);
|
||||
assertEquals(vec, positionList.reverseIterator().next());
|
||||
void reverseNextAfterAdd() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
PositionList positionList = createPositionList();
|
||||
positionList.add(vec);
|
||||
assertEquals(vec, positionList.reverseIterator().next());
|
||||
});
|
||||
}
|
||||
|
||||
@VariedVectors.Test(capToVanilla = true)
|
||||
@Test
|
||||
@DisplayName("calling clear() after add(vec) makes the size() zero")
|
||||
void clearAfterAdd(BlockVector3 vec) {
|
||||
positionList.add(vec);
|
||||
positionList.clear();
|
||||
assertEquals(0, positionList.size());
|
||||
void clearAfterAdd() {
|
||||
generator.makeVectorsStream().forEach(vec -> {
|
||||
PositionList positionList = createPositionList();
|
||||
positionList.add(vec);
|
||||
positionList.clear();
|
||||
assertEquals(0, positionList.size());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.util.test;
|
||||
|
||||
public class ResourceLockKeys {
|
||||
public static final String WORLDEDIT_PLATFORM = "WORLDEDIT_PLATFORM";
|
||||
|
||||
private ResourceLockKeys() {
|
||||
}
|
||||
}
|
@ -30,12 +30,10 @@ import java.util.stream.Stream;
|
||||
|
||||
public class VariedVectorGenerator {
|
||||
|
||||
// For better coverage assurance, increase these values for a local Gradle run.
|
||||
// Don't do it for IntelliJ, it'll probably run out of memory.
|
||||
private static final int DEFAULT_DIVISIONS_XZ =
|
||||
Integer.getInteger("variedvecs.divisions.xz", 2);
|
||||
Integer.getInteger("variedvecs.divisions.xz", 10);
|
||||
private static final int DEFAULT_DIVISIONS_Y =
|
||||
Integer.getInteger("variedvecs.divisions.y", 2);
|
||||
Integer.getInteger("variedvecs.divisions.y", 10);
|
||||
|
||||
public final int divisionsXZ;
|
||||
public final int divisionsY;
|
||||
@ -46,20 +44,24 @@ public class VariedVectorGenerator {
|
||||
public final Set<BlockVector3> alwaysInclude;
|
||||
|
||||
public VariedVectorGenerator() {
|
||||
this(false, -1, -1);
|
||||
this(false);
|
||||
}
|
||||
|
||||
public VariedVectorGenerator(boolean vanilla) {
|
||||
this(vanilla, -1, -1);
|
||||
}
|
||||
|
||||
public VariedVectorGenerator(boolean vanilla, int divisionsXZ, int divisionsY) {
|
||||
this.divisionsXZ = divisionsXZ == -1 ? DEFAULT_DIVISIONS_XZ : divisionsXZ;
|
||||
this.divisionsY = divisionsY == -1 ? DEFAULT_DIVISIONS_Y : divisionsY;
|
||||
maxXZ = 30_000_000;
|
||||
maxY = vanilla ? 255 : Integer.MAX_VALUE;
|
||||
maxY = vanilla ? 2047 : Integer.MAX_VALUE;
|
||||
xzStep = (maxXZ * 2) / this.divisionsXZ;
|
||||
yStep = (maxY * 2) / this.divisionsY;
|
||||
alwaysInclude =
|
||||
ImmutableSet.of(BlockVector3.ZERO, BlockVector3.ONE,
|
||||
BlockVector3.at(-maxXZ, 0, -maxXZ),
|
||||
BlockVector3.at(maxXZ, 0, maxXZ),
|
||||
BlockVector3.at(-maxXZ, -maxY - 1, -maxXZ),
|
||||
BlockVector3.at(maxXZ, -maxY - 1, maxXZ),
|
||||
BlockVector3.at(-maxXZ, maxY, -maxXZ),
|
||||
BlockVector3.at(maxXZ, maxY, maxXZ));
|
||||
}
|
||||
@ -68,7 +70,16 @@ public class VariedVectorGenerator {
|
||||
return Stream.concat(
|
||||
alwaysInclude.stream(),
|
||||
Streams.stream(generateVectors()).filter(v -> !alwaysInclude.contains(v))
|
||||
);
|
||||
).parallel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gives two vectors from {@link #makeVectorsStream()} that aren't the same.
|
||||
*/
|
||||
public Stream<VariedVectorPair> makePairedVectorsStream() {
|
||||
return makeVectorsStream()
|
||||
.flatMap(vec -> makeVectorsStream().filter(v -> !v.equals(vec))
|
||||
.map(v -> new VariedVectorPair(vec, v)));
|
||||
}
|
||||
|
||||
private Iterator<BlockVector3> generateVectors() {
|
||||
@ -86,7 +97,7 @@ public class VariedVectorGenerator {
|
||||
BlockVector3 newVector = BlockVector3.at(x, (int) y, z);
|
||||
y += yStep;
|
||||
if (y > maxY) {
|
||||
y = 0;
|
||||
y = -maxY - 1;
|
||||
z += xzStep;
|
||||
if (z > maxXZ) {
|
||||
z = -maxXZ;
|
||||
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.util.test;
|
||||
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
|
||||
public class VariedVectorPair {
|
||||
public final BlockVector3 first;
|
||||
public final BlockVector3 second;
|
||||
|
||||
public VariedVectorPair(BlockVector3 first, BlockVector3 second) {
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
/*
|
||||
* WorldEdit, a Minecraft world manipulation toolkit
|
||||
* Copyright (C) sk89q <http://www.sk89q.com>
|
||||
* Copyright (C) WorldEdit team and contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.sk89q.worldedit.util.test;
|
||||
|
||||
import org.junit.jupiter.api.extension.ExtensionContext;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.Arguments;
|
||||
import org.junit.jupiter.params.provider.ArgumentsProvider;
|
||||
import org.junit.jupiter.params.provider.ArgumentsSource;
|
||||
import org.junit.jupiter.params.support.AnnotationConsumer;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* Argument provider for various vectors.
|
||||
*/
|
||||
public final class VariedVectors implements ArgumentsProvider, AnnotationConsumer<VariedVectors.Test> {
|
||||
|
||||
@Target({ ElementType.ANNOTATION_TYPE, ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@ArgumentsSource(VariedVectors.class)
|
||||
@ParameterizedTest(name = ParameterizedTest.ARGUMENTS_PLACEHOLDER)
|
||||
public @interface Test {
|
||||
|
||||
/**
|
||||
* If {@code true}, provide a non-matching vector from
|
||||
* the existing vectors set as well. This will nearly
|
||||
* square the number of tests executed, since it will
|
||||
* test <em>every</em> non-matching vector.
|
||||
*/
|
||||
boolean provideNonMatching() default false;
|
||||
|
||||
/**
|
||||
* If {@code true}, only provide vectors inside the range of Vanilla MC.
|
||||
* This caps the Y value to 255.
|
||||
*/
|
||||
boolean capToVanilla() default false;
|
||||
|
||||
int divisionsXZ() default -1;
|
||||
|
||||
int divisionsY() default -1;
|
||||
|
||||
}
|
||||
|
||||
private boolean provideNonMatching;
|
||||
private VariedVectorGenerator generator;
|
||||
|
||||
@Override
|
||||
public void accept(Test test) {
|
||||
provideNonMatching = test.provideNonMatching();
|
||||
generator = new VariedVectorGenerator(test.capToVanilla(), test.divisionsXZ(), test.divisionsY());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<? extends Arguments> provideArguments(ExtensionContext context) {
|
||||
if (provideNonMatching) {
|
||||
return generator.makeVectorsStream()
|
||||
.flatMap(vec -> generator.makeVectorsStream().filter(v -> !v.equals(vec))
|
||||
.map(v -> Arguments.of(vec, v)));
|
||||
}
|
||||
return generator.makeVectorsStream().map(Arguments::of);
|
||||
}
|
||||
|
||||
}
|
@ -2,4 +2,4 @@ junit.jupiter.execution.parallel.enabled=true
|
||||
junit.jupiter.execution.parallel.mode.default=concurrent
|
||||
junit.jupiter.execution.parallel.mode.classes.default=same_thread
|
||||
junit.jupiter.execution.parallel.config.strategy=dynamic
|
||||
junit.jupiter.execution.parallel.config.dynamic.factor=1
|
||||
junit.jupiter.execution.parallel.config.dynamic.factor=4
|
||||
|
@ -25,10 +25,9 @@ configure<LoomGradleExtension> {
|
||||
accessWidener("src/main/resources/worldedit.accesswidener")
|
||||
}
|
||||
|
||||
val minecraftVersion = "1.16.4"
|
||||
val yarnMappings = "1.16.4+build.7:v2"
|
||||
val loaderVersion = "0.10.8"
|
||||
val fabricApiVersion = "0.29.3+1.16"
|
||||
val minecraftVersion = "1.17"
|
||||
val yarnMappings = "1.17+build.1:v2"
|
||||
val loaderVersion = "0.11.3"
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
@ -47,8 +46,8 @@ repositories {
|
||||
|
||||
dependencies {
|
||||
"api"(project(":worldedit-core"))
|
||||
"implementation"(enforcedPlatform("org.apache.logging.log4j:log4j-bom:2.8.1") {
|
||||
because("Mojang provides Log4J at 2.8.1")
|
||||
"implementation"(platform("org.apache.logging.log4j:log4j-bom:2.14.1") {
|
||||
because("Mojang provides Log4J at 2.14.1")
|
||||
})
|
||||
|
||||
"minecraft"("com.mojang:minecraft:$minecraftVersion")
|
||||
@ -56,7 +55,7 @@ dependencies {
|
||||
"modImplementation"("net.fabricmc:fabric-loader:$loaderVersion")
|
||||
|
||||
// [1] declare fabric-api dependency...
|
||||
"fabricApi"("net.fabricmc.fabric-api:fabric-api:$fabricApiVersion")
|
||||
"fabricApi"("net.fabricmc.fabric-api:fabric-api:0.34.9+1.17")
|
||||
|
||||
// [2] Load the API dependencies from the fabric mod json...
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
@ -117,6 +116,12 @@ configure<BasePluginConvention> {
|
||||
configure<PublishingExtension> {
|
||||
publications.named<MavenPublication>("maven") {
|
||||
artifactId = the<BasePluginConvention>().archivesBaseName
|
||||
artifact(tasks.named("jar")) {
|
||||
builtBy(tasks.named("remapJar"))
|
||||
}
|
||||
artifact(tasks.named("sourcesJar")) {
|
||||
builtBy(tasks.named("remapSourcesJar"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -139,31 +144,6 @@ tasks.named<ShadowJar>("shadowJar") {
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register<Jar>("deobfJar") {
|
||||
from(sourceSets["main"].output)
|
||||
archiveClassifier.set("dev")
|
||||
}
|
||||
|
||||
val deobfElements = configurations.register("deobfElements") {
|
||||
isVisible = false
|
||||
description = "De-obfuscated elements for libs"
|
||||
isCanBeResolved = false
|
||||
isCanBeConsumed = true
|
||||
attributes {
|
||||
attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage.JAVA_API))
|
||||
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category.LIBRARY))
|
||||
attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling.EXTERNAL))
|
||||
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements.JAR))
|
||||
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 8)
|
||||
}
|
||||
outgoing.artifact(tasks.named("deobfJar"))
|
||||
}
|
||||
|
||||
val javaComponent = components["java"] as AdhocComponentWithVariants
|
||||
javaComponent.addVariantsFromConfiguration(deobfElements.get()) {
|
||||
mapToMavenScope("runtime")
|
||||
}
|
||||
|
||||
tasks.register<RemapJarTask>("remapShadowJar") {
|
||||
val shadowJar = tasks.getByName<ShadowJar>("shadowJar")
|
||||
dependsOn(shadowJar)
|
||||
|
@ -26,10 +26,6 @@ import com.sk89q.worldedit.fabric.internal.NBTConverter;
|
||||
import com.sk89q.worldedit.internal.block.BlockStateIdAccess;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.math.Vector3;
|
||||
import com.sk89q.worldedit.registry.state.BooleanProperty;
|
||||
import com.sk89q.worldedit.registry.state.DirectionalProperty;
|
||||
import com.sk89q.worldedit.registry.state.EnumProperty;
|
||||
import com.sk89q.worldedit.registry.state.IntegerProperty;
|
||||
import com.sk89q.worldedit.registry.state.Property;
|
||||
import com.sk89q.worldedit.util.Direction;
|
||||
import com.sk89q.worldedit.util.concurrency.LazyReference;
|
||||
@ -46,8 +42,7 @@ import com.sk89q.worldedit.world.item.ItemTypes;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.nbt.NbtElement;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.state.property.DirectionProperty;
|
||||
@ -62,23 +57,12 @@ import java.util.Comparator;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.TreeMap;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
public final class FabricAdapter {
|
||||
|
||||
private static @Nullable MinecraftServer server;
|
||||
|
||||
private static MinecraftServer requireServer() {
|
||||
return Objects.requireNonNull(server, "No server injected");
|
||||
}
|
||||
|
||||
static void setServer(@Nullable MinecraftServer server) {
|
||||
FabricAdapter.server = server;
|
||||
}
|
||||
|
||||
private FabricAdapter() {
|
||||
}
|
||||
|
||||
@ -87,14 +71,15 @@ public final class FabricAdapter {
|
||||
}
|
||||
|
||||
public static Biome adapt(BiomeType biomeType) {
|
||||
return requireServer()
|
||||
return FabricWorldEdit.LIFECYCLED_SERVER.valueOrThrow()
|
||||
.getRegistryManager()
|
||||
.get(Registry.BIOME_KEY)
|
||||
.get(new Identifier(biomeType.getId()));
|
||||
}
|
||||
|
||||
public static BiomeType adapt(Biome biome) {
|
||||
Identifier id = requireServer().getRegistryManager().get(Registry.BIOME_KEY).getId(biome);
|
||||
Identifier id = FabricWorldEdit.LIFECYCLED_SERVER.valueOrThrow().getRegistryManager()
|
||||
.get(Registry.BIOME_KEY).getId(biome);
|
||||
Objects.requireNonNull(id, "biome is not registered");
|
||||
return BiomeTypes.get(id.toString());
|
||||
}
|
||||
@ -206,7 +191,7 @@ public final class FabricAdapter {
|
||||
}
|
||||
|
||||
public static ItemStack adapt(BaseItemStack baseItemStack) {
|
||||
net.minecraft.nbt.CompoundTag fabricCompound = null;
|
||||
net.minecraft.nbt.NbtCompound fabricCompound = null;
|
||||
if (baseItemStack.getNbt() != null) {
|
||||
fabricCompound = NBTConverter.toNative(baseItemStack.getNbt());
|
||||
}
|
||||
@ -216,18 +201,18 @@ public final class FabricAdapter {
|
||||
}
|
||||
|
||||
public static BaseItemStack adapt(ItemStack itemStack) {
|
||||
CompoundTag tag = itemStack.toTag(new CompoundTag());
|
||||
net.minecraft.nbt.NbtCompound tag = itemStack.writeNbt(new net.minecraft.nbt.NbtCompound());
|
||||
if (tag.isEmpty()) {
|
||||
tag = null;
|
||||
} else {
|
||||
final Tag tagTag = tag.get("tag");
|
||||
if (tagTag instanceof CompoundTag) {
|
||||
tag = ((CompoundTag) tagTag);
|
||||
final NbtElement tagTag = tag.get("tag");
|
||||
if (tagTag instanceof net.minecraft.nbt.NbtCompound) {
|
||||
tag = ((net.minecraft.nbt.NbtCompound) tagTag);
|
||||
} else {
|
||||
tag = null;
|
||||
}
|
||||
}
|
||||
CompoundTag finalTag = tag;
|
||||
net.minecraft.nbt.NbtCompound finalTag = tag;
|
||||
return new BaseItemStack(
|
||||
adapt(itemStack.getItem()),
|
||||
finalTag == null ? null : LazyReference.from(() -> NBTConverter.fromNative(finalTag)),
|
||||
|
@ -39,11 +39,11 @@ import com.sk89q.worldedit.fabric.internal.NBTConverter;
|
||||
import com.sk89q.worldedit.util.nbt.CompoundBinaryTag;
|
||||
import net.minecraft.datafixer.Schemas;
|
||||
import net.minecraft.datafixer.TypeReferences;
|
||||
import net.minecraft.nbt.FloatTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.NbtElement;
|
||||
import net.minecraft.nbt.NbtFloat;
|
||||
import net.minecraft.nbt.NbtList;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.nbt.NbtString;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.MutableText;
|
||||
import net.minecraft.text.Text;
|
||||
@ -108,50 +108,50 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
}
|
||||
|
||||
private CompoundBinaryTag fixChunk(CompoundBinaryTag originalChunk, int srcVer) {
|
||||
net.minecraft.nbt.CompoundTag tag = NBTConverter.toNative(originalChunk);
|
||||
net.minecraft.nbt.CompoundTag fixed = convert(LegacyType.CHUNK, tag, srcVer);
|
||||
net.minecraft.nbt.NbtCompound tag = NBTConverter.toNative(originalChunk);
|
||||
net.minecraft.nbt.NbtCompound fixed = convert(LegacyType.CHUNK, tag, srcVer);
|
||||
return NBTConverter.fromNative(fixed);
|
||||
}
|
||||
|
||||
private CompoundBinaryTag fixBlockEntity(CompoundBinaryTag origTileEnt, int srcVer) {
|
||||
net.minecraft.nbt.CompoundTag tag = NBTConverter.toNative(origTileEnt);
|
||||
net.minecraft.nbt.CompoundTag fixed = convert(LegacyType.BLOCK_ENTITY, tag, srcVer);
|
||||
net.minecraft.nbt.NbtCompound tag = NBTConverter.toNative(origTileEnt);
|
||||
net.minecraft.nbt.NbtCompound fixed = convert(LegacyType.BLOCK_ENTITY, tag, srcVer);
|
||||
return NBTConverter.fromNative(fixed);
|
||||
}
|
||||
|
||||
private CompoundBinaryTag fixEntity(CompoundBinaryTag origEnt, int srcVer) {
|
||||
net.minecraft.nbt.CompoundTag tag = NBTConverter.toNative(origEnt);
|
||||
net.minecraft.nbt.CompoundTag fixed = convert(LegacyType.ENTITY, tag, srcVer);
|
||||
net.minecraft.nbt.NbtCompound tag = NBTConverter.toNative(origEnt);
|
||||
net.minecraft.nbt.NbtCompound fixed = convert(LegacyType.ENTITY, tag, srcVer);
|
||||
return NBTConverter.fromNative(fixed);
|
||||
}
|
||||
|
||||
private String fixBlockState(String blockState, int srcVer) {
|
||||
net.minecraft.nbt.CompoundTag stateNBT = stateToNBT(blockState);
|
||||
Dynamic<Tag> dynamic = new Dynamic<>(OPS_NBT, stateNBT);
|
||||
net.minecraft.nbt.CompoundTag fixed = (net.minecraft.nbt.CompoundTag) INSTANCE.fixer.update(TypeReferences.BLOCK_STATE, dynamic, srcVer, DATA_VERSION).getValue();
|
||||
net.minecraft.nbt.NbtCompound stateNBT = stateToNBT(blockState);
|
||||
Dynamic<NbtElement> dynamic = new Dynamic<>(OPS_NBT, stateNBT);
|
||||
net.minecraft.nbt.NbtCompound fixed = (net.minecraft.nbt.NbtCompound) INSTANCE.fixer.update(TypeReferences.BLOCK_STATE, dynamic, srcVer, DATA_VERSION).getValue();
|
||||
return nbtToState(fixed);
|
||||
}
|
||||
|
||||
private String nbtToState(net.minecraft.nbt.CompoundTag tagCompound) {
|
||||
private String nbtToState(net.minecraft.nbt.NbtCompound tagCompound) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(tagCompound.getString("Name"));
|
||||
if (tagCompound.contains("Properties", 10)) {
|
||||
sb.append('[');
|
||||
net.minecraft.nbt.CompoundTag props = tagCompound.getCompound("Properties");
|
||||
net.minecraft.nbt.NbtCompound props = tagCompound.getCompound("Properties");
|
||||
sb.append(props.getKeys().stream().map(k -> k + "=" + props.getString(k).replace("\"", "")).collect(Collectors.joining(",")));
|
||||
sb.append(']');
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static net.minecraft.nbt.CompoundTag stateToNBT(String blockState) {
|
||||
private static net.minecraft.nbt.NbtCompound stateToNBT(String blockState) {
|
||||
int propIdx = blockState.indexOf('[');
|
||||
net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag();
|
||||
net.minecraft.nbt.NbtCompound tag = new net.minecraft.nbt.NbtCompound();
|
||||
if (propIdx < 0) {
|
||||
tag.putString("Name", blockState);
|
||||
} else {
|
||||
tag.putString("Name", blockState.substring(0, propIdx));
|
||||
net.minecraft.nbt.CompoundTag propTag = new net.minecraft.nbt.CompoundTag();
|
||||
net.minecraft.nbt.NbtCompound propTag = new net.minecraft.nbt.NbtCompound();
|
||||
String props = blockState.substring(propIdx + 1, blockState.length() - 1);
|
||||
String[] propArr = props.split(",");
|
||||
for (String pair : propArr) {
|
||||
@ -172,7 +172,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
}
|
||||
|
||||
private static String fixName(String key, int srcVer, TypeReference type) {
|
||||
return INSTANCE.fixer.update(type, new Dynamic<>(OPS_NBT, StringTag.of(key)), srcVer, DATA_VERSION)
|
||||
return INSTANCE.fixer.update(type, new Dynamic<>(OPS_NBT, NbtString.of(key)), srcVer, DATA_VERSION)
|
||||
.asString().result().orElse(key);
|
||||
}
|
||||
|
||||
@ -235,7 +235,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
public <T> Dynamic<T> update(TypeReference type, Dynamic<T> dynamic, int sourceVer, int targetVer) {
|
||||
LegacyType legacyType = DFU_TO_LEGACY.get(type.typeName());
|
||||
if (sourceVer < LEGACY_VERSION && legacyType != null) {
|
||||
net.minecraft.nbt.CompoundTag cmp = (net.minecraft.nbt.CompoundTag) dynamic.getValue();
|
||||
net.minecraft.nbt.NbtCompound cmp = (net.minecraft.nbt.NbtCompound) dynamic.getValue();
|
||||
int desiredVersion = Math.min(targetVer, LEGACY_VERSION);
|
||||
|
||||
cmp = convert(legacyType, cmp, sourceVer, desiredVersion);
|
||||
@ -245,7 +245,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return realFixer.update(type, dynamic, sourceVer, targetVer);
|
||||
}
|
||||
|
||||
private net.minecraft.nbt.CompoundTag convert(LegacyType type, net.minecraft.nbt.CompoundTag cmp, int sourceVer, int desiredVersion) {
|
||||
private net.minecraft.nbt.NbtCompound convert(LegacyType type, net.minecraft.nbt.NbtCompound cmp, int sourceVer, int desiredVersion) {
|
||||
List<DataConverter> converters = FabricDataFixer.this.converters.get(type);
|
||||
if (converters != null && !converters.isEmpty()) {
|
||||
for (DataConverter converter : converters) {
|
||||
@ -272,44 +272,44 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
}
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.CompoundTag convert(LegacyType type, net.minecraft.nbt.CompoundTag cmp) {
|
||||
public static net.minecraft.nbt.NbtCompound convert(LegacyType type, net.minecraft.nbt.NbtCompound cmp) {
|
||||
return convert(type.getDFUType(), cmp);
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.CompoundTag convert(LegacyType type, net.minecraft.nbt.CompoundTag cmp, int sourceVer) {
|
||||
public static net.minecraft.nbt.NbtCompound convert(LegacyType type, net.minecraft.nbt.NbtCompound cmp, int sourceVer) {
|
||||
return convert(type.getDFUType(), cmp, sourceVer);
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.CompoundTag convert(LegacyType type, net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) {
|
||||
public static net.minecraft.nbt.NbtCompound convert(LegacyType type, net.minecraft.nbt.NbtCompound cmp, int sourceVer, int targetVer) {
|
||||
return convert(type.getDFUType(), cmp, sourceVer, targetVer);
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.CompoundTag convert(TypeReference type, net.minecraft.nbt.CompoundTag cmp) {
|
||||
public static net.minecraft.nbt.NbtCompound convert(TypeReference type, net.minecraft.nbt.NbtCompound cmp) {
|
||||
int i = cmp.contains("DataVersion", 99) ? cmp.getInt("DataVersion") : -1;
|
||||
return convert(type, cmp, i);
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.CompoundTag convert(TypeReference type, net.minecraft.nbt.CompoundTag cmp, int sourceVer) {
|
||||
public static net.minecraft.nbt.NbtCompound convert(TypeReference type, net.minecraft.nbt.NbtCompound cmp, int sourceVer) {
|
||||
return convert(type, cmp, sourceVer, DATA_VERSION);
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.CompoundTag convert(TypeReference type, net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) {
|
||||
public static net.minecraft.nbt.NbtCompound convert(TypeReference type, net.minecraft.nbt.NbtCompound cmp, int sourceVer, int targetVer) {
|
||||
if (sourceVer >= targetVer) {
|
||||
return cmp;
|
||||
}
|
||||
return (net.minecraft.nbt.CompoundTag) INSTANCE.fixer.update(type, new Dynamic<>(OPS_NBT, cmp), sourceVer, targetVer).getValue();
|
||||
return (net.minecraft.nbt.NbtCompound) INSTANCE.fixer.update(type, new Dynamic<>(OPS_NBT, cmp), sourceVer, targetVer).getValue();
|
||||
}
|
||||
|
||||
|
||||
public interface DataInspector {
|
||||
net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer);
|
||||
net.minecraft.nbt.NbtCompound inspect(net.minecraft.nbt.NbtCompound cmp, int sourceVer, int targetVer);
|
||||
}
|
||||
|
||||
public interface DataConverter {
|
||||
|
||||
int getDataVersion();
|
||||
|
||||
net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp);
|
||||
net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp);
|
||||
}
|
||||
|
||||
|
||||
@ -587,19 +587,19 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return key;
|
||||
}
|
||||
|
||||
private static void convertCompound(LegacyType type, net.minecraft.nbt.CompoundTag cmp, String key, int sourceVer, int targetVer) {
|
||||
private static void convertCompound(LegacyType type, net.minecraft.nbt.NbtCompound cmp, String key, int sourceVer, int targetVer) {
|
||||
cmp.put(key, convert(type, cmp.getCompound(key), sourceVer, targetVer));
|
||||
}
|
||||
|
||||
private static void convertItem(net.minecraft.nbt.CompoundTag nbttagcompound, String key, int sourceVer, int targetVer) {
|
||||
private static void convertItem(net.minecraft.nbt.NbtCompound nbttagcompound, String key, int sourceVer, int targetVer) {
|
||||
if (nbttagcompound.contains(key, 10)) {
|
||||
convertCompound(LegacyType.ITEM_INSTANCE, nbttagcompound, key, sourceVer, targetVer);
|
||||
}
|
||||
}
|
||||
|
||||
private static void convertItems(net.minecraft.nbt.CompoundTag nbttagcompound, String key, int sourceVer, int targetVer) {
|
||||
private static void convertItems(net.minecraft.nbt.NbtCompound nbttagcompound, String key, int sourceVer, int targetVer) {
|
||||
if (nbttagcompound.contains(key, 9)) {
|
||||
ListTag nbttaglist = nbttagcompound.getList(key, 10);
|
||||
NbtList nbttaglist = nbttagcompound.getList(key, 10);
|
||||
|
||||
for (int j = 0; j < nbttaglist.size(); ++j) {
|
||||
nbttaglist.add(j, convert(LegacyType.ITEM_INSTANCE, nbttaglist.getCompound(j), sourceVer, targetVer));
|
||||
@ -619,19 +619,19 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
}
|
||||
|
||||
@Override
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
ListTag nbttaglist = cmp.getList("Equipment", 10);
|
||||
ListTag nbttaglist1;
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
NbtList nbttaglist = cmp.getList("Equipment", 10);
|
||||
NbtList nbttaglist1;
|
||||
|
||||
if (!nbttaglist.isEmpty() && !cmp.contains("HandItems", 10)) {
|
||||
nbttaglist1 = new ListTag();
|
||||
nbttaglist1 = new NbtList();
|
||||
nbttaglist1.add(nbttaglist.get(0));
|
||||
nbttaglist1.add(new net.minecraft.nbt.CompoundTag());
|
||||
nbttaglist1.add(new net.minecraft.nbt.NbtCompound());
|
||||
cmp.put("HandItems", nbttaglist1);
|
||||
}
|
||||
|
||||
if (nbttaglist.size() > 1 && !cmp.contains("ArmorItem", 10)) {
|
||||
nbttaglist1 = new ListTag();
|
||||
nbttaglist1 = new NbtList();
|
||||
nbttaglist1.add(nbttaglist.get(1));
|
||||
nbttaglist1.add(nbttaglist.get(2));
|
||||
nbttaglist1.add(nbttaglist.get(3));
|
||||
@ -642,21 +642,21 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
cmp.remove("Equipment");
|
||||
if (cmp.contains("DropChances", 9)) {
|
||||
nbttaglist1 = cmp.getList("DropChances", 5);
|
||||
ListTag nbttaglist2;
|
||||
NbtList nbttaglist2;
|
||||
|
||||
if (!cmp.contains("HandDropChances", 10)) {
|
||||
nbttaglist2 = new ListTag();
|
||||
nbttaglist2.add(FloatTag.of(nbttaglist1.getFloat(0)));
|
||||
nbttaglist2.add(FloatTag.of(0.0F));
|
||||
nbttaglist2 = new NbtList();
|
||||
nbttaglist2.add(NbtFloat.of(nbttaglist1.getFloat(0)));
|
||||
nbttaglist2.add(NbtFloat.of(0.0F));
|
||||
cmp.put("HandDropChances", nbttaglist2);
|
||||
}
|
||||
|
||||
if (!cmp.contains("ArmorDropChances", 10)) {
|
||||
nbttaglist2 = new ListTag();
|
||||
nbttaglist2.add(FloatTag.of(nbttaglist1.getFloat(1)));
|
||||
nbttaglist2.add(FloatTag.of(nbttaglist1.getFloat(2)));
|
||||
nbttaglist2.add(FloatTag.of(nbttaglist1.getFloat(3)));
|
||||
nbttaglist2.add(FloatTag.of(nbttaglist1.getFloat(4)));
|
||||
nbttaglist2 = new NbtList();
|
||||
nbttaglist2.add(NbtFloat.of(nbttaglist1.getFloat(1)));
|
||||
nbttaglist2.add(NbtFloat.of(nbttaglist1.getFloat(2)));
|
||||
nbttaglist2.add(NbtFloat.of(nbttaglist1.getFloat(3)));
|
||||
nbttaglist2.add(NbtFloat.of(nbttaglist1.getFloat(4)));
|
||||
cmp.put("ArmorDropChances", nbttaglist2);
|
||||
}
|
||||
|
||||
@ -686,14 +686,14 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
}
|
||||
|
||||
@Override
|
||||
public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) {
|
||||
public net.minecraft.nbt.NbtCompound inspect(net.minecraft.nbt.NbtCompound cmp, int sourceVer, int targetVer) {
|
||||
if (!cmp.contains("tag", 10)) {
|
||||
return cmp;
|
||||
} else {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag");
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound1 = cmp.getCompound("tag");
|
||||
|
||||
if (nbttagcompound1.contains("BlockEntityTag", 10)) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag");
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag");
|
||||
String s = cmp.getString("id");
|
||||
String s1 = convertEntityId(sourceVer, s);
|
||||
boolean flag;
|
||||
@ -818,11 +818,11 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
}
|
||||
|
||||
@Override
|
||||
public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag");
|
||||
public net.minecraft.nbt.NbtCompound inspect(net.minecraft.nbt.NbtCompound cmp, int sourceVer, int targetVer) {
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound1 = cmp.getCompound("tag");
|
||||
|
||||
if (nbttagcompound1.contains("EntityTag", 10)) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("EntityTag");
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound2 = nbttagcompound1.getCompound("EntityTag");
|
||||
String s = cmp.getString("id");
|
||||
String s1;
|
||||
|
||||
@ -865,7 +865,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
this.key = getKey(type);
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) {
|
||||
public net.minecraft.nbt.NbtCompound inspect(net.minecraft.nbt.NbtCompound cmp, int sourceVer, int targetVer) {
|
||||
if (this.key.equals(new Identifier(cmp.getString("id")))) {
|
||||
cmp = this.inspectChecked(cmp, sourceVer, targetVer);
|
||||
}
|
||||
@ -873,7 +873,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return cmp;
|
||||
}
|
||||
|
||||
abstract net.minecraft.nbt.CompoundTag inspectChecked(net.minecraft.nbt.CompoundTag nbttagcompound, int sourceVer, int targetVer);
|
||||
abstract net.minecraft.nbt.NbtCompound inspectChecked(net.minecraft.nbt.NbtCompound nbttagcompound, int sourceVer, int targetVer);
|
||||
}
|
||||
|
||||
private static class DataInspectorItemList extends DataInspectorTagged {
|
||||
@ -885,7 +885,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
this.keys = astring;
|
||||
}
|
||||
|
||||
net.minecraft.nbt.CompoundTag inspectChecked(net.minecraft.nbt.CompoundTag nbttagcompound, int sourceVer, int targetVer) {
|
||||
net.minecraft.nbt.NbtCompound inspectChecked(net.minecraft.nbt.NbtCompound nbttagcompound, int sourceVer, int targetVer) {
|
||||
for (String s : this.keys) {
|
||||
FabricDataFixer.convertItems(nbttagcompound, s, sourceVer, targetVer);
|
||||
}
|
||||
@ -903,7 +903,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
this.keys = astring;
|
||||
}
|
||||
|
||||
net.minecraft.nbt.CompoundTag inspectChecked(net.minecraft.nbt.CompoundTag nbttagcompound, int sourceVer, int targetVer) {
|
||||
net.minecraft.nbt.NbtCompound inspectChecked(net.minecraft.nbt.NbtCompound nbttagcompound, int sourceVer, int targetVer) {
|
||||
for (String key : this.keys) {
|
||||
FabricDataFixer.convertItem(nbttagcompound, key, sourceVer, targetVer);
|
||||
}
|
||||
@ -923,7 +923,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 102;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if (cmp.contains("id", 99)) {
|
||||
short short0 = cmp.getShort("id");
|
||||
|
||||
@ -1263,7 +1263,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 147;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if ("ArmorStand".equals(cmp.getString("id")) && cmp.getBoolean("Silent") && !cmp.getBoolean("Marker")) {
|
||||
cmp.remove("Silent");
|
||||
}
|
||||
@ -1281,20 +1281,20 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 804;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if ("minecraft:banner".equals(cmp.getString("id")) && cmp.contains("tag", 10)) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag");
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound1 = cmp.getCompound("tag");
|
||||
|
||||
if (nbttagcompound1.contains("BlockEntityTag", 10)) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag");
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag");
|
||||
|
||||
if (nbttagcompound2.contains("Base", 99)) {
|
||||
cmp.putShort("Damage", (short) (nbttagcompound2.getShort("Base") & 15));
|
||||
if (nbttagcompound1.contains("display", 10)) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound3 = nbttagcompound1.getCompound("display");
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound3 = nbttagcompound1.getCompound("display");
|
||||
|
||||
if (nbttagcompound3.contains("Lore", 9)) {
|
||||
ListTag nbttaglist = nbttagcompound3.getList("Lore", 8);
|
||||
NbtList nbttaglist = nbttagcompound3.getList("Lore", 8);
|
||||
|
||||
if (nbttaglist.size() == 1 && "(+NBT)".equals(nbttaglist.getString(0))) {
|
||||
return cmp;
|
||||
@ -1329,9 +1329,9 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 102;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if ("minecraft:potion".equals(cmp.getString("id"))) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag");
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound1 = cmp.getCompound("tag");
|
||||
short short0 = cmp.getShort("Damage");
|
||||
|
||||
if (!nbttagcompound1.contains("Potion", 8)) {
|
||||
@ -1495,10 +1495,10 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 105;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if ("minecraft:spawn_egg".equals(cmp.getString("id"))) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag");
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("EntityTag");
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound1 = cmp.getCompound("tag");
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound2 = nbttagcompound1.getCompound("EntityTag");
|
||||
short short0 = cmp.getShort("Damage");
|
||||
|
||||
if (!nbttagcompound2.contains("id", 8)) {
|
||||
@ -1602,7 +1602,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 106;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if ("Minecart".equals(cmp.getString("id"))) {
|
||||
String s = "MinecartRideable";
|
||||
int i = cmp.getInt("Type");
|
||||
@ -1628,13 +1628,13 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 107;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if (!"MobSpawner".equals(cmp.getString("id"))) {
|
||||
return cmp;
|
||||
} else {
|
||||
if (cmp.contains("EntityId", 8)) {
|
||||
String s = cmp.getString("EntityId");
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("SpawnData");
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound1 = cmp.getCompound("SpawnData");
|
||||
|
||||
nbttagcompound1.putString("id", s.isEmpty() ? "Pig" : s);
|
||||
cmp.put("SpawnData", nbttagcompound1);
|
||||
@ -1642,13 +1642,13 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
}
|
||||
|
||||
if (cmp.contains("SpawnPotentials", 9)) {
|
||||
ListTag nbttaglist = cmp.getList("SpawnPotentials", 10);
|
||||
NbtList nbttaglist = cmp.getList("SpawnPotentials", 10);
|
||||
|
||||
for (int i = 0; i < nbttaglist.size(); ++i) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttaglist.getCompound(i);
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound2 = nbttaglist.getCompound(i);
|
||||
|
||||
if (nbttagcompound2.contains("Type", 8)) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound3 = nbttagcompound2.getCompound("Properties");
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound3 = nbttagcompound2.getCompound("Properties");
|
||||
|
||||
nbttagcompound3.putString("id", nbttagcompound2.getString("Type"));
|
||||
nbttagcompound2.put("Entity", nbttagcompound3);
|
||||
@ -1672,7 +1672,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 108;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if (cmp.contains("UUID", 8)) {
|
||||
cmp.putUuid("UUID", UUID.fromString(cmp.getString("UUID")));
|
||||
}
|
||||
@ -1692,7 +1692,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 109;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if (DataConverterHealth.a.contains(cmp.getString("id"))) {
|
||||
float f;
|
||||
|
||||
@ -1723,9 +1723,9 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 110;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if ("EntityHorse".equals(cmp.getString("id")) && !cmp.contains("SaddleItem", 10) && cmp.getBoolean("Saddle")) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound1 = new net.minecraft.nbt.CompoundTag();
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound1 = new net.minecraft.nbt.NbtCompound();
|
||||
|
||||
nbttagcompound1.putString("id", "minecraft:saddle");
|
||||
nbttagcompound1.putByte("Count", (byte) 1);
|
||||
@ -1747,7 +1747,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 111;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
String s = cmp.getString("id");
|
||||
boolean flag = "Painting".equals(s);
|
||||
boolean flag1 = "ItemFrame".equals(s);
|
||||
@ -1785,8 +1785,8 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 113;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
ListTag nbttaglist;
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
NbtList nbttaglist;
|
||||
|
||||
if (cmp.contains("HandDropChances", 9)) {
|
||||
nbttaglist = cmp.getList("HandDropChances", 5);
|
||||
@ -1815,9 +1815,9 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 135;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
while (cmp.contains("Riding", 10)) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound1 = this.b(cmp);
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound1 = this.b(cmp);
|
||||
|
||||
this.convert(cmp, nbttagcompound1);
|
||||
cmp = nbttagcompound1;
|
||||
@ -1826,15 +1826,15 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return cmp;
|
||||
}
|
||||
|
||||
protected void convert(net.minecraft.nbt.CompoundTag nbttagcompound, net.minecraft.nbt.CompoundTag nbttagcompound1) {
|
||||
ListTag nbttaglist = new ListTag();
|
||||
protected void convert(net.minecraft.nbt.NbtCompound nbttagcompound, net.minecraft.nbt.NbtCompound nbttagcompound1) {
|
||||
NbtList nbttaglist = new NbtList();
|
||||
|
||||
nbttaglist.add(nbttagcompound);
|
||||
nbttagcompound1.put("Passengers", nbttaglist);
|
||||
}
|
||||
|
||||
protected net.minecraft.nbt.CompoundTag b(net.minecraft.nbt.CompoundTag nbttagcompound) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound1 = nbttagcompound.getCompound("Riding");
|
||||
protected net.minecraft.nbt.NbtCompound b(net.minecraft.nbt.NbtCompound nbttagcompound) {
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound1 = nbttagcompound.getCompound("Riding");
|
||||
|
||||
nbttagcompound.remove("Riding");
|
||||
return nbttagcompound1;
|
||||
@ -1850,12 +1850,12 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 165;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if ("minecraft:written_book".equals(cmp.getString("id"))) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag");
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound1 = cmp.getCompound("tag");
|
||||
|
||||
if (nbttagcompound1.contains("pages", 9)) {
|
||||
ListTag nbttaglist = nbttagcompound1.getList("pages", 8);
|
||||
NbtList nbttaglist = nbttagcompound1.getList("pages", 8);
|
||||
|
||||
for (int i = 0; i < nbttaglist.size(); ++i) {
|
||||
String s = nbttaglist.getString(i);
|
||||
@ -1898,7 +1898,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
object = new LiteralText("");
|
||||
}
|
||||
|
||||
nbttaglist.set(i, StringTag.of(Text.Serializer.toJson((Text) object)));
|
||||
nbttaglist.set(i, NbtString.of(Text.Serializer.toJson((Text) object)));
|
||||
}
|
||||
|
||||
nbttagcompound1.put("pages", nbttaglist);
|
||||
@ -1920,7 +1920,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 502;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if (cmp.contains("id", 8) && DataConverterCookedFish.a.equals(new Identifier(cmp.getString("id")))) {
|
||||
cmp.putString("id", "minecraft:cooked_fish");
|
||||
}
|
||||
@ -1940,7 +1940,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 502;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if ("Zombie".equals(cmp.getString("id")) && cmp.getBoolean("IsVillager")) {
|
||||
if (!cmp.contains("ZombieType", 99)) {
|
||||
int i = -1;
|
||||
@ -1980,7 +1980,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 505;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
cmp.putString("useVbo", "true");
|
||||
return cmp;
|
||||
}
|
||||
@ -1995,7 +1995,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 700;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if ("Guardian".equals(cmp.getString("id"))) {
|
||||
if (cmp.getBoolean("Elder")) {
|
||||
cmp.putString("id", "ElderGuardian");
|
||||
@ -2017,7 +2017,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 701;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
String s = cmp.getString("id");
|
||||
|
||||
if ("Skeleton".equals(s)) {
|
||||
@ -2045,7 +2045,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 702;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if ("Zombie".equals(cmp.getString("id"))) {
|
||||
int i = cmp.getInt("ZombieType");
|
||||
|
||||
@ -2081,7 +2081,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 703;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if ("EntityHorse".equals(cmp.getString("id"))) {
|
||||
int i = cmp.getInt("Type");
|
||||
|
||||
@ -2126,7 +2126,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 704;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
String s = DataConverterTileEntity.a.get(cmp.getString("id"));
|
||||
|
||||
if (s != null) {
|
||||
@ -2174,7 +2174,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 704;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
String s = DataConverterEntity.a.get(cmp.getString("id"));
|
||||
|
||||
if (s != null) {
|
||||
@ -2272,11 +2272,11 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 806;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
String s = cmp.getString("id");
|
||||
|
||||
if ("minecraft:potion".equals(s) || "minecraft:splash_potion".equals(s) || "minecraft:lingering_potion".equals(s) || "minecraft:tipped_arrow".equals(s)) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag");
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound1 = cmp.getCompound("tag");
|
||||
|
||||
if (!nbttagcompound1.contains("Potion", 8)) {
|
||||
nbttagcompound1.putString("Potion", "minecraft:water");
|
||||
@ -2300,7 +2300,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 808;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if ("minecraft:shulker".equals(cmp.getString("id")) && !cmp.contains("Color", 99)) {
|
||||
cmp.putByte("Color", (byte) 10);
|
||||
}
|
||||
@ -2320,12 +2320,12 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 813;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if ("minecraft:shulker_box".equals(cmp.getString("id")) && cmp.contains("tag", 10)) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("tag");
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound1 = cmp.getCompound("tag");
|
||||
|
||||
if (nbttagcompound1.contains("BlockEntityTag", 10)) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag");
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound2 = nbttagcompound1.getCompound("BlockEntityTag");
|
||||
|
||||
if (nbttagcompound2.getList("Items", 10).isEmpty()) {
|
||||
nbttagcompound2.remove("Items");
|
||||
@ -2359,7 +2359,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 813;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if ("minecraft:shulker".equals(cmp.getString("id"))) {
|
||||
cmp.remove("Color");
|
||||
}
|
||||
@ -2377,7 +2377,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 816;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if (cmp.contains("lang", 8)) {
|
||||
cmp.putString("lang", cmp.getString("lang").toLowerCase(Locale.ROOT));
|
||||
}
|
||||
@ -2395,7 +2395,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 820;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if ("minecraft:totem".equals(cmp.getString("id"))) {
|
||||
cmp.putString("id", "minecraft:totem_of_undying");
|
||||
}
|
||||
@ -2415,18 +2415,18 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 1125;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
boolean flag = true;
|
||||
|
||||
try {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("Level");
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound1 = cmp.getCompound("Level");
|
||||
int i = nbttagcompound1.getInt("xPos");
|
||||
int j = nbttagcompound1.getInt("zPos");
|
||||
ListTag nbttaglist = nbttagcompound1.getList("TileEntities", 10);
|
||||
ListTag nbttaglist1 = nbttagcompound1.getList("Sections", 10);
|
||||
NbtList nbttaglist = nbttagcompound1.getList("TileEntities", 10);
|
||||
NbtList nbttaglist1 = nbttagcompound1.getList("Sections", 10);
|
||||
|
||||
for (int k = 0; k < nbttaglist1.size(); ++k) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttaglist1.getCompound(k);
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound2 = nbttaglist1.getCompound(k);
|
||||
byte b0 = nbttagcompound2.getByte("Y");
|
||||
byte[] abyte = nbttagcompound2.getByteArray("Blocks");
|
||||
|
||||
@ -2435,7 +2435,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
int i1 = l & 15;
|
||||
int j1 = l >> 8 & 15;
|
||||
int k1 = l >> 4 & 15;
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound3 = new net.minecraft.nbt.CompoundTag();
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound3 = new net.minecraft.nbt.NbtCompound();
|
||||
|
||||
nbttagcompound3.putString("id", "bed");
|
||||
nbttagcompound3.putInt("x", i1 + (i << 4));
|
||||
@ -2462,7 +2462,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 1125;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if ("minecraft:bed".equals(cmp.getString("id")) && cmp.getShort("Damage") == 0) {
|
||||
cmp.putShort("Damage", (short) DyeColor.RED.getId());
|
||||
}
|
||||
@ -2511,7 +2511,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return 101;
|
||||
}
|
||||
|
||||
public net.minecraft.nbt.CompoundTag convert(net.minecraft.nbt.CompoundTag cmp) {
|
||||
public net.minecraft.nbt.NbtCompound convert(net.minecraft.nbt.NbtCompound cmp) {
|
||||
if ("Sign".equals(cmp.getString("id"))) {
|
||||
this.convert(cmp, "Text1");
|
||||
this.convert(cmp, "Text2");
|
||||
@ -2522,7 +2522,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
return cmp;
|
||||
}
|
||||
|
||||
private void convert(net.minecraft.nbt.CompoundTag nbttagcompound, String s) {
|
||||
private void convert(net.minecraft.nbt.NbtCompound nbttagcompound, String s) {
|
||||
String s1 = nbttagcompound.getString(s);
|
||||
Object object = null;
|
||||
|
||||
@ -2569,9 +2569,9 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
|
||||
private static class DataInspectorPlayerVehicle implements DataInspector {
|
||||
@Override
|
||||
public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) {
|
||||
public net.minecraft.nbt.NbtCompound inspect(net.minecraft.nbt.NbtCompound cmp, int sourceVer, int targetVer) {
|
||||
if (cmp.contains("RootVehicle", 10)) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("RootVehicle");
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound1 = cmp.getCompound("RootVehicle");
|
||||
|
||||
if (nbttagcompound1.contains("Entity", 10)) {
|
||||
convertCompound(LegacyType.ENTITY, nbttagcompound1, "Entity", sourceVer, targetVer);
|
||||
@ -2584,7 +2584,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
|
||||
private static class DataInspectorLevelPlayer implements DataInspector {
|
||||
@Override
|
||||
public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) {
|
||||
public net.minecraft.nbt.NbtCompound inspect(net.minecraft.nbt.NbtCompound cmp, int sourceVer, int targetVer) {
|
||||
if (cmp.contains("Player", 10)) {
|
||||
convertCompound(LegacyType.PLAYER, cmp, "Player", sourceVer, targetVer);
|
||||
}
|
||||
@ -2595,16 +2595,16 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
|
||||
private static class DataInspectorStructure implements DataInspector {
|
||||
@Override
|
||||
public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) {
|
||||
ListTag nbttaglist;
|
||||
public net.minecraft.nbt.NbtCompound inspect(net.minecraft.nbt.NbtCompound cmp, int sourceVer, int targetVer) {
|
||||
NbtList nbttaglist;
|
||||
int j;
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound1;
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound1;
|
||||
|
||||
if (cmp.contains("entities", 9)) {
|
||||
nbttaglist = cmp.getList("entities", 10);
|
||||
|
||||
for (j = 0; j < nbttaglist.size(); ++j) {
|
||||
nbttagcompound1 = (net.minecraft.nbt.CompoundTag) nbttaglist.get(j);
|
||||
nbttagcompound1 = (net.minecraft.nbt.NbtCompound) nbttaglist.get(j);
|
||||
if (nbttagcompound1.contains("nbt", 10)) {
|
||||
convertCompound(LegacyType.ENTITY, nbttagcompound1, "nbt", sourceVer, targetVer);
|
||||
}
|
||||
@ -2615,7 +2615,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
nbttaglist = cmp.getList("blocks", 10);
|
||||
|
||||
for (j = 0; j < nbttaglist.size(); ++j) {
|
||||
nbttagcompound1 = (net.minecraft.nbt.CompoundTag) nbttaglist.get(j);
|
||||
nbttagcompound1 = (net.minecraft.nbt.NbtCompound) nbttaglist.get(j);
|
||||
if (nbttagcompound1.contains("nbt", 10)) {
|
||||
convertCompound(LegacyType.BLOCK_ENTITY, nbttagcompound1, "nbt", sourceVer, targetVer);
|
||||
}
|
||||
@ -2628,17 +2628,17 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
|
||||
private static class DataInspectorChunks implements DataInspector {
|
||||
@Override
|
||||
public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) {
|
||||
public net.minecraft.nbt.NbtCompound inspect(net.minecraft.nbt.NbtCompound cmp, int sourceVer, int targetVer) {
|
||||
if (cmp.contains("Level", 10)) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("Level");
|
||||
ListTag nbttaglist;
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound1 = cmp.getCompound("Level");
|
||||
NbtList nbttaglist;
|
||||
int j;
|
||||
|
||||
if (nbttagcompound1.contains("Entities", 9)) {
|
||||
nbttaglist = nbttagcompound1.getList("Entities", 10);
|
||||
|
||||
for (j = 0; j < nbttaglist.size(); ++j) {
|
||||
nbttaglist.set(j, convert(LegacyType.ENTITY, (net.minecraft.nbt.CompoundTag) nbttaglist.get(j), sourceVer, targetVer));
|
||||
nbttaglist.set(j, convert(LegacyType.ENTITY, (net.minecraft.nbt.NbtCompound) nbttaglist.get(j), sourceVer, targetVer));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2646,7 +2646,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
nbttaglist = nbttagcompound1.getList("TileEntities", 10);
|
||||
|
||||
for (j = 0; j < nbttaglist.size(); ++j) {
|
||||
nbttaglist.set(j, convert(LegacyType.BLOCK_ENTITY, (net.minecraft.nbt.CompoundTag) nbttaglist.get(j), sourceVer, targetVer));
|
||||
nbttaglist.set(j, convert(LegacyType.BLOCK_ENTITY, (net.minecraft.nbt.NbtCompound) nbttaglist.get(j), sourceVer, targetVer));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2657,9 +2657,9 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
|
||||
private static class DataInspectorEntityPassengers implements DataInspector {
|
||||
@Override
|
||||
public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) {
|
||||
public net.minecraft.nbt.NbtCompound inspect(net.minecraft.nbt.NbtCompound cmp, int sourceVer, int targetVer) {
|
||||
if (cmp.contains("Passengers", 9)) {
|
||||
ListTag nbttaglist = cmp.getList("Passengers", 10);
|
||||
NbtList nbttaglist = cmp.getList("Passengers", 10);
|
||||
|
||||
for (int j = 0; j < nbttaglist.size(); ++j) {
|
||||
nbttaglist.set(j, convert(LegacyType.ENTITY, nbttaglist.getCompound(j), sourceVer, targetVer));
|
||||
@ -2672,7 +2672,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
|
||||
private static class DataInspectorPlayer implements DataInspector {
|
||||
@Override
|
||||
public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) {
|
||||
public net.minecraft.nbt.NbtCompound inspect(net.minecraft.nbt.NbtCompound cmp, int sourceVer, int targetVer) {
|
||||
convertItems(cmp, "Inventory", sourceVer, targetVer);
|
||||
convertItems(cmp, "EnderItems", sourceVer, targetVer);
|
||||
if (cmp.contains("ShoulderEntityLeft", 10)) {
|
||||
@ -2691,15 +2691,15 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
Identifier entityVillager = getKey("EntityVillager");
|
||||
|
||||
@Override
|
||||
public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) {
|
||||
public net.minecraft.nbt.NbtCompound inspect(net.minecraft.nbt.NbtCompound cmp, int sourceVer, int targetVer) {
|
||||
if (entityVillager.equals(new Identifier(cmp.getString("id"))) && cmp.contains("Offers", 10)) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound1 = cmp.getCompound("Offers");
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound1 = cmp.getCompound("Offers");
|
||||
|
||||
if (nbttagcompound1.contains("Recipes", 9)) {
|
||||
ListTag nbttaglist = nbttagcompound1.getList("Recipes", 10);
|
||||
NbtList nbttaglist = nbttagcompound1.getList("Recipes", 10);
|
||||
|
||||
for (int j = 0; j < nbttaglist.size(); ++j) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound2 = nbttaglist.getCompound(j);
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound2 = nbttaglist.getCompound(j);
|
||||
|
||||
convertItem(nbttagcompound2, "buy", sourceVer, targetVer);
|
||||
convertItem(nbttagcompound2, "buyB", sourceVer, targetVer);
|
||||
@ -2718,7 +2718,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
Identifier tileEntityMobSpawner = getKey("TileEntityMobSpawner");
|
||||
|
||||
@Override
|
||||
public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) {
|
||||
public net.minecraft.nbt.NbtCompound inspect(net.minecraft.nbt.NbtCompound cmp, int sourceVer, int targetVer) {
|
||||
String s = cmp.getString("id");
|
||||
if (entityMinecartMobSpawner.equals(new Identifier(s))) {
|
||||
cmp.putString("id", tileEntityMobSpawner.toString());
|
||||
@ -2734,13 +2734,13 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
Identifier tileEntityMobSpawner = getKey("TileEntityMobSpawner");
|
||||
|
||||
@Override
|
||||
public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) {
|
||||
public net.minecraft.nbt.NbtCompound inspect(net.minecraft.nbt.NbtCompound cmp, int sourceVer, int targetVer) {
|
||||
if (tileEntityMobSpawner.equals(new Identifier(cmp.getString("id")))) {
|
||||
if (cmp.contains("SpawnPotentials", 9)) {
|
||||
ListTag nbttaglist = cmp.getList("SpawnPotentials", 10);
|
||||
NbtList nbttaglist = cmp.getList("SpawnPotentials", 10);
|
||||
|
||||
for (int j = 0; j < nbttaglist.size(); ++j) {
|
||||
net.minecraft.nbt.CompoundTag nbttagcompound1 = nbttaglist.getCompound(j);
|
||||
net.minecraft.nbt.NbtCompound nbttagcompound1 = nbttaglist.getCompound(j);
|
||||
|
||||
convertCompound(LegacyType.ENTITY, nbttagcompound1, "Entity", sourceVer, targetVer);
|
||||
}
|
||||
@ -2757,7 +2757,7 @@ class FabricDataFixer extends DataFixerBuilder implements com.sk89q.worldedit.wo
|
||||
Identifier tileEntityCommand = getKey("TileEntityCommand");
|
||||
|
||||
@Override
|
||||
public net.minecraft.nbt.CompoundTag inspect(net.minecraft.nbt.CompoundTag cmp, int sourceVer, int targetVer) {
|
||||
public net.minecraft.nbt.NbtCompound inspect(net.minecraft.nbt.NbtCompound cmp, int sourceVer, int targetVer) {
|
||||
if (tileEntityCommand.equals(new Identifier(cmp.getString("id")))) {
|
||||
cmp.putString("id", "Control");
|
||||
convert(LegacyType.BLOCK_ENTITY, cmp, sourceVer, targetVer);
|
||||
|
@ -29,7 +29,7 @@ import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.concurrency.LazyReference;
|
||||
import com.sk89q.worldedit.world.NullWorld;
|
||||
import com.sk89q.worldedit.world.entity.EntityTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
@ -52,8 +52,8 @@ class FabricEntity implements Entity {
|
||||
net.minecraft.entity.Entity entity = entityRef.get();
|
||||
if (entity != null) {
|
||||
Identifier id = Registry.ENTITY_TYPE.getId(entity.getType());
|
||||
CompoundTag tag = new CompoundTag();
|
||||
entity.toTag(tag);
|
||||
NbtCompound tag = new NbtCompound();
|
||||
entity.writeNbt(tag);
|
||||
return new BaseEntity(EntityTypes.get(id.toString()), LazyReference.from(() -> NBTConverter.fromNative(tag)));
|
||||
} else {
|
||||
return null;
|
||||
@ -65,8 +65,8 @@ class FabricEntity implements Entity {
|
||||
net.minecraft.entity.Entity entity = entityRef.get();
|
||||
if (entity != null) {
|
||||
Vector3 position = Vector3.at(entity.getX(), entity.getY(), entity.getZ());
|
||||
float yaw = entity.yaw;
|
||||
float pitch = entity.pitch;
|
||||
float yaw = entity.getYaw();
|
||||
float pitch = entity.getPitch();
|
||||
|
||||
return new Location(FabricAdapter.adapt(entity.world), position, yaw, pitch);
|
||||
} else {
|
||||
@ -94,7 +94,7 @@ class FabricEntity implements Entity {
|
||||
public boolean remove() {
|
||||
net.minecraft.entity.Entity entity = entityRef.get();
|
||||
if (entity != null) {
|
||||
entity.remove();
|
||||
entity.remove(net.minecraft.entity.Entity.RemovalReason.KILLED);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ package com.sk89q.worldedit.fabric;
|
||||
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.sk89q.worldedit.command.util.PermissionCondition;
|
||||
import com.sk89q.worldedit.entity.Player;
|
||||
import com.sk89q.worldedit.extension.platform.AbstractPlatform;
|
||||
@ -32,13 +31,15 @@ import com.sk89q.worldedit.extension.platform.Preference;
|
||||
import com.sk89q.worldedit.extension.platform.Watchdog;
|
||||
import com.sk89q.worldedit.fabric.internal.ExtendedChunk;
|
||||
import com.sk89q.worldedit.util.SideEffect;
|
||||
import com.sk89q.worldedit.util.lifecycle.Lifecycled;
|
||||
import com.sk89q.worldedit.util.lifecycle.SimpleLifecycled;
|
||||
import com.sk89q.worldedit.world.DataFixer;
|
||||
import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.registry.Registries;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
|
||||
import net.minecraft.SharedConstants;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.PlayerManager;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.server.dedicated.MinecraftDedicatedServer;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
@ -55,7 +56,9 @@ import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static java.util.stream.Collectors.toList;
|
||||
@ -63,19 +66,19 @@ import static java.util.stream.Collectors.toList;
|
||||
class FabricPlatform extends AbstractPlatform implements MultiUserPlatform {
|
||||
|
||||
private final FabricWorldEdit mod;
|
||||
private final MinecraftServer server;
|
||||
private final FabricDataFixer dataFixer;
|
||||
private final @Nullable Watchdog watchdog;
|
||||
private final Lifecycled<Optional<Watchdog>> watchdog;
|
||||
private boolean hookingEvents = false;
|
||||
private CommandDispatcher<ServerCommandSource> nativeDispatcher;
|
||||
|
||||
FabricPlatform(FabricWorldEdit mod, MinecraftServer server) {
|
||||
FabricPlatform(FabricWorldEdit mod) {
|
||||
this.mod = mod;
|
||||
this.server = server;
|
||||
this.nativeDispatcher = server.getCommandManager().getDispatcher();
|
||||
this.dataFixer = new FabricDataFixer(getDataVersion());
|
||||
this.watchdog = server instanceof MinecraftDedicatedServer
|
||||
? (Watchdog) server : null;
|
||||
|
||||
this.watchdog = FabricWorldEdit.LIFECYCLED_SERVER.map(
|
||||
server -> server instanceof MinecraftDedicatedServer
|
||||
? Optional.of((Watchdog) server)
|
||||
: Optional.empty()
|
||||
);
|
||||
}
|
||||
|
||||
boolean isHookingEvents() {
|
||||
@ -116,12 +119,12 @@ class FabricPlatform extends AbstractPlatform implements MultiUserPlatform {
|
||||
@Override
|
||||
@Nullable
|
||||
public Watchdog getWatchdog() {
|
||||
return watchdog;
|
||||
return watchdog.value().flatMap(Function.identity()).orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends World> getWorlds() {
|
||||
Iterable<ServerWorld> worlds = server.getWorlds();
|
||||
Iterable<ServerWorld> worlds = FabricWorldEdit.LIFECYCLED_SERVER.valueOrThrow().getWorlds();
|
||||
List<World> ret = new ArrayList<>();
|
||||
for (ServerWorld world : worlds) {
|
||||
ret.add(new FabricWorld(world));
|
||||
@ -135,7 +138,8 @@ class FabricPlatform extends AbstractPlatform implements MultiUserPlatform {
|
||||
if (player instanceof FabricPlayer) {
|
||||
return player;
|
||||
} else {
|
||||
ServerPlayerEntity entity = server.getPlayerManager().getPlayer(player.getName());
|
||||
ServerPlayerEntity entity = FabricWorldEdit.LIFECYCLED_SERVER.valueOrThrow()
|
||||
.getPlayerManager().getPlayer(player.getName());
|
||||
return entity != null ? new FabricPlayer(entity) : null;
|
||||
}
|
||||
}
|
||||
@ -146,7 +150,7 @@ class FabricPlatform extends AbstractPlatform implements MultiUserPlatform {
|
||||
if (world instanceof FabricWorld) {
|
||||
return world;
|
||||
} else {
|
||||
for (ServerWorld ws : server.getWorlds()) {
|
||||
for (ServerWorld ws : FabricWorldEdit.LIFECYCLED_SERVER.valueOrThrow().getWorlds()) {
|
||||
if (((ServerWorldProperties) ws.getLevelProperties()).getLevelName().equals(world.getName())) {
|
||||
return new FabricWorld(ws);
|
||||
}
|
||||
@ -156,31 +160,14 @@ class FabricPlatform extends AbstractPlatform implements MultiUserPlatform {
|
||||
}
|
||||
}
|
||||
|
||||
public void setNativeDispatcher(CommandDispatcher<ServerCommandSource> nativeDispatcher) {
|
||||
this.nativeDispatcher = nativeDispatcher;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerCommands(CommandManager manager) {
|
||||
if (server == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (Command command : manager.getAllCommands().collect(toList())) {
|
||||
CommandWrapper.register(nativeDispatcher, command);
|
||||
Set<String> perms = command.getCondition().as(PermissionCondition.class)
|
||||
.map(PermissionCondition::getPermissions)
|
||||
.orElseGet(Collections::emptySet);
|
||||
if (!perms.isEmpty()) {
|
||||
perms.forEach(FabricWorldEdit.inst.getPermissionsProvider()::registerPermission);
|
||||
}
|
||||
}
|
||||
// No-op, we register using Fabric's event
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerGameHooks() {
|
||||
// We registered the events already anyway, so we just 'turn them on'
|
||||
hookingEvents = true;
|
||||
public void setGameHooksEnabled(boolean enabled) {
|
||||
this.hookingEvents = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -241,7 +228,7 @@ class FabricPlatform extends AbstractPlatform implements MultiUserPlatform {
|
||||
@Override
|
||||
public Collection<Actor> getConnectedUsers() {
|
||||
List<Actor> users = new ArrayList<>();
|
||||
PlayerManager scm = server.getPlayerManager();
|
||||
PlayerManager scm = FabricWorldEdit.LIFECYCLED_SERVER.valueOrThrow().getPlayerManager();
|
||||
for (ServerPlayerEntity entity : scm.getPlayerList()) {
|
||||
if (entity != null) {
|
||||
users.add(new FabricPlayer(entity));
|
||||
|
@ -44,7 +44,6 @@ import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.network.packet.s2c.play.BlockEntityUpdateS2CPacket;
|
||||
@ -52,12 +51,10 @@ import net.minecraft.network.packet.s2c.play.BlockUpdateS2CPacket;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.MutableText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Formatting;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Locale;
|
||||
import java.util.UUID;
|
||||
@ -101,8 +98,8 @@ public class FabricPlayer extends AbstractPlayerActor {
|
||||
return new Location(
|
||||
FabricWorldEdit.inst.getWorld(this.player.world),
|
||||
position,
|
||||
this.player.yaw,
|
||||
this.player.pitch);
|
||||
this.player.getYaw(),
|
||||
this.player.getPitch());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -118,7 +115,7 @@ public class FabricPlayer extends AbstractPlayerActor {
|
||||
|
||||
@Override
|
||||
public void giveItem(BaseItemStack itemStack) {
|
||||
this.player.inventory.insertStack(FabricAdapter.adapt(itemStack));
|
||||
this.player.getInventory().insertStack(FabricAdapter.adapt(itemStack));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -168,7 +165,7 @@ public class FabricPlayer extends AbstractPlayerActor {
|
||||
|
||||
@Override
|
||||
public void print(Component component) {
|
||||
this.player.sendMessage(Text.Serializer.fromJson(GsonComponentSerializer.INSTANCE.serialize(WorldEditText.format(component, getLocale()))), false);
|
||||
this.player.sendMessage(net.minecraft.text.Text.Serializer.fromJson(GsonComponentSerializer.INSTANCE.serialize(WorldEditText.format(component, getLocale()))), false);
|
||||
}
|
||||
|
||||
private void sendColorized(String msg, Formatting formatting) {
|
||||
@ -208,13 +205,13 @@ public class FabricPlayer extends AbstractPlayerActor {
|
||||
|
||||
@Override
|
||||
public boolean isAllowedToFly() {
|
||||
return player.abilities.allowFlying;
|
||||
return player.getAbilities().allowFlying;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlying(boolean flying) {
|
||||
if (player.abilities.flying != flying) {
|
||||
player.abilities.flying = flying;
|
||||
if (player.getAbilities().flying != flying) {
|
||||
player.getAbilities().flying = flying;
|
||||
player.sendAbilitiesUpdate();
|
||||
}
|
||||
}
|
||||
@ -230,19 +227,13 @@ public class FabricPlayer extends AbstractPlayerActor {
|
||||
final BlockUpdateS2CPacket packetOut = new BlockUpdateS2CPacket(((FabricWorld) world).getWorld(), loc);
|
||||
player.networkHandler.sendPacket(packetOut);
|
||||
} else {
|
||||
final BlockUpdateS2CPacket packetOut = new BlockUpdateS2CPacket();
|
||||
PacketByteBuf buf = new PacketByteBuf(Unpooled.buffer());
|
||||
buf.writeBlockPos(loc);
|
||||
buf.writeVarInt(Block.getRawIdFromState(FabricAdapter.adapt(block.toImmutableState())));
|
||||
try {
|
||||
packetOut.read(buf);
|
||||
} catch (IOException e) {
|
||||
return;
|
||||
}
|
||||
final BlockUpdateS2CPacket packetOut = new BlockUpdateS2CPacket(
|
||||
loc,
|
||||
FabricAdapter.adapt(block.toImmutableState())
|
||||
);
|
||||
player.networkHandler.sendPacket(packetOut);
|
||||
if (block instanceof BaseBlock && block.getBlockType().equals(BlockTypes.STRUCTURE_BLOCK)) {
|
||||
final BaseBlock baseBlock = (BaseBlock) block;
|
||||
final CompoundBinaryTag nbtData = baseBlock.getNbt();
|
||||
final CompoundBinaryTag nbtData = ((BaseBlock) block).getNbt();
|
||||
if (nbtData != null) {
|
||||
player.networkHandler.sendPacket(new BlockEntityUpdateS2CPacket(
|
||||
new BlockPos(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()),
|
||||
|
@ -23,9 +23,8 @@ import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.common.collect.Streams;
|
||||
import com.google.common.util.concurrent.Futures;
|
||||
import com.mojang.serialization.Dynamic;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
@ -69,8 +68,8 @@ import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.ItemEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemUsageContext;
|
||||
import net.minecraft.nbt.NbtElement;
|
||||
import net.minecraft.nbt.NbtOps;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.world.ServerChunkManager;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
@ -85,6 +84,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.registry.DynamicRegistryManager;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.util.registry.RegistryKey;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldProperties;
|
||||
@ -133,7 +133,7 @@ public class FabricWorld extends AbstractWorld {
|
||||
private static Identifier getDimensionRegistryKey(World world) {
|
||||
return Objects.requireNonNull(world.getServer(), "server cannot be null")
|
||||
.getRegistryManager()
|
||||
.getDimensionTypes()
|
||||
.get(Registry.DIMENSION_TYPE_KEY)
|
||||
.getId(world.getDimension());
|
||||
}
|
||||
|
||||
@ -331,7 +331,7 @@ public class FabricWorld extends AbstractWorld {
|
||||
originalWorld.getServer().getSaveProperties();
|
||||
GeneratorOptions originalOpts = levelProperties.getGeneratorOptions();
|
||||
|
||||
RegistryOps<Tag> nbtRegOps = RegistryOps.of(
|
||||
RegistryOps<NbtElement> nbtRegOps = RegistryOps.of(
|
||||
NbtOps.INSTANCE,
|
||||
((ExtendedMinecraftServer) originalWorld.getServer())
|
||||
.getServerResourceManager().getResourceManager(),
|
||||
@ -384,7 +384,7 @@ public class FabricWorld extends AbstractWorld {
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Dynamic<Tag> recursivelySetSeed(Dynamic<Tag> dynamic, long seed, Set<Dynamic<Tag>> seen) {
|
||||
private Dynamic<NbtElement> recursivelySetSeed(Dynamic<NbtElement> dynamic, long seed, Set<Dynamic<NbtElement>> seen) {
|
||||
if (!seen.add(dynamic)) {
|
||||
return dynamic;
|
||||
}
|
||||
@ -392,8 +392,8 @@ public class FabricWorld extends AbstractWorld {
|
||||
if (pair.getFirst().asString("").equals("seed")) {
|
||||
return pair.mapSecond(v -> v.createLong(seed));
|
||||
}
|
||||
if (pair.getSecond().getValue() instanceof net.minecraft.nbt.CompoundTag) {
|
||||
return pair.mapSecond(v -> recursivelySetSeed((Dynamic<Tag>) v, seed, seen));
|
||||
if (pair.getSecond().getValue() instanceof net.minecraft.nbt.NbtCompound) {
|
||||
return pair.mapSecond(v -> recursivelySetSeed((Dynamic<NbtElement>) v, seed, seen));
|
||||
}
|
||||
return pair;
|
||||
});
|
||||
@ -429,8 +429,8 @@ public class FabricWorld extends AbstractWorld {
|
||||
BlockStateHolder<?> state = FabricAdapter.adapt(chunk.getBlockState(pos));
|
||||
BlockEntity blockEntity = chunk.getBlockEntity(pos);
|
||||
if (blockEntity != null) {
|
||||
net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag();
|
||||
blockEntity.toTag(tag);
|
||||
net.minecraft.nbt.NbtCompound tag = new net.minecraft.nbt.NbtCompound();
|
||||
blockEntity.writeNbt(tag);
|
||||
state = state.toBaseBlock(LazyReference.from(() -> NBTConverter.fromNative(tag)));
|
||||
}
|
||||
extent.setBlock(vec, state.toBaseBlock());
|
||||
@ -469,10 +469,10 @@ public class FabricWorld extends AbstractWorld {
|
||||
case SMALL_JUNGLE: return ConfiguredFeatures.JUNGLE_TREE;
|
||||
case SHORT_JUNGLE: return ConfiguredFeatures.JUNGLE_TREE_NO_VINE;
|
||||
case JUNGLE_BUSH: return ConfiguredFeatures.JUNGLE_BUSH;
|
||||
case SWAMP: return ConfiguredFeatures.SWAMP_TREE;
|
||||
case SWAMP: return ConfiguredFeatures.SWAMP_OAK;
|
||||
case ACACIA: return ConfiguredFeatures.ACACIA;
|
||||
case DARK_OAK: return ConfiguredFeatures.DARK_OAK;
|
||||
case TALL_BIRCH: return ConfiguredFeatures.BIRCH_TALL;
|
||||
case TALL_BIRCH: return ConfiguredFeatures.SUPER_BIRCH_BEES_0002;
|
||||
case RED_MUSHROOM: return ConfiguredFeatures.HUGE_RED_MUSHROOM;
|
||||
case BROWN_MUSHROOM: return ConfiguredFeatures.HUGE_BROWN_MUSHROOM;
|
||||
case WARPED_FUNGUS: return ConfiguredFeatures.WARPED_FUNGI;
|
||||
@ -569,9 +569,14 @@ public class FabricWorld extends AbstractWorld {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinY() {
|
||||
return getWorld().getBottomY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxY() {
|
||||
return getWorld().getHeight() - 1;
|
||||
return getWorld().getTopY() - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -600,8 +605,8 @@ public class FabricWorld extends AbstractWorld {
|
||||
BlockEntity tile = ((WorldChunk) getWorld().getChunk(pos)).getBlockEntity(pos, WorldChunk.CreationType.CHECK);
|
||||
|
||||
if (tile != null) {
|
||||
net.minecraft.nbt.CompoundTag tag = new net.minecraft.nbt.CompoundTag();
|
||||
tile.toTag(tag);
|
||||
net.minecraft.nbt.NbtCompound tag = new net.minecraft.nbt.NbtCompound();
|
||||
tile.writeNbt(tag);
|
||||
return getBlock(position).toBaseBlock(LazyReference.from(() -> NBTConverter.fromNative(tag)));
|
||||
} else {
|
||||
return getBlock(position).toBaseBlock();
|
||||
@ -634,15 +639,14 @@ public class FabricWorld extends AbstractWorld {
|
||||
FabricAdapter.toBlockPos(region.getMinimumPoint()),
|
||||
FabricAdapter.toBlockPos(region.getMaximumPoint().add(BlockVector3.ONE))
|
||||
);
|
||||
List<net.minecraft.entity.Entity> nmsEntities = world.getEntitiesByType(
|
||||
List<net.minecraft.entity.Entity> nmsEntities = world.getOtherEntities(
|
||||
null,
|
||||
box,
|
||||
e -> region.contains(FabricAdapter.adapt(e.getBlockPos()))
|
||||
);
|
||||
return ImmutableList.copyOf(Lists.transform(
|
||||
nmsEntities,
|
||||
FabricEntity::new
|
||||
));
|
||||
return nmsEntities.stream()
|
||||
.map(FabricEntity::new)
|
||||
.collect(ImmutableList.toImmutableList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -651,10 +655,9 @@ public class FabricWorld extends AbstractWorld {
|
||||
if (!(world instanceof ServerWorld)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return ImmutableList.copyOf(Iterables.transform(
|
||||
((ServerWorld) world).iterateEntities(),
|
||||
FabricEntity::new
|
||||
));
|
||||
return Streams.stream(((ServerWorld) world).iterateEntities())
|
||||
.map(FabricEntity::new)
|
||||
.collect(ImmutableList.toImmutableList());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@ -669,11 +672,11 @@ public class FabricWorld extends AbstractWorld {
|
||||
if (createdEntity != null) {
|
||||
CompoundBinaryTag nativeTag = entity.getNbt();
|
||||
if (nativeTag != null) {
|
||||
net.minecraft.nbt.CompoundTag tag = NBTConverter.toNative(nativeTag);
|
||||
net.minecraft.nbt.NbtCompound tag = NBTConverter.toNative(nativeTag);
|
||||
for (String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
|
||||
tag.remove(name);
|
||||
}
|
||||
createdEntity.fromTag(tag);
|
||||
createdEntity.readNbt(tag);
|
||||
}
|
||||
|
||||
createdEntity.updatePositionAndAngles(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch());
|
||||
|
@ -22,7 +22,10 @@ package com.sk89q.worldedit.fabric;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.util.PermissionCondition;
|
||||
import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
|
||||
import com.sk89q.worldedit.event.platform.PlatformUnreadyEvent;
|
||||
import com.sk89q.worldedit.event.platform.PlatformsRegisteredEvent;
|
||||
import com.sk89q.worldedit.event.platform.SessionIdleEvent;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
@ -31,6 +34,8 @@ import com.sk89q.worldedit.fabric.net.handler.WECUIPacketHandler;
|
||||
import com.sk89q.worldedit.internal.anvil.ChunkDeleter;
|
||||
import com.sk89q.worldedit.internal.util.LogManagerCompat;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import com.sk89q.worldedit.util.lifecycle.Lifecycled;
|
||||
import com.sk89q.worldedit.util.lifecycle.SimpleLifecycled;
|
||||
import com.sk89q.worldedit.world.biome.BiomeType;
|
||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
@ -65,15 +70,20 @@ import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.World;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.enginehub.piston.Command;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.fabric.FabricAdapter.adaptPlayer;
|
||||
import static com.sk89q.worldedit.internal.anvil.ChunkDeleter.DELCHUNKS_FILE_NAME;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
/**
|
||||
* The Fabric implementation of WorldEdit.
|
||||
@ -84,6 +94,15 @@ public class FabricWorldEdit implements ModInitializer {
|
||||
public static final String MOD_ID = "worldedit";
|
||||
public static final String CUI_PLUGIN_CHANNEL = "cui";
|
||||
|
||||
public static final Lifecycled<MinecraftServer> LIFECYCLED_SERVER;
|
||||
|
||||
static {
|
||||
SimpleLifecycled<MinecraftServer> lifecycledServer = SimpleLifecycled.invalid();
|
||||
ServerLifecycleEvents.SERVER_STARTED.register(lifecycledServer::newValue);
|
||||
ServerLifecycleEvents.SERVER_STOPPING.register(__ -> lifecycledServer.invalidate());
|
||||
LIFECYCLED_SERVER = lifecycledServer;
|
||||
}
|
||||
|
||||
private FabricPermissionsProvider provider;
|
||||
|
||||
public static FabricWorldEdit inst;
|
||||
@ -113,6 +132,12 @@ public class FabricWorldEdit implements ModInitializer {
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
}
|
||||
this.platform = new FabricPlatform(this);
|
||||
|
||||
WorldEdit.getInstance().getPlatformManager().register(platform);
|
||||
|
||||
config = new FabricConfiguration(this);
|
||||
this.provider = getInitialPermissionsProvider();
|
||||
|
||||
WECUIPacketHandler.init();
|
||||
|
||||
@ -129,29 +154,25 @@ public class FabricWorldEdit implements ModInitializer {
|
||||
}
|
||||
|
||||
private void registerCommands(CommandDispatcher<ServerCommandSource> dispatcher, boolean dedicated) {
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformsRegisteredEvent());
|
||||
PlatformManager manager = WorldEdit.getInstance().getPlatformManager();
|
||||
if (manager.getPlatforms().isEmpty()) {
|
||||
// We'll register as part of our platform initialization later.
|
||||
return;
|
||||
}
|
||||
|
||||
// This is a re-register (due to /reload), we must add our commands now
|
||||
|
||||
Platform commandsPlatform = manager.queryCapability(Capability.USER_COMMANDS);
|
||||
if (commandsPlatform != platform || !platform.isHookingEvents()) {
|
||||
// We're not in control of commands/events -- do not re-register.
|
||||
// We're not in control of commands/events -- do not register.
|
||||
return;
|
||||
}
|
||||
platform.setNativeDispatcher(dispatcher);
|
||||
platform.registerCommands(manager.getPlatformCommandManager().getCommandManager());
|
||||
}
|
||||
|
||||
private void setupPlatform(MinecraftServer server) {
|
||||
this.platform = new FabricPlatform(this, server);
|
||||
|
||||
WorldEdit.getInstance().getPlatformManager().register(platform);
|
||||
|
||||
this.provider = getInitialPermissionsProvider();
|
||||
List<Command> commands = manager.getPlatformCommandManager().getCommandManager()
|
||||
.getAllCommands().collect(toList());
|
||||
for (Command command : commands) {
|
||||
CommandWrapper.register(dispatcher, command);
|
||||
Set<String> perms = command.getCondition().as(PermissionCondition.class)
|
||||
.map(PermissionCondition::getPermissions)
|
||||
.orElseGet(Collections::emptySet);
|
||||
if (!perms.isEmpty()) {
|
||||
perms.forEach(getPermissionsProvider()::registerPermission);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private FabricPermissionsProvider getInitialPermissionsProvider() {
|
||||
@ -211,22 +232,16 @@ public class FabricWorldEdit implements ModInitializer {
|
||||
}
|
||||
|
||||
private void onStartServer(MinecraftServer minecraftServer) {
|
||||
FabricAdapter.setServer(minecraftServer);
|
||||
setupPlatform(minecraftServer);
|
||||
setupRegistries(minecraftServer);
|
||||
|
||||
config = new FabricConfiguration(this);
|
||||
config.load();
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent());
|
||||
minecraftServer.reloadResources(
|
||||
minecraftServer.getDataPackManager().getEnabledNames()
|
||||
);
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent(platform));
|
||||
}
|
||||
|
||||
private void onStopServer(MinecraftServer minecraftServer) {
|
||||
WorldEdit worldEdit = WorldEdit.getInstance();
|
||||
worldEdit.getSessionManager().unload();
|
||||
worldEdit.getPlatformManager().unregister(platform);
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformUnreadyEvent(platform));
|
||||
}
|
||||
|
||||
private boolean shouldSkip() {
|
||||
|
@ -20,22 +20,19 @@
|
||||
package com.sk89q.worldedit.fabric;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.damage.DamageSource;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.network.ServerPlayerInteractionManager;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.stat.Stat;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import java.util.UUID;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class WorldEditFakePlayer extends ServerPlayerEntity {
|
||||
private static final GameProfile FAKE_WORLDEDIT_PROFILE = new GameProfile(UUID.nameUUIDFromBytes("worldedit".getBytes()), "[WorldEdit]");
|
||||
|
||||
public WorldEditFakePlayer(ServerWorld world) {
|
||||
super(world.getServer(), world, FAKE_WORLDEDIT_PROFILE, new ServerPlayerInteractionManager(world));
|
||||
super(world.getServer(), world, FAKE_WORLDEDIT_PROFILE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package com.sk89q.worldedit.fabric;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.server.WorldGenerationProgressListener;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.chunk.ChunkStatus;
|
||||
@ -28,6 +30,11 @@ import javax.annotation.Nullable;
|
||||
// For now, this does nothing, but might be useful later for regen progress communication.
|
||||
class WorldEditGenListener implements WorldGenerationProgressListener {
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
@Override
|
||||
public void start() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(ChunkPos spawnPos) {
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import com.sk89q.worldedit.util.nbt.CompoundBinaryTag;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.server.world.ChunkHolder;
|
||||
import net.minecraft.server.world.ServerChunkManager;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@ -105,13 +105,13 @@ public class FabricWorldNativeAccess implements WorldNativeAccess<WorldChunk, Bl
|
||||
|
||||
@Override
|
||||
public boolean updateTileEntity(BlockPos position, CompoundBinaryTag tag) {
|
||||
CompoundTag nativeTag = NBTConverter.toNative(tag);
|
||||
NbtCompound nativeTag = NBTConverter.toNative(tag);
|
||||
BlockEntity tileEntity = getWorld().getWorldChunk(position).getBlockEntity(position);
|
||||
if (tileEntity == null) {
|
||||
return false;
|
||||
}
|
||||
tileEntity.setLocation(getWorld(), position);
|
||||
tileEntity.fromTag(getWorld().getBlockState(position), nativeTag);
|
||||
tileEntity.readNbt(nativeTag);
|
||||
tileEntity.markDirty();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ public final class NBTConverter {
|
||||
private NBTConverter() {
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.Tag toNative(BinaryTag tag) {
|
||||
public static net.minecraft.nbt.NbtElement toNative(BinaryTag tag) {
|
||||
if (tag instanceof IntArrayBinaryTag) {
|
||||
return toNative((IntArrayBinaryTag) tag);
|
||||
|
||||
@ -86,13 +86,13 @@ public final class NBTConverter {
|
||||
}
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.IntArrayTag toNative(IntArrayBinaryTag tag) {
|
||||
public static net.minecraft.nbt.NbtIntArray toNative(IntArrayBinaryTag tag) {
|
||||
int[] value = tag.value();
|
||||
return new net.minecraft.nbt.IntArrayTag(Arrays.copyOf(value, value.length));
|
||||
return new net.minecraft.nbt.NbtIntArray(Arrays.copyOf(value, value.length));
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.ListTag toNative(ListBinaryTag tag) {
|
||||
net.minecraft.nbt.ListTag list = new net.minecraft.nbt.ListTag();
|
||||
public static net.minecraft.nbt.NbtList toNative(ListBinaryTag tag) {
|
||||
net.minecraft.nbt.NbtList list = new net.minecraft.nbt.NbtList();
|
||||
for (BinaryTag child : tag) {
|
||||
if (child instanceof EndBinaryTag) {
|
||||
continue;
|
||||
@ -102,100 +102,100 @@ public final class NBTConverter {
|
||||
return list;
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.LongTag toNative(LongBinaryTag tag) {
|
||||
return net.minecraft.nbt.LongTag.of(tag.value());
|
||||
public static net.minecraft.nbt.NbtLong toNative(LongBinaryTag tag) {
|
||||
return net.minecraft.nbt.NbtLong.of(tag.value());
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.LongArrayTag toNative(LongArrayBinaryTag tag) {
|
||||
return new net.minecraft.nbt.LongArrayTag(tag.value().clone());
|
||||
public static net.minecraft.nbt.NbtLongArray toNative(LongArrayBinaryTag tag) {
|
||||
return new net.minecraft.nbt.NbtLongArray(tag.value().clone());
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.StringTag toNative(StringBinaryTag tag) {
|
||||
return net.minecraft.nbt.StringTag.of(tag.value());
|
||||
public static net.minecraft.nbt.NbtString toNative(StringBinaryTag tag) {
|
||||
return net.minecraft.nbt.NbtString.of(tag.value());
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.IntTag toNative(IntBinaryTag tag) {
|
||||
return net.minecraft.nbt.IntTag.of(tag.value());
|
||||
public static net.minecraft.nbt.NbtInt toNative(IntBinaryTag tag) {
|
||||
return net.minecraft.nbt.NbtInt.of(tag.value());
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.ByteTag toNative(ByteBinaryTag tag) {
|
||||
return net.minecraft.nbt.ByteTag.of(tag.value());
|
||||
public static net.minecraft.nbt.NbtByte toNative(ByteBinaryTag tag) {
|
||||
return net.minecraft.nbt.NbtByte.of(tag.value());
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.ByteArrayTag toNative(ByteArrayBinaryTag tag) {
|
||||
return new net.minecraft.nbt.ByteArrayTag(tag.value().clone());
|
||||
public static net.minecraft.nbt.NbtByteArray toNative(ByteArrayBinaryTag tag) {
|
||||
return new net.minecraft.nbt.NbtByteArray(tag.value().clone());
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.CompoundTag toNative(CompoundBinaryTag tag) {
|
||||
net.minecraft.nbt.CompoundTag compound = new net.minecraft.nbt.CompoundTag();
|
||||
public static net.minecraft.nbt.NbtCompound toNative(CompoundBinaryTag tag) {
|
||||
net.minecraft.nbt.NbtCompound compound = new net.minecraft.nbt.NbtCompound();
|
||||
for (String key : tag.keySet()) {
|
||||
compound.put(key, toNative(tag.get(key)));
|
||||
}
|
||||
return compound;
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.FloatTag toNative(FloatBinaryTag tag) {
|
||||
return net.minecraft.nbt.FloatTag.of(tag.value());
|
||||
public static net.minecraft.nbt.NbtFloat toNative(FloatBinaryTag tag) {
|
||||
return net.minecraft.nbt.NbtFloat.of(tag.value());
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.ShortTag toNative(ShortBinaryTag tag) {
|
||||
return net.minecraft.nbt.ShortTag.of(tag.value());
|
||||
public static net.minecraft.nbt.NbtShort toNative(ShortBinaryTag tag) {
|
||||
return net.minecraft.nbt.NbtShort.of(tag.value());
|
||||
}
|
||||
|
||||
public static net.minecraft.nbt.DoubleTag toNative(DoubleBinaryTag tag) {
|
||||
return net.minecraft.nbt.DoubleTag.of(tag.value());
|
||||
public static net.minecraft.nbt.NbtDouble toNative(DoubleBinaryTag tag) {
|
||||
return net.minecraft.nbt.NbtDouble.of(tag.value());
|
||||
}
|
||||
|
||||
public static BinaryTag fromNative(net.minecraft.nbt.Tag other) {
|
||||
if (other instanceof net.minecraft.nbt.IntArrayTag) {
|
||||
return fromNative((net.minecraft.nbt.IntArrayTag) other);
|
||||
public static BinaryTag fromNative(net.minecraft.nbt.NbtElement other) {
|
||||
if (other instanceof net.minecraft.nbt.NbtIntArray) {
|
||||
return fromNative((net.minecraft.nbt.NbtIntArray) other);
|
||||
|
||||
} else if (other instanceof net.minecraft.nbt.ListTag) {
|
||||
return fromNative((net.minecraft.nbt.ListTag) other);
|
||||
} else if (other instanceof net.minecraft.nbt.NbtList) {
|
||||
return fromNative((net.minecraft.nbt.NbtList) other);
|
||||
|
||||
} else if (other instanceof net.minecraft.nbt.EndTag) {
|
||||
return fromNative((net.minecraft.nbt.EndTag) other);
|
||||
} else if (other instanceof net.minecraft.nbt.NbtNull) {
|
||||
return fromNative((net.minecraft.nbt.NbtNull) other);
|
||||
|
||||
} else if (other instanceof net.minecraft.nbt.LongTag) {
|
||||
return fromNative((net.minecraft.nbt.LongTag) other);
|
||||
} else if (other instanceof net.minecraft.nbt.NbtLong) {
|
||||
return fromNative((net.minecraft.nbt.NbtLong) other);
|
||||
|
||||
} else if (other instanceof net.minecraft.nbt.LongArrayTag) {
|
||||
return fromNative((net.minecraft.nbt.LongArrayTag) other);
|
||||
} else if (other instanceof net.minecraft.nbt.NbtLongArray) {
|
||||
return fromNative((net.minecraft.nbt.NbtLongArray) other);
|
||||
|
||||
} else if (other instanceof net.minecraft.nbt.StringTag) {
|
||||
return fromNative((net.minecraft.nbt.StringTag) other);
|
||||
} else if (other instanceof net.minecraft.nbt.NbtString) {
|
||||
return fromNative((net.minecraft.nbt.NbtString) other);
|
||||
|
||||
} else if (other instanceof net.minecraft.nbt.IntTag) {
|
||||
return fromNative((net.minecraft.nbt.IntTag) other);
|
||||
} else if (other instanceof net.minecraft.nbt.NbtInt) {
|
||||
return fromNative((net.minecraft.nbt.NbtInt) other);
|
||||
|
||||
} else if (other instanceof net.minecraft.nbt.ByteTag) {
|
||||
return fromNative((net.minecraft.nbt.ByteTag) other);
|
||||
} else if (other instanceof net.minecraft.nbt.NbtByte) {
|
||||
return fromNative((net.minecraft.nbt.NbtByte) other);
|
||||
|
||||
} else if (other instanceof net.minecraft.nbt.ByteArrayTag) {
|
||||
return fromNative((net.minecraft.nbt.ByteArrayTag) other);
|
||||
} else if (other instanceof net.minecraft.nbt.NbtByteArray) {
|
||||
return fromNative((net.minecraft.nbt.NbtByteArray) other);
|
||||
|
||||
} else if (other instanceof net.minecraft.nbt.CompoundTag) {
|
||||
return fromNative((net.minecraft.nbt.CompoundTag) other);
|
||||
} else if (other instanceof net.minecraft.nbt.NbtCompound) {
|
||||
return fromNative((net.minecraft.nbt.NbtCompound) other);
|
||||
|
||||
} else if (other instanceof net.minecraft.nbt.FloatTag) {
|
||||
return fromNative((net.minecraft.nbt.FloatTag) other);
|
||||
} else if (other instanceof net.minecraft.nbt.NbtFloat) {
|
||||
return fromNative((net.minecraft.nbt.NbtFloat) other);
|
||||
|
||||
} else if (other instanceof net.minecraft.nbt.ShortTag) {
|
||||
return fromNative((net.minecraft.nbt.ShortTag) other);
|
||||
} else if (other instanceof net.minecraft.nbt.NbtShort) {
|
||||
return fromNative((net.minecraft.nbt.NbtShort) other);
|
||||
|
||||
} else if (other instanceof net.minecraft.nbt.DoubleTag) {
|
||||
return fromNative((net.minecraft.nbt.DoubleTag) other);
|
||||
} else if (other instanceof net.minecraft.nbt.NbtDouble) {
|
||||
return fromNative((net.minecraft.nbt.NbtDouble) other);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Can't convert other of type " + other.getClass().getCanonicalName());
|
||||
}
|
||||
}
|
||||
|
||||
public static IntArrayBinaryTag fromNative(net.minecraft.nbt.IntArrayTag other) {
|
||||
public static IntArrayBinaryTag fromNative(net.minecraft.nbt.NbtIntArray other) {
|
||||
int[] value = other.getIntArray();
|
||||
return IntArrayBinaryTag.of(Arrays.copyOf(value, value.length));
|
||||
}
|
||||
|
||||
public static ListBinaryTag fromNative(net.minecraft.nbt.ListTag other) {
|
||||
public static ListBinaryTag fromNative(net.minecraft.nbt.NbtList other) {
|
||||
other = other.copy();
|
||||
ListBinaryTag.Builder list = ListBinaryTag.builder();
|
||||
int tags = other.size();
|
||||
@ -206,35 +206,35 @@ public final class NBTConverter {
|
||||
return list.build();
|
||||
}
|
||||
|
||||
public static EndBinaryTag fromNative(net.minecraft.nbt.EndTag other) {
|
||||
public static EndBinaryTag fromNative(net.minecraft.nbt.NbtNull other) {
|
||||
return EndBinaryTag.get();
|
||||
}
|
||||
|
||||
public static LongBinaryTag fromNative(net.minecraft.nbt.LongTag other) {
|
||||
return LongBinaryTag.of(other.getLong());
|
||||
public static LongBinaryTag fromNative(net.minecraft.nbt.NbtLong other) {
|
||||
return LongBinaryTag.of(other.longValue());
|
||||
}
|
||||
|
||||
public static LongArrayBinaryTag fromNative(net.minecraft.nbt.LongArrayTag other) {
|
||||
public static LongArrayBinaryTag fromNative(net.minecraft.nbt.NbtLongArray other) {
|
||||
return LongArrayBinaryTag.of(other.getLongArray().clone());
|
||||
}
|
||||
|
||||
public static StringBinaryTag fromNative(net.minecraft.nbt.StringTag other) {
|
||||
public static StringBinaryTag fromNative(net.minecraft.nbt.NbtString other) {
|
||||
return StringBinaryTag.of(other.asString());
|
||||
}
|
||||
|
||||
public static IntBinaryTag fromNative(net.minecraft.nbt.IntTag other) {
|
||||
return IntBinaryTag.of(other.getInt());
|
||||
public static IntBinaryTag fromNative(net.minecraft.nbt.NbtInt other) {
|
||||
return IntBinaryTag.of(other.intValue());
|
||||
}
|
||||
|
||||
public static ByteBinaryTag fromNative(net.minecraft.nbt.ByteTag other) {
|
||||
return ByteBinaryTag.of(other.getByte());
|
||||
public static ByteBinaryTag fromNative(net.minecraft.nbt.NbtByte other) {
|
||||
return ByteBinaryTag.of(other.byteValue());
|
||||
}
|
||||
|
||||
public static ByteArrayBinaryTag fromNative(net.minecraft.nbt.ByteArrayTag other) {
|
||||
public static ByteArrayBinaryTag fromNative(net.minecraft.nbt.NbtByteArray other) {
|
||||
return ByteArrayBinaryTag.of(other.getByteArray().clone());
|
||||
}
|
||||
|
||||
public static CompoundBinaryTag fromNative(net.minecraft.nbt.CompoundTag other) {
|
||||
public static CompoundBinaryTag fromNative(net.minecraft.nbt.NbtCompound other) {
|
||||
Set<String> tags = other.getKeys();
|
||||
CompoundBinaryTag.Builder builder = CompoundBinaryTag.builder();
|
||||
for (String tagName : tags) {
|
||||
@ -243,16 +243,16 @@ public final class NBTConverter {
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
public static FloatBinaryTag fromNative(net.minecraft.nbt.FloatTag other) {
|
||||
return FloatBinaryTag.of(other.getFloat());
|
||||
public static FloatBinaryTag fromNative(net.minecraft.nbt.NbtFloat other) {
|
||||
return FloatBinaryTag.of(other.floatValue());
|
||||
}
|
||||
|
||||
public static ShortBinaryTag fromNative(net.minecraft.nbt.ShortTag other) {
|
||||
return ShortBinaryTag.of(other.getShort());
|
||||
public static ShortBinaryTag fromNative(net.minecraft.nbt.NbtShort other) {
|
||||
return ShortBinaryTag.of(other.shortValue());
|
||||
}
|
||||
|
||||
public static DoubleBinaryTag fromNative(net.minecraft.nbt.DoubleTag other) {
|
||||
return DoubleBinaryTag.of(other.getDouble());
|
||||
public static DoubleBinaryTag fromNative(net.minecraft.nbt.NbtDouble other) {
|
||||
return DoubleBinaryTag.of(other.doubleValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -23,12 +23,14 @@ import com.sk89q.worldedit.fabric.MutableBiomeArray;
|
||||
import com.sk89q.worldedit.internal.util.BiomeMath;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.source.BiomeArray;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(BiomeArray.class)
|
||||
public abstract class MixinBiomeArray implements MutableBiomeArray {
|
||||
|
||||
@Final
|
||||
@Shadow
|
||||
private Biome[] data;
|
||||
|
||||
|
@ -26,6 +26,7 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.level.storage.LevelStorage;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
@ -37,6 +38,7 @@ public abstract class MixinMinecraftServer implements Watchdog, ExtendedMinecraf
|
||||
|
||||
@Shadow
|
||||
private long timeReference;
|
||||
@Final
|
||||
@Shadow
|
||||
protected LevelStorage.Session session;
|
||||
|
||||
|
@ -34,7 +34,7 @@ import org.spongepowered.asm.mixin.injection.Slice;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@Mixin(value = WorldChunk.class)
|
||||
@Mixin(WorldChunk.class)
|
||||
public abstract class MixinWorldChunkSetBlockHook implements Chunk, ExtendedChunk {
|
||||
private boolean shouldUpdate = true;
|
||||
|
||||
@ -54,7 +54,7 @@ public abstract class MixinWorldChunkSetBlockHook implements Chunk, ExtendedChun
|
||||
@Redirect(
|
||||
method = "setBlockState",
|
||||
slice = @Slice(
|
||||
from = @At(value = "INVOKE", target = "Lnet/minecraft/block/entity/BlockEntity;resetBlock()V")
|
||||
from = @At(value = "INVOKE", target = "Lnet/minecraft/block/AbstractBlock$AbstractBlockState;isOf(Lnet/minecraft/block/Block;)Z")
|
||||
),
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;onBlockAdded(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Z)V", ordinal = 0)
|
||||
)
|
||||
|
@ -27,8 +27,8 @@ configurations.all {
|
||||
|
||||
dependencies {
|
||||
"api"(project(":worldedit-core"))
|
||||
"implementation"(enforcedPlatform("org.apache.logging.log4j:log4j-bom:2.11.2") {
|
||||
because("Forge provides Log4J at 2.11.2 (Mojang provides 2.8.1, but Forge bumps)")
|
||||
"implementation"(platform("org.apache.logging.log4j:log4j-bom:2.14.1") {
|
||||
because("Mojang provides Log4J at 2.14.1")
|
||||
})
|
||||
|
||||
"minecraft"("net.minecraftforge:forge:$minecraftVersion-$forgeVersion")
|
||||
@ -36,8 +36,8 @@ dependencies {
|
||||
|
||||
configure<UserDevExtension> {
|
||||
mappings(mapOf(
|
||||
"channel" to "snapshot",
|
||||
"version" to "20200514-$mappingsMinecraftVersion"
|
||||
"channel" to "snapshot",
|
||||
"version" to "20200514-$mappingsMinecraftVersion"
|
||||
))
|
||||
|
||||
accessTransformer(file("src/main/resources/META-INF/accesstransformer.cfg"))
|
||||
@ -45,8 +45,8 @@ configure<UserDevExtension> {
|
||||
runs {
|
||||
val runConfig = Action<RunConfig> {
|
||||
properties(mapOf(
|
||||
"forge.logging.markers" to "SCAN,REGISTRIES,REGISTRYDUMP",
|
||||
"forge.logging.console.level" to "debug"
|
||||
"forge.logging.markers" to "SCAN,REGISTRIES,REGISTRYDUMP",
|
||||
"forge.logging.console.level" to "debug"
|
||||
))
|
||||
workingDirectory = project.file("run").canonicalPath
|
||||
source(sourceSets["main"])
|
||||
@ -60,19 +60,79 @@ configure<UserDevExtension> {
|
||||
configure<BasePluginConvention> {
|
||||
archivesBaseName = "$archivesBaseName-mc$minecraftVersion"
|
||||
}
|
||||
|
||||
val javaComponent = components["java"] as AdhocComponentWithVariants
|
||||
javaComponent.withVariantsFromConfiguration(configurations["apiElements"]) {
|
||||
skip()
|
||||
}
|
||||
|
||||
javaComponent.withVariantsFromConfiguration(configurations["runtimeElements"]) {
|
||||
skip()
|
||||
}
|
||||
tasks.register<Jar>("deobfJar") {
|
||||
from(sourceSets["main"].output)
|
||||
archiveClassifier.set("dev")
|
||||
}
|
||||
|
||||
val reobfApiElements = configurations.register("reobfApiElements") {
|
||||
isVisible = false
|
||||
description = "Re-obfuscated API elements for libs"
|
||||
isCanBeResolved = false
|
||||
isCanBeConsumed = true
|
||||
attributes {
|
||||
attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage.JAVA_API))
|
||||
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category.LIBRARY))
|
||||
attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling.EXTERNAL))
|
||||
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements.JAR))
|
||||
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 8)
|
||||
}
|
||||
outgoing.artifact(tasks.named("jar")) {
|
||||
builtBy(project.provider { tasks.named("reobfJar") })
|
||||
}
|
||||
extendsFrom(configurations["api"])
|
||||
}
|
||||
|
||||
javaComponent.addVariantsFromConfiguration(reobfApiElements.get()) {
|
||||
mapToMavenScope("compile")
|
||||
}
|
||||
|
||||
val reobfRuntimeElements = configurations.register("reobfRuntimeElements") {
|
||||
isVisible = false
|
||||
description = "Re-obfuscated runtime elements for libs"
|
||||
isCanBeResolved = false
|
||||
isCanBeConsumed = true
|
||||
attributes {
|
||||
attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage.JAVA_RUNTIME))
|
||||
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category.LIBRARY))
|
||||
attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling.EXTERNAL))
|
||||
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements.JAR))
|
||||
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 8)
|
||||
}
|
||||
outgoing.artifact(tasks.named("jar")) {
|
||||
builtBy(project.provider { tasks.named("reobfJar") })
|
||||
}
|
||||
extendsFrom(configurations["reobfApiElements"])
|
||||
extendsFrom(configurations["runtimeClasspath"].copy { d -> d.group != "net.minecraftforge" })
|
||||
}
|
||||
|
||||
javaComponent.addVariantsFromConfiguration(reobfRuntimeElements.get()) {
|
||||
mapToMavenScope("runtime")
|
||||
}
|
||||
|
||||
configure<PublishingExtension> {
|
||||
publications.named<MavenPublication>("maven") {
|
||||
artifactId = the<BasePluginConvention>().archivesBaseName
|
||||
from(components["java"])
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<Copy>("processResources") {
|
||||
// this will ensure that this task is redone when the versions change.
|
||||
val properties = mapOf(
|
||||
"version" to project.ext["internalVersion"],
|
||||
"forgeVersion" to forgeVersion,
|
||||
"minecraftVersion" to minecraftVersion,
|
||||
"nextMajorMinecraftVersion" to nextMajorMinecraftVersion
|
||||
"version" to project.ext["internalVersion"],
|
||||
"forgeVersion" to forgeVersion,
|
||||
"minecraftVersion" to minecraftVersion,
|
||||
"nextMajorMinecraftVersion" to nextMajorMinecraftVersion
|
||||
)
|
||||
properties.forEach { (key, value) ->
|
||||
inputs.property(key, value)
|
||||
@ -106,28 +166,3 @@ afterEvaluate {
|
||||
mappings = tasks.getByName<GenerateSRG>("createMcpToSrg").output
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register<Jar>("deobfJar") {
|
||||
from(sourceSets["main"].output)
|
||||
archiveClassifier.set("dev")
|
||||
}
|
||||
|
||||
val deobfElements = configurations.register("deobfElements") {
|
||||
isVisible = false
|
||||
description = "De-obfuscated elements for libs"
|
||||
isCanBeResolved = false
|
||||
isCanBeConsumed = true
|
||||
attributes {
|
||||
attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage.JAVA_API))
|
||||
attribute(Category.CATEGORY_ATTRIBUTE, project.objects.named(Category.LIBRARY))
|
||||
attribute(Bundling.BUNDLING_ATTRIBUTE, project.objects.named(Bundling.EXTERNAL))
|
||||
attribute(LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE, project.objects.named(LibraryElements.JAR))
|
||||
attribute(TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE, 8)
|
||||
}
|
||||
outgoing.artifact(tasks.named("deobfJar"))
|
||||
}
|
||||
|
||||
val javaComponent = components["java"] as AdhocComponentWithVariants
|
||||
javaComponent.addVariantsFromConfiguration(deobfElements.get()) {
|
||||
mapToMavenScope("runtime")
|
||||
}
|
||||
|
@ -176,9 +176,8 @@ class ForgePlatform extends AbstractPlatform implements MultiUserPlatform {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerGameHooks() {
|
||||
// We registered the events already anyway, so we just 'turn them on'
|
||||
hookingEvents = true;
|
||||
public void setGameHooksEnabled(boolean enabled) {
|
||||
this.hookingEvents = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -23,9 +23,14 @@ import com.mojang.brigadier.ParseResults;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
import com.sk89q.worldedit.LocalSession;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import com.sk89q.worldedit.command.util.PermissionCondition;
|
||||
import com.sk89q.worldedit.event.platform.PlatformReadyEvent;
|
||||
import com.sk89q.worldedit.event.platform.PlatformUnreadyEvent;
|
||||
import com.sk89q.worldedit.event.platform.PlatformsRegisteredEvent;
|
||||
import com.sk89q.worldedit.event.platform.SessionIdleEvent;
|
||||
import com.sk89q.worldedit.extension.platform.Capability;
|
||||
import com.sk89q.worldedit.extension.platform.Platform;
|
||||
import com.sk89q.worldedit.extension.platform.PlatformManager;
|
||||
import com.sk89q.worldedit.forge.net.handler.InternalPacketHandler;
|
||||
import com.sk89q.worldedit.forge.net.handler.WECUIPacketHandler;
|
||||
import com.sk89q.worldedit.forge.net.packet.LeftClickAirEventMessage;
|
||||
@ -50,6 +55,7 @@ import net.minecraft.util.registry.Registry;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.CommandEvent;
|
||||
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickEmpty;
|
||||
@ -70,15 +76,20 @@ import net.minecraftforge.fml.network.FMLNetworkConstants;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.enginehub.piston.Command;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UncheckedIOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.sk89q.worldedit.forge.ForgeAdapter.adaptPlayer;
|
||||
import static com.sk89q.worldedit.internal.anvil.ChunkDeleter.DELCHUNKS_FILE_NAME;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
|
||||
/**
|
||||
* The Forge implementation of WorldEdit.
|
||||
@ -132,6 +143,8 @@ public class ForgeWorldEdit {
|
||||
}
|
||||
}
|
||||
|
||||
setupPlatform();
|
||||
|
||||
WECUIPacketHandler.init();
|
||||
InternalPacketHandler.init();
|
||||
|
||||
@ -143,6 +156,8 @@ public class ForgeWorldEdit {
|
||||
|
||||
WorldEdit.getInstance().getPlatformManager().register(platform);
|
||||
|
||||
config = new ForgeConfiguration(this);
|
||||
|
||||
// TODO if (ModList.get().isLoaded("sponge")) {
|
||||
// this.provider = new ForgePermissionsProvider.SpongePermissionsProvider();
|
||||
// } else {
|
||||
@ -189,6 +204,30 @@ public class ForgeWorldEdit {
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerCommands(RegisterCommandsEvent event) {
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformsRegisteredEvent());
|
||||
|
||||
PlatformManager manager = WorldEdit.getInstance().getPlatformManager();
|
||||
Platform commandsPlatform = manager.queryCapability(Capability.USER_COMMANDS);
|
||||
if (commandsPlatform != platform || !platform.isHookingEvents()) {
|
||||
// We're not in control of commands/events -- do not register.
|
||||
return;
|
||||
}
|
||||
|
||||
List<Command> commands = manager.getPlatformCommandManager().getCommandManager()
|
||||
.getAllCommands().collect(toList());
|
||||
for (Command command : commands) {
|
||||
CommandWrapper.register(event.getDispatcher(), command);
|
||||
Set<String> perms = command.getCondition().as(PermissionCondition.class)
|
||||
.map(PermissionCondition::getPermissions)
|
||||
.orElseGet(Collections::emptySet);
|
||||
if (!perms.isEmpty()) {
|
||||
perms.forEach(getPermissionsProvider()::registerPermission);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void serverAboutToStart(FMLServerAboutToStartEvent event) {
|
||||
final Path delChunks = workingDir.resolve(DELCHUNKS_FILE_NAME);
|
||||
@ -201,17 +240,15 @@ public class ForgeWorldEdit {
|
||||
public void serverStopping(FMLServerStoppingEvent event) {
|
||||
WorldEdit worldEdit = WorldEdit.getInstance();
|
||||
worldEdit.getSessionManager().unload();
|
||||
worldEdit.getPlatformManager().unregister(platform);
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformUnreadyEvent(platform));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void serverStarted(FMLServerStartedEvent event) {
|
||||
setupPlatform();
|
||||
setupRegistries(event.getServer());
|
||||
|
||||
config = new ForgeConfiguration(this);
|
||||
config.load();
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent());
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent(platform));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
@ -23,8 +23,8 @@ dependencies {
|
||||
api("org.spongepowered:spongeapi:7.1.0") {
|
||||
exclude(group = "org.slf4j", module = "slf4j-api")
|
||||
}
|
||||
implementation(enforcedPlatform("org.apache.logging.log4j:log4j-bom:2.8.1") {
|
||||
because("Sponge 8 provides Log4J at 2.8.1")
|
||||
implementation(platform("org.apache.logging.log4j:log4j-bom:2.14.1") {
|
||||
because("Sponge 8 (will?) provides Log4J at 2.14.1")
|
||||
})
|
||||
api("org.apache.logging.log4j:log4j-api")
|
||||
api("org.bstats:bstats-sponge:1.7")
|
||||
|
@ -159,9 +159,8 @@ class SpongePlatform extends AbstractPlatform implements MultiUserPlatform {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerGameHooks() {
|
||||
// We registered the events already anyway, so we just 'turn them on'
|
||||
hookingEvents = true;
|
||||
public void setGameHooksEnabled(boolean enabled) {
|
||||
this.hookingEvents = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -179,7 +179,7 @@ public class SpongeWorldEdit {
|
||||
|
||||
@Listener
|
||||
public void serverStarted(GameStartedServerEvent event) {
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent());
|
||||
WorldEdit.getInstance().getEventBus().post(new PlatformReadyEvent(platform));
|
||||
|
||||
loadAdapter();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user