Search in sources :

Example 51 with WorldSectionElement

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

the class MechanicalSawScenes method contraption.

public static void contraption(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("mechanical_saw_contraption", "Using Mechanical Saws on Contraptions");
    scene.configureBasePlate(1, 0, 6);
    scene.scaleSceneView(.9f);
    scene.world.setBlock(util.grid.at(2, 0, 3), Blocks.GRASS_BLOCK.defaultBlockState(), false);
    scene.world.showSection(util.select.layer(0).add(util.select.position(3, 1, 1)).add(util.select.position(1, 1, 2)).add(util.select.position(2, 1, 4)), Direction.UP);
    Selection kinetics = util.select.fromTo(6, 1, 2, 6, 1, 6);
    scene.idle(5);
    ElementLink<WorldSectionElement> pistonHead = scene.world.showIndependentSection(util.select.fromTo(6, 1, 1, 8, 1, 1), Direction.DOWN);
    scene.world.moveSection(pistonHead, util.vector.of(0, 0, 1), 0);
    scene.world.showSection(kinetics, Direction.DOWN);
    scene.idle(5);
    ElementLink<WorldSectionElement> contraption = scene.world.showIndependentSection(util.select.fromTo(5, 1, 3, 5, 1, 2), Direction.DOWN);
    scene.idle(5);
    scene.world.showSectionAndMerge(util.select.position(4, 1, 3), Direction.EAST, contraption);
    scene.idle(5);
    scene.world.showSectionAndMerge(util.select.position(4, 1, 2), Direction.EAST, contraption);
    scene.idle(5);
    scene.overlay.showText(60).attachKeyFrame().placeNearTarget().pointAt(util.vector.topOf(util.grid.at(4, 1, 3))).text("Whenever Saws are moved as part of an animated Contraption...");
    scene.idle(70);
    Selection saws = util.select.fromTo(4, 1, 2, 4, 1, 3);
    Selection tree = util.select.fromTo(2, 1, 3, 2, 7, 3).add(util.select.layersFrom(3));
    scene.world.showSection(tree, Direction.UP);
    scene.world.setKineticSpeed(util.select.position(5, 0, 6), -8);
    scene.world.setKineticSpeed(kinetics, 16);
    scene.world.setKineticSpeed(saws, 16);
    scene.world.moveSection(pistonHead, util.vector.of(-1, 0, 0), 20);
    scene.world.moveSection(contraption, util.vector.of(-1, 0, 0), 20);
    scene.idle(20);
    BlockPos breakingPos = util.grid.at(2, 1, 3);
    for (int i = 0; i < 10; i++) {
        scene.idle(3);
        scene.world.incrementBlockBreakingProgress(breakingPos);
        if (i == 2) {
            scene.overlay.showText(80).placeNearTarget().pointAt(util.vector.blockSurface(breakingPos, Direction.WEST)).text("...they will cut any trees the contraption runs them into");
        }
    }
    scene.world.replaceBlocks(util.select.fromTo(2, 2, 3, 2, 6, 3), Blocks.AIR.defaultBlockState(), true);
    scene.world.destroyBlock(util.grid.at(4, 5, 1));
    scene.world.destroyBlock(util.grid.at(1, 4, 2));
    scene.world.destroyBlock(util.grid.at(3, 6, 2));
    scene.world.destroyBlock(util.grid.at(2, 4, 1));
    scene.world.destroyBlock(util.grid.at(2, 6, 3));
    scene.world.destroyBlock(util.grid.at(2, 5, 2));
    scene.world.destroyBlock(util.grid.at(1, 4, 2));
    scene.world.replaceBlocks(util.select.layersFrom(4), Blocks.AIR.defaultBlockState(), false);
    for (int i = 0; i < 5; i++) {
        Vec3 dropPos = util.vector.centerOf(breakingPos.above(i));
        float distance = (float) dropPos.distanceTo(util.vector.centerOf(breakingPos));
        scene.world.createItemEntity(dropPos, util.vector.of(-distance / 20, 0, 0), new ItemStack(Items.OAK_LOG));
    }
    scene.world.moveSection(pistonHead, util.vector.of(-1, 0, 0), 20);
    scene.world.moveSection(contraption, util.vector.of(-1, 0, 0), 20);
    scene.idle(20);
    scene.world.setKineticSpeed(saws, 0);
    scene.idle(20);
    scene.world.modifyKineticSpeed(util.select.everywhere(), f -> -f);
    scene.world.moveSection(pistonHead, util.vector.of(2, 0, 0), 40);
    scene.world.moveSection(contraption, util.vector.of(2, 0, 0), 40);
    scene.world.hideSection(tree, Direction.UP);
    scene.idle(40);
    scene.world.restoreBlocks(tree);
    scene.world.modifyEntities(ItemEntity.class, Entity::discard);
    scene.world.glueBlockOnto(util.grid.at(5, 2, 2), Direction.DOWN, contraption);
    scene.overlay.showText(60).attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(util.grid.at(5, 2, 2), Direction.WEST)).sharedText("storage_on_contraption");
    scene.idle(70);
    scene.world.showSection(tree, Direction.DOWN);
    scene.world.modifyKineticSpeed(util.select.everywhere(), f -> -f);
    scene.world.setKineticSpeed(saws, 16);
    scene.world.moveSection(pistonHead, util.vector.of(-1, 0, 0), 20);
    scene.world.moveSection(contraption, util.vector.of(-1, 0, 0), 20);
    scene.idle(20);
    for (int i = 0; i < 10; i++) {
        scene.idle(3);
        scene.world.incrementBlockBreakingProgress(breakingPos);
    }
    scene.world.replaceBlocks(util.select.fromTo(2, 2, 3, 2, 6, 3), Blocks.AIR.defaultBlockState(), true);
    scene.world.destroyBlock(util.grid.at(4, 5, 1));
    scene.world.destroyBlock(util.grid.at(1, 4, 2));
    scene.world.destroyBlock(util.grid.at(3, 6, 2));
    scene.world.destroyBlock(util.grid.at(2, 4, 1));
    scene.world.destroyBlock(util.grid.at(2, 6, 3));
    scene.world.destroyBlock(util.grid.at(2, 5, 2));
    scene.world.destroyBlock(util.grid.at(1, 4, 2));
    scene.world.replaceBlocks(util.select.layersFrom(4), Blocks.AIR.defaultBlockState(), false);
    scene.world.moveSection(pistonHead, util.vector.of(-1, 0, 0), 20);
    scene.world.moveSection(contraption, util.vector.of(-1, 0, 0), 20);
    scene.idle(20);
    scene.world.setKineticSpeed(saws, 0);
    scene.idle(10);
    scene.overlay.showControls(new InputWindowElement(util.vector.topOf(3, 2, 2), Pointing.DOWN).withItem(new ItemStack(Blocks.OAK_LOG)), 60);
    scene.idle(20);
}
Also used : SawTileEntity(com.simibubi.create.content.contraptions.components.saw.SawTileEntity) Entity(net.minecraft.world.entity.Entity) ItemEntity(net.minecraft.world.entity.item.ItemEntity) 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) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement) ItemStack(net.minecraft.world.item.ItemStack)

