Interface InventoryHook
- All Known Implementing Classes:
VanillaInventoryHook
public interface InventoryHook
-
Method Summary
Modifier and TypeMethodDescriptioncapture(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.damagesource.DamageSource source) id()default voidprepareDrops(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.damagesource.DamageSource source) net.minecraft.world.item.ItemStackrestore(net.minecraft.server.level.ServerPlayer player, CapturedEntry entry) Restores into the original destination, leaving fallback until all original slots are tried.default net.minecraft.world.item.ItemStackrestoreFallback(net.minecraft.server.level.ServerPlayer player, CapturedEntry entry) Tries alternative hook destinations with the same live-remainder contract as restore.
-
Method Details
-
id
String id() -
prepareDrops
default void prepareDrops(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.damagesource.DamageSource source) -
capture
List<CapturedEntry> capture(net.minecraft.server.level.ServerPlayer player, net.minecraft.world.damagesource.DamageSource source) -
restore
net.minecraft.world.item.ItemStack restore(net.minecraft.server.level.ServerPlayer player, CapturedEntry entry) Restores into the original destination, leaving fallback until all original slots are tried. The entry stack is the live remainder: shrink it as transfers succeed, including before invoking callbacks that may throw. Never install that mutable remainder in an inventory; insert a copy. On failure the engine retains the remainder and retries it on a later claim. -
restoreFallback
default net.minecraft.world.item.ItemStack restoreFallback(net.minecraft.server.level.ServerPlayer player, CapturedEntry entry) Tries alternative hook destinations with the same live-remainder contract as restore.
-