Search in sources :

Example 21 with IRotate

use of com.simibubi.create.content.contraptions.base.IRotate in project Create by Creators-of-Create.

the class Contraption method moveGantryPinion.

protected void moveGantryPinion(Level world, BlockPos pos, Queue<BlockPos> frontier, Set<BlockPos> visited, BlockState state) {
    BlockPos offset = pos.relative(state.getValue(GantryCarriageBlock.FACING));
    if (!visited.contains(offset))
        frontier.add(offset);
    Axis rotationAxis = ((IRotate) state.getBlock()).getRotationAxis(state);
    for (Direction d : Iterate.directionsInAxis(rotationAxis)) {
        offset = pos.relative(d);
        BlockState offsetState = world.getBlockState(offset);
        if (AllBlocks.GANTRY_SHAFT.has(offsetState) && offsetState.getValue(GantryShaftBlock.FACING).getAxis() == d.getAxis())
            if (!visited.contains(offset))
                frontier.add(offset);
    }
}
Also used : IRotate(com.simibubi.create.content.contraptions.base.IRotate) BlockState(net.minecraft.world.level.block.state.BlockState) BlockPos(net.minecraft.core.BlockPos) Direction(net.minecraft.core.Direction) Axis(net.minecraft.core.Direction.Axis)

Aggregations

IRotate (com.simibubi.create.content.contraptions.base.IRotate)21 BlockState (net.minecraft.world.level.block.state.BlockState)12 Direction (net.minecraft.core.Direction)10 BlockPos (net.minecraft.core.BlockPos)9 Axis (net.minecraft.core.Direction.Axis)9 Block (net.minecraft.world.level.block.Block)6 AxisDirection (net.minecraft.core.Direction.AxisDirection)4 Level (net.minecraft.world.level.Level)4 KineticTileEntity (com.simibubi.create.content.contraptions.base.KineticTileEntity)3 SuperByteBuffer (com.simibubi.create.foundation.render.SuperByteBuffer)3 VertexConsumer (com.mojang.blaze3d.vertex.VertexConsumer)2 SpeedControllerBlock (com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerBlock)2 CogWheelBlock (com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock)2 EncasedBeltBlock (com.simibubi.create.content.contraptions.relays.encased.EncasedBeltBlock)2 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 BlockState (net.minecraft.block.BlockState)2 Component (net.minecraft.network.chat.Component)2 TextComponent (net.minecraft.network.chat.TextComponent)2 Direction (net.minecraft.util.Direction)2