Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/nms-patches/ItemBow.patch

52 Zeilen
2.5 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/ItemBow.java
+++ b/net/minecraft/server/ItemBow.java
2019-04-23 04:00:00 +02:00
@@ -6,12 +6,16 @@
2018-07-15 02:00:00 +02:00
public ItemBow(Item.Info item_info) {
super(item_info);
+ // CraftBukkit start - obfuscator went a little crazy
+ /*
this.a(new MinecraftKey("pull"), (itemstack, world, entityliving) -> {
2019-04-23 04:00:00 +02:00
return entityliving == null ? 0.0F : (entityliving.dl().getItem() != Items.BOW ? 0.0F : (float) (itemstack.k() - entityliving.dm()) / 20.0F);
2018-07-15 02:00:00 +02:00
});
this.a(new MinecraftKey("pulling"), (itemstack, world, entityliving) -> {
2019-04-23 04:00:00 +02:00
return entityliving != null && entityliving.isHandRaised() && entityliving.dl() == itemstack ? 1.0F : 0.0F;
2018-07-15 02:00:00 +02:00
});
+ */
+ // CraftBukkit end
}
2019-04-23 04:00:00 +02:00
@Override
@@ -56,6 +60,13 @@
2016-02-29 22:32:46 +01:00
if (EnchantmentManager.getEnchantmentLevel(Enchantments.ARROW_FIRE, itemstack) > 0) {
entityarrow.setOnFire(100);
}
2016-02-29 22:32:46 +01:00
+ // CraftBukkit start
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityhuman, itemstack, entityarrow, f);
+ if (event.isCancelled()) {
+ event.getProjectile().remove();
+ return;
+ }
+ // CraftBukkit end
2019-04-23 04:00:00 +02:00
itemstack.damage(1, entityhuman, (entityhuman1) -> {
entityhuman1.d(entityhuman.getRaisedHand());
@@ -64,7 +75,16 @@
2016-02-29 22:32:46 +01:00
entityarrow.fromPlayer = EntityArrow.PickupStatus.CREATIVE_ONLY;
}
2016-02-29 22:32:46 +01:00
- world.addEntity(entityarrow);
+ // CraftBukkit start
2016-02-29 22:32:46 +01:00
+ if (event.getProjectile() == entityarrow.getBukkitEntity()) {
+ if (!world.addEntity(entityarrow)) {
+ if (entityhuman instanceof EntityPlayer) {
+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory();
+ }
+ return;
+ }
2016-02-29 22:32:46 +01:00
+ }
+ // CraftBukkit end
}
2018-08-26 04:00:00 +02:00
world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (ItemBow.i.nextFloat() * 0.4F + 1.2F) + f * 0.5F);