Search in sources :

Example 36 with Selection

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

the class PulleyScenes method attachment.

public static void attachment(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("rope_pulley_attachment", "Moving Pulleys as part of a Contraption");
    scene.configureBasePlate(0, 0, 5);
    scene.scaleSceneView(0.95f);
    scene.setSceneOffsetY(-1);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    scene.idle(5);
    Selection kinetics = util.select.fromTo(4, 3, 2, 4, 1, 5);
    Selection largeCog = util.select.position(3, 0, 5);
    scene.world.showSection(kinetics, Direction.DOWN);
    ElementLink<WorldSectionElement> poles = scene.world.showIndependentSection(util.select.fromTo(4, 4, 2, 6, 4, 2), Direction.DOWN);
    scene.world.moveSection(poles, util.vector.of(0, -1, 0), 0);
    scene.idle(10);
    BlockPos pulleyPos = util.grid.at(3, 3, 2);
    ElementLink<WorldSectionElement> pulley = scene.world.showIndependentSection(util.select.position(pulleyPos), Direction.EAST);
    scene.idle(10);
    scene.world.showSectionAndMerge(util.select.fromTo(3, 1, 1, 3, 1, 2).add(util.select.position(3, 2, 1)), Direction.SOUTH, pulley);
    scene.idle(10);
    scene.overlay.showText(50).pointAt(util.vector.blockSurface(pulleyPos, Direction.WEST)).placeNearTarget().attachKeyFrame().text("Whenever Pulleys are themselves being moved by a Contraption...");
    scene.idle(60);
    scene.world.setKineticSpeed(largeCog, -16);
    scene.world.setKineticSpeed(kinetics, 32);
    scene.effects.rotationDirectionIndicator(util.grid.at(4, 1, 5));
    scene.world.moveSection(poles, util.vector.of(-2, 0, 0), 40);
    scene.world.moveSection(pulley, util.vector.of(-2, 0, 0), 40);
    scene.idle(40);
    scene.overlay.showSelectionWithText(util.select.fromTo(1, 1, 1, 1, 1, 2), 50).colored(PonderPalette.GREEN).placeNearTarget().attachKeyFrame().text("...its attached structure will be dragged with it");
    scene.idle(60);
    scene.overlay.showText(80).colored(PonderPalette.RED).pointAt(util.vector.topOf(pulleyPos.west(2))).placeNearTarget().text("Mind that pulleys are only movable while stopped");
}
Also used : Selection(com.simibubi.create.foundation.ponder.Selection) BlockPos(net.minecraft.core.BlockPos) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement)

Example 37 with Selection

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

the class PulleyScenes method movement.

