From 2bdc38a4e65a28df2a8d3d206bf948afa59f249e Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sat, 29 Apr 2023 13:22:52 +0200
Subject: [PATCH 01/27] Fix passage entities
---
.../com/fastasyncworldedit/core/queue/IChunkExtent.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java
index ec61627986..093511868a 100644
--- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java
+++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java
@@ -2,6 +2,8 @@
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.DoubleTag;
+import com.sk89q.jnbt.FloatTag;
+import com.sk89q.jnbt.IntArrayTag;
import com.sk89q.jnbt.ListTag;
import com.sk89q.jnbt.NBTUtils;
import com.sk89q.jnbt.StringTag;
@@ -133,6 +135,12 @@ default Entity createEntity(Location location, BaseEntity entity, UUID uuid) {
posList.add(new DoubleTag(location.getY()));
posList.add(new DoubleTag(location.getZ()));
map.put("Pos", new ListTag(DoubleTag.class, posList));
+ if (!map.containsKey("Rotation")) {
+ List rotList = new ArrayList<>();
+ rotList.add(new FloatTag(location.getYaw()));
+ rotList.add(new FloatTag(location.getPitch()));
+ map.put("Rotation", new ListTag(FloatTag.class, rotList));
+ }
NBTUtils.addUUIDToMap(map, uuid);
From 3f009fe03e25dca1144a87dc1e2f2cf36283cdcd Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sat, 29 Apr 2023 16:01:50 +0200
Subject: [PATCH 02/27] Add dirty workaround to fix leashes when copy entities
1.19.4 ONLY
---
.../fawe/v1_19_R3/PaperweightGetBlocks.java | 23 +++++++++++-
.../worldedit/extent/clipboard/Clipboard.java | 35 ++++++++++++++++---
2 files changed, 52 insertions(+), 6 deletions(-)
diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java
index c715e5fc21..cb123fc225 100644
--- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java
@@ -35,12 +35,14 @@
import net.minecraft.core.Registry;
import net.minecraft.core.SectionPos;
import net.minecraft.nbt.IntTag;
+import net.minecraft.nbt.NbtUtils;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.BitStorage;
import net.minecraft.util.ZeroBitStorage;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.decoration.LeashFenceKnotEntity;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.entity.BeaconBlockEntity;
@@ -699,9 +701,10 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
syncTasks[1] = () -> {
Iterator iterator = entities.iterator();
+ Map leashRef = new HashMap<>();
while (iterator.hasNext()) {
final CompoundTag nativeTag = iterator.next();
- final Map entityTagMap = nativeTag.getValue();
+ final Map entityTagMap = new HashMap<>(nativeTag.getValue());
final StringTag idTag = (StringTag) entityTagMap.get("Id");
final ListTag posTag = (ListTag) entityTagMap.get("Pos");
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
@@ -722,12 +725,30 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
if (entity != null) {
final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
nativeTag);
+ if (entityTagMap.containsKey("Leash")) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("Leash")) ;
+ final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
+ if (leashEntity != null) {
+ tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
+ }
+ }
+
for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
tag.remove(name);
}
entity.load(tag);
entity.absMoveTo(x, y, z, yaw, pitch);
entity.setUUID(nativeTag.getUUID());
+ if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("OldPos")) ;
+ if (leashTag != null) {
+ leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
+ leashTag.getInt("Z")),
+ leashFenceKnotEntity);
+ }
+ }
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
LOGGER.warn(
"Error creating entity of type `{}` in world `{}` at location `{},{},{}`",
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
index 15d6365e7b..f98fe22581 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
@@ -27,6 +27,10 @@
import com.fastasyncworldedit.core.function.visitor.Order;
import com.fastasyncworldedit.core.queue.Filter;
import com.fastasyncworldedit.core.util.MaskTraverser;
+import com.fastasyncworldedit.core.util.NbtUtils;
+import com.sk89q.jnbt.CompoundTag;
+import com.sk89q.jnbt.IntTag;
+import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.EditSessionBuilder;
import com.sk89q.worldedit.WorldEdit;
@@ -47,6 +51,7 @@
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
+import com.sk89q.worldedit.world.entity.EntityTypes;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -57,6 +62,7 @@
import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.UUID;
@@ -406,11 +412,30 @@ default void paste(Extent extent, BlockVector3 to, boolean pasteAir, boolean pas
continue;
}
Location pos = entity.getLocation();
- Location newPos = new Location(pos.getExtent(), pos.getX() + entityOffsetX,
- pos.getY() + entityOffsetY, pos.getZ() + entityOffsetZ, pos.getYaw(),
- pos.getPitch()
- );
- extent.createEntity(newPos, entity.getState());
+ if (entity.getType().equals(EntityTypes.LEASH_KNOT)) {
+ var state = entity.getState();
+ var nbtData = new HashMap<>(state.getNbtData().getValue());
+ var posAsMap = new HashMap();
+ posAsMap.put("X", new IntTag(pos.getBlockX()));
+ posAsMap.put("Y", new IntTag(pos.getBlockY()));
+ posAsMap.put("Z", new IntTag(pos.getBlockZ()));
+ nbtData.put("OldPos", new CompoundTag(posAsMap));
+ state.setNbtData(new CompoundTag(nbtData));
+ Location newPos = new Location(pos.getExtent(), pos.getX() + entityOffsetX,
+ pos.getY() + entityOffsetY, pos.getZ() + entityOffsetZ, pos.getYaw(),
+ pos.getPitch()
+ );
+
+ extent.createEntity(newPos, state);
+ } else {
+ Location newPos = new Location(pos.getExtent(), pos.getX() + entityOffsetX,
+ pos.getY() + entityOffsetY, pos.getZ() + entityOffsetZ, pos.getYaw(),
+ pos.getPitch()
+ );
+
+ extent.createEntity(newPos, entity.getState());
+ }
+
}
}
}
From a1663accbae3e203ce31b7d59216297e47f2ea7f Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sat, 29 Apr 2023 16:08:42 +0200
Subject: [PATCH 03/27] Add 1.19.3 support for leash copy
---
.../fawe/v1_20_R1/PaperweightGetBlocks.java | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java
index 08d2f10690..033551985e 100644
--- a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java
@@ -31,12 +31,14 @@
import io.papermc.paper.event.block.BeaconDeactivatedEvent;
import net.minecraft.core.*;
import net.minecraft.nbt.IntTag;
+import net.minecraft.nbt.NbtUtils;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.BitStorage;
import net.minecraft.util.ZeroBitStorage;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.decoration.LeashFenceKnotEntity;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.entity.BeaconBlockEntity;
@@ -676,6 +678,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
syncTasks[1] = () -> {
Iterator iterator = entities.iterator();
+ Map leashRef = new HashMap<>();
while (iterator.hasNext()) {
final CompoundTag nativeTag = iterator.next();
final Map entityTagMap = nativeTag.getValue();
@@ -699,12 +702,29 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
if (entity != null) {
final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
nativeTag);
+ if (entityTagMap.containsKey("Leash")) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("Leash")) ;
+ final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
+ if (leashEntity != null) {
+ tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
+ }
+ }
for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
tag.remove(name);
}
entity.load(tag);
entity.absMoveTo(x, y, z, yaw, pitch);
entity.setUUID(nativeTag.getUUID());
+ if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("OldPos")) ;
+ if (leashTag != null) {
+ leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
+ leashTag.getInt("Z")),
+ leashFenceKnotEntity);
+ }
+ }
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
LOGGER.warn(
"Error creating entity of type `{}` in world `{}` at location `{},{},{}`",
From d6fc7a9a07d496a30c289ec85701cf2c8583513c Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sat, 29 Apr 2023 16:08:58 +0200
Subject: [PATCH 04/27] Add 1.18.X support for leash copy
---
.../fawe/v1_18_R2/PaperweightGetBlocks.java | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java
index 91a5abede7..ee081c5ae3 100644
--- a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java
@@ -36,12 +36,14 @@
import net.minecraft.core.Registry;
import net.minecraft.core.SectionPos;
import net.minecraft.nbt.IntTag;
+import net.minecraft.nbt.NbtUtils;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.BitStorage;
import net.minecraft.util.ZeroBitStorage;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.decoration.LeashFenceKnotEntity;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.entity.BeaconBlockEntity;
@@ -699,6 +701,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
syncTasks[1] = () -> {
Iterator iterator = entities.iterator();
+ Map leashRef = new HashMap<>();
while (iterator.hasNext()) {
final CompoundTag nativeTag = iterator.next();
final Map entityTagMap = nativeTag.getValue();
@@ -722,12 +725,29 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
if (entity != null) {
final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
nativeTag);
+ if (entityTagMap.containsKey("Leash")) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("Leash")) ;
+ final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
+ if (leashEntity != null) {
+ tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
+ }
+ }
for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
tag.remove(name);
}
entity.load(tag);
entity.absMoveTo(x, y, z, yaw, pitch);
entity.setUUID(nativeTag.getUUID());
+ if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("OldPos")) ;
+ if (leashTag != null) {
+ leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
+ leashTag.getInt("Z")),
+ leashFenceKnotEntity);
+ }
+ }
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
LOGGER.warn(
"Error creating entity of type `{}` in world `{}` at location `{},{},{}`",
From 4bd4712aaea8ce7bfdf8faf40fcdba4ca2da2693 Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sat, 29 Apr 2023 16:09:05 +0200
Subject: [PATCH 05/27] Add 1.17.1 support for leash copy
---
.../fawe/v1_17_R1_2/PaperweightGetBlocks.java | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java
index aab9e5aa73..eae60dec65 100644
--- a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java
@@ -32,12 +32,14 @@
import net.minecraft.core.Registry;
import net.minecraft.core.SectionPos;
import net.minecraft.nbt.IntTag;
+import net.minecraft.nbt.NbtUtils;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.BitStorage;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.decoration.LeashFenceKnotEntity;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.entity.BeaconBlockEntity;
@@ -648,6 +650,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
syncTasks[1] = () -> {
Iterator iterator = entities.iterator();
+ Map leashRef = new HashMap<>();
while (iterator.hasNext()) {
final CompoundTag nativeTag = iterator.next();
final Map entityTagMap = nativeTag.getValue();
@@ -671,12 +674,29 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
if (entity != null) {
final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
nativeTag);
+ if (entityTagMap.containsKey("Leash")) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("Leash")) ;
+ final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
+ if (leashEntity != null) {
+ tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
+ }
+ }
for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
tag.remove(name);
}
entity.load(tag);
entity.absMoveTo(x, y, z, yaw, pitch);
entity.setUUID(nativeTag.getUUID());
+ if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("OldPos")) ;
+ if (leashTag != null) {
+ leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
+ leashTag.getInt("Z")),
+ leashFenceKnotEntity);
+ }
+ }
if (!nmsWorld.addEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
LOGGER.warn(
"Error creating entity of type `{}` in world `{}` at location `{},{},{}`",
From 8a3a0a67a65088b24c56c82e3cfce35593a70071 Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sun, 30 Apr 2023 18:58:02 +0200
Subject: [PATCH 06/27] Improve formatting
---
.../impl/fawe/v1_19_R3/PaperweightGetBlocks.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java
index cb123fc225..820864843b 100644
--- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java
@@ -727,7 +727,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
nativeTag);
if (entityTagMap.containsKey("Leash")) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("Leash")) ;
+ entityTagMap.get("Leash"));
final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
if (leashEntity != null) {
tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
@@ -742,11 +742,16 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
entity.setUUID(nativeTag.getUUID());
if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("OldPos")) ;
+ entityTagMap.get("OldPos"));
if (leashTag != null) {
- leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
- leashTag.getInt("Z")),
- leashFenceKnotEntity);
+ leashRef.put(
+ new BlockPos(
+ leashTag.getInt("X"),
+ leashTag.getInt("Y"),
+ leashTag.getInt("Z")
+ ),
+ leashFenceKnotEntity
+ );
}
}
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
From d349cc7e028ee7aa4f1d110b1b876a900a4deea3 Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sun, 30 Apr 2023 18:58:06 +0200
Subject: [PATCH 07/27] Improve formatting
---
.../impl/fawe/v1_20_R1/PaperweightGetBlocks.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java
index 033551985e..11100615c3 100644
--- a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java
@@ -704,7 +704,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
nativeTag);
if (entityTagMap.containsKey("Leash")) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("Leash")) ;
+ entityTagMap.get("Leash"));
final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
if (leashEntity != null) {
tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
@@ -718,11 +718,16 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
entity.setUUID(nativeTag.getUUID());
if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("OldPos")) ;
+ entityTagMap.get("OldPos"));
if (leashTag != null) {
- leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
- leashTag.getInt("Z")),
- leashFenceKnotEntity);
+ leashRef.put(
+ new BlockPos(
+ leashTag.getInt("X"),
+ leashTag.getInt("Y"),
+ leashTag.getInt("Z")
+ ),
+ leashFenceKnotEntity
+ );
}
}
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
From 6c0da37e143d0b62c425e51615c95a635bb80b86 Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sun, 30 Apr 2023 19:02:02 +0200
Subject: [PATCH 08/27] Improve formatting
---
.../impl/fawe/v1_18_R2/PaperweightGetBlocks.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java
index ee081c5ae3..fed1e34575 100644
--- a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java
@@ -727,7 +727,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
nativeTag);
if (entityTagMap.containsKey("Leash")) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("Leash")) ;
+ entityTagMap.get("Leash"));
final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
if (leashEntity != null) {
tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
@@ -741,11 +741,16 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
entity.setUUID(nativeTag.getUUID());
if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("OldPos")) ;
+ entityTagMap.get("OldPos"));
if (leashTag != null) {
- leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
- leashTag.getInt("Z")),
- leashFenceKnotEntity);
+ leashRef.put(
+ new BlockPos(
+ leashTag.getInt("X"),
+ leashTag.getInt("Y"),
+ leashTag.getInt("Z")
+ ),
+ leashFenceKnotEntity
+ );
}
}
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
From cf5e84f40629e484229e9f5e155511c1915e62eb Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sun, 30 Apr 2023 19:03:04 +0200
Subject: [PATCH 09/27] Improve formatting
---
.../fawe/v1_17_R1_2/PaperweightGetBlocks.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java
index eae60dec65..36c6b84957 100644
--- a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java
@@ -676,7 +676,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
nativeTag);
if (entityTagMap.containsKey("Leash")) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("Leash")) ;
+ entityTagMap.get("Leash"));
final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
if (leashEntity != null) {
tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
@@ -690,11 +690,16 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
entity.setUUID(nativeTag.getUUID());
if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("OldPos")) ;
+ entityTagMap.get("OldPos"));
if (leashTag != null) {
- leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
- leashTag.getInt("Z")),
- leashFenceKnotEntity);
+ leashRef.put(
+ new BlockPos(
+ leashTag.getInt("X"),
+ leashTag.getInt("Y"),
+ leashTag.getInt("Z")
+ ),
+ leashFenceKnotEntity
+ );
}
}
if (!nmsWorld.addEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
From c5d30316ef29091c294ad86b2a7e5ed2fd7453d0 Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sat, 29 Apr 2023 13:22:52 +0200
Subject: [PATCH 10/27] Fix passage entities
---
.../com/fastasyncworldedit/core/queue/IChunkExtent.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java
index ec61627986..093511868a 100644
--- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java
+++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java
@@ -2,6 +2,8 @@
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.DoubleTag;
+import com.sk89q.jnbt.FloatTag;
+import com.sk89q.jnbt.IntArrayTag;
import com.sk89q.jnbt.ListTag;
import com.sk89q.jnbt.NBTUtils;
import com.sk89q.jnbt.StringTag;
@@ -133,6 +135,12 @@ default Entity createEntity(Location location, BaseEntity entity, UUID uuid) {
posList.add(new DoubleTag(location.getY()));
posList.add(new DoubleTag(location.getZ()));
map.put("Pos", new ListTag(DoubleTag.class, posList));
+ if (!map.containsKey("Rotation")) {
+ List rotList = new ArrayList<>();
+ rotList.add(new FloatTag(location.getYaw()));
+ rotList.add(new FloatTag(location.getPitch()));
+ map.put("Rotation", new ListTag(FloatTag.class, rotList));
+ }
NBTUtils.addUUIDToMap(map, uuid);
From c39d187f50b59d91d3677d5eb7b6f3465429a529 Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sat, 29 Apr 2023 16:01:50 +0200
Subject: [PATCH 11/27] Add dirty workaround to fix leashes when copy entities
1.19.4 ONLY
---
.../fawe/v1_19_R3/PaperweightGetBlocks.java | 23 +++++++++++-
.../worldedit/extent/clipboard/Clipboard.java | 35 ++++++++++++++++---
2 files changed, 52 insertions(+), 6 deletions(-)
diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java
index 60695c1e86..7f6178f0d1 100644
--- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java
@@ -35,12 +35,14 @@
import net.minecraft.core.Registry;
import net.minecraft.core.SectionPos;
import net.minecraft.nbt.IntTag;
+import net.minecraft.nbt.NbtUtils;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.BitStorage;
import net.minecraft.util.ZeroBitStorage;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.decoration.LeashFenceKnotEntity;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.entity.BeaconBlockEntity;
@@ -727,9 +729,10 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
syncTasks[1] = () -> {
Iterator iterator = entities.iterator();
+ Map leashRef = new HashMap<>();
while (iterator.hasNext()) {
final CompoundTag nativeTag = iterator.next();
- final Map entityTagMap = nativeTag.getValue();
+ final Map entityTagMap = new HashMap<>(nativeTag.getValue());
final StringTag idTag = (StringTag) entityTagMap.get("Id");
final ListTag posTag = (ListTag) entityTagMap.get("Pos");
final ListTag rotTag = (ListTag) entityTagMap.get("Rotation");
@@ -750,12 +753,30 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
if (entity != null) {
final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
nativeTag);
+ if (entityTagMap.containsKey("Leash")) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("Leash")) ;
+ final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
+ if (leashEntity != null) {
+ tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
+ }
+ }
+
for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
tag.remove(name);
}
entity.load(tag);
entity.absMoveTo(x, y, z, yaw, pitch);
entity.setUUID(nativeTag.getUUID());
+ if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("OldPos")) ;
+ if (leashTag != null) {
+ leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
+ leashTag.getInt("Z")),
+ leashFenceKnotEntity);
+ }
+ }
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
LOGGER.warn(
"Error creating entity of type `{}` in world `{}` at location `{},{},{}`",
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
index 15d6365e7b..f98fe22581 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
@@ -27,6 +27,10 @@
import com.fastasyncworldedit.core.function.visitor.Order;
import com.fastasyncworldedit.core.queue.Filter;
import com.fastasyncworldedit.core.util.MaskTraverser;
+import com.fastasyncworldedit.core.util.NbtUtils;
+import com.sk89q.jnbt.CompoundTag;
+import com.sk89q.jnbt.IntTag;
+import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.EditSessionBuilder;
import com.sk89q.worldedit.WorldEdit;
@@ -47,6 +51,7 @@
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
+import com.sk89q.worldedit.world.entity.EntityTypes;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -57,6 +62,7 @@
import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.UUID;
@@ -406,11 +412,30 @@ default void paste(Extent extent, BlockVector3 to, boolean pasteAir, boolean pas
continue;
}
Location pos = entity.getLocation();
- Location newPos = new Location(pos.getExtent(), pos.getX() + entityOffsetX,
- pos.getY() + entityOffsetY, pos.getZ() + entityOffsetZ, pos.getYaw(),
- pos.getPitch()
- );
- extent.createEntity(newPos, entity.getState());
+ if (entity.getType().equals(EntityTypes.LEASH_KNOT)) {
+ var state = entity.getState();
+ var nbtData = new HashMap<>(state.getNbtData().getValue());
+ var posAsMap = new HashMap();
+ posAsMap.put("X", new IntTag(pos.getBlockX()));
+ posAsMap.put("Y", new IntTag(pos.getBlockY()));
+ posAsMap.put("Z", new IntTag(pos.getBlockZ()));
+ nbtData.put("OldPos", new CompoundTag(posAsMap));
+ state.setNbtData(new CompoundTag(nbtData));
+ Location newPos = new Location(pos.getExtent(), pos.getX() + entityOffsetX,
+ pos.getY() + entityOffsetY, pos.getZ() + entityOffsetZ, pos.getYaw(),
+ pos.getPitch()
+ );
+
+ extent.createEntity(newPos, state);
+ } else {
+ Location newPos = new Location(pos.getExtent(), pos.getX() + entityOffsetX,
+ pos.getY() + entityOffsetY, pos.getZ() + entityOffsetZ, pos.getYaw(),
+ pos.getPitch()
+ );
+
+ extent.createEntity(newPos, entity.getState());
+ }
+
}
}
}
From de6612b8fe15bc7c80d8a09b4388ebf920099ab2 Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sat, 29 Apr 2023 16:08:42 +0200
Subject: [PATCH 12/27] Add 1.19.3 support for leash copy
---
.../fawe/v1_20_R1/PaperweightGetBlocks.java | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java
index 67bcd6902c..94d2e8e7fa 100644
--- a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java
@@ -35,12 +35,14 @@
import net.minecraft.core.Registry;
import net.minecraft.core.SectionPos;
import net.minecraft.nbt.IntTag;
+import net.minecraft.nbt.NbtUtils;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.BitStorage;
import net.minecraft.util.ZeroBitStorage;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.decoration.LeashFenceKnotEntity;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.entity.BeaconBlockEntity;
@@ -725,6 +727,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
syncTasks[1] = () -> {
Iterator iterator = entities.iterator();
+ Map leashRef = new HashMap<>();
while (iterator.hasNext()) {
final CompoundTag nativeTag = iterator.next();
final Map entityTagMap = nativeTag.getValue();
@@ -748,12 +751,29 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
if (entity != null) {
final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
nativeTag);
+ if (entityTagMap.containsKey("Leash")) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("Leash")) ;
+ final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
+ if (leashEntity != null) {
+ tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
+ }
+ }
for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
tag.remove(name);
}
entity.load(tag);
entity.absMoveTo(x, y, z, yaw, pitch);
entity.setUUID(nativeTag.getUUID());
+ if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("OldPos")) ;
+ if (leashTag != null) {
+ leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
+ leashTag.getInt("Z")),
+ leashFenceKnotEntity);
+ }
+ }
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
LOGGER.warn(
"Error creating entity of type `{}` in world `{}` at location `{},{},{}`",
From 46ca066e0630fdd2e70dbe2657ac13210568b650 Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sat, 29 Apr 2023 16:08:58 +0200
Subject: [PATCH 13/27] Add 1.18.X support for leash copy
---
.../fawe/v1_18_R2/PaperweightGetBlocks.java | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java
index 81580910c4..c313cd1f3e 100644
--- a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java
@@ -35,12 +35,14 @@
import net.minecraft.core.Registry;
import net.minecraft.core.SectionPos;
import net.minecraft.nbt.IntTag;
+import net.minecraft.nbt.NbtUtils;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.BitStorage;
import net.minecraft.util.ZeroBitStorage;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.decoration.LeashFenceKnotEntity;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.entity.BeaconBlockEntity;
@@ -724,6 +726,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
syncTasks[1] = () -> {
Iterator iterator = entities.iterator();
+ Map leashRef = new HashMap<>();
while (iterator.hasNext()) {
final CompoundTag nativeTag = iterator.next();
final Map entityTagMap = nativeTag.getValue();
@@ -747,12 +750,29 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
if (entity != null) {
final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
nativeTag);
+ if (entityTagMap.containsKey("Leash")) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("Leash")) ;
+ final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
+ if (leashEntity != null) {
+ tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
+ }
+ }
for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
tag.remove(name);
}
entity.load(tag);
entity.absMoveTo(x, y, z, yaw, pitch);
entity.setUUID(nativeTag.getUUID());
+ if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("OldPos")) ;
+ if (leashTag != null) {
+ leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
+ leashTag.getInt("Z")),
+ leashFenceKnotEntity);
+ }
+ }
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
LOGGER.warn(
"Error creating entity of type `{}` in world `{}` at location `{},{},{}`",
From ee3a0796ac3182fa9740675577bbbb6948881e68 Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sat, 29 Apr 2023 16:09:05 +0200
Subject: [PATCH 14/27] Add 1.17.1 support for leash copy
---
.../fawe/v1_17_R1_2/PaperweightGetBlocks.java | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java
index a93437c1aa..61c53cf95e 100644
--- a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java
@@ -32,12 +32,14 @@
import net.minecraft.core.Registry;
import net.minecraft.core.SectionPos;
import net.minecraft.nbt.IntTag;
+import net.minecraft.nbt.NbtUtils;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.BitStorage;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.decoration.LeashFenceKnotEntity;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.entity.BeaconBlockEntity;
@@ -676,6 +678,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
syncTasks[1] = () -> {
Iterator iterator = entities.iterator();
+ Map leashRef = new HashMap<>();
while (iterator.hasNext()) {
final CompoundTag nativeTag = iterator.next();
final Map entityTagMap = nativeTag.getValue();
@@ -699,12 +702,29 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
if (entity != null) {
final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
nativeTag);
+ if (entityTagMap.containsKey("Leash")) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("Leash")) ;
+ final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
+ if (leashEntity != null) {
+ tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
+ }
+ }
for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
tag.remove(name);
}
entity.load(tag);
entity.absMoveTo(x, y, z, yaw, pitch);
entity.setUUID(nativeTag.getUUID());
+ if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("OldPos")) ;
+ if (leashTag != null) {
+ leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
+ leashTag.getInt("Z")),
+ leashFenceKnotEntity);
+ }
+ }
if (!nmsWorld.addEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
LOGGER.warn(
"Error creating entity of type `{}` in world `{}` at location `{},{},{}`",
From 0593a2a09f1d037b774f746470849fc763ca475d Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sun, 30 Apr 2023 18:58:02 +0200
Subject: [PATCH 15/27] Improve formatting
---
.../impl/fawe/v1_19_R3/PaperweightGetBlocks.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java
index 7f6178f0d1..4b19291576 100644
--- a/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_19_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_19_R3/PaperweightGetBlocks.java
@@ -755,7 +755,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
nativeTag);
if (entityTagMap.containsKey("Leash")) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("Leash")) ;
+ entityTagMap.get("Leash"));
final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
if (leashEntity != null) {
tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
@@ -770,11 +770,16 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
entity.setUUID(nativeTag.getUUID());
if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("OldPos")) ;
+ entityTagMap.get("OldPos"));
if (leashTag != null) {
- leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
- leashTag.getInt("Z")),
- leashFenceKnotEntity);
+ leashRef.put(
+ new BlockPos(
+ leashTag.getInt("X"),
+ leashTag.getInt("Y"),
+ leashTag.getInt("Z")
+ ),
+ leashFenceKnotEntity
+ );
}
}
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
From 40b57ca4adce31dc307eac9d8471b90a35cfd6db Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sun, 30 Apr 2023 18:58:06 +0200
Subject: [PATCH 16/27] Improve formatting
---
.../impl/fawe/v1_20_R1/PaperweightGetBlocks.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java
index 94d2e8e7fa..6864f86684 100644
--- a/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_20/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R1/PaperweightGetBlocks.java
@@ -753,7 +753,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
nativeTag);
if (entityTagMap.containsKey("Leash")) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("Leash")) ;
+ entityTagMap.get("Leash"));
final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
if (leashEntity != null) {
tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
@@ -767,11 +767,16 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
entity.setUUID(nativeTag.getUUID());
if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("OldPos")) ;
+ entityTagMap.get("OldPos"));
if (leashTag != null) {
- leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
- leashTag.getInt("Z")),
- leashFenceKnotEntity);
+ leashRef.put(
+ new BlockPos(
+ leashTag.getInt("X"),
+ leashTag.getInt("Y"),
+ leashTag.getInt("Z")
+ ),
+ leashFenceKnotEntity
+ );
}
}
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
From 63bc25d3ebde59658f75b54c2bdd91816c552371 Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sun, 30 Apr 2023 19:02:02 +0200
Subject: [PATCH 17/27] Improve formatting
---
.../impl/fawe/v1_18_R2/PaperweightGetBlocks.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java
index c313cd1f3e..d58ed09aeb 100644
--- a/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_18_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_18_R2/PaperweightGetBlocks.java
@@ -752,7 +752,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
nativeTag);
if (entityTagMap.containsKey("Leash")) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("Leash")) ;
+ entityTagMap.get("Leash"));
final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
if (leashEntity != null) {
tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
@@ -766,11 +766,16 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
entity.setUUID(nativeTag.getUUID());
if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("OldPos")) ;
+ entityTagMap.get("OldPos"));
if (leashTag != null) {
- leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
- leashTag.getInt("Z")),
- leashFenceKnotEntity);
+ leashRef.put(
+ new BlockPos(
+ leashTag.getInt("X"),
+ leashTag.getInt("Y"),
+ leashTag.getInt("Z")
+ ),
+ leashFenceKnotEntity
+ );
}
}
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
From 910ccb741ebcbf3fc52e061176e508c6ba8499aa Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sun, 30 Apr 2023 19:03:04 +0200
Subject: [PATCH 18/27] Improve formatting
---
.../fawe/v1_17_R1_2/PaperweightGetBlocks.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java
index 61c53cf95e..cffe5f310f 100644
--- a/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_17_1/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_17_R1_2/PaperweightGetBlocks.java
@@ -704,7 +704,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
nativeTag);
if (entityTagMap.containsKey("Leash")) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("Leash")) ;
+ entityTagMap.get("Leash"));
final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
if (leashEntity != null) {
tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
@@ -718,11 +718,16 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
entity.setUUID(nativeTag.getUUID());
if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("OldPos")) ;
+ entityTagMap.get("OldPos"));
if (leashTag != null) {
- leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
- leashTag.getInt("Z")),
- leashFenceKnotEntity);
+ leashRef.put(
+ new BlockPos(
+ leashTag.getInt("X"),
+ leashTag.getInt("Y"),
+ leashTag.getInt("Z")
+ ),
+ leashFenceKnotEntity
+ );
}
}
if (!nmsWorld.addEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
From fbad83212b41b0ec59a10fb4692b28f7e8c49d70 Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sat, 29 Apr 2023 13:22:52 +0200
Subject: [PATCH 19/27] Fix passage entities
---
.../com/fastasyncworldedit/core/queue/IChunkExtent.java | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java
index 534a96fac9..137775fb95 100644
--- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java
+++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/queue/IChunkExtent.java
@@ -2,6 +2,8 @@
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.DoubleTag;
+import com.sk89q.jnbt.FloatTag;
+import com.sk89q.jnbt.IntArrayTag;
import com.sk89q.jnbt.ListTag;
import com.sk89q.jnbt.NBTUtils;
import com.sk89q.jnbt.StringTag;
@@ -133,6 +135,12 @@ default Entity createEntity(Location location, BaseEntity entity, UUID uuid) {
posList.add(new DoubleTag(location.y()));
posList.add(new DoubleTag(location.z()));
map.put("Pos", new ListTag(DoubleTag.class, posList));
+ if (!map.containsKey("Rotation")) {
+ List rotList = new ArrayList<>();
+ rotList.add(new FloatTag(location.getYaw()));
+ rotList.add(new FloatTag(location.getPitch()));
+ map.put("Rotation", new ListTag(FloatTag.class, rotList));
+ }
NBTUtils.addUUIDToMap(map, uuid);
From f547d140c53829ce93ae85a848503b3b19d62f5f Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sat, 29 Apr 2023 16:01:50 +0200
Subject: [PATCH 20/27] Add dirty workaround to fix leashes when copy entities
1.19.4 ONLY
---
.../fawe/v1_20_R3/PaperweightGetBlocks.java | 21 ++++++++++++
.../worldedit/extent/clipboard/Clipboard.java | 33 ++++++++++++++++---
2 files changed, 49 insertions(+), 5 deletions(-)
diff --git a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightGetBlocks.java
index d2d18968aa..c21ef3fb6e 100644
--- a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightGetBlocks.java
@@ -35,12 +35,14 @@
import net.minecraft.core.Registry;
import net.minecraft.core.SectionPos;
import net.minecraft.nbt.IntTag;
+import net.minecraft.nbt.NbtUtils;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.BitStorage;
import net.minecraft.util.ZeroBitStorage;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.decoration.LeashFenceKnotEntity;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.entity.BeaconBlockEntity;
@@ -735,6 +737,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
syncTasks[1] = () -> {
Iterator iterator = entities.iterator();
+ Map leashRef = new HashMap<>();
while (iterator.hasNext()) {
final CompoundTag nativeTag = iterator.next();
final Map> entityTagMap = nativeTag.getValue();
@@ -758,12 +761,30 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
if (entity != null) {
final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
nativeTag);
+ if (entityTagMap.containsKey("Leash")) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("Leash")) ;
+ final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
+ if (leashEntity != null) {
+ tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
+ }
+ }
+
for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
tag.remove(name);
}
entity.load(tag);
entity.absMoveTo(x, y, z, yaw, pitch);
entity.setUUID(nativeTag.getUUID());
+ if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("OldPos")) ;
+ if (leashTag != null) {
+ leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
+ leashTag.getInt("Z")),
+ leashFenceKnotEntity);
+ }
+ }
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
LOGGER.warn(
"Error creating entity of type `{}` in world `{}` at location `{},{},{}`",
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
index cac9f4a7b2..1d6011b9fd 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
@@ -27,6 +27,9 @@
import com.fastasyncworldedit.core.function.visitor.Order;
import com.fastasyncworldedit.core.queue.Filter;
import com.fastasyncworldedit.core.util.MaskTraverser;
+import com.sk89q.jnbt.CompoundTag;
+import com.sk89q.jnbt.IntTag;
+import com.sk89q.jnbt.Tag;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.EditSessionBuilder;
import com.sk89q.worldedit.WorldEdit;
@@ -49,6 +52,7 @@
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
+import com.sk89q.worldedit.world.entity.EntityTypes;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -59,6 +63,7 @@
import java.io.IOException;
import java.io.OutputStream;
import java.net.URI;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.UUID;
@@ -428,11 +433,29 @@ default void paste(Extent extent, BlockVector3 to, boolean pasteAir, boolean pas
continue;
}
Location pos = entity.getLocation();
- Location newPos = new Location(pos.getExtent(), pos.x() + entityOffsetX,
- pos.y() + entityOffsetY, pos.z() + entityOffsetZ, pos.getYaw(),
- pos.getPitch()
- );
- extent.createEntity(newPos, entity.getState());
+ if (entity.getType().equals(EntityTypes.LEASH_KNOT)) {
+ var state = entity.getState();
+ var nbtData = new HashMap<>(state.getNbtData().getValue());
+ var posAsMap = new HashMap();
+ posAsMap.put("X", new IntTag(pos.getBlockX()));
+ posAsMap.put("Y", new IntTag(pos.getBlockY()));
+ posAsMap.put("Z", new IntTag(pos.getBlockZ()));
+ nbtData.put("OldPos", new CompoundTag(posAsMap));
+ state.setNbtData(new CompoundTag(nbtData));
+ Location newPos = new Location(pos.getExtent(), pos.x() + entityOffsetX,
+ pos.y() + entityOffsetY, pos.z() + entityOffsetZ, pos.getYaw(),
+ pos.getPitch()
+ );
+
+ extent.createEntity(newPos, state);
+ } else {
+ Location newPos = new Location(pos.getExtent(), pos.x() + entityOffsetX,
+ pos.y() + entityOffsetY, pos.z() + entityOffsetZ, pos.getYaw(),
+ pos.getPitch()
+ );
+
+ extent.createEntity(newPos, entity.getState());
+ }
}
}
}
From cec7a1c4f4af15fd824b7f7f020fb57d29890c14 Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sat, 29 Apr 2023 16:08:42 +0200
Subject: [PATCH 21/27] Add 1.19.3 support for leash copy
---
.../fawe/v1_20_R4/PaperweightGetBlocks.java | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightGetBlocks.java
index 47466ac5e7..dc9bf0d6f9 100644
--- a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightGetBlocks.java
@@ -35,6 +35,7 @@
import net.minecraft.core.Registry;
import net.minecraft.core.SectionPos;
import net.minecraft.nbt.IntTag;
+import net.minecraft.nbt.NbtUtils;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
@@ -42,6 +43,7 @@
import net.minecraft.util.ZeroBitStorage;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.decoration.LeashFenceKnotEntity;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.entity.BeaconBlockEntity;
@@ -736,6 +738,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
syncTasks[1] = () -> {
Iterator iterator = entities.iterator();
+ Map leashRef = new HashMap<>();
while (iterator.hasNext()) {
final CompoundTag nativeTag = iterator.next();
final Map> entityTagMap = nativeTag.getValue();
@@ -759,12 +762,29 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
if (entity != null) {
final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
nativeTag);
+ if (entityTagMap.containsKey("Leash")) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("Leash")) ;
+ final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
+ if (leashEntity != null) {
+ tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
+ }
+ }
for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
tag.remove(name);
}
entity.load(tag);
entity.absMoveTo(x, y, z, yaw, pitch);
entity.setUUID(nativeTag.getUUID());
+ if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("OldPos")) ;
+ if (leashTag != null) {
+ leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
+ leashTag.getInt("Z")),
+ leashFenceKnotEntity);
+ }
+ }
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
LOGGER.warn(
"Error creating entity of type `{}` in world `{}` at location `{},{},{}`",
From 2263aa5c136e8408f257a6e9fc054adfdc08ba8f Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sat, 29 Apr 2023 16:08:58 +0200
Subject: [PATCH 22/27] Add 1.18.X support for leash copy
---
.../fawe/v1_21_R1/PaperweightGetBlocks.java | 20 +++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightGetBlocks.java
index bdd9d0648c..70ea4e59e3 100644
--- a/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightGetBlocks.java
@@ -36,12 +36,14 @@
import net.minecraft.core.SectionPos;
import net.minecraft.nbt.IntTag;
import net.minecraft.server.dedicated.DedicatedServer;
+import net.minecraft.nbt.NbtUtils;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.BitStorage;
import net.minecraft.util.ZeroBitStorage;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.decoration.LeashFenceKnotEntity;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.entity.BeaconBlockEntity;
@@ -730,6 +732,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
syncTasks[1] = () -> {
Iterator iterator = entities.iterator();
+ Map leashRef = new HashMap<>();
while (iterator.hasNext()) {
final CompoundTag nativeTag = iterator.next();
final Map> entityTagMap = nativeTag.getValue();
@@ -753,12 +756,29 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
if (entity != null) {
final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
nativeTag);
+ if (entityTagMap.containsKey("Leash")) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("Leash")) ;
+ final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
+ if (leashEntity != null) {
+ tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
+ }
+ }
for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
tag.remove(name);
}
entity.load(tag);
entity.absMoveTo(x, y, z, yaw, pitch);
entity.setUUID(nativeTag.getUUID());
+ if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("OldPos")) ;
+ if (leashTag != null) {
+ leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
+ leashTag.getInt("Z")),
+ leashFenceKnotEntity);
+ }
+ }
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
LOGGER.warn(
"Error creating entity of type `{}` in world `{}` at location `{},{},{}`",
From d4305fa10d341e75f8cccaed0c586a80b24fcbbf Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sun, 30 Apr 2023 18:58:02 +0200
Subject: [PATCH 23/27] Improve formatting
---
.../impl/fawe/v1_20_R3/PaperweightGetBlocks.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightGetBlocks.java
index c21ef3fb6e..19d3e16c4b 100644
--- a/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_20_4/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R3/PaperweightGetBlocks.java
@@ -763,7 +763,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
nativeTag);
if (entityTagMap.containsKey("Leash")) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("Leash")) ;
+ entityTagMap.get("Leash"));
final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
if (leashEntity != null) {
tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
@@ -778,11 +778,16 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
entity.setUUID(nativeTag.getUUID());
if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("OldPos")) ;
+ entityTagMap.get("OldPos"));
if (leashTag != null) {
- leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
- leashTag.getInt("Z")),
- leashFenceKnotEntity);
+ leashRef.put(
+ new BlockPos(
+ leashTag.getInt("X"),
+ leashTag.getInt("Y"),
+ leashTag.getInt("Z")
+ ),
+ leashFenceKnotEntity
+ );
}
}
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
From b73f63d720727a1dea3031c420d83de8b8f8ea34 Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sun, 30 Apr 2023 19:03:04 +0200
Subject: [PATCH 24/27] Improve formatting
---
.../impl/fawe/v1_20_R4/PaperweightGetBlocks.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightGetBlocks.java
index dc9bf0d6f9..4eba3d5206 100644
--- a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightGetBlocks.java
@@ -764,7 +764,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
nativeTag);
if (entityTagMap.containsKey("Leash")) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("Leash")) ;
+ entityTagMap.get("Leash"));
final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
if (leashEntity != null) {
tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
@@ -778,11 +778,16 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
entity.setUUID(nativeTag.getUUID());
if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("OldPos")) ;
+ entityTagMap.get("OldPos"));
if (leashTag != null) {
- leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
- leashTag.getInt("Z")),
- leashFenceKnotEntity);
+ leashRef.put(
+ new BlockPos(
+ leashTag.getInt("X"),
+ leashTag.getInt("Y"),
+ leashTag.getInt("Z")
+ ),
+ leashFenceKnotEntity
+ );
}
}
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
From 59d32992d8f02bccd3e7312f9dc26216734628fc Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sat, 29 Apr 2023 16:01:50 +0200
Subject: [PATCH 25/27] Add dirty workaround to fix leashes when copy entities
1.19.4 ONLY
---
.../fawe/v1_20_R2/PaperweightGetBlocks.java | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightGetBlocks.java
index 93f84a1ec4..44c2d0d329 100644
--- a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightGetBlocks.java
@@ -35,12 +35,14 @@
import net.minecraft.core.Registry;
import net.minecraft.core.SectionPos;
import net.minecraft.nbt.IntTag;
+import net.minecraft.nbt.NbtUtils;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.util.BitStorage;
import net.minecraft.util.ZeroBitStorage;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.decoration.LeashFenceKnotEntity;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.block.entity.BeaconBlockEntity;
@@ -736,6 +738,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
syncTasks[1] = () -> {
Iterator iterator = entities.iterator();
+ Map leashRef = new HashMap<>();
while (iterator.hasNext()) {
final CompoundTag nativeTag = iterator.next();
final Map> entityTagMap = nativeTag.getValue();
@@ -759,12 +762,30 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
if (entity != null) {
final net.minecraft.nbt.CompoundTag tag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
nativeTag);
+ if (entityTagMap.containsKey("Leash")) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("Leash")) ;
+ final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
+ if (leashEntity != null) {
+ tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
+ }
+ }
+
for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
tag.remove(name);
}
entity.load(tag);
entity.absMoveTo(x, y, z, yaw, pitch);
entity.setUUID(nativeTag.getUUID());
+ if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
+ var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
+ entityTagMap.get("OldPos")) ;
+ if (leashTag != null) {
+ leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
+ leashTag.getInt("Z")),
+ leashFenceKnotEntity);
+ }
+ }
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
LOGGER.warn(
"Error creating entity of type `{}` in world `{}` at location `{},{},{}`",
From 072cf755bc0df808f8a9a145aa6f1bb0e32e8a8f Mon Sep 17 00:00:00 2001
From: Phillipp Glanz
Date: Sun, 30 Apr 2023 18:58:02 +0200
Subject: [PATCH 26/27] Improve formatting
---
.../impl/fawe/v1_20_R2/PaperweightGetBlocks.java | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightGetBlocks.java
index 44c2d0d329..6d81b20855 100644
--- a/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_20_2/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R2/PaperweightGetBlocks.java
@@ -764,7 +764,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
nativeTag);
if (entityTagMap.containsKey("Leash")) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("Leash")) ;
+ entityTagMap.get("Leash"));
final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
if (leashEntity != null) {
tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
@@ -779,11 +779,16 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
entity.setUUID(nativeTag.getUUID());
if (entity instanceof LeashFenceKnotEntity leashFenceKnotEntity) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
- entityTagMap.get("OldPos")) ;
+ entityTagMap.get("OldPos"));
if (leashTag != null) {
- leashRef.put(new BlockPos(leashTag.getInt("X"), leashTag.getInt("Y"),
- leashTag.getInt("Z")),
- leashFenceKnotEntity);
+ leashRef.put(
+ new BlockPos(
+ leashTag.getInt("X"),
+ leashTag.getInt("Y"),
+ leashTag.getInt("Z")
+ ),
+ leashFenceKnotEntity
+ );
}
}
if (!nmsWorld.addFreshEntity(entity, CreatureSpawnEvent.SpawnReason.CUSTOM)) {
From 0282a48691efa9150945b38e91965c807aeeb68a Mon Sep 17 00:00:00 2001
From: Phillipp Glanz <6745190+TheMeinerLP@users.noreply.github.com>
Date: Sun, 11 Aug 2024 22:58:22 +0200
Subject: [PATCH 27/27] Fix 1.205 and 1.21 compatible
---
.../adapter/impl/fawe/v1_20_R4/PaperweightGetBlocks.java | 2 +-
.../adapter/impl/fawe/v1_21_R1/PaperweightGetBlocks.java | 4 ++--
.../java/com/sk89q/worldedit/extent/clipboard/Clipboard.java | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightGetBlocks.java
index 4eba3d5206..d8f6a6769e 100644
--- a/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_20_5/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_20_R4/PaperweightGetBlocks.java
@@ -765,7 +765,7 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
if (entityTagMap.containsKey("Leash")) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
entityTagMap.get("Leash"));
- final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
+ final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag, "Leash"));
if (leashEntity != null) {
tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
}
diff --git a/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightGetBlocks.java b/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightGetBlocks.java
index 70ea4e59e3..cba99181e4 100644
--- a/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightGetBlocks.java
+++ b/worldedit-bukkit/adapters/adapter-1_21/src/main/java/com/sk89q/worldedit/bukkit/adapter/impl/fawe/v1_21_R1/PaperweightGetBlocks.java
@@ -759,9 +759,9 @@ public synchronized > T call(IChunkSet set, Runnable finaliz
if (entityTagMap.containsKey("Leash")) {
var leashTag = (net.minecraft.nbt.CompoundTag) adapter.fromNative(
entityTagMap.get("Leash")) ;
- final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag));
+ final LeashFenceKnotEntity leashEntity = leashRef.get(NbtUtils.readBlockPos(leashTag, "Leash"));
if (leashEntity != null) {
- tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.pos));
+ tag.put("Leash", NbtUtils.writeBlockPos(leashEntity.getPos()));
}
}
for (final String name : Constants.NO_COPY_ENTITY_NBT_FIELDS) {
diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
index 1d6011b9fd..05c04d905f 100644
--- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
+++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/Clipboard.java
@@ -436,7 +436,7 @@ default void paste(Extent extent, BlockVector3 to, boolean pasteAir, boolean pas
if (entity.getType().equals(EntityTypes.LEASH_KNOT)) {
var state = entity.getState();
var nbtData = new HashMap<>(state.getNbtData().getValue());
- var posAsMap = new HashMap();
+ var posAsMap = new HashMap>();
posAsMap.put("X", new IntTag(pos.getBlockX()));
posAsMap.put("Y", new IntTag(pos.getBlockY()));
posAsMap.put("Z", new IntTag(pos.getBlockZ()));