13
0
geforkt von Mirrors/Paper
Paper/nms-patches/EntitySmallFireball.patch

55 Zeilen
2.8 KiB
Diff

2015-05-25 12:37:24 +02:00
--- 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
+
2019-04-23 04:00:00 +02:00
public class EntitySmallFireball extends EntityFireballFireball {
2019-04-23 04:00:00 +02:00
public EntitySmallFireball(EntityTypes<? extends EntitySmallFireball> entitytypes, World world) {
2018-07-15 02:00:00 +02:00
@@ -8,6 +10,11 @@
public EntitySmallFireball(World world, EntityLiving entityliving, double d0, double d1, double d2) {
2019-04-23 04:00:00 +02:00
super(EntityTypes.SMALL_FIREBALL, entityliving, d0, d1, d2, world);
+ // CraftBukkit start
+ if (this.shooter != null && this.shooter instanceof EntityInsentient) {
2019-06-21 12:00:00 +02:00
+ isIncendiary = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING);
+ }
+ // CraftBukkit end
}
public EntitySmallFireball(World world, double d0, double d1, double d2, double d3, double d4, double d5) {
2019-12-10 23:00:00 +01:00
@@ -24,7 +31,16 @@
2019-04-23 04:00:00 +02:00
if (!entity.isFireProof()) {
2019-06-21 12:00:00 +02:00
int i = entity.ad();
2019-04-23 04:00:00 +02:00
- entity.setOnFire(5);
+ // CraftBukkit start - Entity damage by entity event + combust event
+ if (isIncendiary) {
2019-04-23 04:00:00 +02:00
+ EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), entity.getBukkitEntity(), 5);
+ entity.world.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
2019-04-23 04:00:00 +02:00
+ entity.setOnFire(event.getDuration(), false);
+ }
2018-08-26 04:00:00 +02:00
+ }
+ // CraftBukkit end
2019-04-23 04:00:00 +02:00
boolean flag = entity.damageEntity(DamageSource.fireball(this, this.shooter), 5.0F);
2018-08-26 04:00:00 +02:00
if (flag) {
2019-12-10 23:00:00 +01:00
@@ -33,11 +49,11 @@
2019-06-21 12:00:00 +02:00
entity.g(i);
2019-04-23 04:00:00 +02:00
}
}
2019-06-21 12:00:00 +02:00
- } else if (this.shooter == null || !(this.shooter instanceof EntityInsentient) || this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
2019-04-23 04:00:00 +02:00
+ } else if (isIncendiary) { // CraftBukkit
MovingObjectPositionBlock movingobjectpositionblock = (MovingObjectPositionBlock) movingobjectposition;
BlockPosition blockposition = movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection());
2019-04-23 04:00:00 +02:00
- if (this.world.isEmpty(blockposition)) {
+ if (this.world.isEmpty(blockposition) && !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition, this).isCancelled()) { // CraftBukkit
this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
}
}