ReplaceItem.from constructor
ReplaceItem.from(})
To copy an Item from one slot to another use ReplaceItem.from
:
ReplaceItem.from | |
---|---|
Location or Entity | the target container to copy to |
slot | the slot to copy to(required) |
from | another Location or Entity to copy from(required) |
fromSlot | the slot to copy from(required) |
modifier | an item modifier path |
Example:
ReplaceItem.from(
Entity.Player(),
slot: Slot.Hotbar5,
from: Location.here(),
fromSlot: Slot.Container1,
)
⇒ item entity @p hotbar.5 copy block ~ ~ ~ container.1
Implementation
ReplaceItem.from(
dynamic target, {
required dynamic from,
required this.fromSlot,
required this.slot,
this.modifier,
}) : _type = _ReplaceItemType.from {
_setTarget(target);
if (from is Entity) {
fromEntity = from;
} else if (from is Location) {
fromLoc = from;
} else {
throw 'ReplaceItem has to get a from argument as Entity or Location';
}
}