PaperMC/paper-server/patches/sources/net/minecraft/server/commands/SummonCommand.java.patch
2024-12-14 13:42:45 -08:00

19 lines
1.2 KiB
Diff

--- a/net/minecraft/server/commands/SummonCommand.java
+++ b/net/minecraft/server/commands/SummonCommand.java
@@ -82,6 +_,7 @@
ServerLevel level = source.getLevel();
Entity entity = EntityType.loadEntityRecursive(compoundTag, level, EntitySpawnReason.COMMAND, entity1 -> {
entity1.moveTo(pos.x, pos.y, pos.z, entity1.getYRot(), entity1.getXRot());
+ entity1.spawnReason = org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.COMMAND; // Paper - Entity#getEntitySpawnReason
return entity1;
});
if (entity == null) {
@@ -92,7 +_,7 @@
.finalizeSpawn(source.getLevel(), source.getLevel().getCurrentDifficultyAt(entity.blockPosition()), EntitySpawnReason.COMMAND, null);
}
- if (!level.tryAddFreshEntityWithPassengers(entity)) {
+ if (!level.tryAddFreshEntityWithPassengers(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.COMMAND)) { // CraftBukkit - pass a spawn reason of "COMMAND"
throw ERROR_DUPLICATE_UUID.create();
} else {
return entity;