Skip to content

Commit 1c9259f

Browse files
committed
Re-Use AP Fake Player, player destroy item hook for third party events/mods
1 parent b623e1a commit 1c9259f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/main/java/de/srendi/advancedperipherals/common/util/fakeplayer/APFakePlayer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import net.neoforged.neoforge.common.CommonHooks;
4242
import net.neoforged.neoforge.common.NeoForgeMod;
4343
import net.neoforged.neoforge.common.util.FakePlayer;
44+
import net.neoforged.neoforge.event.EventHooks;
4445
import net.neoforged.neoforge.event.entity.player.PlayerInteractEvent;
4546
import org.jetbrains.annotations.NotNull;
4647
import org.jetbrains.annotations.Nullable;
@@ -278,10 +279,9 @@ public InteractionResult use(boolean skipEntity, boolean skipBlock, @Nullable Pr
278279

279280
ItemStack copyBeforeUse = stack.copy();
280281
InteractionResult result = stack.useOn(new UseOnContext(level(), this, InteractionHand.MAIN_HAND, stack, blockHit));
281-
//if (stack.isEmpty()) {
282-
//TODO
283-
//CommonHooks.onPlayerDestroyItem(this, copyBeforeUse, InteractionHand.MAIN_HAND);
284-
//}
282+
if (stack.isEmpty()) {
283+
EventHooks.onPlayerDestroyItem(this, copyBeforeUse, InteractionHand.MAIN_HAND);
284+
}
285285
return result;
286286
} else if (hit instanceof EntityHitResult entityHit) {
287287
return useOnSpecificEntity(entityHit.getEntity(), entityHit);

0 commit comments

Comments
 (0)