diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/monster/AbstractSkeletonEntityMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/monster/AbstractSkeletonEntityMixin.java index 7f4149da..1b2eb525 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/monster/AbstractSkeletonEntityMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/monster/AbstractSkeletonEntityMixin.java @@ -6,6 +6,7 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.monster.AbstractSkeletonEntity; import net.minecraft.entity.projectile.AbstractArrowEntity; import net.minecraft.item.ItemStack; +import net.minecraft.util.Hand; import net.minecraft.util.SoundEvents; import org.bukkit.craftbukkit.v.event.CraftEventFactory; import org.bukkit.event.entity.EntityShootBowEvent; @@ -21,7 +22,7 @@ public abstract class AbstractSkeletonEntityMixin extends CreatureEntityMixin { @Inject(method = "attackEntityWithRangedAttack", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/monster/AbstractSkeletonEntity;playSound(Lnet/minecraft/util/SoundEvent;FF)V")) private void arclight$shootBow(LivingEntity target, float distanceFactor, CallbackInfo ci, ItemStack itemStack, AbstractArrowEntity arrowEntity) { - EntityShootBowEvent event = CraftEventFactory.callEntityShootBowEvent((AbstractSkeletonEntity) (Object) this, this.getHeldItemMainhand(), arrowEntity, 0.8F); + EntityShootBowEvent event = CraftEventFactory.callEntityShootBowEvent((AbstractSkeletonEntity) (Object) this, this.getHeldItemMainhand(), null, arrowEntity, Hand.MAIN_HAND, 0.8F, true); if (event.isCancelled()) { event.getProjectile().remove(); ci.cancel(); diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/item/BowItemMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/item/BowItemMixin.java index 2e1d1c1e..5802fea7 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/item/BowItemMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/item/BowItemMixin.java @@ -82,11 +82,12 @@ public abstract class BowItemMixin extends ShootableItem { abstractarrowentity.setFire(100); } - EntityShootBowEvent event = CraftEventFactory.callEntityShootBowEvent(playerentity, itemstack, abstractarrowentity, f); + EntityShootBowEvent event = CraftEventFactory.callEntityShootBowEvent(playerentity, stack, itemstack, abstractarrowentity, playerentity.getActiveHand(), f, !flag1); if (event.isCancelled()) { event.getProjectile().remove(); return; } + flag1 = !event.shouldConsumeItem(); stack.damageItem(1, playerentity, (p_220009_1_) -> { p_220009_1_.sendBreakAnimation(playerentity.getActiveHand()); diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/item/CrossbowItemMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/item/CrossbowItemMixin.java index 51a2aa85..529e46bf 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/item/CrossbowItemMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/item/CrossbowItemMixin.java @@ -25,7 +25,7 @@ public class CrossbowItemMixin { @Inject(method = "fireProjectile", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;damageItem(ILnet/minecraft/entity/LivingEntity;Ljava/util/function/Consumer;)V")) private static void arclight$entityShoot(World worldIn, LivingEntity shooter, Hand handIn, ItemStack crossbow, ItemStack projectile, float soundPitch, boolean isCreativeMode, float velocity, float inaccuracy, float projectileAngle, CallbackInfo ci, boolean flag, ProjectileEntity proj) { - EntityShootBowEvent event = CraftEventFactory.callEntityShootBowEvent(shooter, crossbow, proj, soundPitch); + EntityShootBowEvent event = CraftEventFactory.callEntityShootBowEvent(shooter, crossbow, projectile, proj, shooter.getActiveHand(), soundPitch, true); if (event.isCancelled()) { event.getProjectile().remove(); ci.cancel();