-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d70d7e4
commit 173b89a
Showing
6 changed files
with
144 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/main/java/powercyphe/coffins/event/TrinketDropEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package powercyphe.coffins.event; | ||
|
||
|
||
import dev.emi.trinkets.api.TrinketEnums; | ||
import dev.emi.trinkets.api.event.TrinketDropCallback; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.world.GameRules; | ||
|
||
public class TrinketDropEvent { | ||
|
||
public static void registerCallback() { | ||
TrinketDropCallback.EVENT.register((rule, stack, ref, entity) -> { | ||
|
||
// If the trinkets were dropped by a player and keep inventory is off, destroy the trinket | ||
if (!(entity instanceof PlayerEntity player)) return rule; | ||
if (player.getWorld().getGameRules().getBoolean(GameRules.KEEP_INVENTORY)) return rule; | ||
|
||
return TrinketEnums.DropRule.DESTROY; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters