2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/EntityArrow.java
|
|
|
|
+++ b/net/minecraft/server/EntityArrow.java
|
2019-01-09 10:38:37 +01:00
|
|
|
@@ -7,6 +7,12 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
import java.util.function.Predicate;
|
2016-05-10 13:47:39 +02:00
|
|
|
import javax.annotation.Nullable;
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.entity.LivingEntity;
|
|
|
|
+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
|
|
|
|
+
|
2016-02-29 22:32:46 +01:00
|
|
|
public abstract class EntityArrow extends Entity implements IProjectile {
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2018-08-26 04:00:00 +02:00
|
|
|
private static final Predicate<Entity> g = IEntitySelector.f.and(IEntitySelector.a.and(Entity::isInteractable));
|
2019-01-09 10:38:37 +01:00
|
|
|
@@ -22,7 +28,7 @@
|
2018-12-27 02:02:17 +01:00
|
|
|
public EntityArrow.PickupStatus fromPlayer;
|
|
|
|
public int shake;
|
|
|
|
public UUID shooter;
|
|
|
|
- private int despawnCounter;
|
|
|
|
+ public int despawnCounter; // PAIL
|
|
|
|
private int aB;
|
|
|
|
private double damage;
|
|
|
|
public int knockbackStrength;
|
2019-01-09 10:38:37 +01:00
|
|
|
@@ -250,6 +256,7 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2016-02-29 22:32:46 +01:00
|
|
|
protected void a(MovingObjectPosition movingobjectposition) {
|
2016-11-28 02:47:01 +01:00
|
|
|
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); // CraftBukkit - Call event
|
2018-07-15 02:00:00 +02:00
|
|
|
if (movingobjectposition.entity != null) {
|
|
|
|
this.b(movingobjectposition);
|
|
|
|
} else {
|
2019-01-09 10:38:37 +01:00
|
|
|
@@ -299,7 +306,13 @@
|
2018-07-15 02:00:00 +02:00
|
|
|
}
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
if (this.isBurning() && !(entity instanceof EntityEnderman)) {
|
|
|
|
- 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)) {
|
2019-01-09 10:38:37 +01:00
|
|
|
@@ -444,6 +457,7 @@
|
2018-08-26 04:00:00 +02:00
|
|
|
|
|
|
|
public void setShooter(@Nullable Entity entity) {
|
|
|
|
this.shooter = entity == null ? null : entity.getUniqueID();
|
|
|
|
+ this.projectileSource = entity == null ? null : (LivingEntity) entity.getBukkitEntity(); // CraftBukkit
|
|
|
|
}
|
|
|
|
|
|
|
|
@Nullable
|
2019-01-09 10:38:37 +01:00
|
|
|
@@ -453,9 +467,23 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
|
|
|
|
public void d(EntityHuman entityhuman) {
|
2018-08-26 04:00:00 +02:00
|
|
|
if (!this.world.isClientSide && (this.inGround || this.q()) && this.shake <= 0) {
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start
|
2018-07-15 02:00:00 +02:00
|
|
|
+ ItemStack itemstack = this.getItemStack();
|
2018-11-30 22:18:09 +01:00
|
|
|
+ if (this.fromPlayer == PickupStatus.ALLOWED && !itemstack.isEmpty() && entityhuman.inventory.canHold(itemstack) > 0) {
|
|
|
|
+ EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
|
2016-03-22 19:03:48 +01:00
|
|
|
+ PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), this, item), (org.bukkit.entity.Arrow) this.getBukkitEntity());
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // event.setCancelled(!entityhuman.canPickUpLoot); TODO
|
|
|
|
+ this.world.getServer().getPluginManager().callEvent(event);
|
|
|
|
+
|
|
|
|
+ if (event.isCancelled()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
2018-11-30 22:18:09 +01:00
|
|
|
+ itemstack = item.getItemStack();
|
2014-11-25 22:32:16 +01:00
|
|
|
+ }
|
2018-08-26 04:00:00 +02:00
|
|
|
boolean flag = this.fromPlayer == EntityArrow.PickupStatus.ALLOWED || this.fromPlayer == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.abilities.canInstantlyBuild || this.q() && this.getShooter().getUniqueID() == entityhuman.getUniqueID();
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2018-07-15 02:00:00 +02:00
|
|
|
- if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(this.getItemStack())) {
|
2018-11-30 22:18:09 +01:00
|
|
|
+ if (this.fromPlayer == EntityArrow.PickupStatus.ALLOWED && !entityhuman.inventory.pickup(itemstack)) {
|
2016-12-10 02:48:56 +01:00
|
|
|
+ // CraftBukkit end
|
|
|
|
flag = false;
|
|
|
|
}
|
|
|
|
|