aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/Interaction.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/Interaction.java.patch')
-rw-r--r--patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/Interaction.java.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/Interaction.java.patch b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/Interaction.java.patch
new file mode 100644
index 0000000000..e78b361c1c
--- /dev/null
+++ b/patch-remap/mache-spigotflower-stripped/net/minecraft/world/entity/Interaction.java.patch
@@ -0,0 +1,39 @@
+--- a/net/minecraft/world/entity/Interaction.java
++++ b/net/minecraft/world/entity/Interaction.java
+@@ -24,6 +23,13 @@
+ import net.minecraft.world.phys.AABB;
+ import org.slf4j.Logger;
+
++// CraftBukkit start
++import net.minecraft.world.damagesource.DamageSource;
++import net.minecraft.world.entity.player.Player;
++import org.bukkit.craftbukkit.event.CraftEventFactory;
++import org.bukkit.event.entity.EntityDamageEvent;
++// CraftBukkit end
++
+ public class Interaction extends Entity implements Attackable, Targeting {
+
+ private static final Logger LOGGER = LogUtils.getLogger();
+@@ -151,13 +148,20 @@
+ @Override
+ public boolean skipAttackInteraction(Entity entity) {
+ if (entity instanceof Player) {
+- Player player = (Player) entity;
++ Player entityhuman = (Player) entity;
++ // CraftBukkit start
++ DamageSource source = entityhuman.damageSources().playerAttack(entityhuman);
++ EntityDamageEvent event = CraftEventFactory.callNonLivingEntityDamageEvent(this, source, 1.0F, false);
++ if (event.isCancelled()) {
++ return true;
++ }
++ // CraftBukkit end
+
+ this.attack = new Interaction.PlayerAction(player.getUUID(), this.level().getGameTime());
+ if (player instanceof ServerPlayer) {
+ ServerPlayer serverplayer = (ServerPlayer) player;
+
+- CriteriaTriggers.PLAYER_HURT_ENTITY.trigger(serverplayer, this, player.damageSources().generic(), 1.0F, 1.0F, false);
++ CriteriaTriggers.PLAYER_HURT_ENTITY.trigger(entityplayer, this, source, (float) event.getFinalDamage(), 1.0F, false); // CraftBukkit
+ }
+
+ return !this.getResponse();