2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/projectile/EntityArrow.java
|
|
|
|
+++ b/net/minecraft/world/entity/projectile/EntityArrow.java
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -44,6 +44,12 @@
|
2021-03-15 23:00:00 +01:00
|
|
|
import net.minecraft.world.phys.Vec3D;
|
|
|
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
+// CraftBukkit start
|
2021-03-15 23:00:00 +01:00
|
|
|
+import net.minecraft.world.entity.item.EntityItem;
|
2014-11-25 22:32:16 +01:00
|
|
|
+import org.bukkit.event.entity.EntityCombustByEntityEvent;
|
2016-03-22 19:03:48 +01:00
|
|
|
+import org.bukkit.event.player.PlayerPickupArrowEvent;
|
2014-11-25 22:32:16 +01:00
|
|
|
+// CraftBukkit end
|
|
|
|
+
|
2020-06-25 02:00:00 +02:00
|
|
|
public abstract class EntityArrow extends IProjectile {
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2021-06-11 07:00:00 +02:00
|
|
|
private static final double ARROW_BASE_DAMAGE = 2.0D;
|
|
|
|
@@ -210,7 +216,7 @@
|
2021-05-09 08:51:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (object != null && !flag) {
|
|
|
|
- this.a((MovingObjectPosition) object);
|
|
|
|
+ this.preOnHit((MovingObjectPosition) object); // CraftBukkit - projectile hit event
|
2021-06-11 07:00:00 +02:00
|
|
|
this.hasImpulse = true;
|
2021-05-09 08:51:44 +02:00
|
|
|
}
|
|
|
|
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -357,7 +363,13 @@
|
2020-06-25 02:00:00 +02:00
|
|
|
int k = entity.getFireTicks();
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2019-12-10 23:00:00 +01:00
|
|
|
if (this.isBurning() && !flag) {
|
2018-07-15 02:00:00 +02:00
|
|
|
- entity.setOnFire(5);
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
|
|
|
|
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
|
|
|
|
+ if (!combustEvent.isCancelled()) {
|
2019-01-11 01:41:32 +01:00
|
|
|
+ entity.setOnFire(combustEvent.getDuration(), false);
|
2018-07-15 02:00:00 +02:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
if (entity.damageEntity(damagesource, (float) i)) {
|
2021-06-11 07:00:00 +02:00
|
|
|
@@ -519,7 +531,22 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|
|
|
|
public void pickup(EntityHuman entityhuman) {
|
2021-06-11 07:00:00 +02:00
|
|
|
if (!this.level.isClientSide && (this.inGround || this.t()) && this.shakeTime <= 0) {
|
|
|
|
- if (this.a(entityhuman)) {
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start
|
2018-07-15 02:00:00 +02:00
|
|
|
+ ItemStack itemstack = this.getItemStack();
|
2021-06-11 07:00:00 +02:00
|
|
|
+ if (this.pickup == PickupStatus.ALLOWED && !itemstack.isEmpty() && entityhuman.getInventory().canHold(itemstack) > 0) {
|
|
|
|
+ EntityItem item = new EntityItem(this.level, this.locX(), this.locY(), this.locZ(), itemstack);
|
|
|
|
+ PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.level.getServer(), this, item), (org.bukkit.entity.AbstractArrow) this.getBukkitEntity());
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // event.setCancelled(!entityhuman.canPickUpLoot); TODO
|
2021-06-11 07:00:00 +02:00
|
|
|
+ this.level.getServer().getPluginManager().callEvent(event);
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
|
|
|
+ if (event.isCancelled()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
2018-11-30 22:18:09 +01:00
|
|
|
+ itemstack = item.getItemStack();
|
2014-11-25 22:32:16 +01:00
|
|
|
+ }
|
2021-06-11 07:00:00 +02:00
|
|
|
+
|
|
|
|
+ if ((this.pickup == EntityArrow.PickupStatus.ALLOWED && entityhuman.getInventory().pickup(itemstack)) || (this.pickup == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.getAbilities().instabuild)) {
|
2016-12-10 02:48:56 +01:00
|
|
|
+ // CraftBukkit end
|
2021-06-11 07:00:00 +02:00
|
|
|
entityhuman.receive(this, 1);
|
|
|
|
this.die();
|
2016-12-10 02:48:56 +01:00
|
|
|
}
|