Search in sources :

Example 11 with EntityElement

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

the class MechanicalDrillScenes method breaker.

public static void breaker(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("mechanical_drill", "Breaking Blocks with the Mechanical Drill");
    scene.configureBasePlate(0, 0, 5);
    scene.world.setKineticSpeed(util.select.layer(0), -8);
    scene.world.setKineticSpeed(util.select.layer(1), 16);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    scene.idle(5);
    scene.world.showSection(util.select.fromTo(4, 1, 2, 5, 1, 2), Direction.DOWN);
    scene.idle(10);
    scene.world.showSection(util.select.position(3, 1, 2), Direction.EAST);
    scene.idle(20);
    BlockPos breakingPos = util.grid.at(2, 1, 2);
    scene.world.showSection(util.select.position(2, 1, 2), Direction.DOWN);
    scene.idle(5);
    for (int i = 0; i < 10; i++) {
        scene.idle(10);
        scene.world.incrementBlockBreakingProgress(breakingPos);
        if (i == 1) {
            scene.overlay.showText(80).attachKeyFrame().placeNearTarget().pointAt(util.vector.topOf(breakingPos)).text("When given Rotational Force, a Mechanical Drill will break blocks directly in front of it");
        }
    }
    scene.world.hideSection(util.select.position(breakingPos), Direction.UP);
    ElementLink<EntityElement> plankEntity = scene.world.createItemEntity(util.vector.centerOf(breakingPos), util.vector.of(0, .1f, 0), new ItemStack(Items.OAK_PLANKS));
    scene.idle(20);
    scene.idle(15);
    scene.world.modifyEntity(plankEntity, Entity::discard);
    scene.world.modifyKineticSpeed(util.select.everywhere(), f -> 4 * f);
    scene.effects.rotationSpeedIndicator(breakingPos.east(3));
    scene.idle(5);
    scene.world.setBlock(breakingPos, Blocks.OAK_PLANKS.defaultBlockState(), false);
    scene.world.showSection(util.select.position(breakingPos), Direction.DOWN);
    scene.idle(5);
    for (int i = 0; i < 10; i++) {
        scene.idle(3);
        scene.world.incrementBlockBreakingProgress(breakingPos);
        if (i == 2) {
            scene.overlay.showText(80).attachKeyFrame().placeNearTarget().pointAt(util.vector.topOf(breakingPos.east())).text("Its mining speed depends on the Rotational Input");
        }
    }
    scene.world.createItemEntity(util.vector.centerOf(breakingPos), util.vector.of(0, .1f, 0), new ItemStack(Items.OAK_PLANKS));
}
Also used : Entity(net.minecraft.world.entity.Entity) ItemEntity(net.minecraft.world.entity.item.ItemEntity) BlockPos(net.minecraft.core.BlockPos) EntityElement(com.simibubi.create.foundation.ponder.element.EntityElement) ItemStack(net.minecraft.world.item.ItemStack)

Example 12 with EntityElement

use of com.simibubi.create.foundation.ponder.element.EntityElement 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 13 with EntityElement

use of com.simibubi.create.foundation.ponder.element.EntityElement 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 14 with EntityElement

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

the class ProcessingScenes method crushingWheels.

