PaperMC/paper-server/patches/sources/net/minecraft/world/item/SpawnEggItem.java.patch

20 lines
1.3 KiB
Diff
Raw Normal View History

2024-12-14 21:50:20 +01:00
--- a/net/minecraft/world/item/SpawnEggItem.java
+++ b/net/minecraft/world/item/SpawnEggItem.java
@@ -55,6 +_,7 @@
Direction clickedFace = context.getClickedFace();
BlockState blockState = level.getBlockState(clickedPos);
if (level.getBlockEntity(clickedPos) instanceof Spawner spawner) {
+ if (level.paperConfig().entities.spawning.disableMobSpawnerSpawnEggTransformation) return InteractionResult.FAIL; // Paper - Allow disabling mob spawner spawn egg transformation
EntityType<?> type = this.getType(level.registryAccess(), itemInHand);
spawner.setEntityId(type, level.getRandom());
level.sendBlockUpdated(clickedPos, blockState, blockState, 3);
@@ -169,7 +_,7 @@
return Optional.empty();
} else {
breedOffspring.moveTo(pos.x(), pos.y(), pos.z(), 0.0F, 0.0F);
- serverLevel.addFreshEntityWithPassengers(breedOffspring);
+ serverLevel.addFreshEntityWithPassengers(breedOffspring, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
breedOffspring.setCustomName(stack.get(DataComponents.CUSTOM_NAME));
stack.consume(1, player);
return Optional.of(breedOffspring);