mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-05 02:22:12 +01:00
0b77748b35
Expose an entities spawn reason on the entity. Pre existing entities will return NATURAL if it was a non persistenting Living Entity, SPAWNER for spawners, or DEFAULT since data was not stored. Additionally, add missing spawn reasons. Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Doc <nachito94@msn.com>
29 lines
1.6 KiB
Diff
29 lines
1.6 KiB
Diff
--- a/net/minecraft/world/entity/OminousItemSpawner.java
|
|
+++ b/net/minecraft/world/entity/OminousItemSpawner.java
|
|
@@ -76,7 +76,7 @@
|
|
entity = this.spawnProjectile(serverLevel, projectileItem, itemStack);
|
|
} else {
|
|
entity = new ItemEntity(serverLevel, this.getX(), this.getY(), this.getZ(), itemStack);
|
|
- serverLevel.addFreshEntity(entity);
|
|
+ serverLevel.addFreshEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.OMINOUS_ITEM_SPAWNER); // Paper - fixes and addition to spawn reason API
|
|
}
|
|
|
|
serverLevel.levelEvent(3021, this.blockPosition(), 1);
|
|
@@ -90,7 +90,7 @@
|
|
ProjectileItem.DispenseConfig dispenseConfig = item.createDispenseConfig();
|
|
dispenseConfig.overrideDispenseEvent().ifPresent(dispenseEvent -> world.levelEvent(dispenseEvent, this.blockPosition(), 0));
|
|
Direction direction = Direction.DOWN;
|
|
- Projectile projectile = Projectile.spawnProjectileUsingShoot(
|
|
+ Projectile projectile = Projectile.spawnProjectileUsingShootDelayed( // Paper - fixes and addition to spawn reason API
|
|
item.asProjectile(world, this.position(), stack, direction),
|
|
world,
|
|
stack,
|
|
@@ -99,7 +99,7 @@
|
|
(double)direction.getStepZ(),
|
|
dispenseConfig.power(),
|
|
dispenseConfig.uncertainty()
|
|
- );
|
|
+ ).spawn(org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.OMINOUS_ITEM_SPAWNER); // Paper - fixes and addition to spawn reason API
|
|
projectile.setOwner(this);
|
|
return projectile;
|
|
}
|