mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-27 13:06:02 +01:00
62 lines
3.0 KiB
Diff
62 lines
3.0 KiB
Diff
--- a/net/minecraft/server/EntitySmallFireball.java
|
|
+++ b/net/minecraft/server/EntitySmallFireball.java
|
|
@@ -1,5 +1,7 @@
|
|
package net.minecraft.server;
|
|
|
|
+import org.bukkit.event.entity.EntityCombustByEntityEvent; // CraftBukkit
|
|
+
|
|
public class EntitySmallFireball extends EntityFireball {
|
|
|
|
public EntitySmallFireball(World world) {
|
|
@@ -10,6 +12,11 @@
|
|
public EntitySmallFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
|
|
super(world, entityliving, d0, d1, d2);
|
|
this.setSize(0.3125F, 0.3125F);
|
|
+ // CraftBukkit start
|
|
+ if (this.shooter != null && this.shooter instanceof EntityInsentient) {
|
|
+ isIncendiary = this.world.getGameRules().getBoolean("mobGriefing");
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
public EntitySmallFireball(World world, double d0, double d1, double d2, double d3, double d4, double d5) {
|
|
@@ -27,10 +34,17 @@
|
|
|
|
if (movingobjectposition.entity != null) {
|
|
if (!movingobjectposition.entity.isFireProof()) {
|
|
- flag = movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5.0F);
|
|
- if (flag) {
|
|
+ // CraftBukkit start - Entity damage by entity event + combust event
|
|
+ isIncendiary = movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5.0F);
|
|
+ if (isIncendiary) {
|
|
this.a(this.shooter, movingobjectposition.entity);
|
|
- movingobjectposition.entity.setOnFire(5);
|
|
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), movingobjectposition.entity.getBukkitEntity(), 5);
|
|
+ movingobjectposition.entity.world.getServer().getPluginManager().callEvent(event);
|
|
+
|
|
+ if (!event.isCancelled()) {
|
|
+ movingobjectposition.entity.setOnFire(event.getDuration());
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
} else {
|
|
@@ -39,11 +53,15 @@
|
|
flag = this.world.getGameRules().getBoolean("mobGriefing");
|
|
}
|
|
|
|
- if (flag) {
|
|
+ // CraftBukkit start
|
|
+ if (isIncendiary) {
|
|
BlockPosition blockposition = movingobjectposition.a().shift(movingobjectposition.direction);
|
|
|
|
if (this.world.isEmpty(blockposition)) {
|
|
- this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
|
|
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this).isCancelled()) {
|
|
+ this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
}
|
|
}
|