public static void crushingWheels(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("crushing_wheels", "Processing Items with Crushing Wheels");
    scene.configureBasePlate(0, 0, 5);
    scene.scaleSceneView(.9f);
    Selection wheels = util.select.fromTo(3, 2, 2, 1, 2, 2);
    Selection kinetics = util.select.fromTo(0, 1, 5, 4, 1, 3);
    Selection kinetics2 = util.select.fromTo(0, 2, 5, 4, 2, 3);
    Selection beltCog = util.select.position(5, 0, 1);
    scene.world.setKineticSpeed(wheels, 0);
    scene.world.setBlock(util.grid.at(2, 3, 2), Blocks.AIR.defaultBlockState(), false);
    scene.world.showSection(util.select.layer(0).substract(beltCog), Direction.UP);
    scene.idle(5);
    Selection belt = util.select.fromTo(4, 1, 2, 4, 4, 2).add(util.select.fromTo(4, 3, 3, 4, 4, 3)).add(util.select.position(3, 3, 2)).add(util.select.position(2, 3, 2));
    Selection bottomBelt = util.select.fromTo(5, 1, 0, 2, 1, 0).add(util.select.fromTo(2, 1, 2, 2, 1, 1));
    BlockPos center = util.grid.at(2, 2, 2);
    Selection wWheel = util.select.position(center.west());
    Selection eWheel = util.select.position(center.east());
    scene.world.showSection(wWheel, Direction.SOUTH);
    scene.idle(3);
    scene.world.showSection(eWheel, Direction.SOUTH);
    scene.idle(10);
    Vec3 centerTop = util.vector.topOf(center);
    scene.overlay.showText(60).attachKeyFrame().text("A pair of Crushing Wheels can grind items very effectively").pointAt(centerTop).placeNearTarget();
    scene.idle(70);
    scene.world.showSection(kinetics, Direction.DOWN);
    scene.idle(3);
    scene.world.showSection(kinetics2, Direction.DOWN);
    scene.world.setKineticSpeed(wWheel, -16);
    scene.world.setKineticSpeed(eWheel, 16);
    scene.idle(5);
    scene.effects.rotationDirectionIndicator(center.west());
    scene.effects.rotationDirectionIndicator(center.east());
    scene.idle(10);
    scene.overlay.showText(60).attachKeyFrame().text("Their Rotational Input has to make them spin into each other").pointAt(util.vector.blockSurface(center.west(), Direction.NORTH)).placeNearTarget();
    scene.idle(40);
    scene.effects.rotationDirectionIndicator(center.west());
    scene.effects.rotationDirectionIndicator(center.east());
    scene.idle(30);
    ItemStack input = new ItemStack(Items.GOLD_ORE);
    ItemStack output = new ItemStack(Items.RAW_GOLD);
    Vec3 entitySpawn = util.vector.topOf(center.above(2));
    ElementLink<EntityElement> entity1 = scene.world.createItemEntity(entitySpawn, util.vector.of(0, 0.2, 0), input);
    scene.idle(18);
    scene.world.modifyEntity(entity1, Entity::discard);
    Emitter blockSpace = Emitter.withinBlockSpace(new ItemParticleOption(ParticleTypes.ITEM, input), util.vector.of(0, 0, 0));
    scene.effects.emitParticles(util.vector.centerOf(center).add(0, -0.2, 0), blockSpace, 3, 40);
    scene.idle(10);
    scene.overlay.showControls(new InputWindowElement(centerTop, Pointing.DOWN).withItem(input), 30);
    scene.idle(7);
    scene.overlay.showText(50).attachKeyFrame().text("Items thrown or inserted into the top will get processed").pointAt(centerTop).placeNearTarget();
    scene.idle(60);
    scene.world.createItemEntity(centerTop.add(0, -1.4, 0), util.vector.of(0, 0, 0), output);
    scene.idle(10);
    scene.world.createItemEntity(centerTop.add(0, -1.4, 0), util.vector.of(0, 0, 0), output);
    scene.overlay.showControls(new InputWindowElement(centerTop.add(0, -2, 0), Pointing.UP).withItem(output), 30);
    scene.idle(40);
    scene.world.restoreBlocks(util.select.position(2, 3, 2));
    scene.world.showSection(belt, Direction.DOWN);
    scene.idle(5);
    scene.world.showSection(beltCog, Direction.UP);
    scene.idle(5);
    scene.world.modifyEntities(ItemEntity.class, Entity::discard);
    scene.world.showSection(bottomBelt, Direction.SOUTH);
    scene.idle(5);
    scene.overlay.showText(50).attachKeyFrame().text("Items can be inserted and picked up through automated means as well").pointAt(centerTop.add(0, .5, 0)).placeNearTarget();
    scene.idle(40);
    for (int i = 0; i < 5; i++) {
        if (i < 4)
            scene.world.createItemOnBelt(util.grid.at(4, 4, 2), Direction.EAST, input);
        scene.idle(15);
        if (i < 3)
            scene.world.createItemOnBelt(util.grid.at(4, 4, 2), Direction.EAST, input);
        scene.idle(15);
        if (i > 0) {
            scene.world.createItemOnBelt(center.below(), Direction.UP, output);
            scene.idle(15);
            scene.world.createItemOnBelt(center.below(), Direction.UP, output);
        }
        scene.world.removeItemsFromBelt(util.grid.at(3, 3, 2));
        if (i < 4)
            scene.effects.emitParticles(util.vector.centerOf(center).add(0, -0.2, 0), blockSpace, 3, 28);
        if (i == 0)
            scene.markAsFinished();
    }
}
Also used : BasinTileEntity(com.simibubi.create.content.contraptions.processing.BasinTileEntity) MechanicalPressTileEntity(com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity) DeployerTileEntity(com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity) Entity(net.minecraft.world.entity.Entity) ItemEntity(net.minecraft.world.entity.item.ItemEntity) MillstoneTileEntity(com.simibubi.create.content.contraptions.components.millstone.MillstoneTileEntity) MechanicalMixerTileEntity(com.simibubi.create.content.contraptions.components.mixer.MechanicalMixerTileEntity) Emitter(com.simibubi.create.foundation.ponder.instruction.EmitParticlesInstruction.Emitter) Selection(com.simibubi.create.foundation.ponder.Selection) Vec3(net.minecraft.world.phys.Vec3) ItemParticleOption(net.minecraft.core.particles.ItemParticleOption) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) BlockPos(net.minecraft.core.BlockPos) EntityElement(com.simibubi.create.foundation.ponder.element.EntityElement) ItemStack(net.minecraft.world.item.ItemStack)

