2020-08-31 14:30:51 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Sat, 15 Jun 2013 19:51:17 -0400
|
|
|
|
Subject: [PATCH] Improve EntityShootBowEvent
|
|
|
|
|
|
|
|
Adds missing call to Illagers and also adds Arrow ItemStack to skeltons
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java
|
2020-11-18 04:45:18 +01:00
|
|
|
index b00a18643ea8425c5008a25563dbaa17d1a82ca4..50442b3a498d1bab4270e69952a79f5182153ece 100644
|
2020-08-31 14:30:51 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java
|
|
|
|
@@ -134,8 +134,18 @@ public class EntityIllagerIllusioner extends EntityIllagerWizard implements IRan
|
|
|
|
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));
|
|
|
|
+ // Paper start
|
|
|
|
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), entityarrow.getOriginalItemStack(), entityarrow, entityliving.getRaisedHand(), 0.8F, true);
|
|
|
|
+ if (event.isCancelled()) {
|
|
|
|
+ event.getProjectile().remove();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
|
|
|
|
+ this.world.addEntity(entityarrow);
|
|
|
|
+ }
|
|
|
|
this.playSound(SoundEffects.ENTITY_SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
|
|
|
|
- this.world.addEntity(entityarrow);
|
|
|
|
+ // Paper end
|
|
|
|
}
|
|
|
|
|
2020-09-11 01:47:58 +02:00
|
|
|
class a extends EntityIllagerWizard.PathfinderGoalCastSpell {
|
2020-08-31 14:30:51 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
|
2020-11-18 04:45:18 +01:00
|
|
|
index 48c7ba6ecc4ab42805363e31d0864fb685c8d3ca..ced89af70ca791bfe42c4e2d21604997a0cf3e0f 100644
|
2020-08-31 14:30:51 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java
|
|
|
|
@@ -155,7 +155,7 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR
|
|
|
|
|
|
|
|
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(), null, entityarrow, EnumHand.MAIN_HAND, 0.8F, true);
|
|
|
|
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), entityarrow.getOriginalItemStack(), entityarrow, EnumHand.MAIN_HAND, 0.8F, true); // Paper
|
|
|
|
if (event.isCancelled()) {
|
|
|
|
event.getProjectile().remove();
|
|
|
|
return;
|