2019-04-23 04:00:00 +02:00
|
|
|
--- a/net/minecraft/server/ItemCrossbow.java
|
|
|
|
+++ b/net/minecraft/server/ItemCrossbow.java
|
|
|
|
@@ -12,6 +12,8 @@
|
|
|
|
|
|
|
|
public ItemCrossbow(Item.Info item_info) {
|
|
|
|
super(item_info);
|
|
|
|
+ // CraftBukkit start - obfuscator went a little crazy
|
|
|
|
+ /*
|
|
|
|
this.a(new MinecraftKey("pull"), (itemstack, world, entityliving) -> {
|
2019-12-10 23:00:00 +01:00
|
|
|
return entityliving != null && itemstack.getItem() == this ? (d(itemstack) ? 0.0F : (float) (itemstack.k() - entityliving.dE()) / (float) e(itemstack)) : 0.0F;
|
2019-04-23 04:00:00 +02:00
|
|
|
});
|
|
|
|
@@ -24,6 +26,8 @@
|
|
|
|
this.a(new MinecraftKey("firework"), (itemstack, world, entityliving) -> {
|
|
|
|
return entityliving != null && d(itemstack) && a(itemstack, Items.FIREWORK_ROCKET) ? 1.0F : 0.0F;
|
|
|
|
});
|
|
|
|
+ */
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-05-14 02:00:00 +02:00
|
|
|
@@ -87,6 +91,11 @@
|
2019-05-05 08:18:29 +02:00
|
|
|
itemstack1 = new ItemStack(Items.ARROW);
|
|
|
|
itemstack2 = itemstack1.cloneItemStack();
|
|
|
|
}
|
|
|
|
+ // CraftBukkit start - SPIGOT-4870, MC-150847
|
|
|
|
+ else if (itemstack1.isEmpty()) {
|
2019-05-14 02:00:00 +02:00
|
|
|
+ return false;
|
2019-05-05 08:18:29 +02:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
|
2019-05-14 02:00:00 +02:00
|
|
|
if (!a(entityliving, itemstack, itemstack1, k > 0, flag)) {
|
|
|
|
return false;
|
|
|
|
@@ -210,11 +219,27 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
vector3fa.a(quaternion);
|
|
|
|
((IProjectile) object).shoot((double) vector3fa.a(), (double) vector3fa.b(), (double) vector3fa.c(), f1, f2);
|
|
|
|
}
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(entityliving, itemstack, (Entity) object, f);
|
|
|
|
+ if (event.isCancelled()) {
|
|
|
|
+ event.getProjectile().remove();
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
|
|
|
|
itemstack.damage(flag1 ? 3 : 1, entityliving, (entityliving1) -> {
|
|
|
|
entityliving1.d(enumhand);
|
|
|
|
});
|
|
|
|
- world.addEntity((Entity) object);
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ if (event.getProjectile() == ((Entity) object).getBukkitEntity()) {
|
|
|
|
+ if (!world.addEntity((Entity) object)) {
|
|
|
|
+ if (entityliving instanceof EntityPlayer) {
|
|
|
|
+ ((EntityPlayer) entityliving).getBukkitEntity().updateInventory();
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2019-12-10 23:00:00 +01:00
|
|
|
world.playSound((EntityHuman) null, entityliving.locX(), entityliving.locY(), entityliving.locZ(), SoundEffects.ITEM_CROSSBOW_SHOOT, SoundCategory.PLAYERS, 1.0F, f);
|
2019-04-23 04:00:00 +02:00
|
|
|
}
|
|
|
|
}
|