Example 52 with WorldSectionElement

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

the class MechanicalSawScenes method processing.

public static void processing(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("mechanical_saw_processing", "Processing Items on the Mechanical Saw");
    scene.configureBasePlate(0, 0, 5);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    BlockPos shaftPos = util.grid.at(2, 1, 3);
    scene.world.setBlock(shaftPos, AllBlocks.SHAFT.getDefaultState().setValue(ShaftBlock.AXIS, Axis.Z), false);
    BlockPos sawPos = util.grid.at(2, 1, 2);
    Selection sawSelect = util.select.position(sawPos);
    scene.world.modifyTileNBT(sawSelect, SawTileEntity.class, nbt -> nbt.putInt("RecipeIndex", 0));
    scene.idle(5);
    scene.world.showSection(util.select.fromTo(2, 1, 3, 2, 1, 5), Direction.DOWN);
    scene.idle(10);
    scene.effects.rotationDirectionIndicator(shaftPos);
    scene.world.showSection(sawSelect, Direction.DOWN);
    scene.idle(10);
    scene.overlay.showText(50).attachKeyFrame().text("Upward facing Mechanical Saws can process a variety of items").pointAt(util.vector.blockSurface(sawPos, Direction.WEST)).placeNearTarget();
    scene.idle(45);
    ItemStack log = new ItemStack(Items.OAK_LOG);
    ItemStack strippedLog = new ItemStack(Items.STRIPPED_OAK_LOG);
    ItemStack planks = new ItemStack(Items.OAK_PLANKS);
    Vec3 itemSpawn = util.vector.centerOf(sawPos.above().west());
    ElementLink<EntityElement> logItem = scene.world.createItemEntity(itemSpawn, util.vector.of(0, 0, 0), log);
    scene.idle(12);
    scene.overlay.showControls(new InputWindowElement(itemSpawn, Pointing.DOWN).withItem(log), 20);
    scene.idle(10);
    scene.world.modifyEntity(logItem, e -> e.setDeltaMovement(util.vector.of(0.05, 0.2, 0)));
    scene.idle(12);
    scene.world.modifyEntity(logItem, Entity::discard);
    scene.world.createItemOnBeltLike(sawPos, Direction.WEST, log);
    scene.idle(50);
    logItem = scene.world.createItemEntity(util.vector.topOf(sawPos).add(0.5, -.1, 0), util.vector.of(0.05, 0.18, 0), strippedLog);
    scene.idle(12);
    scene.overlay.showControls(new InputWindowElement(itemSpawn.add(2, 0, 0), Pointing.DOWN).withItem(strippedLog), 20);
    scene.idle(30);
    scene.overlay.showText(60).attachKeyFrame().text("The processed item always moves against the rotational input to the saw").pointAt(util.vector.blockSurface(sawPos, Direction.UP)).placeNearTarget();
    scene.idle(70);
    scene.world.modifyKineticSpeed(util.select.everywhere(), f -> -2 * f);
    scene.effects.rotationDirectionIndicator(shaftPos);
    scene.world.modifyEntity(logItem, e -> e.setDeltaMovement(util.vector.of(-0.05, 0.2, 0)));
    scene.idle(12);
    scene.world.modifyEntity(logItem, Entity::discard);
    scene.world.createItemOnBeltLike(sawPos, Direction.EAST, strippedLog);
    scene.idle(25);
    logItem = scene.world.createItemEntity(util.vector.topOf(sawPos).add(-0.5, -.1, 0), util.vector.of(-0.05, 0.18, 0), planks);
    scene.idle(22);
    Selection otherBelt = util.select.fromTo(3, 1, 3, 4, 1, 2);
    Selection belt = util.select.fromTo(0, 1, 2, 1, 1, 3);
    scene.world.setKineticSpeed(otherBelt, 0);
    scene.world.setKineticSpeed(belt, 0);
    scene.world.modifyKineticSpeed(util.select.everywhere(), f -> -f);
    scene.world.modifyEntity(logItem, Entity::discard);
    scene.world.setBlock(shaftPos, AllBlocks.COGWHEEL.getDefaultState().setValue(ShaftBlock.AXIS, Axis.Z), true);
    scene.idle(3);
    scene.addKeyframe();
    ElementLink<WorldSectionElement> beltSection = scene.world.showIndependentSection(belt, Direction.EAST);
    scene.world.moveSection(beltSection, util.vector.of(0, 100, 0), 0);
    scene.idle(1);
    scene.world.removeItemsFromBelt(util.grid.at(1, 1, 2));
    scene.idle(1);
    scene.world.setKineticSpeed(belt, -64);
    scene.idle(1);
    scene.world.moveSection(beltSection, util.vector.of(0, -100, 0), 0);
    scene.idle(3);
    ElementLink<WorldSectionElement> otherBeltSection = scene.world.showIndependentSection(otherBelt, Direction.WEST);
    scene.world.moveSection(otherBeltSection, util.vector.of(0, 100, 0), 0);
    scene.idle(1);
    scene.world.removeItemsFromBelt(util.grid.at(3, 1, 2));
    scene.idle(1);
    scene.world.setKineticSpeed(otherBelt, -64);
    scene.idle(1);
    scene.world.moveSection(otherBeltSection, util.vector.of(0, -100, 0), 0);
    scene.idle(3);
    ItemStack stone = new ItemStack(Blocks.STONE);
    BlockPos firstBelt = util.grid.at(0, 1, 2);
    scene.world.createItemOnBelt(firstBelt, Direction.WEST, stone);
    scene.overlay.showText(60).text("Saws can work in-line with Mechanical Belts").pointAt(util.vector.blockSurface(firstBelt, Direction.WEST)).placeNearTarget();
    scene.idle(60);
    scene.rotateCameraY(-90);
    scene.idle(20);
    Vec3 filter = util.vector.of(2.5, 1 + 13 / 16f, 2.75);
    scene.overlay.showFilterSlotInput(filter, 80);
    ItemStack bricks = new ItemStack(Blocks.STONE_BRICKS);
    scene.overlay.showControls(new InputWindowElement(filter, Pointing.DOWN).withItem(bricks), 80);
    scene.world.modifyEntities(ItemEntity.class, Entity::discard);
    scene.idle(7);
    scene.world.setFilterData(util.select.position(sawPos), SawTileEntity.class, bricks);
    scene.idle(10);
    scene.overlay.showText(80).attachKeyFrame().text("When an ingredient has multiple possible outcomes, the filter slot can specify it").pointAt(filter).placeNearTarget();
    scene.idle(90);
    scene.rotateCameraY(90);
    scene.world.createItemOnBelt(firstBelt, Direction.WEST, stone);
    scene.idle(20);
    scene.markAsFinished();
    scene.overlay.showText(100).text("Without filter, the Saw would cycle through all outcomes instead").colored(PonderPalette.RED).pointAt(filter).placeNearTarget();
    scene.idle(65);
    scene.world.modifyEntities(ItemEntity.class, Entity::discard);
}
Also used : SawTileEntity(com.simibubi.create.content.contraptions.components.saw.SawTileEntity) Entity(net.minecraft.world.entity.Entity) ItemEntity(net.minecraft.world.entity.item.ItemEntity) 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) EntityElement(com.simibubi.create.foundation.ponder.element.EntityElement) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement) ItemStack(net.minecraft.world.item.ItemStack)