public static void movement(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("rope_pulley", "Moving Structures using Rope Pulleys");
    scene.configureBasePlate(0, 0, 5);
    scene.scaleSceneView(0.95f);
    scene.setSceneOffsetY(-1);
    Selection reversable = util.select.fromTo(2, 3, 4, 2, 4, 2);
    BlockPos leverPos = util.grid.at(1, 2, 4);
    BlockPos pulleyPos = util.grid.at(2, 4, 2);
    Selection redstoneStuff = util.select.fromTo(leverPos, leverPos.east());
    scene.world.showSection(util.select.layer(0), Direction.UP);
    ElementLink<WorldSectionElement> plank = scene.world.showIndependentSection(util.select.position(2, 1, 2), Direction.UP);
    scene.idle(5);
    scene.world.showSection(util.select.fromTo(1, 4, 3, 2, 1, 4), Direction.DOWN);
    scene.idle(10);
    scene.world.showSection(util.select.position(pulleyPos), Direction.SOUTH);
    scene.idle(20);
    scene.world.toggleRedstonePower(redstoneStuff);
    scene.effects.indicateRedstone(leverPos);
    scene.world.modifyKineticSpeed(reversable, f -> -f);
    scene.effects.rotationDirectionIndicator(pulleyPos.south());
    scene.world.movePulley(pulleyPos, 2, 40);
    scene.idle(45);
    scene.overlay.showText(60).pointAt(util.vector.blockSurface(pulleyPos, Direction.WEST)).attachKeyFrame().text("Rope Pulleys can move blocks vertically when given Rotational Force").placeNearTarget();
    scene.idle(70);
    scene.world.toggleRedstonePower(redstoneStuff);
    scene.effects.indicateRedstone(leverPos);
    scene.world.modifyKineticSpeed(reversable, f -> -f);
    scene.effects.rotationDirectionIndicator(pulleyPos.south());
    scene.world.movePulley(pulleyPos, -2, 40);
    scene.world.moveSection(plank, util.vector.of(0, 2, 0), 40);
    scene.idle(60);
    scene.overlay.showText(60).pointAt(util.vector.blockSurface(pulleyPos, Direction.SOUTH)).text("Direction and Speed of movement depend on the Rotational Input").placeNearTarget();
    scene.world.toggleRedstonePower(redstoneStuff);
    scene.effects.indicateRedstone(leverPos);
    scene.world.modifyKineticSpeed(reversable, f -> -f);
    scene.effects.rotationDirectionIndicator(pulleyPos.south());
    scene.world.movePulley(pulleyPos, 2, 40);
    scene.world.moveSection(plank, util.vector.of(0, -2, 0), 40);
    scene.idle(50);
    scene.world.hideIndependentSection(plank, Direction.NORTH);
    scene.idle(15);
    ElementLink<WorldSectionElement> chassis = scene.world.showIndependentSection(util.select.fromTo(2, 1, 1, 0, 2, 1), Direction.SOUTH);
    scene.world.moveSection(chassis, util.vector.of(1, 0, 1), 0);
    scene.idle(5);
    scene.world.showSectionAndMerge(util.select.position(2, 1, 0), Direction.SOUTH, chassis);
    scene.idle(15);
    scene.effects.superGlue(util.grid.at(3, 1, 1), Direction.SOUTH, true);
    scene.overlay.showText(80).pointAt(util.vector.blockSurface(util.grid.at(1, 2, 2), Direction.NORTH)).placeNearTarget().attachKeyFrame().sharedText("movement_anchors");
    scene.idle(90);
    scene.world.toggleRedstonePower(redstoneStuff);
    scene.effects.indicateRedstone(leverPos);
    scene.world.modifyKineticSpeed(reversable, f -> -f);
    scene.effects.rotationDirectionIndicator(pulleyPos.south());
    scene.world.movePulley(pulleyPos, -2, 40);
    scene.world.moveSection(chassis, util.vector.of(0, 2, 0), 40);
    scene.idle(50);
    scene.world.toggleRedstonePower(redstoneStuff);
    scene.effects.indicateRedstone(leverPos);
    scene.world.modifyKineticSpeed(reversable, f -> -f);
    scene.effects.rotationDirectionIndicator(pulleyPos.south());
    scene.world.movePulley(pulleyPos, 2, 40);
    scene.world.moveSection(chassis, util.vector.of(0, -2, 0), 40);
    scene.idle(50);
}
Also used : Selection(com.simibubi.create.foundation.ponder.Selection) BlockPos(net.minecraft.core.BlockPos) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement)

Example 38 with Selection

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

the class RedstoneScenes method sticker.

