Partial Keepinventory
NOTE: This mod is in alpha stage and I'm working on it alone. Bugs and errors may occur.
A Fabric mod that changes the standard inventory saving behavior upon death.
Control Interface
To open the graphical interface, use the command /pki-gui. This requires the mod to be installed on the client side.
Dynamic Formulas
The expression system allows flexible configuration of item drop rules upon death. You can create formulas using available variables. The calculation result is limited to values between 0 and 1.
Basic Variables
| Variable | Description |
|---|---|
| spawnDistance | Distance from player to respawn point |
| spawnX, spawnY, spawnZ | Player respawn point coordinates |
| playerX, playerY, playerZ | Current player coordinates |
Inventory Variables
| Variable | Description |
|---|---|
| isCommon, isUncommon, isRare, isEpic | Determines item rarity (1.0 - yes, 0.0 - no) |
| rarityPercent | Configured drop percentage for item rarity |
| dropPercent | Static inventory drop percentage |
Experience Variables
| Variable | Description |
|---|---|
| xpPoints | Player's experience points amount |
| xpLevel | Player's experience level |
Ready Formula Examples
Distance Dependency
Replace DISTANCE_IN_BLOCKS with the distance from respawn point where item dropping stops (drop percentage decreases linearly).
abs(1-(spawnDistance/DISTANCE_IN_BLOCKS))
Management Commands
Enable/disable the mod
/pki [enable|disable]
Drop behavior configuration
/pki inv mode [vanilla / static / rarity / custom]
Set drop percentage for inventory/rarities (0-100)
/pki inv droprate [static / common / uncommon / rare / epic]
List of players with normal inventory saving
/pki inv savedPlayers list
Add/remove players with normal inventory saving
/pki inv savedPlayers [add / remove]
Set custom drop formula
/pki inv invExpression set [expression]
Experience Drop Settings
Two variables available for experience drop configuration:
- Loss percentage (How much experience is lost)
- Drop percentage (How much of lost experience is dropped)
/pki xp droprate [drop / loss]
Also available are two operation modes:
- Based on levels
- Based on experience points
The levels mode becomes more strict at high levels, as each subsequent level requires more experience to obtain.
/pki xp mode [vanilla / static-level / static-points / custom-level / custom-points]