Fire EntityInteractSpecific on server side. Closes #9984

This commit is contained in:
LexManos committed 2024-06-03 12:33:53 -07:00
1 parent f22894cf70
commit 7ee4a44c75
2 files changed
+16

No files matched your search

@@ -37,6 +37,15 @@
PlayerChatMessage playerchatmessage1 = playerchatmessage.withUnsignedContent(component).filter(p_296589_.mask());
this.broadcastChatMessage(playerchatmessage1);
});
@@ -1516,7 +_,7 @@
@Override
public void onInteraction(InteractionHand p_143682_, Vec3 p_143683_) {
- this.performInteraction(p_143682_, (p_143686_, p_143687_, p_143688_) -> p_143687_.interactAt(p_143686_, p_143683_, p_143688_));
+ this.performInteraction(p_143682_, (p_143686_, p_143687_, p_143688_) -> net.minecraftforge.common.ForgeHooks.onInteractEntityAt(p_143687_, p_143686_, p_143683_, p_143688_));
}
@Override
@@ -1797,6 +_,7 @@
@Override
@@ -255,6 +255,13 @@ public final class ForgeHooks {
return (MinecraftForge.EVENT_BUS.post(event) ? 0 : event.getAmount());
}
public static InteractionResult onInteractEntityAt(Entity entity, Player player, Vec3 vec3d, InteractionHand hand) {
var ret = ForgeEventFactory.onEntityInteractSpecific(player, entity, hand, vec3d);
if (ret.isCanceled())
return ret.getCancellationResult();
return entity.interactAt(player, vec3d, hand);
}
public static int getLootingLevel(Entity target, @Nullable Entity killer, @Nullable DamageSource cause) {
int looting = 0;
if (killer instanceof LivingEntity living)