Search in sources :

Example 16 with Selection

use of com.simibubi.create.foundation.ponder.Selection in project Create by Creators-of-Create.

the class KineticsScenes method manualSource.

private static void manualSource(SceneBuilder scene, SceneBuildingUtil util, boolean handCrank) {
    String name = handCrank ? "Hand Cranks" : "Valve Handles";
    scene.title(handCrank ? "hand_crank" : "valve_handle", "Generating Rotational Force using " + name);
    scene.configureBasePlate(0, 0, 5);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    scene.idle(5);
    BlockPos gaugePos = util.grid.at(1, 3, 3);
    BlockPos handlePos = util.grid.at(2, 2, 2);
    Selection handleSelect = util.select.position(handlePos);
    scene.world.showSection(util.select.layersFrom(1).substract(handleSelect), Direction.DOWN);
    scene.idle(10);
    scene.world.showSection(handleSelect, Direction.DOWN);
    scene.idle(20);
    Vec3 centerOf = util.vector.centerOf(handlePos);
    scene.overlay.showText(70).text(name + " can be used by players to apply rotational force manually").placeNearTarget().pointAt(centerOf);
    scene.idle(80);
    scene.overlay.showControls(new InputWindowElement(centerOf, Pointing.DOWN).rightClick(), 40);
    scene.idle(7);
    scene.world.setKineticSpeed(util.select.everywhere(), handCrank ? 32 : 16);
    scene.world.modifyKineticSpeed(util.select.column(1, 3), f -> f * -2);
    scene.effects.rotationDirectionIndicator(handlePos);
    scene.effects.indicateSuccess(gaugePos);
    scene.idle(10);
    scene.overlay.showText(50).text("Hold Right-Click to rotate it Counter-Clockwise").attachKeyFrame().placeNearTarget().pointAt(centerOf);
    scene.idle(70);
    scene.overlay.showText(50).colored(handCrank ? PonderPalette.MEDIUM : PonderPalette.SLOW).text("Its conveyed speed is " + (handCrank ? "relatively high" : "slow and precise")).placeNearTarget().pointAt(centerOf);
    scene.idle(70);
    scene.world.setKineticSpeed(util.select.everywhere(), 0);
    scene.idle(10);
    scene.overlay.showControls(new InputWindowElement(centerOf, Pointing.DOWN).rightClick().whileSneaking(), 40);
    scene.idle(7);
    scene.world.setKineticSpeed(util.select.everywhere(), handCrank ? -32 : -16);
    scene.world.modifyKineticSpeed(util.select.column(1, 3), f -> f * -2);
    scene.effects.rotationDirectionIndicator(handlePos);
    scene.effects.indicateSuccess(gaugePos);
    scene.idle(10);
    scene.overlay.showText(90).text("Sneak and Hold Right-Click to rotate it Clockwise").attachKeyFrame().placeNearTarget().pointAt(centerOf);
    scene.idle(90);
}
Also used : Selection(com.simibubi.create.foundation.ponder.Selection) Vec3(net.minecraft.world.phys.Vec3) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) BlockPos(net.minecraft.core.BlockPos)

Example 17 with Selection

use of com.simibubi.create.foundation.ponder.Selection in project Create by Creators-of-Create.

the class KineticsScenes method gearbox.