public static void sticker(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("sticker", "Attaching blocks using the Sticker");
    scene.configureBasePlate(0, 0, 5);
    scene.showBasePlate();
    scene.idle(5);
    Selection redstone = util.select.fromTo(0, 2, 2, 2, 2, 2);
    BlockPos stickerPos = util.grid.at(2, 2, 2);
    Selection stickerSelect = util.select.position(stickerPos);
    BlockPos buttonPos = util.grid.at(0, 2, 2);
    BlockPos bearingPos = util.grid.at(2, 1, 2);
    scene.world.showSection(util.select.fromTo(2, 1, 2, 0, 2, 2).substract(stickerSelect), Direction.DOWN);
    scene.idle(10);
    ElementLink<WorldSectionElement> sticker = scene.world.showIndependentSection(stickerSelect, Direction.DOWN);
    scene.idle(10);
    ElementLink<WorldSectionElement> plank = scene.world.showIndependentSection(util.select.position(2, 2, 1), Direction.SOUTH);
    scene.world.configureCenterOfRotation(sticker, util.vector.centerOf(stickerPos));
    scene.world.configureCenterOfRotation(plank, util.vector.centerOf(stickerPos));
    scene.overlay.showText(60).text("Stickers are ideal for Redstone-controlled block attachment").attachKeyFrame().pointAt(util.vector.blockSurface(stickerPos, Direction.WEST)).placeNearTarget();
    scene.idle(70);
    scene.world.toggleRedstonePower(redstone);
    scene.world.modifyBlock(stickerPos, s -> s.setValue(StickerBlock.EXTENDED, true), false);
    scene.effects.indicateRedstone(buttonPos);
    scene.world.modifyTileNBT(stickerSelect, StickerTileEntity.class, nbt -> {
    });
    scene.idle(20);
    scene.world.toggleRedstonePower(redstone);
    scene.idle(20);
    scene.overlay.showText(60).text("Upon receiving a signal, it will toggle its state").pointAt(util.vector.blockSurface(stickerPos, Direction.WEST)).placeNearTarget();
    scene.idle(70);
    scene.world.rotateBearing(bearingPos, 180 * 3, 80);
    scene.world.rotateSection(sticker, 0, 180 * 3, 0, 80);
    scene.world.rotateSection(plank, 0, 180 * 3, 0, 80);
    scene.overlay.showText(70).text("If it is now moved in a contraption, the block will move with it").pointAt(util.vector.topOf(stickerPos)).placeNearTarget();
    scene.idle(90);
    scene.addKeyframe();
    scene.world.toggleRedstonePower(redstone);
    scene.world.modifyBlock(stickerPos, s -> s.setValue(StickerBlock.EXTENDED, false), false);
    scene.effects.indicateRedstone(buttonPos);
    scene.world.modifyTileNBT(stickerSelect, StickerTileEntity.class, nbt -> {
    });
    scene.idle(20);
    scene.world.toggleRedstonePower(redstone);
    scene.idle(20);
    scene.overlay.showText(60).text("Toggled once again, the block is no longer attached").pointAt(util.vector.blockSurface(stickerPos, Direction.WEST)).placeNearTarget();
    scene.idle(70);
    scene.world.rotateBearing(bearingPos, 180 * 3, 80);
    scene.world.rotateSection(sticker, 0, 180 * 3, 0, 80);
}
Also used : Selection(com.simibubi.create.foundation.ponder.Selection) BlockPos(net.minecraft.core.BlockPos) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement)

Example 39 with Selection

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

the class RedstoneScenes method redstoneLink.

