PaperMC/nms-patches/EntitySkeletonAbstract.patch

48 lines
1.8 KiB
Diff
Raw Normal View History

2016-11-17 02:41:03 +01:00
--- a/net/minecraft/server/EntitySkeletonAbstract.java
+++ b/net/minecraft/server/EntitySkeletonAbstract.java
2018-12-25 22:00:00 +01:00
@@ -3,6 +3,7 @@
2018-07-15 02:00:00 +02:00
import java.time.LocalDate;
import java.time.temporal.ChronoField;
2016-11-17 02:41:03 +01:00
import javax.annotation.Nullable;
+import org.bukkit.event.entity.EntityCombustEvent; // CraftBukkit
public abstract class EntitySkeletonAbstract extends EntityMonster implements IRangedEntity {
2018-07-15 02:00:00 +02:00
@@ -78,7 +79,14 @@
}
2016-11-17 02:41:03 +01:00
2018-07-15 02:00:00 +02:00
if (flag) {
- this.setOnFire(8);
+ // CraftBukkit start
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
+ this.world.getServer().getPluginManager().callEvent(event);
2016-11-17 02:41:03 +01:00
+
2018-07-15 02:00:00 +02:00
+ if (!event.isCancelled()) {
+ this.setOnFire(event.getDuration());
+ }
+ // CraftBukkit end
2016-11-17 02:41:03 +01:00
}
}
2018-07-15 02:00:00 +02:00
@@ -151,8 +159,19 @@
2016-11-17 02:41:03 +01:00
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4));
+ // CraftBukkit start
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), entityarrow, 0.8F);
+ if (event.isCancelled()) {
+ event.getProjectile().remove();
+ return;
+ }
+
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
+ world.addEntity(entityarrow);
+ }
+ // CraftBukkit end
2018-07-15 02:00:00 +02:00
this.a(SoundEffects.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
2016-11-17 02:41:03 +01:00
- this.world.addEntity(entityarrow);
+ // this.world.addEntity(entityarrow); // CraftBukkit - moved up
}
protected EntityArrow a(float f) {