[Fabric] Update to 1.17 (#1772)

This commit is contained in:
Octavia Togami 2021-06-08 19:18:24 -07:00 committed by GitHub
parent 95160027d9
commit 7676a2d54c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 331 additions and 316 deletions

View File

@ -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

View File

@ -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

View File

@ -41,7 +41,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:4.1.12")
implementation("net.fabricmc:fabric-loom:$loomVersion")
implementation("net.fabricmc:sponge-mixin:$mixinVersion")
implementation("org.enginehub.gradle:gradle-codecov-plugin:0.1.0")

View File

@ -4,5 +4,5 @@ version=7.2.6-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

View File

@ -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

View File

@ -2,7 +2,8 @@ rootProject.name = "worldedit"
include("worldedit-libs")
listOf("bukkit", "core", "forge", "sponge", "fabric", "cli").forEach {
// Forge has been removed until FG 5 is available.
listOf("bukkit", "core", "sponge", "fabric", "cli").forEach {
include("worldedit-libs:$it")
include("worldedit-$it")
}

View File

@ -25,8 +25,7 @@ dependencies {
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.
"implementation"(enforcedPlatform("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")

View File

@ -42,8 +42,8 @@ dependencies {
"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")
@ -61,7 +61,7 @@ dependencies {
"languageFiles"("${project.group}:worldedit-lang:7.2.1:68@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") {

View File

@ -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) {

View File

@ -53,13 +53,13 @@ public class VariedVectorGenerator {
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));
}
@ -86,7 +86,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;

View File

@ -55,7 +55,7 @@ public final class VariedVectors implements ArgumentsProvider, AnnotationConsume
/**
* If {@code true}, only provide vectors inside the range of Vanilla MC.
* This caps the Y value to 255.
* This sets the Y range [-2048, 2048).
*/
boolean capToVanilla() default false;

View File

@ -25,9 +25,9 @@ configure<LoomGradleExtension> {
accessWidener("src/main/resources/worldedit.accesswidener")
}
val minecraftVersion = "1.16.3"
val yarnMappings = "1.16.3+build.1:v2"
val loaderVersion = "0.10.8"
val minecraftVersion = "1.17"
val yarnMappings = "1.17+build.1:v2"
val loaderVersion = "0.11.3"
configurations.all {
resolutionStrategy {
@ -46,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"(enforcedPlatform("org.apache.logging.log4j:log4j-bom:2.14.1") {
because("Mojang provides Log4J at 2.14.1")
})
"minecraft"("com.mojang:minecraft:$minecraftVersion")
@ -55,7 +55,7 @@ dependencies {
"modImplementation"("net.fabricmc:fabric-loader:$loaderVersion")
// [1] declare fabric-api dependency...
"fabricApi"("net.fabricmc.fabric-api:fabric-api:0.29.3+1.16")
"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")

View File

@ -187,7 +187,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.getNbtData() != null) {
fabricCompound = NBTConverter.toNative(baseItemStack.getNbtData());
}
@ -197,7 +197,7 @@ public final class FabricAdapter {
}
public static BaseItemStack adapt(ItemStack itemStack) {
CompoundTag tag = NBTConverter.fromNative(itemStack.toTag(new net.minecraft.nbt.CompoundTag()));
CompoundTag tag = NBTConverter.fromNative(itemStack.writeNbt(new net.minecraft.nbt.NbtCompound()));
if (tag.getValue().isEmpty()) {
tag = null;
} else {

View File

@ -39,11 +39,11 @@ import com.sk89q.jnbt.CompoundTag;
import com.sk89q.worldedit.fabric.internal.NBTConverter;
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 CompoundTag fixChunk(CompoundTag 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 CompoundTag fixBlockEntity(CompoundTag 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 CompoundTag fixEntity(CompoundTag 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);

View File

@ -28,7 +28,7 @@ import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.util.Location;
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;
@ -51,8 +51,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()), NBTConverter.fromNative(tag));
} else {
return null;
@ -64,8 +64,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 {
@ -93,7 +93,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;
}

View File

@ -41,7 +41,7 @@ import net.minecraft.entity.projectile.ProjectileEntity;
import net.minecraft.entity.vehicle.AbstractMinecartEntity;
import net.minecraft.entity.vehicle.BoatEntity;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.village.Trader;
import net.minecraft.village.Merchant;
import static com.google.common.base.Preconditions.checkNotNull;
@ -121,7 +121,7 @@ public class FabricEntityProperties implements EntityProperties {
@Override
public boolean isNPC() {
return entity instanceof Npc || entity instanceof Trader;
return entity instanceof Npc || entity instanceof Merchant;
}
@Override

View File

@ -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,13 +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.Identifier;
import net.minecraft.util.math.BlockPos;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Locale;
import java.util.UUID;
@ -102,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
@ -119,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
@ -169,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) {
@ -209,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();
}
}
@ -231,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 CompoundTag nbtData = baseBlock.getNbtData();
final CompoundTag nbtData = ((BaseBlock) block).getNbtData();
if (nbtData != null) {
player.networkHandler.sendPacket(new BlockEntityUpdateS2CPacket(
new BlockPos(pos.getBlockX(), pos.getBlockY(), pos.getBlockZ()),

View File

@ -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.jnbt.CompoundTag;
@ -68,8 +67,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;
@ -84,6 +83,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;
@ -132,7 +132,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());
}
@ -330,7 +330,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(),
@ -383,7 +383,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;
}
@ -391,8 +391,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;
});
@ -428,8 +428,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(NBTConverter.fromNative(tag));
}
extent.setBlock(vec, state.toBaseBlock());
@ -468,10 +468,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;
@ -568,9 +568,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
@ -599,8 +604,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(NBTConverter.fromNative(tag));
} else {
return getBlock(position).toBaseBlock();
@ -633,15 +638,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
@ -650,10 +654,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
@ -668,11 +671,11 @@ public class FabricWorld extends AbstractWorld {
if (createdEntity != null) {
CompoundTag nativeTag = entity.getNbtData();
if (nativeTag != null) {
net.minecraft.nbt.CompoundTag tag = NBTConverter.toNative(entity.getNbtData());
net.minecraft.nbt.NbtCompound tag = NBTConverter.toNative(entity.getNbtData());
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());

View File

@ -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

View File

@ -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) {
}

View File

@ -27,7 +27,7 @@ import com.sk89q.worldedit.util.SideEffectSet;
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;
@ -104,13 +104,13 @@ public class FabricWorldNativeAccess implements WorldNativeAccess<WorldChunk, Bl
@Override
public boolean updateTileEntity(BlockPos position, com.sk89q.jnbt.CompoundTag 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;
}

View File

@ -50,7 +50,7 @@ public final class NBTConverter {
private NBTConverter() {
}
public static net.minecraft.nbt.Tag toNative(Tag tag) {
public static net.minecraft.nbt.NbtElement toNative(Tag tag) {
if (tag instanceof IntArrayTag) {
return toNative((IntArrayTag) tag);
@ -91,13 +91,13 @@ public final class NBTConverter {
}
}
public static net.minecraft.nbt.IntArrayTag toNative(IntArrayTag tag) {
public static net.minecraft.nbt.NbtIntArray toNative(IntArrayTag tag) {
int[] value = tag.getValue();
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(ListTag tag) {
net.minecraft.nbt.ListTag list = new net.minecraft.nbt.ListTag();
public static net.minecraft.nbt.NbtList toNative(ListTag tag) {
net.minecraft.nbt.NbtList list = new net.minecraft.nbt.NbtList();
for (Tag child : tag.getValue()) {
if (child instanceof EndTag) {
continue;
@ -107,100 +107,100 @@ public final class NBTConverter {
return list;
}
public static net.minecraft.nbt.LongTag toNative(LongTag tag) {
return net.minecraft.nbt.LongTag.of(tag.getValue());
public static net.minecraft.nbt.NbtLong toNative(LongTag tag) {
return net.minecraft.nbt.NbtLong.of(tag.getValue());
}
public static net.minecraft.nbt.LongArrayTag toNative(LongArrayTag tag) {
return new net.minecraft.nbt.LongArrayTag(tag.getValue().clone());
public static net.minecraft.nbt.NbtLongArray toNative(LongArrayTag tag) {
return new net.minecraft.nbt.NbtLongArray(tag.getValue().clone());
}
public static net.minecraft.nbt.StringTag toNative(StringTag tag) {
return net.minecraft.nbt.StringTag.of(tag.getValue());
public static net.minecraft.nbt.NbtString toNative(StringTag tag) {
return net.minecraft.nbt.NbtString.of(tag.getValue());
}
public static net.minecraft.nbt.IntTag toNative(IntTag tag) {
return net.minecraft.nbt.IntTag.of(tag.getValue());
public static net.minecraft.nbt.NbtInt toNative(IntTag tag) {
return net.minecraft.nbt.NbtInt.of(tag.getValue());
}
public static net.minecraft.nbt.ByteTag toNative(ByteTag tag) {
return net.minecraft.nbt.ByteTag.of(tag.getValue());
public static net.minecraft.nbt.NbtByte toNative(ByteTag tag) {
return net.minecraft.nbt.NbtByte.of(tag.getValue());
}
public static net.minecraft.nbt.ByteArrayTag toNative(ByteArrayTag tag) {
return new net.minecraft.nbt.ByteArrayTag(tag.getValue().clone());
public static net.minecraft.nbt.NbtByteArray toNative(ByteArrayTag tag) {
return new net.minecraft.nbt.NbtByteArray(tag.getValue().clone());
}
public static net.minecraft.nbt.CompoundTag toNative(CompoundTag tag) {
net.minecraft.nbt.CompoundTag compound = new net.minecraft.nbt.CompoundTag();
public static net.minecraft.nbt.NbtCompound toNative(CompoundTag tag) {
net.minecraft.nbt.NbtCompound compound = new net.minecraft.nbt.NbtCompound();
for (Entry<String, Tag> child : tag.getValue().entrySet()) {
compound.put(child.getKey(), toNative(child.getValue()));
}
return compound;
}
public static net.minecraft.nbt.FloatTag toNative(FloatTag tag) {
return net.minecraft.nbt.FloatTag.of(tag.getValue());
public static net.minecraft.nbt.NbtFloat toNative(FloatTag tag) {
return net.minecraft.nbt.NbtFloat.of(tag.getValue());
}
public static net.minecraft.nbt.ShortTag toNative(ShortTag tag) {
return net.minecraft.nbt.ShortTag.of(tag.getValue());
public static net.minecraft.nbt.NbtShort toNative(ShortTag tag) {
return net.minecraft.nbt.NbtShort.of(tag.getValue());
}
public static net.minecraft.nbt.DoubleTag toNative(DoubleTag tag) {
return net.minecraft.nbt.DoubleTag.of(tag.getValue());
public static net.minecraft.nbt.NbtDouble toNative(DoubleTag tag) {
return net.minecraft.nbt.NbtDouble.of(tag.getValue());
}
public static Tag fromNative(net.minecraft.nbt.Tag other) {
if (other instanceof net.minecraft.nbt.IntArrayTag) {
return fromNative((net.minecraft.nbt.IntArrayTag) other);
public static Tag 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 IntArrayTag fromNative(net.minecraft.nbt.IntArrayTag other) {
public static IntArrayTag fromNative(net.minecraft.nbt.NbtIntArray other) {
int[] value = other.getIntArray();
return new IntArrayTag(Arrays.copyOf(value, value.length));
}
public static ListTag fromNative(net.minecraft.nbt.ListTag other) {
public static ListTag fromNative(net.minecraft.nbt.NbtList other) {
other = other.copy();
List<Tag> list = new ArrayList<>();
Class<? extends Tag> listClass = StringTag.class;
@ -213,35 +213,35 @@ public final class NBTConverter {
return new ListTag(listClass, list);
}
public static EndTag fromNative(net.minecraft.nbt.EndTag other) {
public static EndTag fromNative(net.minecraft.nbt.NbtNull other) {
return new EndTag();
}
public static LongTag fromNative(net.minecraft.nbt.LongTag other) {
return new LongTag(other.getLong());
public static LongTag fromNative(net.minecraft.nbt.NbtLong other) {
return new LongTag(other.longValue());
}
public static LongArrayTag fromNative(net.minecraft.nbt.LongArrayTag other) {
public static LongArrayTag fromNative(net.minecraft.nbt.NbtLongArray other) {
return new LongArrayTag(other.getLongArray().clone());
}
public static StringTag fromNative(net.minecraft.nbt.StringTag other) {
public static StringTag fromNative(net.minecraft.nbt.NbtString other) {
return new StringTag(other.asString());
}
public static IntTag fromNative(net.minecraft.nbt.IntTag other) {
return new IntTag(other.getInt());
public static IntTag fromNative(net.minecraft.nbt.NbtInt other) {
return new IntTag(other.intValue());
}
public static ByteTag fromNative(net.minecraft.nbt.ByteTag other) {
return new ByteTag(other.getByte());
public static ByteTag fromNative(net.minecraft.nbt.NbtByte other) {
return new ByteTag(other.byteValue());
}
public static ByteArrayTag fromNative(net.minecraft.nbt.ByteArrayTag other) {
public static ByteArrayTag fromNative(net.minecraft.nbt.NbtByteArray other) {
return new ByteArrayTag(other.getByteArray().clone());
}
public static CompoundTag fromNative(net.minecraft.nbt.CompoundTag other) {
public static CompoundTag fromNative(net.minecraft.nbt.NbtCompound other) {
Set<String> tags = other.getKeys();
Map<String, Tag> map = new HashMap<>();
for (String tagName : tags) {
@ -250,16 +250,16 @@ public final class NBTConverter {
return new CompoundTag(map);
}
public static FloatTag fromNative(net.minecraft.nbt.FloatTag other) {
return new FloatTag(other.getFloat());
public static FloatTag fromNative(net.minecraft.nbt.NbtFloat other) {
return new FloatTag(other.floatValue());
}
public static ShortTag fromNative(net.minecraft.nbt.ShortTag other) {
return new ShortTag(other.getShort());
public static ShortTag fromNative(net.minecraft.nbt.NbtShort other) {
return new ShortTag(other.shortValue());
}
public static DoubleTag fromNative(net.minecraft.nbt.DoubleTag other) {
return new DoubleTag(other.getDouble());
public static DoubleTag fromNative(net.minecraft.nbt.NbtDouble other) {
return new DoubleTag(other.doubleValue());
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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)
)

View File

@ -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"(enforcedPlatform("org.apache.logging.log4j:log4j-bom:2.14.1") {
because("Mojang provides Log4J at 2.14.1")
})
"minecraft"("net.minecraftforge:forge:$minecraftVersion-$forgeVersion")

View File

@ -9,11 +9,11 @@ applyCommonConfiguration()
tasks.register<Jar>("jar") {
val remapFabric = project(":worldedit-fabric").tasks.named<RemapJarTask>("remapShadowJar")
dependsOn(
remapFabric,
project(":worldedit-forge").tasks.named("reobfShadowJar")
remapFabric//,
//project(":worldedit-forge").tasks.named("reobfShadowJar")
)
from(zipTree({remapFabric.get().archiveFile}))
from(zipTree({project(":worldedit-forge").tasks.getByName("shadowJar").outputs.files.singleFile}))
//from(zipTree({project(":worldedit-forge").tasks.getByName("shadowJar").outputs.files.singleFile}))
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveClassifier.set("dist")

View File

@ -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(enforcedPlatform("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")