Fix multi block change cloning

Fixes #990
This commit is contained in:
Dan Mulloy 2020-10-19 11:04:11 -04:00
parent 553e4b6813
commit f381f0a2f7
No known key found for this signature in database
GPG Key ID: 2B62F7DACFF133E8
3 changed files with 8 additions and 0 deletions

View File

@ -82,6 +82,7 @@ public class BukkitCloner implements Cloner {
fromWrapper(MinecraftReflection::getNBTBaseClass, NbtFactory::fromNMS);
fromWrapper(MinecraftReflection::getIChatBaseComponentClass, WrappedChatComponent::fromHandle);
fromWrapper(WrappedVillagerData::getNmsClass, WrappedVillagerData::fromHandle);
fromConverter(MinecraftReflection::getSectionPositionClass, BukkitConverters.getSectionPositionConverter());
try {
fromManual(ComponentConverter::getBaseComponentArrayClass, source ->

View File

@ -1872,6 +1872,10 @@ public class MinecraftReflection {
return getCraftBukkitClass("CraftSound");
}
public static Class<?> getSectionPositionClass() {
return getMinecraftClass("SectionPosition");
}
// ---- ItemStack conversions
private static Object itemStackAir = null;
private static Method asNMSCopy = null;

View File

@ -560,6 +560,9 @@ public class PacketContainerTest {
packet.getSectionPositions().writeSafely(0, new BlockPosition(42, 43, 44));
assertEquals(new BlockPosition(42, 43, 44), packet.getSectionPositions().readSafely(0));
PacketContainer clone = packet.deepClone();
assertNotSame(clone, packet);
}
/**