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));
}
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;
}
Aggregations