mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-22 10:35:38 +01:00
Fixes a couple issues with entity spawn reasons (#8390)
This commit is contained in:
parent
b58c0cf14a
commit
f7d16f656a
@ -174,6 +174,20 @@ index 1119e26e270bb45f517955b19d95a9ec3d113634..4631647c64c89ffdde2d9b63bdab974a
|
||||
* @param sz The new size of the slime.
|
||||
*/
|
||||
public void setSize(int sz);
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java b/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java
|
||||
index e9de00e9e434d36117a672fa9fbfc7c52f284b67..9a06487e0f76cd7765e6f900b7458a3cf0aa44e7 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java
|
||||
@@ -158,7 +158,8 @@ public class CreatureSpawnEvent extends EntitySpawnEvent {
|
||||
*/
|
||||
SHEARED,
|
||||
/**
|
||||
- * When eg an effect cloud is spawned as a result of a creeper exploding
|
||||
+ * When an entity is spawned as a result of an explosion. Like an area effect cloud from
|
||||
+ * a creeper or a dragon fireball.
|
||||
*/
|
||||
EXPLOSION,
|
||||
/**
|
||||
diff --git a/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java b/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java
|
||||
index d51d2ec1d04d9ea8a25a70d0d856f2355ebfcb4a..7ecff9fcee19fc94be784474fea620e5dd434731 100644
|
||||
--- a/src/main/java/org/bukkit/event/entity/EntityRegainHealthEvent.java
|
||||
|
@ -0,0 +1,48 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
||||
Date: Sun, 25 Sep 2022 11:21:01 -0700
|
||||
Subject: [PATCH] Fixes and additions to the SpawnReason API
|
||||
|
||||
Fixes some wrong reasons, and adds missing spawn reasons for entities.
|
||||
|
||||
Co-authored-by: Doc <nachito94@msn.com>
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/EntityType.java b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
index ac0f0a4da4282c13f6e1f37710cb615d66b8ef2c..12cf4d3dfbd2c4f4a1815f5e26e59ae8667f7b47 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/EntityType.java
|
||||
@@ -342,7 +342,7 @@ public class EntityType<T extends Entity> implements EntityTypeTest<Entity, T> {
|
||||
@Nullable
|
||||
public T spawn(ServerLevel world, @Nullable CompoundTag itemNbt, @Nullable Component name, @Nullable Player player, BlockPos pos, MobSpawnType spawnReason, boolean alignPosition, boolean invertY) {
|
||||
// CraftBukkit start
|
||||
- return this.spawn(world, itemNbt, name, player, pos, spawnReason, alignPosition, invertY, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG);
|
||||
+ return this.spawn(world, itemNbt, name, player, pos, spawnReason, alignPosition, invertY, spawnReason == MobSpawnType.DISPENSER ? org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DISPENSE_EGG : org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // Paper - use correct spawn reason for dispenser spawn eggs
|
||||
}
|
||||
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
|
||||
index 6afe37e42d88701af38df5793a9ea9d7d2cda5c5..c72ab3c9f7cb20f22b051981fe1fc41965d2b2af 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/DragonFireball.java
|
||||
@@ -54,7 +54,7 @@ public class DragonFireball extends AbstractHurtingProjectile {
|
||||
|
||||
if (new com.destroystokyo.paper.event.entity.EnderDragonFireballHitEvent((org.bukkit.entity.DragonFireball) this.getBukkitEntity(), list.stream().map(LivingEntity::getBukkitLivingEntity).collect(java.util.stream.Collectors.toList()), (org.bukkit.entity.AreaEffectCloud) areaEffectCloud.getBukkitEntity()).callEvent()) { // Paper
|
||||
this.level.levelEvent(2006, this.blockPosition(), this.isSilent() ? -1 : 1);
|
||||
- this.level.addFreshEntity(areaEffectCloud);
|
||||
+ this.level.addFreshEntity(areaEffectCloud, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EXPLOSION); // Paper
|
||||
} else areaEffectCloud.discard(); // Paper
|
||||
this.discard();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
|
||||
index af7f77fb9fdf27509499f9d35fd42a6a50bf9cb0..e1d8ababdb992821cc0ac383c13f1f4d10b09107 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FrogspawnBlock.java
|
||||
@@ -103,7 +103,7 @@ public class FrogspawnBlock extends Block {
|
||||
int k = random.nextInt(1, 361);
|
||||
tadpole.moveTo(d, (double)pos.getY() - 0.5D, e, (float)k, 0.0F);
|
||||
tadpole.setPersistenceRequired();
|
||||
- world.addFreshEntity(tadpole);
|
||||
+ world.addFreshEntity(tadpole, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); // Paper
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user