public static void redstoneLink(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("redstone_link", "Using Redstone Links");
    scene.configureBasePlate(0, 0, 5);
    scene.world.showSection(util.select.layer(0).add(util.select.fromTo(3, 1, 1, 2, 1, 1)), Direction.UP);
    scene.idle(5);
    scene.world.showSection(util.select.fromTo(4, 1, 3, 0, 2, 3), Direction.DOWN);
    scene.idle(10);
    Selection redstone = util.select.fromTo(3, 1, 1, 1, 1, 1);
    BlockPos leverPos = util.grid.at(3, 1, 1);
    BlockPos link1Pos = util.grid.at(1, 1, 1);
    BlockPos link2Pos = util.grid.at(1, 2, 2);
    BlockPos link3Pos = util.grid.at(3, 2, 2);
    Selection link1Select = util.select.position(link1Pos);
    Selection link2Select = util.select.position(link2Pos);
    Selection link3Select = util.select.position(link3Pos);
    Vec3 link1Vec = util.vector.blockSurface(link1Pos, Direction.DOWN).add(0, 3 / 16f, 0);
    Vec3 link2Vec = util.vector.blockSurface(link2Pos, Direction.SOUTH).add(0, 0, -3 / 16f);
    Vec3 link3Vec = util.vector.blockSurface(link3Pos, Direction.SOUTH).add(0, 0, -3 / 16f);
    scene.world.showSection(link1Select, Direction.DOWN);
    scene.idle(5);
    scene.world.showSection(link2Select, Direction.DOWN);
    scene.idle(5);
    scene.world.showSection(link3Select, Direction.DOWN);
    scene.idle(10);
    scene.overlay.showText(50).attachKeyFrame().text("Redstone Links can transmit redstone signals wirelessly").placeNearTarget().pointAt(link1Vec);
    scene.idle(60);
    scene.overlay.showControls(new InputWindowElement(link2Vec, Pointing.UP).rightClick().whileSneaking(), 40);
    scene.idle(7);
    scene.world.modifyBlock(link2Pos, s -> s.cycle(RedstoneLinkBlock.RECEIVER), true);
    scene.idle(10);
    scene.overlay.showText(50).text("Right-click while Sneaking to toggle receive mode").placeNearTarget().pointAt(link2Vec);
    scene.idle(60);
    scene.overlay.showControls(new InputWindowElement(link3Vec, Pointing.UP).rightClick().withWrench(), 40);
    scene.idle(7);
    scene.world.modifyBlock(link3Pos, s -> s.cycle(RedstoneLinkBlock.RECEIVER), true);
    scene.idle(10);
    scene.overlay.showText(50).text("A simple Right-click with a Wrench can do the same").placeNearTarget().pointAt(link3Vec);
    scene.idle(70);
    scene.addKeyframe();
    scene.idle(10);
    scene.world.toggleRedstonePower(redstone);
    scene.effects.indicateRedstone(leverPos);
    scene.idle(5);
    scene.world.toggleRedstonePower(util.select.fromTo(3, 2, 3, 1, 2, 2));
    scene.effects.indicateRedstone(link2Pos);
    scene.effects.indicateRedstone(link3Pos);
    scene.idle(10);
    scene.overlay.showText(70).colored(PonderPalette.GREEN).text("Receivers emit the redstone power of transmitters within 128 blocks").placeNearTarget().pointAt(link2Vec);
    scene.idle(80);
    scene.world.toggleRedstonePower(redstone);
    scene.idle(5);
    scene.world.toggleRedstonePower(util.select.fromTo(3, 2, 3, 1, 2, 2));
    scene.idle(20);
    Vec3 frontSlot = link1Vec.add(.18, -.05, -.15);
    Vec3 backSlot = link1Vec.add(.18, -.05, .15);
    Vec3 top2Slot = link2Vec.add(-.09, .15, 0);
    Vec3 bottom2Slot = link2Vec.add(-.09, -.2, 0);
    Vec3 top3Slot = link3Vec.add(-.09, .15, 0);
    Vec3 bottom3Slot = link3Vec.add(-.09, -.2, 0);
    scene.addKeyframe();
    scene.idle(10);
    scene.overlay.showFilterSlotInput(frontSlot, 100);
    scene.overlay.showFilterSlotInput(backSlot, 100);
    scene.idle(10);
    scene.overlay.showText(50).text("Placing items in the two slots can specify a Frequency").placeNearTarget().pointAt(backSlot);
    scene.idle(60);
    ItemStack iron = new ItemStack(Items.IRON_INGOT);
    ItemStack gold = new ItemStack(Items.GOLD_INGOT);
    ItemStack sapling = new ItemStack(Items.OAK_SAPLING);
    scene.overlay.showControls(new InputWindowElement(backSlot, Pointing.DOWN).withItem(iron), 40);
    scene.idle(7);
    scene.overlay.showControls(new InputWindowElement(frontSlot, Pointing.UP).withItem(sapling), 40);
    scene.world.modifyTileNBT(link1Select, RedstoneLinkTileEntity.class, nbt -> nbt.put("FrequencyLast", iron.save(new CompoundTag())));
    scene.idle(7);
    scene.world.modifyTileNBT(link1Select, RedstoneLinkTileEntity.class, nbt -> nbt.put("FrequencyFirst", sapling.save(new CompoundTag())));
    scene.idle(20);
    scene.overlay.showControls(new InputWindowElement(top2Slot, Pointing.DOWN).withItem(iron), 40);
    scene.idle(7);
    scene.overlay.showControls(new InputWindowElement(bottom2Slot, Pointing.UP).withItem(sapling), 40);
    scene.world.modifyTileNBT(link2Select, RedstoneLinkTileEntity.class, nbt -> nbt.put("FrequencyLast", iron.save(new CompoundTag())));
    scene.idle(7);
    scene.world.modifyTileNBT(link2Select, RedstoneLinkTileEntity.class, nbt -> nbt.put("FrequencyFirst", sapling.save(new CompoundTag())));
    scene.idle(20);
    scene.overlay.showControls(new InputWindowElement(top3Slot, Pointing.DOWN).withItem(gold), 40);
    scene.idle(7);
    scene.overlay.showControls(new InputWindowElement(bottom3Slot, Pointing.UP).withItem(sapling), 40);
    scene.world.modifyTileNBT(link3Select, RedstoneLinkTileEntity.class, nbt -> nbt.put("FrequencyLast", gold.save(new CompoundTag())));
    scene.idle(7);
    scene.world.modifyTileNBT(link3Select, RedstoneLinkTileEntity.class, nbt -> nbt.put("FrequencyFirst", sapling.save(new CompoundTag())));
    scene.idle(20);
    scene.world.toggleRedstonePower(redstone);
    scene.effects.indicateRedstone(leverPos);
    scene.idle(5);
    scene.world.toggleRedstonePower(util.select.fromTo(1, 2, 2, 1, 2, 3));
    scene.effects.indicateRedstone(link2Pos);
    scene.overlay.showText(90).attachKeyFrame().text("Only the links with matching Frequencies will communicate").placeNearTarget().pointAt(link2Vec);
    scene.idle(100);
}
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) ItemStack(net.minecraft.world.item.ItemStack) CompoundTag(net.minecraft.nbt.CompoundTag)

