aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/projectile/AbstractArrow.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/projectile/AbstractArrow.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/projectile/AbstractArrow.java.patch69
1 files changed, 69 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/projectile/AbstractArrow.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/projectile/AbstractArrow.java.patch
new file mode 100644
index 0000000000..f87c49e800
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/projectile/AbstractArrow.java.patch
@@ -0,0 +1,69 @@
+--- a/net/minecraft/world/entity/projectile/AbstractArrow.java
++++ b/net/minecraft/world/entity/projectile/AbstractArrow.java
+@@ -44,6 +47,9 @@
+ import net.minecraft.world.phys.HitResult;
+ import net.minecraft.world.phys.Vec3;
+ import net.minecraft.world.phys.shapes.VoxelShape;
++import org.bukkit.event.entity.EntityCombustByEntityEvent;
++import org.bukkit.event.player.PlayerPickupArrowEvent;
++// CraftBukkit end
+
+ public abstract class AbstractArrow extends Projectile {
+ private static final double ARROW_BASE_DAMAGE = 2.0;
+@@ -197,8 +222,8 @@
+ }
+ }
+
+- if (hitResult != null && !isNoPhysics) {
+- this.onHit(hitResult);
++ if (object != null && !flag) {
++ this.preOnHit((HitResult) object); // CraftBukkit - projectile hit event
+ this.hasImpulse = true;
+ }
+
+@@ -341,10 +367,17 @@
+ }
+
+ boolean flag = entity.getType() == EntityType.ENDERMAN;
+- int remainingFireTicks = entity.getRemainingFireTicks();
+- boolean isDeflectsArrows = entity.getType().is(EntityTypeTags.DEFLECTS_ARROWS);
+- if (this.isOnFire() && !flag && !isDeflectsArrows) {
+- entity.setSecondsOnFire(5);
++ int k = entity.getRemainingFireTicks();
++ boolean flag1 = entity.getType().is(EntityTypeTags.DEFLECTS_ARROWS);
++
++ if (this.isOnFire() && !flag && !flag1) {
++ // CraftBukkit start
++ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
++ org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
++ if (!combustEvent.isCancelled()) {
++ entity.setSecondsOnFire(combustEvent.getDuration(), false);
++ }
++ // CraftBukkit end
+ }
+
+ if (entity.hurt(damageSource, (float)ceil)) {
+@@ -516,7 +555,22 @@
+ @Override
+ public void playerTouch(Player entity) {
+ if (!this.level().isClientSide && (this.inGround || this.isNoPhysics()) && this.shakeTime <= 0) {
+- if (this.tryPickup(entity)) {
++ // CraftBukkit start
++ ItemStack itemstack = this.getPickupItem();
++ if (this.pickup == Pickup.ALLOWED && !itemstack.isEmpty() && entity.getInventory().canHold(itemstack) > 0) {
++ ItemEntity item = new ItemEntity(this.level(), this.getX(), this.getY(), this.getZ(), itemstack);
++ PlayerPickupArrowEvent event = new PlayerPickupArrowEvent((org.bukkit.entity.Player) entity.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.level().getCraftServer(), item), (org.bukkit.entity.AbstractArrow) this.getBukkitEntity());
++ // event.setCancelled(!entityhuman.canPickUpLoot); TODO
++ this.level().getCraftServer().getPluginManager().callEvent(event);
++
++ if (event.isCancelled()) {
++ return;
++ }
++ itemstack = item.getItem();
++ }
++
++ if ((this.pickup == AbstractArrow.Pickup.ALLOWED && entity.getInventory().add(itemstack)) || (this.pickup == AbstractArrow.Pickup.CREATIVE_ONLY && entity.getAbilities().instabuild)) {
++ // CraftBukkit end
+ entity.take(this, 1);
+ this.discard();
+ }