mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 11:38:29 +01:00
Implement CreatureSpawnEvent.SpawnReason.SPAWNER_BUCKET
This commit is contained in:
parent
69950d5a6a
commit
b8d4bc57b0
@ -0,0 +1,23 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Doc <nachito94@msn.com>
|
||||||
|
Date: Wed, 3 Aug 2022 22:15:16 -0400
|
||||||
|
Subject: [PATCH] Add CreatureSpawnEvent.SpawnReason.SPAWNER_BUCKET
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java b/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java
|
||||||
|
index 6d5c81824c7cb36f0c76baf532434fb7bf233da6..7d2990b33e2404c3c5942d852e8a948c052efabf 100644
|
||||||
|
--- a/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java
|
||||||
|
+++ b/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java
|
||||||
|
@@ -71,6 +71,12 @@ public class CreatureSpawnEvent extends EntitySpawnEvent {
|
||||||
|
* When a creature spawns from a Spawner Egg
|
||||||
|
*/
|
||||||
|
SPAWNER_EGG,
|
||||||
|
+ // Paper start
|
||||||
|
+ /**
|
||||||
|
+ * When a creature spawns from a Bucket
|
||||||
|
+ */
|
||||||
|
+ SPAWNER_BUCKET,
|
||||||
|
+ // Paper end
|
||||||
|
/**
|
||||||
|
* When a creature spawns because of a lightning strike
|
||||||
|
*/
|
@ -0,0 +1,19 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Doc <nachito94@msn.com>
|
||||||
|
Date: Wed, 3 Aug 2022 22:17:08 -0400
|
||||||
|
Subject: [PATCH] Add CreatureSpawnEvent.SpawnReason.SPAWNER_BUCKET
|
||||||
|
|
||||||
|
|
||||||
|
diff --git a/src/main/java/net/minecraft/world/item/MobBucketItem.java b/src/main/java/net/minecraft/world/item/MobBucketItem.java
|
||||||
|
index a45d93273c6ac881249f0828131e6fd6040c0d69..3a58aec5cc150af5f346ed9b6fbcbf00a42815b8 100644
|
||||||
|
--- a/src/main/java/net/minecraft/world/item/MobBucketItem.java
|
||||||
|
+++ b/src/main/java/net/minecraft/world/item/MobBucketItem.java
|
||||||
|
@@ -46,7 +46,7 @@ public class MobBucketItem extends BucketItem {
|
||||||
|
}
|
||||||
|
|
||||||
|
private void spawn(ServerLevel world, ItemStack stack, BlockPos pos) {
|
||||||
|
- Entity entity = this.type.spawn(world, stack, (Player)null, pos, MobSpawnType.BUCKET, true, false);
|
||||||
|
+ Entity entity = this.type.spawn(world, stack == null ? null : stack.getTag(), stack != null && stack.hasCustomHoverName() ? stack.getHoverName() : null, (Player)null, pos, MobSpawnType.BUCKET, true, false, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_BUCKET); // Paper
|
||||||
|
if (entity instanceof Bucketable bucketable) {
|
||||||
|
bucketable.loadFromBucketTag(stack.getOrCreateTag());
|
||||||
|
bucketable.setFromBucket(true);
|
Loading…
Reference in New Issue
Block a user