public static void gearbox(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("gearbox", "Relaying rotational force using Gearboxes");
    scene.configureBasePlate(1, 1, 5);
    scene.setSceneOffsetY(-1);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    scene.world.showSection(util.select.fromTo(4, 1, 6, 3, 2, 5), Direction.UP);
    scene.idle(10);
    BlockPos largeCogBack = util.grid.at(3, 2, 4);
    BlockPos largeCogLeft = util.grid.at(4, 2, 3);
    BlockPos largeCogFront = util.grid.at(3, 2, 2);
    BlockPos largeCogRight = util.grid.at(2, 2, 3);
    scene.world.showSection(util.select.position(largeCogBack), Direction.SOUTH);
    scene.idle(5);
    scene.world.showSection(util.select.position(largeCogLeft), Direction.WEST);
    scene.world.showSection(util.select.position(largeCogLeft.east()), Direction.WEST);
    scene.world.showSection(util.select.position(largeCogRight), Direction.EAST);
    scene.world.showSection(util.select.position(largeCogRight.west()), Direction.EAST);
    scene.idle(5);
    scene.world.showSection(util.select.position(largeCogFront), Direction.SOUTH);
    scene.world.showSection(util.select.position(largeCogFront.north()), Direction.SOUTH);
    scene.idle(10);
    scene.overlay.showText(80).colored(PonderPalette.RED).pointAt(util.vector.blockSurface(largeCogRight.west(), Direction.WEST)).placeNearTarget().text("Jumping between axes of rotation can get bulky quickly");
    scene.idle(80);
    Selection gearbox = util.select.position(3, 2, 3);
    scene.world.hideSection(util.select.fromTo(4, 2, 2, 2, 2, 4).substract(gearbox), Direction.UP);
    scene.idle(20);
    BlockState defaultState = AllBlocks.SHAFT.getDefaultState();
    BlockState cogState = AllBlocks.COGWHEEL.getDefaultState();
    scene.world.setBlock(largeCogBack, defaultState.setValue(CogWheelBlock.AXIS, Axis.Z), false);
    scene.world.setBlock(largeCogFront, defaultState.setValue(CogWheelBlock.AXIS, Axis.Z), false);
    scene.world.setBlock(largeCogRight, defaultState.setValue(CogWheelBlock.AXIS, Axis.X), false);
    scene.world.setBlock(largeCogLeft, defaultState.setValue(CogWheelBlock.AXIS, Axis.X), false);
    scene.world.showSection(util.select.fromTo(4, 2, 2, 2, 2, 4), Direction.DOWN);
    scene.idle(20);
    scene.overlay.showText(80).colored(PonderPalette.GREEN).pointAt(util.vector.topOf(3, 2, 3)).placeNearTarget().attachKeyFrame().text("A gearbox is the more compact equivalent of this setup");
    scene.idle(90);
    scene.world.setBlock(largeCogFront.north(), cogState.setValue(CogWheelBlock.AXIS, Axis.Z), true);
    scene.world.setBlock(largeCogRight.west(), cogState.setValue(CogWheelBlock.AXIS, Axis.X), true);
    scene.idle(10);
    scene.effects.rotationDirectionIndicator(largeCogFront.north());
    scene.effects.rotationDirectionIndicator(largeCogRight.west());
    scene.idle(15);
    scene.overlay.showText(60).pointAt(util.vector.of(3, 2.5, 3)).placeNearTarget().text("Shafts around corners rotate in mirrored directions");
    scene.idle(70);
    scene.world.hideSection(util.select.fromTo(1, 2, 3, 2, 2, 3), Direction.WEST);
    scene.world.hideSection(util.select.fromTo(4, 2, 3, 5, 2, 3), Direction.EAST);
    scene.world.setBlock(largeCogBack.south(), cogState.setValue(CogWheelBlock.AXIS, Axis.Z), true);
    scene.idle(10);
    scene.effects.rotationDirectionIndicator(largeCogFront.north());
    scene.effects.rotationDirectionIndicator(largeCogBack.south());
    scene.idle(15);
    scene.overlay.showText(60).pointAt(util.vector.centerOf(3, 2, 5)).placeNearTarget().text("Straight connections will be reversed");
}
Also used : BlockState(net.minecraft.world.level.block.state.BlockState) Selection(com.simibubi.create.foundation.ponder.Selection) BlockPos(net.minecraft.core.BlockPos)

Example 18 with Selection

use of com.simibubi.create.foundation.ponder.Selection 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 19 with Selection

use of com.simibubi.create.foundation.ponder.Selection in project Create by Creators-of-Create.

the class KineticsScenes method cogAsRelay.

public static void cogAsRelay(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("cogwheel", "Relaying rotational force using Cogwheels");
    scene.configureBasePlate(0, 0, 5);
    BlockPos gauge = util.grid.at(4, 1, 1);
    Selection gaugeSelect = util.select.position(gauge);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    scene.world.showSection(gaugeSelect, Direction.UP);
    scene.world.setKineticSpeed(gaugeSelect, 0);
    scene.idle(5);
    scene.world.showSection(util.select.fromTo(1, 1, 3, 1, 1, 5), Direction.DOWN);
    scene.idle(10);
    for (int i = 1; i <= 4; i++) {
        scene.idle(5);
        if (i == 2)
            scene.world.showSection(util.select.position(0, 1, 2), Direction.DOWN);
        scene.world.showSection(util.select.position(i, 1, 2), Direction.DOWN);
    }
    scene.world.setKineticSpeed(gaugeSelect, 64);
    scene.effects.indicateSuccess(gauge);
    scene.idle(10);
    scene.overlay.showText(60).text("Cogwheels will relay rotation to other adjacent cogwheels").pointAt(util.vector.blockSurface(util.grid.at(0, 1, 2), Direction.EAST));
    scene.idle(60);
    scene.world.showSection(util.select.fromTo(1, 1, 1, 2, 1, 1), Direction.SOUTH);
    scene.idle(10);
    scene.effects.rotationDirectionIndicator(util.grid.at(1, 1, 1));
    scene.effects.rotationDirectionIndicator(util.grid.at(2, 1, 1));
    scene.idle(20);
    scene.overlay.showText(100).text("Neighbouring shafts connected like this will rotate in opposite directions").placeNearTarget().pointAt(util.vector.blockSurface(util.grid.at(1, 1, 2), Direction.NORTH));
}
Also used : Selection(com.simibubi.create.foundation.ponder.Selection) BlockPos(net.minecraft.core.BlockPos)

