From 546ba82ea73ad1a51af026181ed35b68d40d4e38 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Thu, 4 Nov 2021 07:08:53 -0700 Subject: [PATCH] Added missing mappings (#6810) --- build-data/mappings-patch.tiny | 101 +++++++++++++++--- ...trolled-flushing-for-network-manager.patch | 14 +-- ...difications-to-critical-entity-state.patch | 10 +- .../Optimise-non-flush-packet-sending.patch | 8 +- ...ancement-data-player-iteration-to-be.patch | 8 +- 5 files changed, 109 insertions(+), 32 deletions(-) diff --git a/build-data/mappings-patch.tiny b/build-data/mappings-patch.tiny index de9bd959c9..4dddff41fc 100644 --- a/build-data/mappings-patch.tiny +++ b/build-data/mappings-patch.tiny @@ -28,18 +28,16 @@ c net/minecraft/server/level/WorldServer net/minecraft/server/level/ServerLevel c net/minecraft/world/level/SpawnerCreature$d net/minecraft/world/level/NaturalSpawner$SpawnState m (Lnet/minecraft/world/entity/EnumCreatureType;I)Z a canSpawnForCategory -# missed mapping? -c net/minecraft/world/level/block/MultifaceBlock net/minecraft/world/level/block/MultifaceBlock - m (Lnet/minecraft/world/level/block/state/IBlockData;Lnet/minecraft/world/level/IBlockAccess;Lnet/minecraft/core/BlockPosition;Lnet/minecraft/core/EnumDirection;)Lnet/minecraft/world/level/block/state/IBlockData; c getStateForPlacement - -# another missed one -c net/minecraft/server/players/UserCache net/minecraft/server/players/GameProfileCache - m (Ljava/lang/String;)Ljava/util/Optional; getProfile get - p 0 name - -# change dimension in ServerPlayer +# CraftBukkit adds a TeleportCause to methods in ServerPLayer c net/minecraft/server/level/EntityPlayer net/minecraft/server/level/ServerPlayer m (Lnet/minecraft/server/level/WorldServer;Lorg/bukkit/event/player/PlayerTeleportEvent$TeleportCause;)Lnet/minecraft/world/entity/Entity; b changeDimension + m (Lnet/minecraft/server/level/WorldServer;DDDFFLorg/bukkit/event/player/PlayerTeleportEvent$TeleportCause;)V a teleportTo + p 0 targetWorld + p 1 x + p 2 y + p 3 z + p 4 yaw + p 5 pitch # We add the getLevel method back to Hopper since mojang removed it - we need the method for hooper optimization # We add the method with this name to match the mojmap method of the same name in BlockEntity @@ -51,10 +49,89 @@ c net/minecraft/world/level/block/entity/IHopper net/minecraft/world/level/block c net/minecraft/commands/CommandDispatcher net/minecraft/commands/Commands m (Lnet/minecraft/commands/CommandListenerWrapper;Ljava/lang/String;Ljava/lang/String;Z)I a performCommand -# Craftbukkit overloads equipItemIfPossible in Mob adding an ItemEntity parameter +# CraftBukkit overloads equipItemIfPossible in Mob adding an ItemEntity parameter c net/minecraft/world/entity/EntityInsentient net/minecraft/world/entity/Mob m (Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/world/entity/item/EntityItem;)Z j equipItemIfPossible -# Craftbukkit overloads convertTo in Mob adding various API reasons +# CraftBukkit overloads convertTo in Mob adding various API reasons c net/minecraft/world/entity/EntityInsentient net/minecraft/world/entity/Mob m (Lnet/minecraft/world/entity/EntityTypes;ZLorg/bukkit/event/entity/EntityTransformEvent$TransformReason;Lorg/bukkit/event/entity/CreatureSpawnEvent$SpawnReason;)Lnet/minecraft/world/entity/EntityInsentient; a convertTo + +# CraftBukkit changes the signature of DefaultDispenseItemBehavior#spawnItem +c net/minecraft/core/dispenser/DispenseBehaviorItem net/minecraft/core/dispenser/DefaultDispenseItemBehavior + m (Lnet/minecraft/world/level/World;Lnet/minecraft/world/item/ItemStack;ILnet/minecraft/core/EnumDirection;Lnet/minecraft/core/ISourceBlock;)Z a spawnItem + +# Craftbukkit adds args to ShearsDispenseItemBehavior +c net/minecraft/core/dispenser/DispenseBehaviorShears net/minecraft/core/dispenser/ShearsDispenseItemBehavior + m (Lnet/minecraft/server/level/WorldServer;Lnet/minecraft/core/BlockPosition;Lorg/bukkit/block/Block;Lorg/bukkit/craftbukkit/inventory/CraftItemStack;)Z b tryShearLivingEntity + +# CraftBukkit adds ServerPlayer parameter to ServerEntity#sendPairingData +c net/minecraft/server/level/EntityTrackerEntry net/minecraft/server/level/ServerEntity + m (Ljava/util/function/Consumer;Lnet/minecraft/server/level/EntityPlayer;)V a sendPairingData + +# CraftBukkit overloads LivingEntity#removeEffectNoUpdate +c net/minecraft/world/entity/EntityLiving net/minecraft/world/entity/LivingEntity + m (Lnet/minecraft/world/effect/MobEffectList;Lorg/bukkit/event/entity/EntityPotionEffectEvent$Cause;)Lnet/minecraft/world/effect/MobEffect; c removeEffectNoUpdate + +# CraftBukkit adds an Entity parameter to methods in BigDripleafBlock +c net/minecraft/world/level/block/BigDripleafBlock net/minecraft/world/level/block/BigDripleafBlock + m (Lnet/minecraft/world/level/block/state/IBlockData;Lnet/minecraft/world/level/World;Lnet/minecraft/core/BlockPosition;Lnet/minecraft/world/level/block/state/properties/Tilt;Lnet/minecraft/sounds/SoundEffect;Lnet/minecraft/world/entity/Entity;)V a setTiltAndScheduleTick + m (Lnet/minecraft/world/level/block/state/IBlockData;Lnet/minecraft/world/level/World;Lnet/minecraft/core/BlockPosition;Lnet/minecraft/world/level/block/state/properties/Tilt;Lnet/minecraft/world/entity/Entity;)Z a setTilt + +# CraftBukkit adds the source BlockPos to MultifaceBlock#spreadToFace +c net/minecraft/world/level/block/MultifaceBlock net/minecraft/world/level/block/MultifaceBlock + m (Lnet/minecraft/world/level/GeneratorAccess;Lnet/minecraft/core/BlockPosition;Lnet/minecraft/core/EnumDirection;ZLnet/minecraft/core/BlockPosition;)Z a spreadToFace + +# CraftBukkit adds the source BlockPos to PointedDripstoneBlock#createDripstone +c net/minecraft/world/level/block/PointedDripstoneBlock net/minecraft/world/level/block/PointedDripstoneBlock + m (Lnet/minecraft/world/level/GeneratorAccess;Lnet/minecraft/core/BlockPosition;Lnet/minecraft/core/EnumDirection;Lnet/minecraft/world/level/block/state/properties/DripstoneThickness;Lnet/minecraft/core/BlockPosition;)V a createDripstone + +# CraftBukkit modifies methods in AbstraftFurnaceBlockEntity +c net/minecraft/world/level/block/entity/TileEntityFurnace net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity + m (Lnet/minecraft/server/level/EntityPlayer;Lnet/minecraft/world/item/ItemStack;I)V a awardUsedRecipesAndPopExperience + m (Lnet/minecraft/server/level/WorldServer;Lnet/minecraft/world/phys/Vec3D;Lnet/minecraft/core/BlockPosition;Lnet/minecraft/server/level/EntityPlayer;Lnet/minecraft/world/item/ItemStack;I)Ljava/util/List; a getRecipesToAwardAndPopExperience + m (Lnet/minecraft/server/level/WorldServer;Lnet/minecraft/world/phys/Vec3D;IFLnet/minecraft/core/BlockPosition;Lnet/minecraft/world/entity/player/EntityHuman;Lnet/minecraft/world/item/ItemStack;I)V a createExperience + +# CraftBukkit overloads PersistentEntitySectionManager#storeChunkSections +c net/minecraft/world/level/entity/PersistentEntitySectionManager net/minecraft/world/level/entity/PersistentEntitySectionManager + m (JLjava/util/function/Consumer;Z)Z a storeChunkSections + p 0 chunkPos + p 1 action + +# CraftBukkit adds parameters to PortalShape#createPortalInfo +c net/minecraft/world/level/portal/BlockPortalShape net/minecraft/world/level/portal/PortalShape + m (Lnet/minecraft/server/level/WorldServer;Lnet/minecraft/BlockUtil$Rectangle;Lnet/minecraft/core/EnumDirection$EnumAxis;Lnet/minecraft/world/phys/Vec3D;Lnet/minecraft/world/entity/EntitySize;Lnet/minecraft/world/phys/Vec3D;FFLorg/bukkit/craftbukkit/event/CraftPortalEvent;)Lnet/minecraft/world/level/portal/ShapeDetectorShape; a createPortalInfo + +# CraftBukkit adds a byte array parameter to MapItemSavedData$HoldingPlayer#createPatch +c net/minecraft/world/level/saveddata/maps/WorldMap$WorldMapHumanTracker net/minecraft/world/level/saveddata/maps/MapItemSavedData$HoldingPlayer + m ([B)Lnet/minecraft/world/level/saveddata/maps/WorldMap$b; a createPatch + +# CraftBukkit adds a level resource key to LevelStorageSource#createAccess +c net/minecraft/world/level/storage/Convertable net/minecraft/world/level/storage/LevelStorageSource + m (Ljava/lang/String;Lnet/minecraft/resources/ResourceKey;)Lnet/minecraft/world/level/storage/Convertable$ConversionSession; c createAccess + +# Missed mappings - these should work as they are unmodified by CraftBukkit but don't for some reason +c net/minecraft/network/NetworkManager net/minecraft/network/Connection + m (Lnet/minecraft/network/protocol/Packet;Lio/netty/util/concurrent/GenericFutureListener;Lnet/minecraft/network/EnumProtocol;Lnet/minecraft/network/EnumProtocol;)V a doSendPacket + +c net/minecraft/server/gui/ServerGUI net/minecraft/server/gui/MinecraftServerGui + m (Ljavax/swing/JTextArea;Ljavax/swing/JScrollPane;Ljava/lang/String;)V a print + +c net/minecraft/server/level/PlayerChunk net/minecraft/server/level/ChunkHolder + m (Lnet/minecraft/world/level/World;Lnet/minecraft/core/BlockPosition;Lnet/minecraft/world/level/block/state/IBlockData;)V a broadcastBlockEntityIfNeeded + +c net/minecraft/server/level/PlayerChunkMap net/minecraft/server/level/ChunkMap + m (Lnet/minecraft/world/level/chunk/ChunkStatus;I)Lnet/minecraft/world/level/chunk/ChunkStatus; a getDependencyStatus + +c net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetSet net/minecraft/world/entity/ai/behavior/StartAttacking + m (Lnet/minecraft/world/entity/EntityInsentient;Lnet/minecraft/world/entity/EntityLiving;)V a setAttackTarget + +c net/minecraft/world/entity/ai/behavior/BehaviorMakeLove net/minecraft/world/entity/ai/behavior/VillagerMakeLove + m (Lnet/minecraft/world/entity/npc/EntityVillager;Lnet/minecraft/core/BlockPosition;)Z a canReach + +c net/minecraft/world/level/block/MultifaceBlock net/minecraft/world/level/block/MultifaceBlock + m (Lnet/minecraft/world/level/block/state/IBlockData;Lnet/minecraft/world/level/IBlockAccess;Lnet/minecraft/core/BlockPosition;Lnet/minecraft/core/EnumDirection;)Lnet/minecraft/world/level/block/state/IBlockData; c getStateForPlacement + +c net/minecraft/server/players/UserCache net/minecraft/server/players/GameProfileCache + m (Ljava/lang/String;)Ljava/util/Optional; getProfile get + p 0 name diff --git a/patches/server/Allow-controlled-flushing-for-network-manager.patch b/patches/server/Allow-controlled-flushing-for-network-manager.patch index cd6e20086d..1c6435f019 100644 --- a/patches/server/Allow-controlled-flushing-for-network-manager.patch +++ b/patches/server/Allow-controlled-flushing-for-network-manager.patch @@ -80,22 +80,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } if (this.channel.eventLoop().inEventLoop()) { -- this.a(packet, callback, enumprotocol, enumprotocol1); -+ this.a(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter +- this.doSendPacket(packet, callback, enumprotocol, enumprotocol1); ++ this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter } else { this.channel.eventLoop().execute(() -> { -- this.a(packet, callback, enumprotocol, enumprotocol1); -+ this.a(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter +- this.doSendPacket(packet, callback, enumprotocol, enumprotocol1); ++ this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter }); } } - private void a(Packet packet, @Nullable GenericFutureListener> genericfuturelistener, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1) { + private void doSendPacket(Packet packet, @Nullable GenericFutureListener> genericfuturelistener, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1) { + // Paper start - add flush parameter -+ this.a(packet, genericfuturelistener, enumprotocol, enumprotocol1, true); ++ this.doSendPacket(packet, genericfuturelistener, enumprotocol, enumprotocol1, true); + } -+ private void a(Packet packet, @Nullable GenericFutureListener> genericfuturelistener, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1, boolean flush) { ++ private void doSendPacket(Packet packet, @Nullable GenericFutureListener> genericfuturelistener, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1, boolean flush) { + // Paper end - add flush parameter if (enumprotocol != enumprotocol1) { this.setProtocol(enumprotocol); diff --git a/patches/server/Async-catch-modifications-to-critical-entity-state.patch b/patches/server/Async-catch-modifications-to-critical-entity-state.patch index c797fcae73..b9a21bb661 100644 --- a/patches/server/Async-catch-modifications-to-critical-entity-state.patch +++ b/patches/server/Async-catch-modifications-to-critical-entity-state.patch @@ -60,13 +60,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (trackingStatus == Visibility.HIDDEN) { @@ -0,0 +0,0 @@ public class PersistentEntitySectionManager implements A - - private boolean a(long i, Consumer consumer, boolean callEvent) { + private boolean storeChunkSections(long chunkPos, Consumer action, boolean callEvent) { // CraftBukkit end + PersistentEntitySectionManager.ChunkLoadStatus persistententitysectionmanager_b = (PersistentEntitySectionManager.ChunkLoadStatus) this.chunkLoadStatuses.get(chunkPos); + org.spigotmc.AsyncCatcher.catchOp("Entity chunk save"); // Paper - PersistentEntitySectionManager.ChunkLoadStatus persistententitysectionmanager_b = (PersistentEntitySectionManager.ChunkLoadStatus) this.chunkLoadStatuses.get(i); if (persistententitysectionmanager_b == PersistentEntitySectionManager.ChunkLoadStatus.PENDING) { + return false; @@ -0,0 +0,0 @@ public class PersistentEntitySectionManager implements A } @@ -76,13 +76,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ChunkPos chunkcoordintpair = new ChunkPos(chunkPos); CompletableFuture completablefuture = this.permanentStorage.loadEntities(chunkcoordintpair); @@ -0,0 +0,0 @@ public class PersistentEntitySectionManager implements A - } private boolean processChunkUnload(long chunkPos) { + boolean flag = this.storeChunkSections(chunkPos, (entityaccess) -> { + org.spigotmc.AsyncCatcher.catchOp("Entity chunk unload process"); // Paper - boolean flag = this.a(chunkPos, (entityaccess) -> { entityaccess.getPassengersAndSelf().forEach(this::unloadEntity); }, true); // CraftBukkit - add boolean for event call + @@ -0,0 +0,0 @@ public class PersistentEntitySectionManager implements A } diff --git a/patches/server/Optimise-non-flush-packet-sending.patch b/patches/server/Optimise-non-flush-packet-sending.patch index b99c08d8d8..fb74bc9207 100644 --- a/patches/server/Optimise-non-flush-packet-sending.patch +++ b/patches/server/Optimise-non-flush-packet-sending.patch @@ -34,20 +34,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private static final float AVERAGE_PACKETS_SMOOTHING = 0.75F; @@ -0,0 +0,0 @@ public class Connection extends SimpleChannelInboundHandler> { if (this.channel.eventLoop().inEventLoop()) { - this.a(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter + this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter } else { + // Paper start - optimise packets that are not flushed + // note: since the type is not dynamic here, we need to actually copy the old executor code + // into two branches. On conflict, just re-copy - no changes were made inside the executor code. + if (!flush) { + AbstractEventExecutor.LazyRunnable run = () -> { -+ this.a(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter ++ this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter + }; + this.channel.eventLoop().execute(run); + } else { // Paper end - optimise packets that are not flushed this.channel.eventLoop().execute(() -> { -- this.a(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter -+ this.a(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter // Paper - diff on change +- this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter ++ this.doSendPacket(packet, callback, enumprotocol, enumprotocol1, flush); // Paper - add flush parameter // Paper - diff on change }); + } // Paper } diff --git a/patches/server/Optimize-the-advancement-data-player-iteration-to-be.patch b/patches/server/Optimize-the-advancement-data-player-iteration-to-be.patch index 2fdb6042cc..2a16d2f93c 100644 --- a/patches/server/Optimize-the-advancement-data-player-iteration-to-be.patch +++ b/patches/server/Optimize-the-advancement-data-player-iteration-to-be.patch @@ -14,14 +14,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private void ensureVisibility(Advancement advancement) { + // Paper start -+ e(advancement, IterationEntryPoint.ROOT); ++ ensureVisibility(advancement, IterationEntryPoint.ROOT); + } + private enum IterationEntryPoint { + ROOT, + ITERATOR, + PARENT_OF_ITERATOR + } -+ private void e(Advancement advancement, IterationEntryPoint entryPoint) { ++ private void ensureVisibility(Advancement advancement, IterationEntryPoint entryPoint) { + // Paper end boolean flag = this.shouldBeVisible(advancement); boolean flag1 = this.visible.contains(advancement); @@ -33,7 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - this.ensureVisibility(advancement.getParent()); + // Paper start - If we're not coming from an iterator consider this to be a root entry, otherwise + // market that we're entering from the parent of an iterator. -+ this.e(advancement.getParent(), entryPoint == IterationEntryPoint.ITERATOR ? IterationEntryPoint.PARENT_OF_ITERATOR : IterationEntryPoint.ROOT); ++ this.ensureVisibility(advancement.getParent(), entryPoint == IterationEntryPoint.ITERATOR ? IterationEntryPoint.PARENT_OF_ITERATOR : IterationEntryPoint.ROOT); } + // If this is true, we've went through a child iteration, entered the parent, processed the parent @@ -48,7 +48,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Advancement advancement1 = (Advancement) iterator.next(); - this.ensureVisibility(advancement1); -+ this.e(advancement1, IterationEntryPoint.ITERATOR); // Paper - Mark this call as being from iteration ++ this.ensureVisibility(advancement1, IterationEntryPoint.ITERATOR); // Paper - Mark this call as being from iteration } }