Interface MountedDispenseBehavior
- All Known Implementing Classes:
DefaultMountedDispenseBehavior,MountedProjectileDispenseBehavior,OptionalMountedDispenseBehavior
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A parallel to
DispenseItemBehavior, for use by mounted dispensers.
Create will attempt to wrap existing DispenseItemBehaviors, but this interface can be used to provide better or fixed behavior.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SimpleRegistry<net.minecraft.world.item.Item, MountedDispenseBehavior> -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.ItemStackdispense(net.minecraft.world.item.ItemStack stack, MovementContext context, net.minecraft.core.BlockPos pos) Dispense the given stack into the world.static net.minecraft.core.DirectiongetClosestFacingDirection(net.minecraft.world.phys.Vec3 facing) static net.minecraft.world.phys.Vec3static voidplaceItemInInventory(net.minecraft.world.item.ItemStack stack, MovementContext context, net.minecraft.core.BlockPos pos) Attempt to place an item back into the inventory.
-
Field Details
-
REGISTRY
-
-
Method Details
-
dispense
net.minecraft.world.item.ItemStack dispense(net.minecraft.world.item.ItemStack stack, MovementContext context, net.minecraft.core.BlockPos pos) Dispense the given stack into the world.- Parameters:
stack- the stack to dispense. Safe to modify, behaviors are given a copycontext- the MovementContext of the dispenserpos- the BlockPos being visited by the dispenser- Returns:
- the remaining stack after dispensing one item
-
getDispenserNormal
-
getClosestFacingDirection
static net.minecraft.core.Direction getClosestFacingDirection(net.minecraft.world.phys.Vec3 facing) -
placeItemInInventory
static void placeItemInInventory(net.minecraft.world.item.ItemStack stack, MovementContext context, net.minecraft.core.BlockPos pos) Attempt to place an item back into the inventory. This is used in the case of item overflow, such as a stack of buckets becoming two separate stacks when one is filled with water.First tries to insert directly into the dispenser inventory. If that fails, it then tries the contraption's whole inventory. If that still fails, the stack is dispensed into the world with the default behavior.
- Parameters:
stack- the stack to store in the inventorycontext- the MovementContext given to the behaviorpos- the position given to the behavior
-