aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/Interaction.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/Interaction.java.patch')
-rw-r--r--patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/Interaction.java.patch44
1 files changed, 44 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/Interaction.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/Interaction.java.patch
new file mode 100644
index 0000000000..c03fcd8095
--- /dev/null
+++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/Interaction.java.patch
@@ -0,0 +1,44 @@
+--- a/net/minecraft/world/entity/Interaction.java
++++ b/net/minecraft/world/entity/Interaction.java
+@@ -25,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();
+ private static final EntityDataAccessor<Float> DATA_WIDTH_ID = SynchedEntityData.defineId(Interaction.class, EntityDataSerializers.FLOAT);
+@@ -129,12 +147,23 @@
+
+ @Override
+ public boolean skipAttackInteraction(Entity entity) {
+- if (entity instanceof Player player) {
+- this.attack = new Interaction.PlayerAction(player.getUUID(), this.level().getGameTime());
+- if (player instanceof ServerPlayer serverPlayer) {
+- CriteriaTriggers.PLAYER_HURT_ENTITY.trigger(serverPlayer, this, player.damageSources().generic(), 1.0F, 1.0F, false);
++ if (entity instanceof Player) {
++ 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(entityhuman.getUUID(), this.level().getGameTime());
++ if (entityhuman instanceof ServerPlayer) {
++ ServerPlayer entityplayer = (ServerPlayer) entityhuman;
++
++ CriteriaTriggers.PLAYER_HURT_ENTITY.trigger(entityplayer, this, source, (float) event.getFinalDamage(), 1.0F, false); // CraftBukkit
++ }
++
+ return !this.getResponse();
+ } else {
+ return false;