Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-20 21:40:06 +01:00
36 Zeilen
2.0 KiB
Diff
36 Zeilen
2.0 KiB
Diff
--- a/net/minecraft/server/ItemBow.java
|
|
+++ b/net/minecraft/server/ItemBow.java
|
|
@@ -50,6 +50,14 @@
|
|
if (EnchantmentManager.getEnchantmentLevel(Enchantments.ARROW_FIRE, itemstack) > 0) {
|
|
entityarrow.setOnFire(100);
|
|
}
|
|
+ // CraftBukkit start
|
|
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityhuman, itemstack, itemstack1, entityarrow, entityhuman.getRaisedHand(), f, !flag1);
|
|
+ if (event.isCancelled()) {
|
|
+ event.getProjectile().remove();
|
|
+ return;
|
|
+ }
|
|
+ flag1 = !event.shouldConsumeItem();
|
|
+ // CraftBukkit end
|
|
|
|
itemstack.damage(1, entityhuman, (entityhuman1) -> {
|
|
entityhuman1.broadcastItemBreak(entityhuman.getRaisedHand());
|
|
@@ -58,7 +66,16 @@
|
|
entityarrow.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY;
|
|
}
|
|
|
|
- world.addEntity(entityarrow);
|
|
+ // CraftBukkit start
|
|
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
|
|
+ if (!world.addEntity(entityarrow)) {
|
|
+ if (entityhuman instanceof EntityPlayer) {
|
|
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
|
|
+ }
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (ItemBow.RANDOM.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
|