Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/main/java/com/example/oneshot/OneShotHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ public static void onAttack(LivingEntity target, LivingEntity attacker, ItemStac
livingAttacker = (net.minecraft.entity.LivingEntity) attacker;
}

// For players, wipe inventory before kill so nothing drops
if (target instanceof PlayerEntity playerTarget) {
try {
playerTarget.getInventory().clear();
} catch (Throwable ignored) {}
}

// Attempt a proper instant-kill using DamageSources when attacker exists
if (livingAttacker != null) {
try {
Expand Down
Loading