From 7a0886180f01d39c8ac3b8c2f46b8aeb6c615092 Mon Sep 17 00:00:00 2001 From: Jason <11360596+jpenilla@users.noreply.github.com> Date: Thu, 21 Oct 2021 03:16:31 -0500 Subject: [PATCH] AT & Mapping fixes (#6809) --- build-data/mappings-patch.tiny | 13 ++++--------- build-data/paper.at | 10 ++-------- ...Optimize-NibbleArray-to-use-pooled-buffers.patch | 8 ++++---- patches/server/0762-Rewrite-the-light-engine.patch | 10 +++++----- 4 files changed, 15 insertions(+), 26 deletions(-) diff --git a/build-data/mappings-patch.tiny b/build-data/mappings-patch.tiny index 36f89a0742..de9bd959c9 100644 --- a/build-data/mappings-patch.tiny +++ b/build-data/mappings-patch.tiny @@ -4,13 +4,12 @@ tiny 2 0 spigot mojang+yarn # is imported and not fully qualified. Easiest fix is to just change the name c net/minecraft/server/level/PlayerChunkMap$a net/minecraft/server/level/ChunkMap$ChunkDistanceManager -# CraftBukkit adds the getServer() method, clashes with a Mojang method -c net/minecraft/world/level/World net/minecraft/world/level/Level - m ()Lorg/bukkit/craftbukkit/CraftServer; getServer getCraftServer - -# CraftBukkit adds the server field, clashes with a Mojang field c net/minecraft/server/network/PlayerConnection net/minecraft/server/network/ServerGamePacketListenerImpl + # CB adds getPlayer()CraftPlayer, conflicts with getPlayer()ServerPlayer m ()Lorg/bukkit/craftbukkit/entity/CraftPlayer; getPlayer getCraftPlayer + m (DDDFFLorg/bukkit/event/player/PlayerTeleportEvent$TeleportCause;)V a teleport + # CB adds int, ItemStack to end of params + m (Ljava/util/List;Ljava/util/function/UnaryOperator;Lnet/minecraft/world/item/ItemStack;ILnet/minecraft/world/item/ItemStack;)V a updateBookPages # CraftBukkit adds the getType() method, clashes with a Mojang method c net/minecraft/world/entity/EntityAreaEffectCloud net/minecraft/world/entity/AreaEffectCloud @@ -48,10 +47,6 @@ c net/minecraft/server/level/EntityPlayer net/minecraft/server/level/ServerPlaye c net/minecraft/world/level/block/entity/IHopper net/minecraft/world/level/block/entity/Hopper m ()Lnet/minecraft/world/level/World; getWorld getLevel -# Teleport method in ServerGamePacketListenerImpl -c net/minecraft/server/network/PlayerConnection net/minecraft/server/network/ServerGamePacketListenerImpl - m (DDDFFLorg/bukkit/event/player/PlayerTeleportEvent$TeleportCause;)V a teleport - # Commands performCommand adds a stripSlash boolean c net/minecraft/commands/CommandDispatcher net/minecraft/commands/Commands m (Lnet/minecraft/commands/CommandListenerWrapper;Ljava/lang/String;Ljava/lang/String;Z)I a performCommand diff --git a/build-data/paper.at b/build-data/paper.at index a5d4276693..cb11ee3b66 100644 --- a/build-data/paper.at +++ b/build-data/paper.at @@ -79,7 +79,7 @@ public net.minecraft.world.entity.animal.Turtle isTravelling()Z public net.minecraft.world.entity.animal.Turtle setTravelling(Z)V # Call player spectator target event -public net.minecraft.server.network.ServerGamePacketListenerImpl a(Ljava/util/List;Ljava/util/function/UnaryOperator;Lnet/minecraft/world/item/ItemStack;ILnet/minecraft/world/item/ItemStack;)V # todo fix this mapping +public net.minecraft.server.network.ServerGamePacketListenerImpl updateBookPages(Ljava/util/List;Ljava/util/function/UnaryOperator;Lnet/minecraft/world/item/ItemStack;ILnet/minecraft/world/item/ItemStack;)V # Improve Server THread Pool public net.minecraft.Util onThreadException(Ljava/lang/Thread;Ljava/lang/Throwable;)V @@ -219,12 +219,6 @@ public net.minecraft.world.entity.animal.Fox setFaceplanted(Z)V # Cook speed multipler API public net.minecraft.world.level.block.entity.AbstractFurnaceBlockEntity recipeType -# Improve CraftChunk#getEntities -public net.minecraft.world.level.entity.PersistentEntitySectionManager sectionStorage - -# Optimize light engine -public-f net.minecraft.world.level.chunk.DataLayer - # Add methods to get translation keys public org.bukkit.craftbukkit.inventory.CraftMetaFirework public org.bukkit.craftbukkit.inventory.CraftMetaFirework getNBT(Lorg/bukkit/FireworkEffect$Type;)I @@ -250,5 +244,5 @@ public net.minecraft.world.level.block.entity.BlockEntityType validBlocks # Default entity attributes public net.minecraft.world.entity.ai.attributes.AttributeSupplier instances -# Add ItemFactory#getMonsterEgg API +# Add ItemFactory#getSpawnEgg API public net.minecraft.world.item.SpawnEggItem BY_ID diff --git a/patches/server/0478-Optimize-NibbleArray-to-use-pooled-buffers.patch b/patches/server/0478-Optimize-NibbleArray-to-use-pooled-buffers.patch index 40e6719967..9132183d7a 100644 --- a/patches/server/0478-Optimize-NibbleArray-to-use-pooled-buffers.patch +++ b/patches/server/0478-Optimize-NibbleArray-to-use-pooled-buffers.patch @@ -84,10 +84,10 @@ index 24d5a44cb81ec5f10bfcce002a193f4566de88fc..d8be2ad889f46491e50404916fb4ae0d } diff --git a/src/main/java/net/minecraft/world/level/chunk/DataLayer.java b/src/main/java/net/minecraft/world/level/chunk/DataLayer.java -index 689a3bc80e753ecb3194ae81c0c48d2eef61f700..c561d69b4b903cd3625468b239cb1ace3e317700 100644 +index 4ddcdb3881f616f922cb539bf9d00a1ac89f051f..68a6c4db5980e733d81ef9a34cf32950f0983de6 100644 --- a/src/main/java/net/minecraft/world/level/chunk/DataLayer.java +++ b/src/main/java/net/minecraft/world/level/chunk/DataLayer.java -@@ -13,11 +13,65 @@ public class DataLayer { +@@ -13,11 +13,65 @@ public final class DataLayer { private static final int NIBBLE_SIZE = 4; @Nullable protected byte[] data; @@ -153,7 +153,7 @@ index 689a3bc80e753ecb3194ae81c0c48d2eef61f700..c561d69b4b903cd3625468b239cb1ace if (bytes.length != 2048) { throw (IllegalArgumentException) Util.pauseInIde((Throwable) (new IllegalArgumentException("DataLayer should be 2048 bytes not: " + bytes.length))); } -@@ -52,7 +106,8 @@ public class DataLayer { +@@ -52,7 +106,8 @@ public final class DataLayer { private void set(int index, int value) { if (this.data == null) { @@ -163,7 +163,7 @@ index 689a3bc80e753ecb3194ae81c0c48d2eef61f700..c561d69b4b903cd3625468b239cb1ace } int k = DataLayer.getByteIndex(index); -@@ -74,13 +129,33 @@ public class DataLayer { +@@ -74,13 +129,33 @@ public final class DataLayer { public byte[] getData() { if (this.data == null) { this.data = new byte[2048]; diff --git a/patches/server/0762-Rewrite-the-light-engine.patch b/patches/server/0762-Rewrite-the-light-engine.patch index 793952b3bc..214c76a928 100644 --- a/patches/server/0762-Rewrite-the-light-engine.patch +++ b/patches/server/0762-Rewrite-the-light-engine.patch @@ -4276,10 +4276,10 @@ index 8393950a0b38ec7897d7643803d5accdb1f983f3..ae2050da03ea2ed82b5b0dadbe4e9d37 @Nullable BlockState setBlockState(BlockPos pos, BlockState state, boolean moved); diff --git a/src/main/java/net/minecraft/world/level/chunk/DataLayer.java b/src/main/java/net/minecraft/world/level/chunk/DataLayer.java -index c561d69b4b903cd3625468b239cb1ace3e317700..08c1be9c9735132f383b9be9fda6f8af4a502107 100644 +index 68a6c4db5980e733d81ef9a34cf32950f0983de6..0ed00b98e2e183aa6a8a2dfeaabea6b3c8ab97a9 100644 --- a/src/main/java/net/minecraft/world/level/chunk/DataLayer.java +++ b/src/main/java/net/minecraft/world/level/chunk/DataLayer.java -@@ -12,7 +12,7 @@ public class DataLayer { +@@ -12,7 +12,7 @@ public final class DataLayer { public static final int SIZE = 2048; private static final int NIBBLE_SIZE = 4; @Nullable @@ -4288,7 +4288,7 @@ index c561d69b4b903cd3625468b239cb1ace3e317700..08c1be9c9735132f383b9be9fda6f8af // Paper start public static byte[] EMPTY_NIBBLE = new byte[2048]; private static final int nibbleBucketSizeMultiplier = Integer.getInteger("Paper.nibbleBucketSize", 3072); -@@ -55,6 +55,7 @@ public class DataLayer { +@@ -55,6 +55,7 @@ public final class DataLayer { boolean poolSafe = false; public java.lang.Runnable cleaner; private void registerCleaner() { @@ -4296,7 +4296,7 @@ index c561d69b4b903cd3625468b239cb1ace3e317700..08c1be9c9735132f383b9be9fda6f8af if (!poolSafe) { cleaner = net.minecraft.server.MCUtil.registerCleaner(this, this.data, DataLayer::releaseBytes); } else { -@@ -69,7 +70,7 @@ public class DataLayer { +@@ -69,7 +70,7 @@ public final class DataLayer { } public DataLayer(byte[] bytes, boolean isSafe) { this.data = bytes; @@ -4305,7 +4305,7 @@ index c561d69b4b903cd3625468b239cb1ace3e317700..08c1be9c9735132f383b9be9fda6f8af registerCleaner(); // Paper end if (bytes.length != 2048) { -@@ -155,7 +156,7 @@ public class DataLayer { +@@ -155,7 +156,7 @@ public final class DataLayer { } // Paper end public DataLayer copy() {