Interface ContainerExtension
- All Known Subinterfaces:
Container,ContainerEntity,ContainerSingleItem,ContainerSingleItem.BlockContainerSingleItem,CraftingContainer,Hopper,ListBackedContainer,RandomizableContainer,WorldlyContainer
- All Known Implementing Classes:
AbstractChestBoat,AbstractFurnaceBlockEntity,AbstractMinecartContainer,BarrelBlockEntity,BaseContainerBlockEntity,BlastFurnaceBlockEntity,BrewingStandBlockEntity,ChestBlockEntity,ChestBoat,ChestRaft,ChiseledBookShelfBlockEntity,ComposterBlock.EmptyContainer,ComposterBlock.InputContainer,ComposterBlock.OutputContainer,CompoundContainer,CrafterBlockEntity,DecoratedPotBlockEntity,DispenserBlockEntity,DropperBlockEntity,FurnaceBlockEntity,HopperBlockEntity,Inventory,JukeboxBlockEntity,MerchantContainer,MinecartChest,MinecartHopper,PlayerEnderChestContainer,RandomizableContainerBlockEntity,ResultContainer,ShelfBlockEntity,ShulkerBoxBlockEntity,SimpleContainer,SmokerBlockEntity,TransientCraftingContainer,TrappedChestBlockEntity
public interface ContainerExtension
Extension methods for
Container. These methods are used by VanillaContainerWrapper,
to allow containers to be integrated in a transaction.-
Method Summary
Modifier and TypeMethodDescriptiondefault voidonTransfer(int slot, int amountChange, TransactionContext transaction) Perform additional logic during the transaction, immediately after a successful transfer (i.e.private Containerself()default voidAn extension ofContainer.setItem(int, ItemStack)that allows non-transactional side-effects to be skipped.
-
Method Details
-
self
-
setItem
An extension ofContainer.setItem(int, ItemStack)that allows non-transactional side-effects to be skipped. Non-transactional side-effects include for example callingsetChangedor making changes to the world.- Parameters:
insideTransaction- Whentrue, non-transactional actions should be deferred. Whenfalse, non-transactional actions can be performed immediately.- See Also:
-
onTransfer
Perform additional logic during the transaction, immediately after a successful transfer (i.e. insert or extract with result > 0). Any logic performed by this method should be fully transactional, and support being rolled back. In other words, the transaction is still ongoing.- Parameters:
amountChange- If positive, the amount of items that were just inserted into this slot. If negative, minus the amount of items that were just extracted from this slot.
-