use of com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour in project Create by Creators-of-Create.
the class StockpileSwitchTileEntity method addBehaviours.
@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
filtering = new FilteringBehaviour(this, new FilteredDetectorFilterSlot()).moveText(new Vec3(0, 5, 0)).withCallback($ -> updateCurrentLevel());
behaviours.add(filtering);
InterfaceProvider towardBlockFacing = InterfaceProvider.towardBlockFacing();
behaviours.add(observedInventory = new InvManipulationBehaviour(this, towardBlockFacing).bypassSidedness());
behaviours.add(observedTank = new TankManipulationBehaviour(this, towardBlockFacing).bypassSidedness());
}
use of com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour in project Create by Creators-of-Create.
the class FunnelTileEntity method addBehaviours.
@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
invManipulation = new InvManipulationBehaviour(this, (w, p, s) -> new BlockFace(p, AbstractFunnelBlock.getFunnelFacing(s).getOpposite()));
behaviours.add(invManipulation);
filtering = new FilteringBehaviour(this, new FunnelFilterSlotPositioning());
filtering.showCountWhen(this::supportsAmountOnFilter);
filtering.onlyActiveWhen(this::supportsFiltering);
behaviours.add(filtering);
behaviours.add(new DirectBeltInputBehaviour(this).onlyInsertWhen(this::supportsDirectBeltInput).setInsertionHandler(this::handleDirectBeltInput));
}
use of com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour in project Create by Creators-of-Create.
the class ContentObserverTileEntity method addBehaviours.
@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
filtering = new FilteringBehaviour(this, new FilteredDetectorFilterSlot()).moveText(new Vec3(0, 5, 0));
behaviours.add(filtering);
InterfaceProvider towardBlockFacing = InterfaceProvider.towardBlockFacing();
behaviours.add(observedInventory = new InvManipulationBehaviour(this, towardBlockFacing).bypassSidedness());
behaviours.add(observedTank = new TankManipulationBehaviour(this, towardBlockFacing).bypassSidedness());
}
use of com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour in project Create by Creators-of-Create.
the class AbstractFunnelBlock method tryInsert.
public static ItemStack tryInsert(Level worldIn, BlockPos pos, ItemStack toInsert, boolean simulate) {
FilteringBehaviour filter = TileEntityBehaviour.get(worldIn, pos, FilteringBehaviour.TYPE);
InvManipulationBehaviour inserter = TileEntityBehaviour.get(worldIn, pos, InvManipulationBehaviour.TYPE);
if (inserter == null)
return toInsert;
if (filter != null && !filter.test(toInsert))
return toInsert;
if (simulate)
inserter.simulate();
ItemStack insert = inserter.insert(toInsert);
if (!simulate && insert.getCount() != toInsert.getCount()) {
BlockEntity tileEntity = worldIn.getBlockEntity(pos);
if (tileEntity instanceof FunnelTileEntity) {
FunnelTileEntity funnelTileEntity = (FunnelTileEntity) tileEntity;
funnelTileEntity.onTransfer(toInsert);
if (funnelTileEntity.hasFlap())
funnelTileEntity.flap(true);
}
}
return insert;
}
Aggregations