aboutsummaryrefslogtreecommitdiffhomepage
path: root/paper-server/patches/unapplied/net/minecraft/world/item/SpawnEggItem.java.patch
blob: a33a635c7aafe3180252e46c7a673fb615ee0d94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--- a/net/minecraft/world/item/SpawnEggItem.java
+++ b/net/minecraft/world/item/SpawnEggItem.java
@@ -63,6 +63,8 @@
             EntityType entitytypes;
 
             if (tileentity instanceof Spawner) {
+                if (world.paperConfig().entities.spawning.disableMobSpawnerSpawnEggTransformation) return InteractionResult.FAIL; // Paper - Allow disabling mob spawner spawn egg transformation
+
                 Spawner spawner = (Spawner) tileentity;
 
                 entitytypes = this.getType(world.registryAccess(), itemstack);
@@ -176,10 +178,10 @@
                     return Optional.empty();
                 } else {
                     ((Mob) object).moveTo(pos.x(), pos.y(), pos.z(), 0.0F, 0.0F);
-                    world.addFreshEntityWithPassengers((Entity) object);
+                    world.addFreshEntityWithPassengers((Entity) object, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
                     ((Mob) object).setCustomName((Component) stack.get(DataComponents.CUSTOM_NAME));
                     stack.consume(1, user);
-                    return Optional.of(object);
+                    return Optional.of((Mob) object); // CraftBukkit - decompile error
                 }
             }
         }