Example 53 with WorldSectionElement

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

the class MovementActorScenes method psiTransfer.

public static void psiTransfer(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("portable_storage_interface", "Contraption Storage Exchange");
    scene.configureBasePlate(0, 0, 6);
    scene.scaleSceneView(0.95f);
    scene.setSceneOffsetY(-1);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    scene.idle(5);
    BlockPos bearing = util.grid.at(5, 1, 2);
    scene.world.showSection(util.select.position(bearing), Direction.DOWN);
    scene.idle(5);
    ElementLink<WorldSectionElement> contraption = scene.world.showIndependentSection(util.select.fromTo(5, 2, 2, 6, 3, 2), Direction.DOWN);
    scene.world.configureCenterOfRotation(contraption, util.vector.centerOf(bearing));
    scene.idle(10);
    scene.world.rotateBearing(bearing, 360, 70);
    scene.world.rotateSection(contraption, 0, 360, 0, 70);
    scene.overlay.showText(60).pointAt(util.vector.topOf(bearing.above(2))).colored(PonderPalette.RED).placeNearTarget().attachKeyFrame().text("Inventories on moving contraptions cannot be accessed by players.");
    scene.idle(70);
    BlockPos psi = util.grid.at(4, 2, 2);
    scene.world.showSectionAndMerge(util.select.position(psi), Direction.EAST, contraption);
    scene.idle(13);
    scene.effects.superGlue(psi, Direction.EAST, true);
    scene.overlay.showText(80).pointAt(util.vector.topOf(psi)).colored(PonderPalette.GREEN).placeNearTarget().attachKeyFrame().text("This component can interact with storage without the need to stop the contraption.");
    scene.idle(90);
    BlockPos psi2 = psi.west(2);
    scene.world.showSection(util.select.position(psi2), Direction.DOWN);
    scene.overlay.showSelectionWithText(util.select.position(psi.west()), 50).colored(PonderPalette.RED).placeNearTarget().attachKeyFrame().text("Place a second one with a gap of 1 or 2 blocks inbetween");
    scene.idle(55);
    scene.world.rotateBearing(bearing, 360, 60);
    scene.world.rotateSection(contraption, 0, 360, 0, 60);
    scene.idle(20);
    scene.overlay.showText(40).placeNearTarget().pointAt(util.vector.of(3, 3, 2.5)).text("Whenever they pass by each other, they will engage in a connection");
    scene.idle(35);
    Selection both = util.select.fromTo(2, 2, 2, 4, 2, 2);
    Class<PortableItemInterfaceTileEntity> psiClass = PortableItemInterfaceTileEntity.class;
    scene.world.modifyTileNBT(both, psiClass, nbt -> {
        nbt.putFloat("Distance", 1);
        nbt.putFloat("Timer", 40);
    });
    scene.idle(20);
    scene.overlay.showOutline(PonderPalette.GREEN, psi, util.select.fromTo(5, 3, 2, 6, 3, 2), 80);
    scene.idle(10);
    scene.overlay.showSelectionWithText(util.select.position(psi2), 70).placeNearTarget().colored(PonderPalette.GREEN).attachKeyFrame().text("While engaged, the stationary interface will represent ALL inventories on the contraption");
    scene.idle(80);
    BlockPos hopper = util.grid.at(2, 3, 2);
    scene.world.showSection(util.select.position(hopper), Direction.DOWN);
    scene.overlay.showText(70).placeNearTarget().pointAt(util.vector.topOf(hopper)).attachKeyFrame().text("Items can now be inserted...");
    ItemStack itemStack = new ItemStack(Items.COPPER_INGOT);
    Vec3 entitySpawn = util.vector.topOf(hopper.above(3));
    ElementLink<EntityElement> entity1 = scene.world.createItemEntity(entitySpawn, util.vector.of(0, 0.2, 0), itemStack);
    scene.idle(10);
    ElementLink<EntityElement> entity2 = scene.world.createItemEntity(entitySpawn, util.vector.of(0, 0.2, 0), itemStack);
    scene.idle(10);
    scene.world.modifyEntity(entity1, Entity::discard);
    scene.idle(10);
    scene.world.modifyEntity(entity2, Entity::discard);
    scene.overlay.showControls(new InputWindowElement(util.vector.topOf(5, 3, 2), Pointing.DOWN).withItem(itemStack), 40);
    scene.idle(30);
    scene.world.hideSection(util.select.position(hopper), Direction.UP);
    scene.idle(15);
    BlockPos beltPos = util.grid.at(1, 1, 2);
    scene.world.showSection(util.select.fromTo(0, 1, 0, 1, 2, 6), Direction.DOWN);
    scene.idle(10);
    scene.world.createItemOnBelt(beltPos, Direction.EAST, itemStack.copy());
    scene.overlay.showText(40).placeNearTarget().pointAt(util.vector.topOf(beltPos.above())).text("...or extracted from the contraption");
    scene.idle(15);
    scene.world.createItemOnBelt(beltPos, Direction.EAST, itemStack);
    scene.idle(20);
    scene.world.modifyEntities(ItemEntity.class, Entity::discard);
    scene.idle(15);
    scene.world.modifyEntities(ItemEntity.class, Entity::discard);
    scene.overlay.showText(120).placeNearTarget().pointAt(util.vector.topOf(psi2)).text("After no items have been exchanged for a while, the contraption will continue on its way");
    scene.world.modifyTileNBT(both, psiClass, nbt -> nbt.putFloat("Timer", 9));
    scene.idle(15);
    scene.markAsFinished();
    scene.world.rotateBearing(bearing, 270, 120);
    scene.world.rotateSection(contraption, 0, 270, 0, 120);
}
Also used : HarvesterTileEntity(com.simibubi.create.content.contraptions.components.actors.HarvesterTileEntity) Entity(net.minecraft.world.entity.Entity) ItemEntity(net.minecraft.world.entity.item.ItemEntity) PortableItemInterfaceTileEntity(com.simibubi.create.content.contraptions.components.actors.PortableItemInterfaceTileEntity) PortableStorageInterfaceTileEntity(com.simibubi.create.content.contraptions.components.actors.PortableStorageInterfaceTileEntity) 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) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement) EntityElement(com.simibubi.create.foundation.ponder.element.EntityElement) PortableItemInterfaceTileEntity(com.simibubi.create.content.contraptions.components.actors.PortableItemInterfaceTileEntity) ItemStack(net.minecraft.world.item.ItemStack)

