Search in sources :

Example 6 with TileEntityBehaviour

use of com.simibubi.create.foundation.tileEntity.TileEntityBehaviour 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 TileEntityBehaviour

use of com.simibubi.create.foundation.tileEntity.TileEntityBehaviour 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 TileEntityBehaviour

use of com.simibubi.create.foundation.tileEntity.TileEntityBehaviour in project Create by Creators-of-Create.

the class ChassisTileEntity method addBehaviours.

@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
    int max = AllConfigs.SERVER.kinetics.maxChassisRange.get();
    range = new BulkScrollValueBehaviour(Lang.translate("generic.range"), this, new CenteredSideValueBoxTransform(), te -> ((ChassisTileEntity) te).collectChassisGroup());
    range.requiresWrench();
    range.between(1, max);
    range.withClientCallback(i -> DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> ChassisRangeDisplay.display(this)));
    range.value = max / 2;
    behaviours.add(range);
}
Also used : Direction(net.minecraft.core.Direction) BlockState(net.minecraft.world.level.block.state.BlockState) ArrayList(java.util.ArrayList) Dist(net.minecraftforge.api.distmarker.Dist) HashSet(java.util.HashSet) SmartTileEntity(com.simibubi.create.foundation.tileEntity.SmartTileEntity) Axis(net.minecraft.core.Direction.Axis) AxisDirection(net.minecraft.core.Direction.AxisDirection) AllConfigs(com.simibubi.create.foundation.config.AllConfigs) Lang(com.simibubi.create.foundation.utility.Lang) LinkedList(java.util.LinkedList) AllBlocks(com.simibubi.create.AllBlocks) CenteredSideValueBoxTransform(com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform) BlockMovementChecks(com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementChecks) BlockStateProperties(net.minecraft.world.level.block.state.properties.BlockStateProperties) Iterate(com.simibubi.create.foundation.utility.Iterate) TileEntityBehaviour(com.simibubi.create.foundation.tileEntity.TileEntityBehaviour) BulkScrollValueBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.BulkScrollValueBehaviour) Set(java.util.Set) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity) DistExecutor(net.minecraftforge.fml.DistExecutor) List(java.util.List) BlockPos(net.minecraft.core.BlockPos) BlockEntityType(net.minecraft.world.level.block.entity.BlockEntityType) Queue(java.util.Queue) ScrollValueBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour) Collections(java.util.Collections) BulkScrollValueBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.BulkScrollValueBehaviour) CenteredSideValueBoxTransform(com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform)

Aggregations

TileEntityBehaviour (com.simibubi.create.foundation.tileEntity.TileEntityBehaviour)8 List (java.util.List)8 BlockPos (net.minecraft.core.BlockPos)8 BlockEntityType (net.minecraft.world.level.block.entity.BlockEntityType)8 BlockState (net.minecraft.world.level.block.state.BlockState)8 ItemStack (net.minecraft.world.item.ItemStack)7 AllBlocks (com.simibubi.create.AllBlocks)6 ArrayList (java.util.ArrayList)6 Direction (net.minecraft.core.Direction)6 CompoundTag (net.minecraft.nbt.CompoundTag)6 Vec3 (net.minecraft.world.phys.Vec3)6 AABB (net.minecraft.world.phys.AABB)5 NBTHelper (com.simibubi.create.foundation.utility.NBTHelper)4 Tag (net.minecraft.nbt.Tag)4 ItemEntity (net.minecraft.world.entity.item.ItemEntity)4 AllConfigs (com.simibubi.create.foundation.config.AllConfigs)3 SmartTileEntity (com.simibubi.create.foundation.tileEntity.SmartTileEntity)3 FilteringBehaviour (com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour)3 VecHelper (com.simibubi.create.foundation.utility.VecHelper)3 Mth (net.minecraft.util.Mth)3