Search in sources :

Example 6 with InvManipulationBehaviour

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());
}
Also used : IItemHandler(net.minecraftforge.items.IItemHandler) IFluidHandler(net.minecraftforge.fluids.capability.IFluidHandler) TileEntityBehaviour(com.simibubi.create.foundation.tileEntity.TileEntityBehaviour) InterfaceProvider(com.simibubi.create.foundation.tileEntity.behaviour.inventory.CapManipulationBehaviourBase.InterfaceProvider) InvManipulationBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour) TankManipulationBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.inventory.TankManipulationBehaviour) BlockState(net.minecraft.world.level.block.state.BlockState) FilteringBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour) SmartTileEntity(com.simibubi.create.foundation.tileEntity.SmartTileEntity) TickPriority(net.minecraft.world.ticks.TickPriority) List(java.util.List) CompoundTag(net.minecraft.nbt.CompoundTag) BlockPos(net.minecraft.core.BlockPos) BlockEntityType(net.minecraft.world.level.block.entity.BlockEntityType) Vec3(net.minecraft.world.phys.Vec3) Block(net.minecraft.world.level.block.Block) FluidStack(net.minecraftforge.fluids.FluidStack) ItemStack(net.minecraft.world.item.ItemStack) Mth(net.minecraft.util.Mth) FilteringBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour) Vec3(net.minecraft.world.phys.Vec3) InvManipulationBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour) InterfaceProvider(com.simibubi.create.foundation.tileEntity.behaviour.inventory.CapManipulationBehaviourBase.InterfaceProvider) TankManipulationBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.inventory.TankManipulationBehaviour)

Example 7 with InvManipulationBehaviour

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));
}
Also used : InstancedRenderDispatcher(com.jozufozu.flywheel.backend.instancing.InstancedRenderDispatcher) AllPackets(com.simibubi.create.foundation.networking.AllPackets) IHaveHoveringInformation(com.simibubi.create.content.contraptions.goggles.IHaveHoveringInformation) VecHelper(com.simibubi.create.foundation.utility.VecHelper) AABB(net.minecraft.world.phys.AABB) InvManipulationBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour) Direction(net.minecraft.core.Direction) BlockState(net.minecraft.world.level.block.state.BlockState) BeltHelper(com.simibubi.create.content.contraptions.relays.belt.BeltHelper) FilteringBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour) Dist(net.minecraftforge.api.distmarker.Dist) SmartTileEntity(com.simibubi.create.foundation.tileEntity.SmartTileEntity) InterpolatedChasingValue(com.simibubi.create.foundation.utility.animation.InterpolatedChasingValue) AllConfigs(com.simibubi.create.foundation.config.AllConfigs) BlockFace(com.simibubi.create.foundation.utility.BlockFace) WeakReference(java.lang.ref.WeakReference) AllBlocks(com.simibubi.create.AllBlocks) BlockStateProperties(net.minecraft.world.level.block.state.properties.BlockStateProperties) TileEntityBehaviour(com.simibubi.create.foundation.tileEntity.TileEntityBehaviour) DistExecutor(net.minecraftforge.fml.DistExecutor) BeltTileEntity(com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity) List(java.util.List) CompoundTag(net.minecraft.nbt.CompoundTag) BlockPos(net.minecraft.core.BlockPos) ItemEntity(net.minecraft.world.entity.item.ItemEntity) BlockEntityType(net.minecraft.world.level.block.entity.BlockEntityType) Vec3(net.minecraft.world.phys.Vec3) Shape(com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock.Shape) TransportedItemStack(com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack) FunnelFlapPacket(com.simibubi.create.content.logistics.packet.FunnelFlapPacket) ItemStack(net.minecraft.world.item.ItemStack) DirectBeltInputBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour) AllSoundEvents(com.simibubi.create.AllSoundEvents) FilteringBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour) DirectBeltInputBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour) BlockFace(com.simibubi.create.foundation.utility.BlockFace) InvManipulationBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour)

Example 8 with InvManipulationBehaviour

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());
}
Also used : FilteringBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour) Vec3(net.minecraft.world.phys.Vec3) InvManipulationBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour) InterfaceProvider(com.simibubi.create.foundation.tileEntity.behaviour.inventory.CapManipulationBehaviourBase.InterfaceProvider) TankManipulationBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.inventory.TankManipulationBehaviour)

Example 9 with InvManipulationBehaviour

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;
}
Also used : FilteringBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour) InvManipulationBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour) ItemStack(net.minecraft.world.item.ItemStack) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity)

Aggregations

InvManipulationBehaviour (com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour)9 FilteringBehaviour (com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour)6 ItemStack (net.minecraft.world.item.ItemStack)6 BlockState (net.minecraft.world.level.block.state.BlockState)5 Direction (net.minecraft.core.Direction)4 BlockEntity (net.minecraft.world.level.block.entity.BlockEntity)4 BlockPos (net.minecraft.core.BlockPos)3 Vec3 (net.minecraft.world.phys.Vec3)3 FluidStack (net.minecraftforge.fluids.FluidStack)3 IFluidHandler (net.minecraftforge.fluids.capability.IFluidHandler)3 SmartTileEntity (com.simibubi.create.foundation.tileEntity.SmartTileEntity)2 TileEntityBehaviour (com.simibubi.create.foundation.tileEntity.TileEntityBehaviour)2 InterfaceProvider (com.simibubi.create.foundation.tileEntity.behaviour.inventory.CapManipulationBehaviourBase.InterfaceProvider)2 TankManipulationBehaviour (com.simibubi.create.foundation.tileEntity.behaviour.inventory.TankManipulationBehaviour)2 List (java.util.List)2 CompoundTag (net.minecraft.nbt.CompoundTag)2 BlockEntityType (net.minecraft.world.level.block.entity.BlockEntityType)2 IItemHandler (net.minecraftforge.items.IItemHandler)2 InstancedRenderDispatcher (com.jozufozu.flywheel.backend.instancing.InstancedRenderDispatcher)1 AllBlocks (com.simibubi.create.AllBlocks)1