Example 54 with WorldSectionElement

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

the class MovementActorScenes method harvester.

public static void harvester(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("mechanical_harvester", "Using Mechanical Harvesters on Contraptions");
    scene.configureBasePlate(0, 0, 6);
    scene.scaleSceneView(0.9f);
    Selection crops = util.select.fromTo(4, 1, 2, 3, 1, 2).add(util.select.fromTo(3, 1, 1, 2, 1, 1).add(util.select.position(2, 1, 3)).add(util.select.position(1, 1, 2)));
    scene.world.setBlocks(crops, Blocks.WHEAT.defaultBlockState().setValue(CropBlock.AGE, 7), false);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    BlockPos bearingPos = util.grid.at(4, 1, 4);
    scene.idle(5);
    scene.world.showSection(crops, Direction.UP);
    scene.world.showSection(util.select.position(bearingPos), Direction.DOWN);
    scene.idle(5);
    ElementLink<WorldSectionElement> contraption = scene.world.showIndependentSection(util.select.fromTo(4, 2, 4, 2, 2, 5).add(util.select.fromTo(2, 1, 5, 0, 1, 5)), Direction.DOWN);
    scene.world.configureCenterOfRotation(contraption, util.vector.centerOf(bearingPos));
    scene.idle(10);
    for (int i = 0; i < 3; i++) {
        scene.world.showSectionAndMerge(util.select.position(i, 1, 4), Direction.SOUTH, contraption);
        scene.idle(5);
    }
    scene.overlay.showText(60).attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(util.grid.at(1, 1, 4), Direction.SOUTH)).text("Whenever Harvesters are moved as part of an animated Contraption...");
    scene.idle(70);
    for (int i = 0; i < 3; i++) scene.world.modifyTileEntity(util.grid.at(i, 1, 4), HarvesterTileEntity.class, hte -> hte.setAnimatedSpeed(-150));
    scene.world.rotateBearing(bearingPos, -360, 140);
    scene.world.rotateSection(contraption, 0, -360, 0, 140);
    BlockState harvested = Blocks.WHEAT.defaultBlockState();
    ItemStack wheatItem = new ItemStack(Items.WHEAT);
    scene.idle(5);
    BlockPos current = util.grid.at(2, 1, 3);
    scene.world.setBlock(current, harvested, true);
    scene.world.createItemEntity(util.vector.centerOf(current), util.vector.of(0, 0.3, -.2), wheatItem);
    scene.idle(5);
    current = util.grid.at(1, 1, 2);
    scene.world.setBlock(current, harvested, true);
    scene.world.createItemEntity(util.vector.centerOf(current), util.vector.of(0, 0.3, -.2), wheatItem);
    scene.idle(5);
    current = util.grid.at(3, 1, 2);
    scene.world.setBlock(current, harvested, true);
    scene.world.createItemEntity(util.vector.centerOf(current), util.vector.of(.1, 0.3, -.1), wheatItem);
    current = util.grid.at(2, 1, 1);
    scene.world.setBlock(current, harvested, true);
    scene.world.createItemEntity(util.vector.centerOf(current), util.vector.of(.1, 0.3, -.1), wheatItem);
    scene.idle(5);
    current = util.grid.at(3, 1, 1);
    scene.world.setBlock(current, harvested, true);
    scene.world.createItemEntity(util.vector.centerOf(current), util.vector.of(.1, 0.3, -.1), wheatItem);
    scene.idle(5);
    current = util.grid.at(4, 1, 2);
    scene.world.setBlock(current, harvested, true);
    scene.world.createItemEntity(util.vector.centerOf(current), util.vector.of(.2, 0.3, 0), wheatItem);
    scene.overlay.showText(80).pointAt(util.vector.topOf(1, 0, 2)).text("They will harvest and reset any mature crops on their way").placeNearTarget();
    scene.idle(101);
    scene.world.hideSection(crops, Direction.DOWN);
    scene.idle(15);
    scene.world.modifyEntities(ItemEntity.class, Entity::discard);
    scene.world.setBlocks(crops, Blocks.WHEAT.defaultBlockState().setValue(CropBlock.AGE, 7), false);
    scene.world.showSection(crops, Direction.UP);
    for (int i = 0; i < 3; i++) scene.world.modifyTileEntity(util.grid.at(i, 1, 4), HarvesterTileEntity.class, hte -> hte.setAnimatedSpeed(0));
    scene.idle(10);
    scene.world.cycleBlockProperty(util.grid.at(1, 1, 5), LinearChassisBlock.STICKY_TOP);
    scene.world.glueBlockOnto(util.grid.at(1, 2, 5), Direction.DOWN, contraption);
    scene.overlay.showText(60).attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(util.grid.at(1, 2, 5), Direction.WEST)).sharedText("storage_on_contraption");
    scene.idle(70);
    for (int i = 0; i < 3; i++) scene.world.modifyTileEntity(util.grid.at(i, 1, 4), HarvesterTileEntity.class, hte -> hte.setAnimatedSpeed(-150));
    scene.world.rotateBearing(bearingPos, -360, 140);
    scene.world.rotateSection(contraption, 0, -360, 0, 140);
    scene.idle(5);
    current = util.grid.at(2, 1, 3);
    scene.world.setBlock(current, harvested, true);
    scene.idle(5);
    current = util.grid.at(1, 1, 2);
    scene.world.setBlock(current, harvested, true);
    scene.idle(5);
    current = util.grid.at(3, 1, 2);
    scene.world.setBlock(current, harvested, true);
    current = util.grid.at(2, 1, 1);
    scene.world.setBlock(current, harvested, true);
    scene.idle(5);
    current = util.grid.at(3, 1, 1);
    scene.world.setBlock(current, harvested, true);
    scene.idle(5);
    current = util.grid.at(4, 1, 2);
    scene.world.setBlock(current, harvested, true);
    scene.idle(116);
    scene.overlay.showControls(new InputWindowElement(util.vector.topOf(1, 2, 5), Pointing.DOWN).withItem(wheatItem), 50);
    for (int i = 0; i < 3; i++) scene.world.modifyTileEntity(util.grid.at(i, 1, 4), HarvesterTileEntity.class, hte -> hte.setAnimatedSpeed(0));
}
Also used : Items(net.minecraft.world.item.Items) SceneBuilder(com.simibubi.create.foundation.ponder.SceneBuilder) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) Direction(net.minecraft.core.Direction) Pointing(com.simibubi.create.foundation.utility.Pointing) BlockState(net.minecraft.world.level.block.state.BlockState) LinearChassisBlock(com.simibubi.create.content.contraptions.components.structureMovement.chassis.LinearChassisBlock) CropBlock(net.minecraft.world.level.block.CropBlock) ElementLink(com.simibubi.create.foundation.ponder.ElementLink) PonderPalette(com.simibubi.create.foundation.ponder.PonderPalette) FlappyPose(com.simibubi.create.foundation.ponder.element.ParrotElement.FlappyPose) Selection(com.simibubi.create.foundation.ponder.Selection) EntityElement(com.simibubi.create.foundation.ponder.element.EntityElement) SceneBuildingUtil(com.simibubi.create.foundation.ponder.SceneBuildingUtil) HarvesterTileEntity(com.simibubi.create.content.contraptions.components.actors.HarvesterTileEntity) ParrotElement(com.simibubi.create.foundation.ponder.element.ParrotElement) Blocks(net.minecraft.world.level.block.Blocks) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement) Entity(net.minecraft.world.entity.Entity) BlockPos(net.minecraft.core.BlockPos) ItemEntity(net.minecraft.world.entity.item.ItemEntity) Vec3(net.minecraft.world.phys.Vec3) PortableItemInterfaceTileEntity(com.simibubi.create.content.contraptions.components.actors.PortableItemInterfaceTileEntity) ItemStack(net.minecraft.world.item.ItemStack) PortableStorageInterfaceTileEntity(com.simibubi.create.content.contraptions.components.actors.PortableStorageInterfaceTileEntity) HarvesterTileEntity(com.simibubi.create.content.contraptions.components.actors.HarvesterTileEntity) Entity(net.minecraft.world.entity.Entity) ItemEntity(net.minecraft.world.entity.item.ItemEntity) PortableItemInterfaceTileEntity(com.simibubi.create.content.contraptions.components.actors.PortableItemInterfaceTileEntity) PortableStorageInterfaceTileEntity(com.simibubi.create.content.contraptions.components.actors.PortableStorageInterfaceTileEntity) HarvesterTileEntity(com.simibubi.create.content.contraptions.components.actors.HarvesterTileEntity) BlockState(net.minecraft.world.level.block.state.BlockState) Selection(com.simibubi.create.foundation.ponder.Selection) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) BlockPos(net.minecraft.core.BlockPos) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement) ItemStack(net.minecraft.world.item.ItemStack)