Example 15 with EntityElement

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

the class DeployerScenes method filter.

public static void filter(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("deployer", "Using the Deployer");
    scene.configureBasePlate(0, 0, 5);
    BlockPos potPosition = util.grid.at(1, 1, 2);
    BlockPos deployerPos = util.grid.at(3, 1, 2);
    Selection deployerSelection = util.select.position(deployerPos);
    scene.world.setBlock(potPosition, Blocks.AIR.defaultBlockState(), false);
    scene.world.showSection(util.select.layer(0).add(util.select.position(1, 1, 2)), Direction.UP);
    scene.idle(5);
    scene.world.showSection(util.select.fromTo(3, 1, 3, 3, 1, 5), Direction.DOWN);
    scene.idle(10);
    scene.world.showSection(deployerSelection, Direction.SOUTH);
    scene.idle(10);
    scene.overlay.showText(60).placeNearTarget().pointAt(util.vector.topOf(deployerPos)).text("Given Rotational Force, a Deployer can imitate player interactions");
    scene.world.moveDeployer(deployerPos, 1, 25);
    scene.idle(26);
    scene.world.moveDeployer(deployerPos, -1, 25);
    scene.idle(44);
    scene.overlay.showSelectionWithText(util.select.position(deployerPos.west(2)), 60).text("It will always interact with the position 2 blocks in front of itself").attachKeyFrame().placeNearTarget().colored(PonderPalette.GREEN).attachKeyFrame();
    scene.world.moveDeployer(deployerPos, 1, 25);
    scene.idle(26);
    scene.world.moveDeployer(deployerPos, -1, 25);
    scene.idle(20);
    scene.world.showSection(util.select.fromTo(2, 1, 3, 2, 1, 1), Direction.DOWN);
    scene.idle(24);
    scene.overlay.showText(50).pointAt(util.vector.topOf(deployerPos.west())).text("Blocks directly in front will not obstruct it").placeNearTarget();
    scene.world.moveDeployer(deployerPos, 1, 25);
    scene.idle(26);
    scene.world.moveDeployer(deployerPos, -1, 25);
    scene.idle(34);
    scene.world.hideSection(util.select.fromTo(2, 1, 3, 2, 1, 1), Direction.UP);
    scene.idle(20);
    String[] actions = new String[] { "Place Blocks,", "Use Items,", "Activate Blocks,", "Harvest blocks", "and Attack Mobs" };
    scene.overlay.showText(80).attachKeyFrame().independent(40).placeNearTarget().text("Deployers can:");
    int y = 60;
    for (String s : actions) {
        scene.idle(15);
        scene.overlay.showText(50).colored(PonderPalette.MEDIUM).placeNearTarget().independent(y).text(s);
        y += 16;
    }
    scene.idle(50);
    ItemStack pot = new ItemStack(Items.FLOWER_POT);
    Vec3 frontVec = util.vector.blockSurface(deployerPos, Direction.WEST).add(-.125, 0, 0);
    scene.overlay.showControls(new InputWindowElement(frontVec, Pointing.DOWN).rightClick().withItem(pot), 40);
    scene.idle(7);
    Class<DeployerTileEntity> teType = DeployerTileEntity.class;
    scene.world.modifyTileNBT(deployerSelection, teType, nbt -> nbt.put("HeldItem", pot.serializeNBT()));
    scene.idle(10);
    scene.overlay.showText(40).attachKeyFrame().placeNearTarget().pointAt(frontVec).text("Right-click the front to give it an Item to use");
    scene.idle(40);
    scene.world.moveDeployer(deployerPos, 1, 25);
    scene.idle(26);
    scene.world.restoreBlocks(util.select.position(potPosition));
    scene.world.modifyTileNBT(deployerSelection, teType, nbt -> nbt.put("HeldItem", ItemStack.EMPTY.serializeNBT()));
    scene.world.moveDeployer(deployerPos, -1, 25);
    scene.idle(20);
    scene.world.showSection(util.select.position(deployerPos.above()), Direction.DOWN);
    ItemStack tulip = new ItemStack(Items.RED_TULIP);
    Vec3 entitySpawn = util.vector.topOf(deployerPos.above(3));
    ElementLink<EntityElement> entity1 = scene.world.createItemEntity(entitySpawn, util.vector.of(0, 0.2, 0), tulip);
    scene.idle(17);
    scene.world.modifyEntity(entity1, Entity::discard);
    scene.world.modifyTileNBT(deployerSelection, teType, nbt -> nbt.put("HeldItem", tulip.serializeNBT()));
    scene.idle(10);
    scene.overlay.showText(40).placeNearTarget().pointAt(util.vector.of(3, 2.5, 3)).text("Items can also be inserted automatically");
    scene.idle(30);
    scene.world.moveDeployer(deployerPos, 1, 25);
    scene.idle(26);
    scene.world.setBlock(potPosition, Blocks.POTTED_RED_TULIP.defaultBlockState(), false);
    scene.world.modifyTileNBT(deployerSelection, teType, nbt -> nbt.put("HeldItem", ItemStack.EMPTY.serializeNBT()));
    scene.world.moveDeployer(deployerPos, -1, 25);
    scene.idle(25);
    scene.world.hideSection(util.select.position(potPosition), Direction.UP);
    scene.world.hideSection(util.select.position(deployerPos.above()), Direction.EAST);
    scene.idle(20);
    Vec3 filterSlot = frontVec.add(0.375, 0.25, 0);
    scene.overlay.showFilterSlotInput(filterSlot, 80);
    scene.overlay.showText(40).attachKeyFrame().placeNearTarget().pointAt(filterSlot).text("Deployers carry a filter slot");
    scene.idle(50);
    ItemStack shears = new ItemStack(Items.SHEARS);
    scene.overlay.showControls(new InputWindowElement(filterSlot, Pointing.DOWN).rightClick().withItem(shears), 40);
    scene.idle(7);
    scene.world.setFilterData(deployerSelection, teType, shears);
    scene.overlay.showText(60).placeNearTarget().pointAt(filterSlot).text("When a filter is set, it activates only while holding a matching item");
    scene.idle(70);
    ElementLink<EntityElement> sheep = scene.world.createEntity(w -> {
        Sheep entity = EntityType.SHEEP.create(w);
        entity.setColor(DyeColor.PINK);
        Vec3 p = util.vector.topOf(util.grid.at(1, 0, 2));
        entity.setPos(p.x, p.y, p.z);
        entity.xo = p.x;
        entity.yo = p.y;
        entity.zo = p.z;
        entity.animationPosition = 0;
        entity.yRotO = 210;
        entity.setYRot(210);
        entity.yHeadRotO = 210;
        entity.yHeadRot = 210;
        return entity;
    });
    scene.idle(20);
    scene.world.showSection(util.select.position(deployerPos.above()), Direction.WEST);
    entity1 = scene.world.createItemEntity(entitySpawn, util.vector.of(0, 0.2, 0), shears);
    scene.idle(17);
    scene.world.modifyEntity(entity1, Entity::discard);
    scene.world.modifyTileNBT(deployerSelection, teType, nbt -> nbt.put("HeldItem", shears.serializeNBT()));
    scene.idle(10);
    scene.overlay.showText(60).placeNearTarget().pointAt(util.vector.of(3, 2.5, 3)).text("Only items matching the filter can now be inserted...");
    scene.idle(70);
    scene.world.moveDeployer(deployerPos, 1, 25);
    scene.idle(26);
    scene.world.modifyEntity(sheep, e -> ((Sheep) e).setSheared(true));
    scene.effects.emitParticles(util.vector.topOf(deployerPos.west(2)).add(0, -.25, 0), Emitter.withinBlockSpace(new BlockParticleOption(ParticleTypes.BLOCK, Blocks.PINK_WOOL.defaultBlockState()), util.vector.of(0, 0, 0)), 25, 1);
    scene.world.moveDeployer(deployerPos, -1, 25);
    scene.world.showSection(util.select.position(deployerPos.north()), Direction.SOUTH);
    scene.idle(25);
    scene.overlay.showText(80).placeNearTarget().pointAt(util.vector.of(3.5, 1.25, 1.25)).text("...and only non-matching items will be extracted");
    scene.world.flapFunnel(deployerPos.north(), true);
    scene.world.createItemEntity(util.vector.centerOf(deployerPos.north()).subtract(0, .45, 0), util.vector.of(0, 0, -0.1), new ItemStack(Items.PINK_WOOL));
    scene.markAsFinished();
    for (int i = 0; i < 10; i++) {
        scene.idle(26);
        scene.world.moveDeployer(deployerPos, 1, 25);
        scene.idle(26);
        scene.world.moveDeployer(deployerPos, -1, 25);
        scene.idle(26);
    }
}
Also used : DeployerTileEntity(com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity) Entity(net.minecraft.world.entity.Entity) BlockParticleOption(net.minecraft.core.particles.BlockParticleOption) Selection(com.simibubi.create.foundation.ponder.Selection) DeployerTileEntity(com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity) EntityElement(com.simibubi.create.foundation.ponder.element.EntityElement) Vec3(net.minecraft.world.phys.Vec3) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) Sheep(net.minecraft.world.entity.animal.Sheep) BlockPos(net.minecraft.core.BlockPos) ItemStack(net.minecraft.world.item.ItemStack)

