Improve EntityShootBowEvent
Adds missing call to Illagers and also adds Arrow ItemStack to skeletons == AT == public net.minecraft.world.entity.projectile.AbstractArrow getPickupItem()Lnet.minecraft.world.item.ItemStack;
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
if (world instanceof ServerLevel worldserver) {
|
if (world instanceof ServerLevel worldserver) {
|
||||||
- Projectile.spawnProjectileUsingShoot(entityarrow, worldserver, itemstack1, d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - worldserver.getDifficulty().getId() * 4));
|
- Projectile.spawnProjectileUsingShoot(entityarrow, worldserver, itemstack1, d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - worldserver.getDifficulty().getId() * 4));
|
||||||
+ // CraftBukkit start
|
+ // CraftBukkit start
|
||||||
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), null, entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true);
|
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, net.minecraft.world.InteractionHand.MAIN_HAND, 0.8F, true); // Paper - improve entity shhot bow event - add arrow stack to event
|
||||||
+ if (event.isCancelled()) {
|
+ if (event.isCancelled()) {
|
||||||
+ event.getProjectile().remove();
|
+ event.getProjectile().remove();
|
||||||
+ return;
|
+ return;
|
||||||
|
|||||||
@@ -1,6 +1,24 @@
|
|||||||
--- a/net/minecraft/world/entity/monster/Illusioner.java
|
--- a/net/minecraft/world/entity/monster/Illusioner.java
|
||||||
+++ b/net/minecraft/world/entity/monster/Illusioner.java
|
+++ b/net/minecraft/world/entity/monster/Illusioner.java
|
||||||
@@ -218,7 +218,7 @@
|
@@ -184,7 +184,17 @@
|
||||||
|
Level world = this.level();
|
||||||
|
|
||||||
|
if (world instanceof ServerLevel worldserver) {
|
||||||
|
+ // Paper start - EntityShootBowEvent
|
||||||
|
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getMainHandItem(), entityarrow.getPickupItem(), entityarrow, target.getUsedItemHand(), 0.8F, true);
|
||||||
|
+ if (event.isCancelled()) {
|
||||||
|
+ event.getProjectile().remove();
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
|
||||||
|
Projectile.spawnProjectileUsingShoot(entityarrow, worldserver, itemstack1, d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - worldserver.getDifficulty().getId() * 4));
|
||||||
|
+ }
|
||||||
|
+ // Paper end - EntityShootBowEvent
|
||||||
|
}
|
||||||
|
|
||||||
|
this.playSound(SoundEvents.SKELETON_SHOOT, 1.0F, 1.0F / (this.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||||
|
@@ -218,7 +228,7 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void performSpellCasting() {
|
protected void performSpellCasting() {
|
||||||
@@ -9,7 +27,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@@ -269,7 +269,7 @@
|
@@ -269,7 +279,7 @@
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void performSpellCasting() {
|
protected void performSpellCasting() {
|
||||||
|
|||||||
Reference in New Issue
Block a user