mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 03:52:45 +01:00
eed041d629
By: md_5 <git@md-5.net>
64 lines
3 KiB
Diff
64 lines
3 KiB
Diff
--- a/net/minecraft/world/entity/projectile/EntitySmallFireball.java
|
|
+++ b/net/minecraft/world/entity/projectile/EntitySmallFireball.java
|
|
@@ -16,6 +16,11 @@
|
|
import net.minecraft.world.phys.MovingObjectPositionEntity;
|
|
import net.minecraft.world.phys.Vec3D;
|
|
|
|
+// CraftBukkit start
|
|
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
|
+import org.bukkit.event.entity.EntityRemoveEvent;
|
|
+// CraftBukkit end
|
|
+
|
|
public class EntitySmallFireball extends EntityFireballFireball {
|
|
|
|
public EntitySmallFireball(EntityTypes<? extends EntitySmallFireball> entitytypes, World world) {
|
|
@@ -24,6 +29,11 @@
|
|
|
|
public EntitySmallFireball(World world, EntityLiving entityliving, Vec3D vec3d) {
|
|
super(EntityTypes.SMALL_FIREBALL, entityliving, vec3d, world);
|
|
+ // CraftBukkit start
|
|
+ if (this.getOwner() != null && this.getOwner() instanceof EntityInsentient) {
|
|
+ isIncendiary = this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
public EntitySmallFireball(World world, double d0, double d1, double d2, Vec3D vec3d) {
|
|
@@ -40,7 +50,14 @@
|
|
Entity entity1 = this.getOwner();
|
|
int i = entity.getRemainingFireTicks();
|
|
|
|
- entity.igniteForSeconds(5.0F);
|
|
+ // CraftBukkit start - Entity damage by entity event + combust event
|
|
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), entity.getBukkitEntity(), 5.0F);
|
|
+ entity.level().getCraftServer().getPluginManager().callEvent(event);
|
|
+
|
|
+ if (!event.isCancelled()) {
|
|
+ entity.igniteForSeconds(event.getDuration(), false);
|
|
+ }
|
|
+ // CraftBukkit end
|
|
DamageSource damagesource = this.damageSources().fireball(this, entity1);
|
|
|
|
if (!entity.hurt(damagesource, 5.0F)) {
|
|
@@ -58,10 +75,10 @@
|
|
if (!this.level().isClientSide) {
|
|
Entity entity = this.getOwner();
|
|
|
|
- if (!(entity instanceof EntityInsentient) || this.level().getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) {
|
|
+ if (isIncendiary) { // CraftBukkit
|
|
BlockPosition blockposition = movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection());
|
|
|
|
- if (this.level().isEmptyBlock(blockposition)) {
|
|
+ if (this.level().isEmptyBlock(blockposition) && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.level(), blockposition, this).isCancelled()) { // CraftBukkit
|
|
this.level().setBlockAndUpdate(blockposition, BlockFireAbstract.getState(this.level(), blockposition));
|
|
}
|
|
}
|
|
@@ -73,7 +90,7 @@
|
|
protected void onHit(MovingObjectPosition movingobjectposition) {
|
|
super.onHit(movingobjectposition);
|
|
if (!this.level().isClientSide) {
|
|
- this.discard();
|
|
+ this.discard(EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause
|
|
}
|
|
|
|
}
|