Added missing mappings (#6810)

This commit is contained in:
Jake Potrebic 2021-11-04 07:08:53 -07:00 committed by GitHub
parent 485d15ff8f
commit 09d50a9277
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 115 additions and 38 deletions

View File

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

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Optimize the advancement data player iteration to be O(N)
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index 3d82f984648605d58fae3c57f145d0da8a2ae225..ce02a467c1c3434f2cdb112ceb9794196069a820 100644
index 3d82f984648605d58fae3c57f145d0da8a2ae225..bd858a9da2f2442be85f36bb2de0dac46d0c68d7 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -437,6 +437,16 @@ public class PlayerAdvancements {
@ -14,14 +14,14 @@ index 3d82f984648605d58fae3c57f145d0da8a2ae225..ce02a467c1c3434f2cdb112ceb979419
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 3d82f984648605d58fae3c57f145d0da8a2ae225..ce02a467c1c3434f2cdb112ceb979419
- 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 3d82f984648605d58fae3c57f145d0da8a2ae225..ce02a467c1c3434f2cdb112ceb979419
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
}
}

View File

@ -9,7 +9,7 @@ This patch will be used to optimise out flush calls in later
patches.
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 9d09ec3b127e3440bef6b248578dec109407f9ff..103657ad936f1a75ffbb92ca5eafb816e977e363 100644
index c327609fdb7641e4dc5fb58d97903fa666eac24d..0b47144cb8ad72efebf10e163f5b442995ef213e 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -94,6 +94,39 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@ -80,22 +80,22 @@ index 9d09ec3b127e3440bef6b248578dec109407f9ff..103657ad936f1a75ffbb92ca5eafb816
}
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<? extends Future<? super Void>> genericfuturelistener, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1) {
private void doSendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> 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<? extends Future<? super Void>> genericfuturelistener, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1, boolean flush) {
+ private void doSendPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener, ConnectionProtocol enumprotocol, ConnectionProtocol enumprotocol1, boolean flush) {
+ // Paper end - add flush parameter
if (enumprotocol != enumprotocol1) {
this.setProtocol(enumprotocol);

View File

@ -20,7 +20,7 @@ up on this optimisation before he came along.
Locally this patch drops the entity tracker tick by a full 1.5x.
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 73457ae24ba6f605dd831a870499f1a990570e53..0dae504f49a4a3c66a01eb03896833a010cd5821 100644
index 300cd4d2861c7f155cc6a5bb5a0c47b0b77ff240..7c66d5d51efd3ec55f5170cf828db22e26131517 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -49,6 +49,8 @@ import org.apache.logging.log4j.Logger;
@ -34,20 +34,20 @@ index 73457ae24ba6f605dd831a870499f1a990570e53..0dae504f49a4a3c66a01eb03896833a0
private static final float AVERAGE_PACKETS_SMOOTHING = 0.75F;
@@ -409,9 +411,19 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
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
}

View File

@ -8,7 +8,7 @@ Now in 1.17, this state is _even more_ critical than it was before,
so these must exist to catch stupid plugins.
diff --git a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
index ea6d16d36cc98c0de5ad9d8faa8cbd8984fb309d..8634cf852d7ecb70c7bac6ad7f606aed1347f61d 100644
index fe5739c0949636343ea68e403aa5f4bef89e9d9f..394de90cc25179cd7576af9a08214b0d4ad53795 100644
--- a/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
+++ b/src/main/java/net/minecraft/world/level/entity/PersistentEntitySectionManager.java
@@ -134,6 +134,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
@ -59,14 +59,14 @@ index ea6d16d36cc98c0de5ad9d8faa8cbd8984fb309d..8634cf852d7ecb70c7bac6ad7f606aed
long i = chunkPos.toLong();
if (trackingStatus == Visibility.HIDDEN) {
@@ -291,6 +298,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
private boolean a(long i, Consumer<T> consumer, boolean callEvent) {
@@ -292,6 +299,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
private boolean storeChunkSections(long chunkPos, Consumer<T> 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;
@@ -320,6 +328,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
@ -75,14 +75,14 @@ index ea6d16d36cc98c0de5ad9d8faa8cbd8984fb309d..8634cf852d7ecb70c7bac6ad7f606aed
this.chunkLoadStatuses.put(chunkPos, PersistentEntitySectionManager.ChunkLoadStatus.PENDING);
ChunkPos chunkcoordintpair = new ChunkPos(chunkPos);
CompletableFuture completablefuture = this.permanentStorage.loadEntities(chunkcoordintpair);
@@ -333,6 +342,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}
@@ -334,6 +343,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> 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
@@ -357,6 +367,7 @@ public class PersistentEntitySectionManager<T extends EntityAccess> implements A
}