2023-03-15 21:15:33 +01:00
|
|
|
--- a/net/minecraft/world/entity/Interaction.java
|
|
|
|
+++ b/net/minecraft/world/entity/Interaction.java
|
2024-12-03 17:20:00 +01:00
|
|
|
@@ -27,6 +27,12 @@
|
|
|
|
import net.minecraft.world.phys.Vec3D;
|
2023-03-15 21:15:33 +01:00
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
|
|
|
+// CraftBukkit start
|
|
|
|
+import net.minecraft.world.damagesource.DamageSource;
|
|
|
|
+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();
|
2024-12-03 17:20:00 +01:00
|
|
|
@@ -65,7 +71,7 @@
|
2023-03-15 21:15:33 +01:00
|
|
|
this.setHeight(nbttagcompound.getFloat("height"));
|
|
|
|
}
|
|
|
|
|
|
|
|
- DataResult dataresult;
|
|
|
|
+ DataResult<com.mojang.datafixers.util.Pair<Interaction.PlayerAction, net.minecraft.nbt.NBTBase>> dataresult; // CraftBukkit - decompile error
|
|
|
|
Logger logger;
|
|
|
|
|
|
|
|
if (nbttagcompound.contains("attack")) {
|
2024-12-03 17:20:00 +01:00
|
|
|
@@ -145,9 +151,16 @@
|
2024-04-23 17:15:00 +02:00
|
|
|
@Override
|
2023-03-15 21:15:33 +01:00
|
|
|
public boolean skipAttackInteraction(Entity entity) {
|
2024-04-23 17:15:00 +02:00
|
|
|
if (entity instanceof EntityHuman entityhuman) {
|
2023-03-15 21:15:33 +01:00
|
|
|
+ // CraftBukkit start
|
|
|
|
+ DamageSource source = entityhuman.damageSources().playerAttack(entityhuman);
|
|
|
|
+ EntityDamageEvent event = CraftEventFactory.callNonLivingEntityDamageEvent(this, source, 1.0F, false);
|
|
|
|
+ if (event.isCancelled()) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
2023-06-07 17:30:00 +02:00
|
|
|
this.attack = new Interaction.PlayerAction(entityhuman.getUUID(), this.level().getGameTime());
|
2024-04-23 17:15:00 +02:00
|
|
|
if (entityhuman instanceof EntityPlayer entityplayer) {
|
2023-03-15 21:15:33 +01:00
|
|
|
- CriterionTriggers.PLAYER_HURT_ENTITY.trigger(entityplayer, this, entityhuman.damageSources().generic(), 1.0F, 1.0F, false);
|
|
|
|
+ CriterionTriggers.PLAYER_HURT_ENTITY.trigger(entityplayer, this, source, (float) event.getFinalDamage(), 1.0F, false); // CraftBukkit
|
|
|
|
}
|
|
|
|
|
|
|
|
return !this.getResponse();
|