Search in sources :

Example 1 with Shape

use of com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock.Shape in project Create by Creators-of-Create.

the class FunnelFilterSlotPositioning method rotate.

@Override
protected void rotate(BlockState state, PoseStack ms) {
    Direction facing = FunnelBlock.getFunnelFacing(state);
    if (facing.getAxis().isVertical()) {
        super.rotate(state, ms);
        return;
    }
    boolean isBeltFunnel = state.getBlock() instanceof BeltFunnelBlock;
    if (isBeltFunnel && state.getValue(BeltFunnelBlock.SHAPE) != Shape.EXTENDED) {
        Shape shape = state.getValue(BeltFunnelBlock.SHAPE);
        super.rotate(state, ms);
        if (shape == Shape.PULLING || shape == Shape.PUSHING)
            TransformStack.cast(ms).rotateX(-22.5f);
        return;
    }
    if (state.getBlock() instanceof FunnelBlock) {
        super.rotate(state, ms);
        TransformStack.cast(ms).rotateX(-22.5f);
        return;
    }
    float yRot = AngleHelper.horizontalAngle(AbstractFunnelBlock.getFunnelFacing(state)) + (facing == Direction.DOWN ? 180 : 0);
    TransformStack.cast(ms).rotateY(yRot).rotateX(facing == Direction.DOWN ? -90 : 90);
}
Also used : Shape(com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock.Shape) Direction(net.minecraft.core.Direction)

Example 2 with Shape

use of com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock.Shape in project Create by Creators-of-Create.

the class FunnelTileEntity method supportsAmountOnFilter.

private boolean supportsAmountOnFilter() {
    BlockState blockState = getBlockState();
    boolean beltFunnelsupportsAmount = false;
    if (blockState.getBlock() instanceof BeltFunnelBlock) {
        Shape shape = blockState.getValue(BeltFunnelBlock.SHAPE);
        if (shape == Shape.PUSHING)
            beltFunnelsupportsAmount = true;
        else
            beltFunnelsupportsAmount = BeltHelper.getSegmentTE(level, worldPosition.below()) != null;
    }
    boolean extractor = blockState.getBlock() instanceof FunnelBlock && blockState.getValue(FunnelBlock.EXTRACTING);
    return beltFunnelsupportsAmount || extractor;
}
Also used : BlockState(net.minecraft.world.level.block.state.BlockState) Shape(com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock.Shape)

Example 3 with Shape

use of com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock.Shape in project Create by Creators-of-Create.

the class FunnelTileEntity method determineCurrentMode.

public Mode determineCurrentMode() {
    BlockState state = getBlockState();
    if (!FunnelBlock.isFunnel(state))
        return Mode.INVALID;
    if (state.getOptionalValue(BlockStateProperties.POWERED).orElse(false))
        return Mode.PAUSED;
    if (state.getBlock() instanceof BeltFunnelBlock) {
        Shape shape = state.getValue(BeltFunnelBlock.SHAPE);
        if (shape == Shape.PULLING)
            return Mode.TAKING_FROM_BELT;
        if (shape == Shape.PUSHING)
            return Mode.PUSHING_TO_BELT;
        BeltTileEntity belt = BeltHelper.getSegmentTE(level, worldPosition.below());
        if (belt != null)
            return belt.getMovementFacing() == state.getValue(BeltFunnelBlock.HORIZONTAL_FACING) ? Mode.PUSHING_TO_BELT : Mode.TAKING_FROM_BELT;
        return Mode.INVALID;
    }
    if (state.getBlock() instanceof FunnelBlock)
        return state.getValue(FunnelBlock.EXTRACTING) ? Mode.EXTRACT : Mode.COLLECT;
    return Mode.INVALID;
}
Also used : BlockState(net.minecraft.world.level.block.state.BlockState) Shape(com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock.Shape) BeltTileEntity(com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity)

Aggregations

Shape (com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock.Shape)3 BlockState (net.minecraft.world.level.block.state.BlockState)2 BeltTileEntity (com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity)1 Direction (net.minecraft.core.Direction)1