Search in sources :

Example 1 with EncasedShaftBlock

use of com.simibubi.create.content.contraptions.relays.encased.EncasedShaftBlock in project Create by Creators-of-Create.

the class KineticsScenes method shaftsCanBeEncased.

public static void shaftsCanBeEncased(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("shaft_casing", "Encasing Shafts");
    scene.configureBasePlate(0, 0, 5);
    scene.showBasePlate();
    Selection shaft = util.select.cuboid(new BlockPos(0, 1, 2), new Vec3i(5, 0, 2));
    Selection andesite = util.select.position(3, 1, 2);
    Selection brass = util.select.position(1, 1, 2);
    scene.world.showSection(shaft, Direction.DOWN);
    scene.idle(20);
    BlockEntry<EncasedShaftBlock> andesiteEncased = AllBlocks.ANDESITE_ENCASED_SHAFT;
    ItemStack andesiteCasingItem = AllBlocks.ANDESITE_CASING.asStack();
    scene.overlay.showControls(new InputWindowElement(util.vector.topOf(3, 1, 2), Pointing.DOWN).rightClick().withItem(andesiteCasingItem), 60);
    scene.idle(7);
    scene.world.setBlocks(andesite, andesiteEncased.getDefaultState().setValue(EncasedShaftBlock.AXIS, Axis.X), true);
    scene.world.setKineticSpeed(shaft, 32);
    scene.idle(10);
    BlockEntry<EncasedShaftBlock> brassEncased = AllBlocks.BRASS_ENCASED_SHAFT;
    ItemStack brassCasingItem = AllBlocks.BRASS_CASING.asStack();
    scene.overlay.showControls(new InputWindowElement(util.vector.topOf(1, 0, 2), Pointing.UP).rightClick().withItem(brassCasingItem), 60);
    scene.idle(7);
    scene.world.setBlocks(brass, brassEncased.getDefaultState().setValue(EncasedShaftBlock.AXIS, Axis.X), true);
    scene.world.setKineticSpeed(shaft, 32);
    scene.idle(10);
    scene.overlay.showText(1000).placeNearTarget().text("Brass or Andesite Casing can be used to decorate Shafts").pointAt(util.vector.topOf(1, 1, 2));
}
Also used : Vec3i(net.minecraft.core.Vec3i) Selection(com.simibubi.create.foundation.ponder.Selection) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) BlockPos(net.minecraft.core.BlockPos) ItemStack(net.minecraft.world.item.ItemStack) EncasedShaftBlock(com.simibubi.create.content.contraptions.relays.encased.EncasedShaftBlock)

Example 2 with EncasedShaftBlock

use of com.simibubi.create.content.contraptions.relays.encased.EncasedShaftBlock in project Create by Creators-of-Create.

the class ShaftBlock method use.

@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand, BlockHitResult ray) {
    if (player.isShiftKeyDown() || !player.mayBuild())
        return InteractionResult.PASS;
    ItemStack heldItem = player.getItemInHand(hand);
    for (EncasedShaftBlock encasedShaft : new EncasedShaftBlock[] { AllBlocks.ANDESITE_ENCASED_SHAFT.get(), AllBlocks.BRASS_ENCASED_SHAFT.get() }) {
        if (!encasedShaft.getCasing().isIn(heldItem))
            continue;
        if (world.isClientSide)
            return InteractionResult.SUCCESS;
        AllTriggers.triggerFor(AllTriggers.CASING_SHAFT, player);
        KineticTileEntity.switchToBlockState(world, pos, encasedShaft.defaultBlockState().setValue(AXIS, state.getValue(AXIS)));
        return InteractionResult.SUCCESS;
    }
    IPlacementHelper helper = PlacementHelpers.get(placementHelperId);
    if (helper.matchesItem(heldItem))
        return helper.getOffset(player, world, state, pos, ray).placeInWorld(world, (BlockItem) heldItem.getItem(), player, hand, ray);
    return InteractionResult.PASS;
}
Also used : ItemStack(net.minecraft.world.item.ItemStack) EncasedShaftBlock(com.simibubi.create.content.contraptions.relays.encased.EncasedShaftBlock) BlockItem(net.minecraft.world.item.BlockItem) IPlacementHelper(com.simibubi.create.foundation.utility.placement.IPlacementHelper)

Aggregations

EncasedShaftBlock (com.simibubi.create.content.contraptions.relays.encased.EncasedShaftBlock)2 ItemStack (net.minecraft.world.item.ItemStack)2 Selection (com.simibubi.create.foundation.ponder.Selection)1 InputWindowElement (com.simibubi.create.foundation.ponder.element.InputWindowElement)1 IPlacementHelper (com.simibubi.create.foundation.utility.placement.IPlacementHelper)1 BlockPos (net.minecraft.core.BlockPos)1 Vec3i (net.minecraft.core.Vec3i)1 BlockItem (net.minecraft.world.item.BlockItem)1