Example 20 with Selection

use of com.simibubi.create.foundation.ponder.Selection in project Create by Creators-of-Create.

the class DebugScenes method sectionsScene.

public static void sectionsScene(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("debug_sections", "Sections");
    scene.showBasePlate();
    scene.idle(10);
    scene.rotateCameraY(95);
    BlockPos mergePos = util.grid.at(1, 1, 1);
    BlockPos independentPos = util.grid.at(3, 1, 1);
    Selection toMerge = util.select.position(mergePos);
    Selection independent = util.select.position(independentPos);
    Selection start = util.select.layersFrom(1).substract(toMerge).substract(independent);
    scene.world.showSection(start, Direction.DOWN);
    scene.idle(20);
    scene.world.showSection(toMerge, Direction.DOWN);
    ElementLink<WorldSectionElement> link = scene.world.showIndependentSection(independent, Direction.DOWN);
    scene.idle(20);
    scene.overlay.showText(40).colored(PonderPalette.GREEN).text("This Section got merged to base.").pointAt(util.vector.topOf(mergePos));
    scene.idle(10);
    scene.overlay.showText(40).colored(PonderPalette.RED).text("This Section renders independently.").pointAt(util.vector.topOf(independentPos));
    scene.idle(40);
    scene.world.hideIndependentSection(link, Direction.DOWN);
    scene.world.hideSection(util.select.fromTo(mergePos, util.grid.at(1, 1, 4)), Direction.DOWN);
    scene.idle(20);
    Selection hiddenReplaceArea = util.select.fromTo(2, 1, 2, 4, 1, 4).substract(util.select.position(4, 1, 3)).substract(util.select.position(2, 1, 3));
    scene.world.hideSection(hiddenReplaceArea, Direction.UP);
    scene.idle(20);
    scene.world.setBlocks(hiddenReplaceArea, AllBlocks.REFINED_RADIANCE_CASING.getDefaultState(), false);
    scene.world.showSection(hiddenReplaceArea, Direction.DOWN);
    scene.idle(20);
    scene.overlay.showSelectionWithText(hiddenReplaceArea, 30).colored(PonderPalette.BLUE).text("Seamless substitution of blocks");
    scene.idle(40);
    ElementLink<WorldSectionElement> helicopter = scene.world.makeSectionIndependent(hiddenReplaceArea);
    scene.world.rotateSection(helicopter, 50, 5 * 360, 0, 60);
    scene.world.moveSection(helicopter, util.vector.of(0, 4, 5), 50);
    scene.overlay.showText(30).colored(PonderPalette.BLUE).text("Up, up and away.").independent(30);
    scene.idle(40);
    scene.world.hideIndependentSection(helicopter, Direction.UP);
}
Also used : Selection(com.simibubi.create.foundation.ponder.Selection) BlockPos(net.minecraft.core.BlockPos) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement)

Aggregations

Selection (com.simibubi.create.foundation.ponder.Selection)94 BlockPos (net.minecraft.core.BlockPos)84 WorldSectionElement (com.simibubi.create.foundation.ponder.element.WorldSectionElement)59 InputWindowElement (com.simibubi.create.foundation.ponder.element.InputWindowElement)57 Vec3 (net.minecraft.world.phys.Vec3)51 ItemStack (net.minecraft.world.item.ItemStack)46 Entity (net.minecraft.world.entity.Entity)15 AABB (net.minecraft.world.phys.AABB)14 EntityElement (com.simibubi.create.foundation.ponder.element.EntityElement)11 ItemEntity (net.minecraft.world.entity.item.ItemEntity)11 FluidStack (net.minecraftforge.fluids.FluidStack)10 SceneBuilder (com.simibubi.create.foundation.ponder.SceneBuilder)8 Direction (net.minecraft.core.Direction)8 ElementLink (com.simibubi.create.foundation.ponder.ElementLink)7 PonderPalette (com.simibubi.create.foundation.ponder.PonderPalette)7 SceneBuildingUtil (com.simibubi.create.foundation.ponder.SceneBuildingUtil)7 BlockState (net.minecraft.world.level.block.state.BlockState)7 CapabilityFluidHandler (net.minecraftforge.fluids.capability.CapabilityFluidHandler)6 FluidAction (net.minecraftforge.fluids.capability.IFluidHandler.FluidAction)6 ParrotElement (com.simibubi.create.foundation.ponder.element.ParrotElement)5