Search in sources :

Example 71 with Selection

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

the class PulleyScenes method movementModes.

public static void movementModes(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("rope_pulley_modes", "Movement Modes of the Rope Pulley");
    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());
    BlockPos flowerPos = util.grid.at(2, 1, 2);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    scene.world.showSection(util.select.position(flowerPos), 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);
    ElementLink<WorldSectionElement> glass = scene.world.showIndependentSection(util.select.position(pulleyPos.below()), Direction.UP);
    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.world.moveSection(glass, util.vector.of(0, -2, 0), 40);
    scene.idle(40);
    scene.world.destroyBlock(flowerPos);
    scene.idle(10);
    scene.overlay.showSelectionWithText(util.select.position(flowerPos), 70).text("Whenever Pulleys stop moving, the moved structure reverts to blocks").attachKeyFrame().placeNearTarget().colored(PonderPalette.RED);
    scene.idle(80);
    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(glass, util.vector.of(0, 2, 0), 40);
    scene.world.hideSection(util.select.position(flowerPos), Direction.DOWN);
    scene.idle(40);
    scene.world.setBlock(flowerPos, Blocks.BLUE_ORCHID.defaultBlockState(), false);
    scene.world.showSection(util.select.position(flowerPos), Direction.DOWN);
    scene.overlay.showCenteredScrollInput(pulleyPos, Direction.UP, 60);
    scene.overlay.showControls(new InputWindowElement(util.vector.topOf(pulleyPos), Pointing.DOWN).scroll().withWrench(), 60);
    scene.overlay.showText(70).pointAt(util.vector.topOf(pulleyPos)).placeNearTarget().attachKeyFrame().sharedText("behaviour_modify_wrench");
    scene.idle(80);
    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(glass, util.vector.of(0, -2, 0), 40);
    scene.idle(50);
    scene.overlay.showText(120).colored(PonderPalette.GREEN).pointAt(util.vector.blockSurface(flowerPos, Direction.WEST)).placeNearTarget().text("It can be configured never to revert to solid blocks, or only at the location it started at");
}
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)

Example 72 with Selection

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

the class RedstoneScenes method nixieTube.

public static void nixieTube(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("nixie_tube", "Using Nixie Tubes");
    scene.configureBasePlate(0, 0, 5);
    scene.world.showSection(util.select.layer(0).add(util.select.fromTo(2, 1, 1, 2, 1, 2)), Direction.UP);
    scene.idle(10);
    scene.world.showSection(util.select.position(2, 1, 3), Direction.DOWN);
    scene.idle(20);
    Selection tubes = util.select.fromTo(3, 1, 3, 1, 1, 3);
    scene.effects.indicateRedstone(util.grid.at(2, 1, 1));
    scene.world.modifyTileNBT(util.select.position(2, 1, 1), AnalogLeverTileEntity.class, nbt -> nbt.putInt("State", 11));
    scene.world.modifyBlock(util.grid.at(2, 1, 2), s -> s.setValue(RedStoneWireBlock.POWER, 11), false);
    scene.world.modifyTileNBT(tubes, NixieTubeTileEntity.class, nbt -> nbt.putInt("RedstoneStrength", 11));
    scene.idle(20);
    Vec3 centerTube = util.vector.centerOf(2, 1, 3);
    scene.overlay.showText(60).attachKeyFrame().text("When powered by Redstone, Nixie Tubes will display the redstone signals' strength").placeNearTarget().pointAt(util.vector.blockSurface(util.grid.at(2, 1, 3), Direction.WEST));
    scene.idle(70);
    scene.world.hideSection(util.select.position(2, 1, 3), Direction.UP);
    scene.idle(5);
    scene.world.hideSection(util.select.fromTo(2, 1, 1, 2, 1, 2), Direction.NORTH);
    scene.idle(10);
    scene.world.modifyTileNBT(tubes, NixieTubeTileEntity.class, nbt -> nbt.putInt("RedstoneStrength", 0));
    scene.world.showSection(tubes, Direction.DOWN);
    scene.idle(20);
    scene.overlay.showControls(new InputWindowElement(centerTube.add(1, .35, 0), Pointing.DOWN).rightClick().withItem(new ItemStack(Items.NAME_TAG)), 40);
    scene.idle(7);
    Component component = new TextComponent("CREATE");
    for (int i = 0; i < 3; i++) {
        final int index = i;
        scene.world.modifyTileNBT(util.select.position(3 - i, 1, 3), NixieTubeTileEntity.class, nbt -> {
            nbt.putString("RawCustomText", component.getString());
            nbt.putString("CustomText", Component.Serializer.toJson(component));
            nbt.putInt("CustomTextIndex", index);
        });
    }
    scene.idle(10);
    scene.world.showSection(util.select.position(4, 1, 3), Direction.DOWN);
    scene.idle(10);
    scene.special.createBirb(util.vector.topOf(util.grid.at(0, 0, 3)), ParrotElement.DancePose::new);
    scene.idle(20);
    scene.overlay.showText(80).attachKeyFrame().placeNearTarget().text("Using name tags edited with an anvil, custom text can be displayed").pointAt(util.vector.topOf(util.grid.at(3, 1, 3)).add(-.75, -.05f, 0));
    scene.idle(90);
    InputWindowElement input = new InputWindowElement(util.vector.blockSurface(util.grid.at(3, 1, 3), Direction.UP), Pointing.DOWN).withItem(new ItemStack(Items.BLUE_DYE));
    scene.overlay.showControls(input, 30);
    scene.idle(7);
    scene.world.setBlocks(util.select.fromTo(1, 1, 3, 3, 1, 3), AllBlocks.NIXIE_TUBES.get(DyeColor.BLUE).getDefaultState().setValue(NixieTubeBlock.FACING, Direction.NORTH), false);
    scene.idle(10);
    scene.overlay.showText(80).colored(PonderPalette.BLUE).text("Right-Click with Dye to change their display colour").attachKeyFrame().pointAt(util.vector.topOf(util.grid.at(3, 1, 3)).add(-.75, -.05f, 0)).placeNearTarget();
    scene.idle(60);
}
Also used : TextComponent(net.minecraft.network.chat.TextComponent) Selection(com.simibubi.create.foundation.ponder.Selection) Vec3(net.minecraft.world.phys.Vec3) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) ItemStack(net.minecraft.world.item.ItemStack) Component(net.minecraft.network.chat.Component) TextComponent(net.minecraft.network.chat.TextComponent)