Example 55 with WorldSectionElement

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

the class PistonScenes method movement.

public static void movement(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("mechanical_piston", "Moving Structures using Mechanical Pistons");
    scene.configureBasePlate(0, 0, 5);
    scene.world.showSection(util.select.layer(0).add(util.select.position(0, 1, 2)), Direction.UP);
    Selection kinetics = util.select.fromTo(3, 1, 3, 3, 1, 2);
    BlockPos piston = util.grid.at(3, 1, 2);
    BlockPos leverPos = util.grid.at(3, 2, 4);
    BlockPos shaft = util.grid.at(3, 1, 3);
    scene.idle(5);
    scene.world.showSection(util.select.fromTo(3, 1, 3, 3, 2, 5), Direction.DOWN);
    scene.idle(10);
    scene.world.showSection(util.select.position(piston), Direction.DOWN);
    ElementLink<WorldSectionElement> contraption = scene.world.showIndependentSection(util.select.position(3, 1, 1), Direction.DOWN);
    scene.world.moveSection(contraption, util.vector.of(0, 0, 1), 0);
    scene.idle(20);
    scene.world.showSectionAndMerge(util.select.position(piston.north().east()), Direction.DOWN, contraption);
    scene.idle(5);
    scene.world.showSectionAndMerge(util.select.position(piston.north().east(2)), Direction.DOWN, contraption);
    scene.world.showSectionAndMerge(util.select.position(piston.north().west()), Direction.DOWN, contraption);
    scene.idle(15);
    scene.effects.indicateRedstone(leverPos);
    scene.world.toggleRedstonePower(util.select.fromTo(leverPos, leverPos.below()));
    scene.world.modifyKineticSpeed(kinetics, f -> -f);
    scene.effects.rotationDirectionIndicator(shaft);
    scene.world.moveSection(contraption, util.vector.of(-2, 0, 0), 40);
    scene.overlay.showText(55).pointAt(util.vector.topOf(piston)).placeNearTarget().attachKeyFrame().text("Mechanical Pistons can move blocks in front of them");
    scene.idle(65);
    scene.overlay.showText(45).pointAt(util.vector.blockSurface(shaft, Direction.SOUTH)).placeNearTarget().text("Speed and direction of movement depend on the Rotational Input");
    scene.world.setBlock(util.grid.at(2, 1, 1), Blocks.AIR.defaultBlockState(), false);
    scene.world.setBlock(util.grid.at(0, 1, 2), Blocks.OAK_PLANKS.defaultBlockState(), false);
    scene.effects.indicateRedstone(leverPos);
    scene.world.toggleRedstonePower(util.select.fromTo(leverPos, leverPos.below()));
    scene.world.modifyKineticSpeed(kinetics, f -> -f);
    scene.effects.rotationDirectionIndicator(shaft);
    scene.world.moveSection(contraption, util.vector.of(2, 0, 0), 40);
    scene.idle(60);
    scene.overlay.showControls(new InputWindowElement(util.vector.blockSurface(piston, Direction.WEST), Pointing.DOWN).rightClick().withItem(new ItemStack(Items.SLIME_BALL)), 30);
    scene.idle(7);
    scene.world.modifyBlock(piston.north(), s -> s.setValue(MechanicalPistonHeadBlock.TYPE, PistonType.STICKY), false);
    scene.effects.superGlue(piston, Direction.WEST, true);
    scene.idle(33);
    scene.effects.indicateRedstone(leverPos);
    scene.world.toggleRedstonePower(util.select.fromTo(leverPos, leverPos.below()));
    scene.world.modifyKineticSpeed(kinetics, f -> -f);
    scene.effects.rotationDirectionIndicator(shaft);
    scene.world.moveSection(contraption, util.vector.of(-2, 0, 0), 40);
    scene.idle(25);
    scene.overlay.showText(60).pointAt(util.vector.topOf(piston)).placeNearTarget().attachKeyFrame().text("Sticky Mechanical Pistons can pull the attached blocks back");
    scene.idle(20);
    scene.world.setBlock(util.grid.at(2, 1, 1), Blocks.OAK_PLANKS.defaultBlockState(), false);
    scene.world.setBlock(util.grid.at(0, 1, 2), Blocks.AIR.defaultBlockState(), false);
    scene.effects.indicateRedstone(leverPos);
    scene.world.toggleRedstonePower(util.select.fromTo(leverPos, leverPos.below()));
    scene.world.modifyKineticSpeed(kinetics, f -> -f);
    scene.effects.rotationDirectionIndicator(shaft);
    scene.world.moveSection(contraption, util.vector.of(2, 0, 0), 40);
    scene.idle(50);
    scene.world.setBlock(util.grid.at(2, 1, 1), Blocks.AIR.defaultBlockState(), false);
    ElementLink<WorldSectionElement> chassis = scene.world.showIndependentSection(util.select.fromTo(2, 2, 0, 2, 3, 2), Direction.DOWN);
    scene.world.moveSection(chassis, util.vector.of(0, -1, 1), 0);
    scene.addKeyframe();
    scene.idle(5);
    scene.world.showSectionAndMerge(util.select.position(1, 2, 0), Direction.EAST, chassis);
    scene.idle(15);
    scene.effects.superGlue(piston.west().north(), Direction.WEST, true);
    scene.overlay.showText(80).pointAt(util.vector.topOf(piston.west())).placeNearTarget().sharedText("movement_anchors");
    scene.idle(90);
    scene.effects.indicateRedstone(leverPos);
    scene.world.toggleRedstonePower(util.select.fromTo(leverPos, leverPos.below()));
    scene.world.modifyKineticSpeed(kinetics, f -> -f);
    scene.effects.rotationDirectionIndicator(shaft);
    scene.world.moveSection(contraption, util.vector.of(-2, 0, 0), 40);
    scene.world.moveSection(chassis, util.vector.of(-2, 0, 0), 40);
}
Also used : Selection(com.simibubi.create.foundation.ponder.Selection) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) BlockPos(net.minecraft.core.BlockPos) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement) ItemStack(net.minecraft.world.item.ItemStack)