Aggregations

EntityElement (com.simibubi.create.foundation.ponder.element.EntityElement)16 ItemStack (net.minecraft.world.item.ItemStack)15 BlockPos (net.minecraft.core.BlockPos)14 Entity (net.minecraft.world.entity.Entity)14 InputWindowElement (com.simibubi.create.foundation.ponder.element.InputWindowElement)13 Vec3 (net.minecraft.world.phys.Vec3)13 Selection (com.simibubi.create.foundation.ponder.Selection)10 ItemEntity (net.minecraft.world.entity.item.ItemEntity)9 WorldSectionElement (com.simibubi.create.foundation.ponder.element.WorldSectionElement)8 DeployerTileEntity (com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity)3 MechanicalPressTileEntity (com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity)3 MillstoneTileEntity (com.simibubi.create.content.contraptions.components.millstone.MillstoneTileEntity)2 MechanicalMixerTileEntity (com.simibubi.create.content.contraptions.components.mixer.MechanicalMixerTileEntity)2 BasinTileEntity (com.simibubi.create.content.contraptions.processing.BasinTileEntity)2 HarvesterTileEntity (com.simibubi.create.content.contraptions.components.actors.HarvesterTileEntity)1 PortableItemInterfaceTileEntity (com.simibubi.create.content.contraptions.components.actors.PortableItemInterfaceTileEntity)1 PortableStorageInterfaceTileEntity (com.simibubi.create.content.contraptions.components.actors.PortableStorageInterfaceTileEntity)1 MechanicalCrafterTileEntity (com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterTileEntity)1 SawTileEntity (com.simibubi.create.content.contraptions.components.saw.SawTileEntity)1 SpoutTileEntity (com.simibubi.create.content.contraptions.fluids.actors.SpoutTileEntity)1