2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/projectile/EntityArrow.java
|
|
|
|
+++ b/net/minecraft/world/entity/projectile/EntityArrow.java
|
2022-12-07 17:00:00 +01:00
|
|
|
@@ -46,6 +46,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;
|
2022-12-07 17:00:00 +01:00
|
|
|
@@ -212,7 +218,7 @@
|
2021-05-09 08:51:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (object != null && !flag) {
|
2021-11-21 23:00:00 +01:00
|
|
|
- this.onHit((MovingObjectPosition) object);
|
2021-05-09 08:51:44 +02:00
|
|
|
+ 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
|
|
|
}
|
|
|
|
|
2022-12-07 17:00:00 +01:00
|
|
|
@@ -359,7 +365,13 @@
|
2021-11-21 23:00:00 +01:00
|
|
|
int k = entity.getRemainingFireTicks();
|
2015-02-26 23:41:06 +01:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
if (this.isOnFire() && !flag) {
|
|
|
|
- entity.setSecondsOnFire(5);
|
2018-07-15 02:00:00 +02:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
|
|
|
|
+ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
|
|
|
|
+ if (!combustEvent.isCancelled()) {
|
2021-11-21 23:00:00 +01:00
|
|
|
+ entity.setSecondsOnFire(combustEvent.getDuration(), false);
|
2018-07-15 02:00:00 +02:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
}
|
2014-11-25 22:32:16 +01:00
|
|
|
|
2021-11-21 23:00:00 +01:00
|
|
|
if (entity.hurt(damagesource, (float) i)) {
|
2022-12-07 17:00:00 +01:00
|
|
|
@@ -522,7 +534,22 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
@Override
|
2021-11-21 23:00:00 +01:00
|
|
|
public void playerTouch(EntityHuman entityhuman) {
|
2023-06-07 17:30:00 +02:00
|
|
|
if (!this.level().isClientSide && (this.inGround || this.isNoPhysics()) && this.shakeTime <= 0) {
|
2021-11-21 23:00:00 +01:00
|
|
|
- if (this.tryPickup(entityhuman)) {
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // CraftBukkit start
|
2021-11-21 23:00:00 +01:00
|
|
|
+ ItemStack itemstack = this.getPickupItem();
|
2021-06-11 07:00:00 +02:00
|
|
|
+ if (this.pickup == PickupStatus.ALLOWED && !itemstack.isEmpty() && entityhuman.getInventory().canHold(itemstack) > 0) {
|
2023-06-07 17:30:00 +02:00
|
|
|
+ EntityItem item = new EntityItem(this.level(), this.getX(), this.getY(), this.getZ(), itemstack);
|
|
|
|
+ PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.level().getCraftServer(), this, item), (org.bukkit.entity.AbstractArrow) this.getBukkitEntity());
|
2014-11-25 22:32:16 +01:00
|
|
|
+ // event.setCancelled(!entityhuman.canPickUpLoot); TODO
|
2023-06-07 17:30:00 +02:00
|
|
|
+ this.level().getCraftServer().getPluginManager().callEvent(event);
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
|
|
|
+ if (event.isCancelled()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
2021-11-21 23:00:00 +01:00
|
|
|
+ itemstack = item.getItem();
|
2014-11-25 22:32:16 +01:00
|
|
|
+ }
|
2021-06-11 07:00:00 +02:00
|
|
|
+
|
2021-11-21 23:00:00 +01:00
|
|
|
+ if ((this.pickup == EntityArrow.PickupStatus.ALLOWED && entityhuman.getInventory().add(itemstack)) || (this.pickup == EntityArrow.PickupStatus.CREATIVE_ONLY && entityhuman.getAbilities().instabuild)) {
|
2016-12-10 02:48:56 +01:00
|
|
|
+ // CraftBukkit end
|
2021-11-21 23:00:00 +01:00
|
|
|
entityhuman.take(this, 1);
|
|
|
|
this.discard();
|
2016-12-10 02:48:56 +01:00
|
|
|
}
|