Aggregations

WorldSectionElement (com.simibubi.create.foundation.ponder.element.WorldSectionElement)70 BlockPos (net.minecraft.core.BlockPos)64 Selection (com.simibubi.create.foundation.ponder.Selection)60 InputWindowElement (com.simibubi.create.foundation.ponder.element.InputWindowElement)44 Vec3 (net.minecraft.world.phys.Vec3)39 ItemStack (net.minecraft.world.item.ItemStack)34 Entity (net.minecraft.world.entity.Entity)16 Direction (net.minecraft.core.Direction)11 ItemEntity (net.minecraft.world.entity.item.ItemEntity)11 EntityElement (com.simibubi.create.foundation.ponder.element.EntityElement)10 ElementLink (com.simibubi.create.foundation.ponder.ElementLink)9 SceneBuilder (com.simibubi.create.foundation.ponder.SceneBuilder)9 SceneBuildingUtil (com.simibubi.create.foundation.ponder.SceneBuildingUtil)8 AABB (net.minecraft.world.phys.AABB)8 FluidStack (net.minecraftforge.fluids.FluidStack)8 PonderPalette (com.simibubi.create.foundation.ponder.PonderPalette)7 Pointing (com.simibubi.create.foundation.utility.Pointing)6 HarvesterTileEntity (com.simibubi.create.content.contraptions.components.actors.HarvesterTileEntity)5 BeltItemElement (com.simibubi.create.foundation.ponder.element.BeltItemElement)5 BlockState (net.minecraft.world.level.block.state.BlockState)5