Example 73 with Selection

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

the class DebugScenes method coordinateScene.

public static void coordinateScene(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("debug_coords", "Coordinate Space");
    scene.showBasePlate();
    scene.idle(10);
    scene.world.showSection(util.select.layersFrom(1), Direction.DOWN);
    Selection xAxis = util.select.fromTo(2, 1, 1, 4, 1, 1);
    Selection yAxis = util.select.fromTo(1, 2, 1, 1, 4, 1);
    Selection zAxis = util.select.fromTo(1, 1, 2, 1, 1, 4);
    scene.idle(10);
    scene.overlay.showSelectionWithText(xAxis, 20).colored(PonderPalette.RED).text("Das X axis");
    scene.idle(20);
    scene.overlay.showSelectionWithText(yAxis, 20).colored(PonderPalette.GREEN).text("Das Y axis");
    scene.idle(20);
    scene.overlay.showSelectionWithText(zAxis, 20).colored(PonderPalette.BLUE).text("Das Z axis");
}
Also used : Selection(com.simibubi.create.foundation.ponder.Selection)

Example 74 with Selection

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

the class DebugScenes method offScreenScene.

public static void offScreenScene(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("debug_baseplate", "Out of bounds / configureBasePlate");
    scene.configureBasePlate(1, 0, 6);
    scene.showBasePlate();
    Selection out1 = util.select.fromTo(7, 0, 0, 8, 0, 5);
    Selection out2 = util.select.fromTo(0, 0, 0, 0, 0, 5);
    Selection blocksExceptBasePlate = util.select.layersFrom(1).add(out1).add(out2);
    scene.idle(10);
    scene.world.showSection(blocksExceptBasePlate, Direction.DOWN);
    scene.idle(10);
    scene.overlay.showSelectionWithText(out1, 100).colored(PonderPalette.BLACK).text("Blocks outside of the base plate do not affect scaling");
    scene.overlay.showSelectionWithText(out2, 100).colored(PonderPalette.BLACK).text("configureBasePlate() makes sure of that.");
    scene.markAsFinished();
}
Also used : Selection(com.simibubi.create.foundation.ponder.Selection)

Example 75 with Selection

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

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