Example 40 with Selection

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

the class RedstoneScenes method contact.

public static void contact(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("redstone_contact", "Redstone Contacts");
    scene.configureBasePlate(0, 0, 5);
    scene.showBasePlate();
    scene.idle(5);
    Selection contactAndRedstone = util.select.fromTo(1, 1, 0, 1, 1, 2);
    Selection topContact = util.select.position(1, 2, 2);
    scene.world.toggleRedstonePower(contactAndRedstone);
    scene.world.toggleRedstonePower(topContact);
    scene.world.showSection(contactAndRedstone, Direction.DOWN);
    BlockPos bearingPos = util.grid.at(3, 1, 2);
    scene.idle(25);
    ElementLink<WorldSectionElement> contact = scene.world.showIndependentSection(topContact, Direction.DOWN);
    scene.idle(10);
    scene.world.toggleRedstonePower(topContact);
    scene.world.toggleRedstonePower(contactAndRedstone);
    scene.effects.indicateRedstone(util.grid.at(1, 1, 2));
    scene.idle(10);
    scene.overlay.showText(60).attachKeyFrame().placeNearTarget().pointAt(util.vector.of(1, 2, 2.5)).text("Redstone Contacts facing each other will emit a redstone signal");
    scene.idle(70);
    scene.world.showSection(util.select.position(bearingPos), Direction.DOWN);
    scene.idle(10);
    scene.world.showSectionAndMerge(util.select.fromTo(2, 2, 2, 4, 2, 2), Direction.DOWN, contact);
    scene.idle(10);
    scene.effects.superGlue(util.grid.at(1, 2, 2), Direction.EAST, true);
    scene.world.configureCenterOfRotation(contact, util.vector.centerOf(bearingPos));
    int speed = 2;
    scene.idle(10);
    scene.world.rotateBearing(bearingPos, 10, speed);
    scene.world.rotateSection(contact, 0, 10, 0, speed);
    scene.idle(speed);
    scene.world.toggleRedstonePower(topContact);
    scene.world.toggleRedstonePower(contactAndRedstone);
    scene.effects.indicateRedstone(util.grid.at(1, 1, 2));
    scene.world.rotateBearing(bearingPos, 340, 34 * speed);
    scene.world.rotateSection(contact, 0, 340, 0, 34 * speed);
    scene.addKeyframe();
    scene.idle(34 * speed);
    scene.overlay.showText(100).placeNearTarget().pointAt(util.vector.of(1, 1.5, 2.5)).text("This still applies when one of them is part of a moving Contraption");
    for (int i = 0; i < 5; i++) {
        scene.world.toggleRedstonePower(topContact);
        scene.world.toggleRedstonePower(contactAndRedstone);
        scene.effects.indicateRedstone(util.grid.at(1, 1, 2));
        scene.world.rotateBearing(bearingPos, 20, 2 * speed);
        scene.world.rotateSection(contact, 0, 20, 0, 2 * speed);
        scene.idle(2 * speed);
        scene.world.toggleRedstonePower(topContact);
        scene.world.toggleRedstonePower(contactAndRedstone);
        scene.world.rotateBearing(bearingPos, 340, 34 * speed);
        scene.world.rotateSection(contact, 0, 340, 0, 34 * speed);
        scene.idle(34 * speed);
        if (i == 0)
            scene.markAsFinished();
    }
    scene.world.toggleRedstonePower(topContact);
    scene.world.toggleRedstonePower(contactAndRedstone);
    scene.world.rotateBearing(bearingPos, 10, speed);
    scene.world.rotateSection(contact, 0, 10, 0, speed);
}
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