Search in sources :

Example 81 with Selection

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

the class FluidTankScenes method storage.

public static void storage(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("fluid_tank_storage", "Storing Fluids in Fluid Tanks");
    scene.configureBasePlate(0, 0, 5);
    scene.showBasePlate();
    scene.idle(5);
    BlockPos tankPos = util.grid.at(3, 1, 2);
    Selection chocolate = util.select.fromTo(1, 5, 0, 0, 8, 1);
    Selection tank = util.select.fromTo(3, 1, 2, 3, 2, 2);
    Selection largeCog1 = util.select.position(3, 0, 5);
    Selection kinetics1 = util.select.fromTo(2, 1, 5, 2, 1, 3).add(util.select.position(2, 2, 4));
    Selection largeCog2 = util.select.position(6, 0, 1);
    Selection comparatorStuff = util.select.fromTo(2, 1, 1, 2, 1, 0);
    Selection pump = util.select.position(1, 1, 3);
    BlockPos pumpPos = util.grid.at(1, 1, 3);
    Selection spoutstuff = util.select.fromTo(3, 1, 0, 5, 3, 2).substract(tank);
    Selection pipe = util.select.fromTo(1, 1, 2, 1, 1, 5).add(util.select.position(1, 0, 5)).add(util.select.position(2, 1, 2));
    ElementLink<WorldSectionElement> tankLink = scene.world.showIndependentSection(tank, Direction.NORTH);
    scene.world.moveSection(tankLink, util.vector.of(0, 0, -1), 0);
    scene.idle(5);
    ElementLink<WorldSectionElement> chocLink = scene.world.showIndependentSection(chocolate, Direction.NORTH);
    scene.world.moveSection(chocLink, util.vector.of(2, -4, 3), 0);
    scene.idle(10);
    scene.overlay.showOutline(PonderPalette.GREEN, chocLink, util.select.fromTo(3, 1, 3, 2, 4, 4), 40);
    scene.idle(10);
    scene.overlay.showLine(PonderPalette.GREEN, util.vector.of(3, 1, 2), util.vector.of(2, 1, 3), 30);
    scene.overlay.showLine(PonderPalette.GREEN, util.vector.of(3, 3, 2), util.vector.of(2, 5, 3), 30);
    scene.overlay.showLine(PonderPalette.GREEN, util.vector.of(4, 3, 2), util.vector.of(4, 5, 3), 30);
    scene.overlay.showOutline(PonderPalette.GREEN, tankLink, util.select.fromTo(3, 1, 1, 3, 2, 1), 40);
    scene.idle(10);
    scene.overlay.showText(40).text("Fluid Tanks can be used to store large amounts of fluid").attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(util.grid.at(3, 2, 1), Direction.WEST));
    scene.idle(50);
    scene.world.hideIndependentSection(chocLink, Direction.DOWN);
    scene.idle(5);
    FluidStack content = new FluidStack(AllFluids.CHOCOLATE.get().getSource(), 16000);
    scene.world.modifyTileEntity(tankPos, FluidTankTileEntity.class, te -> te.getTankInventory().fill(content, FluidAction.EXECUTE));
    scene.idle(25);
    scene.world.moveSection(tankLink, util.vector.of(0, 0, 1), 10);
    scene.idle(5);
    scene.world.setKineticSpeed(pump, 0);
    scene.world.showSection(pipe, Direction.EAST);
    scene.idle(10);
    scene.world.showSection(largeCog1, Direction.UP);
    scene.world.showSection(kinetics1, Direction.WEST);
    scene.idle(10);
    scene.world.setBlock(util.grid.at(1, -1, 5), AllBlocks.FLUID_TANK.getDefaultState(), false);
    scene.world.setKineticSpeed(pump, 128);
    scene.idle(5);
    Selection pumpRedstone = util.select.fromTo(2, 1, 4, 2, 2, 4);
    Selection pumpCogs = util.select.fromTo(2, 1, 3, 1, 1, 3);
    scene.world.toggleRedstonePower(pumpRedstone);
    scene.world.multiplyKineticSpeed(pumpCogs, -1);
    scene.world.propagatePipeChange(pumpPos);
    scene.effects.rotationDirectionIndicator(pumpPos);
    scene.world.modifyTileEntity(util.grid.at(2, 0, 5), FluidTankTileEntity.class, te -> te.getTankInventory().fill(content, FluidAction.EXECUTE));
    scene.idle(20);
    for (int i = 0; i < 4; i++) {
        scene.world.modifyTileEntity(tankPos, FluidTankTileEntity.class, te -> te.getTankInventory().drain(2000, FluidAction.EXECUTE));
        scene.idle(5);
    }
    scene.overlay.showText(60).text("Pipe networks can push and pull fluids from any side").attachKeyFrame().placeNearTarget().pointAt(util.vector.centerOf(1, 1, 2));
    scene.idle(40);
    scene.world.toggleRedstonePower(pumpRedstone);
    scene.world.multiplyKineticSpeed(pumpCogs, -1);
    scene.world.propagatePipeChange(pumpPos);
    scene.effects.rotationDirectionIndicator(pumpPos);
    for (int i = 0; i < 4; i++) {
        scene.world.modifyTileEntity(tankPos, FluidTankTileEntity.class, te -> te.getTankInventory().fill(FluidHelper.copyStackWithAmount(content, 2000), FluidAction.EXECUTE));
        scene.idle(5);
    }
    scene.idle(40);
    scene.world.hideSection(largeCog1, Direction.DOWN);
    scene.world.hideSection(kinetics1, Direction.SOUTH);
    scene.world.hideSection(pipe, Direction.WEST);
    scene.idle(10);
    scene.world.showSection(comparatorStuff, Direction.SOUTH);
    scene.idle(5);
    scene.world.moveSection(tankLink, util.vector.of(-1, 0, 0), 10);
    scene.idle(10);
    scene.world.toggleRedstonePower(comparatorStuff);
    scene.world.modifyTileNBT(util.select.position(2, 1, 0), NixieTubeTileEntity.class, nbt -> nbt.putInt("RedstoneStrength", 15));
    scene.overlay.showText(50).text("The contained fluid can be measured by a Comparator").attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(util.grid.at(2, 1, 1), Direction.DOWN).add(0, 1 / 8f, 0));
    scene.idle(50);
    scene.world.hideSection(comparatorStuff, Direction.EAST);
    scene.idle(20);
    ItemStack bucket = new ItemStack(Items.BUCKET, 1);
    scene.overlay.showControls(new InputWindowElement(util.vector.blockSurface(util.grid.at(2, 2, 2), Direction.NORTH), Pointing.RIGHT).showing(AllIcons.I_MTD_CLOSE).withItem(bucket), 40);
    scene.idle(7);
    scene.overlay.showSelectionWithText(util.select.fromTo(2, 1, 2, 2, 2, 2), 70).text("However, in Survival Mode Fluids cannot be added or taken manually").attachKeyFrame().colored(PonderPalette.RED).placeNearTarget().pointAt(util.vector.blockSurface(util.grid.at(2, 2, 2), Direction.WEST));
    scene.idle(80);
    scene.world.modifyTileEntity(util.grid.at(4, 3, 0), SpoutTileEntity.class, te -> te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY).ifPresent(ifh -> ifh.fill(content, FluidAction.EXECUTE)));
    scene.world.moveSection(tankLink, util.vector.of(0, 0, 1), 7);
    scene.world.multiplyKineticSpeed(spoutstuff, -1);
    scene.world.multiplyKineticSpeed(largeCog2, -1);
    scene.idle(7);
    ElementLink<WorldSectionElement> spoutLink = scene.world.showIndependentSection(spoutstuff, Direction.SOUTH);
    ElementLink<WorldSectionElement> largeCogLink = scene.world.showIndependentSection(largeCog2, Direction.UP);
    scene.world.moveSection(spoutLink, util.vector.of(-1, 0, 1), 0);
    scene.world.moveSection(largeCogLink, util.vector.of(-1, 0, 1), 0);
    scene.idle(20);
    scene.overlay.showOutline(PonderPalette.GREEN, new Object(), util.select.position(2, 1, 1), 50);
    scene.idle(5);
    scene.overlay.showOutline(PonderPalette.GREEN, new Object(), util.select.position(3, 3, 1), 50);
    scene.idle(5);
    scene.overlay.showText(80).text("You can use Basins, Item Drains and Spouts to drain or fill fluid containing items").attachKeyFrame().colored(PonderPalette.GREEN).placeNearTarget().pointAt(util.vector.topOf(2, 1, 1));
    scene.idle(90);
    ItemStack chocBucket = AllFluids.CHOCOLATE.get().getAttributes().getBucket(new FluidStack(FluidHelper.convertToStill(AllFluids.CHOCOLATE.get()), 1000));
    scene.world.createItemOnBeltLike(util.grid.at(3, 1, 0), Direction.WEST, chocBucket);
    scene.idle(40);
    scene.world.modifyTileNBT(util.select.position(util.grid.at(4, 3, 0)), SpoutTileEntity.class, nbt -> nbt.putInt("ProcessingTicks", 20));
    scene.idle(20);
    scene.world.removeItemsFromBelt(util.grid.at(4, 1, 0));
    scene.world.createItemOnBeltLike(util.grid.at(4, 1, 0), Direction.UP, chocBucket);
    for (int i = 0; i < 10; i++) {
        scene.effects.emitParticles(util.vector.topOf(3, 1, 1).add(0, 1 / 16f, 0), Emitter.simple(FluidFX.getFluidParticle(content), VecHelper.offsetRandomly(Vec3.ZERO, Create.RANDOM, .1f)), 1, 1);
    }
}
Also used : AllFluids(com.simibubi.create.AllFluids) VecHelper(com.simibubi.create.foundation.utility.VecHelper) Items(net.minecraft.world.item.Items) SceneBuilder(com.simibubi.create.foundation.ponder.SceneBuilder) NixieTubeTileEntity(com.simibubi.create.content.logistics.block.redstone.NixieTubeTileEntity) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) Direction(net.minecraft.core.Direction) FluidAction(net.minecraftforge.fluids.capability.IFluidHandler.FluidAction) Pointing(com.simibubi.create.foundation.utility.Pointing) AllIcons(com.simibubi.create.foundation.gui.AllIcons) CreativeSmartFluidTank(com.simibubi.create.content.contraptions.fluids.tank.CreativeFluidTankTileEntity.CreativeSmartFluidTank) ElementLink(com.simibubi.create.foundation.ponder.ElementLink) PonderPalette(com.simibubi.create.foundation.ponder.PonderPalette) Create(com.simibubi.create.Create) FluidTankBlock(com.simibubi.create.content.contraptions.fluids.tank.FluidTankBlock) Fluids(net.minecraft.world.level.material.Fluids) AllBlocks(com.simibubi.create.AllBlocks) Selection(com.simibubi.create.foundation.ponder.Selection) CapabilityFluidHandler(net.minecraftforge.fluids.capability.CapabilityFluidHandler) FluidFX(com.simibubi.create.content.contraptions.fluids.FluidFX) Emitter(com.simibubi.create.foundation.ponder.instruction.EmitParticlesInstruction.Emitter) SceneBuildingUtil(com.simibubi.create.foundation.ponder.SceneBuildingUtil) FluidHelper(com.simibubi.create.foundation.fluid.FluidHelper) SpoutTileEntity(com.simibubi.create.content.contraptions.fluids.actors.SpoutTileEntity) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement) BlockPos(net.minecraft.core.BlockPos) Vec3(net.minecraft.world.phys.Vec3) CreativeFluidTankTileEntity(com.simibubi.create.content.contraptions.fluids.tank.CreativeFluidTankTileEntity) FluidStack(net.minecraftforge.fluids.FluidStack) FluidTankTileEntity(com.simibubi.create.content.contraptions.fluids.tank.FluidTankTileEntity) ItemStack(net.minecraft.world.item.ItemStack) Selection(com.simibubi.create.foundation.ponder.Selection) FluidStack(net.minecraftforge.fluids.FluidStack) 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 82 with Selection

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

the class HosePulleyScenes method intro.

public static void intro(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("hose_pulley", "Source Filling and Draining using Hose Pulleys");
    scene.configureBasePlate(0, 0, 3);
    scene.setSceneOffsetY(-1);
    scene.scaleSceneView(.9f);
    scene.showBasePlate();
    scene.idle(5);
    Selection cogs = util.select.fromTo(3, 1, 2, 3, 2, 2);
    Selection pipes = util.select.fromTo(3, 1, 1, 3, 5, 1).add(util.select.position(2, 5, 1));
    BlockPos hosePos = util.grid.at(1, 5, 1);
    Selection hose = util.select.position(1, 5, 1);
    Selection crank = util.select.position(0, 5, 1);
    ElementLink<WorldSectionElement> hoselink = scene.world.showIndependentSection(hose, Direction.UP);
    scene.world.moveSection(hoselink, util.vector.of(0, -1, 0), 0);
    scene.idle(10);
    Vec3 shaftInput = util.vector.blockSurface(hosePos.below(), Direction.WEST);
    scene.overlay.showText(70).text("Hose Pulleys can be used to fill or drain large bodies of Fluid").attachKeyFrame().placeNearTarget().pointAt(util.vector.topOf(hosePos.below()));
    scene.idle(80);
    scene.overlay.showText(80).text("With the Kinetic Input, the height of the pulleys' hose can be controlled").attachKeyFrame().placeNearTarget().pointAt(shaftInput);
    scene.idle(40);
    scene.world.showSectionAndMerge(crank, Direction.EAST, hoselink);
    scene.idle(20);
    Selection kinetics = util.select.fromTo(1, 5, 1, 0, 5, 1);
    scene.world.setKineticSpeed(kinetics, 32);
    scene.idle(50);
    scene.world.setKineticSpeed(kinetics, 0);
    scene.overlay.showText(80).text("The Pulley retracts while the input rotation is inverted").attachKeyFrame().placeNearTarget().pointAt(util.vector.centerOf(hosePos.below(3)));
    scene.idle(30);
    scene.world.setKineticSpeed(kinetics, -32);
    scene.idle(16);
    scene.world.setKineticSpeed(kinetics, 0);
    scene.idle(10);
    scene.rotateCameraY(70);
    scene.idle(40);
    scene.overlay.showText(60).text("On the opposite side, pipes can be connected").attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(hosePos.below(), Direction.EAST));
    scene.idle(70);
    scene.rotateCameraY(-70);
    scene.idle(10);
    scene.world.showSectionAndMerge(cogs, Direction.NORTH, hoselink);
    scene.world.showSectionAndMerge(pipes, Direction.WEST, hoselink);
    scene.world.showSection(util.select.fromTo(0, 1, 0, 2, 2, 2), Direction.UP);
    scene.idle(10);
    scene.overlay.showText(70).text("Attached pipe networks can either provide fluid to the hose...").attachKeyFrame().pointAt(util.vector.centerOf(util.grid.at(3, 1, 1)));
    scene.idle(40);
    List<BlockPos> blocks = new LinkedList<>();
    for (int y = 1; y < 3; y++) {
        blocks.add(util.grid.at(1, y, 1));
        blocks.add(util.grid.at(0, y, 1));
        blocks.add(util.grid.at(1, y, 0));
        blocks.add(util.grid.at(2, y, 1));
        blocks.add(util.grid.at(1, y, 2));
        blocks.add(util.grid.at(0, y, 0));
        blocks.add(util.grid.at(2, y, 0));
        blocks.add(util.grid.at(2, y, 2));
        blocks.add(util.grid.at(0, y, 2));
    }
    for (BlockPos blockPos : blocks) {
        scene.world.setBlock(blockPos, Blocks.WATER.defaultBlockState(), false);
        scene.idle(3);
    }
    scene.world.multiplyKineticSpeed(util.select.fromTo(3, 1, 2, 3, 2, 1), -1);
    scene.world.modifyTileEntity(util.grid.at(1, 5, 1), HosePulleyTileEntity.class, te -> te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY).ifPresent(ifh -> ((HosePulleyFluidHandler) ifh).fill(new FluidStack(Fluids.WATER, 100), FluidAction.EXECUTE)));
    scene.world.propagatePipeChange(util.grid.at(3, 2, 1));
    scene.idle(40);
    scene.world.setKineticSpeed(kinetics, 32);
    scene.idle(16);
    scene.world.setKineticSpeed(kinetics, 0);
    scene.idle(5);
    scene.overlay.showText(70).text("...or pull from it, draining the pool instead").attachKeyFrame().pointAt(util.vector.centerOf(util.grid.at(3, 1, 1)));
    scene.idle(40);
    Collections.reverse(blocks);
    for (BlockPos blockPos : blocks) {
        scene.world.destroyBlock(blockPos);
        scene.idle(3);
    }
    scene.idle(20);
    scene.overlay.showText(120).text("Fill and Drain speed of the pulley depends entirely on the fluid networks' throughput").placeNearTarget().colored(PonderPalette.MEDIUM).attachKeyFrame().pointAt(util.vector.centerOf(util.grid.at(3, 1, 1)));
    scene.idle(40);
}
Also used : HosePulleyFluidHandler(com.simibubi.create.content.contraptions.fluids.actors.HosePulleyFluidHandler) Selection(com.simibubi.create.foundation.ponder.Selection) AABB(net.minecraft.world.phys.AABB) SceneBuilder(com.simibubi.create.foundation.ponder.SceneBuilder) CapabilityFluidHandler(net.minecraftforge.fluids.capability.CapabilityFluidHandler) Direction(net.minecraft.core.Direction) FluidAction(net.minecraftforge.fluids.capability.IFluidHandler.FluidAction) SceneBuildingUtil(com.simibubi.create.foundation.ponder.SceneBuildingUtil) Blocks(net.minecraft.world.level.block.Blocks) List(java.util.List) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement) ElementLink(com.simibubi.create.foundation.ponder.ElementLink) PonderPalette(com.simibubi.create.foundation.ponder.PonderPalette) BlockPos(net.minecraft.core.BlockPos) Vec3(net.minecraft.world.phys.Vec3) HosePulleyTileEntity(com.simibubi.create.content.contraptions.fluids.actors.HosePulleyTileEntity) FluidStack(net.minecraftforge.fluids.FluidStack) Fluids(net.minecraft.world.level.material.Fluids) LinkedList(java.util.LinkedList) Collections(java.util.Collections) HosePulleyFluidHandler(com.simibubi.create.content.contraptions.fluids.actors.HosePulleyFluidHandler) Selection(com.simibubi.create.foundation.ponder.Selection) FluidStack(net.minecraftforge.fluids.FluidStack) Vec3(net.minecraft.world.phys.Vec3) BlockPos(net.minecraft.core.BlockPos) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement) LinkedList(java.util.LinkedList)

Example 83 with Selection

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

the class ChainDriveScenes method chainDriveAsRelay.

public static void chainDriveAsRelay(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("chain_drive", "Relaying rotational force with Chain Drives");
    scene.configureBasePlate(0, 0, 5);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    BlockPos gaugePos = util.grid.at(0, 1, 3);
    Selection gauge = util.select.position(gaugePos);
    scene.world.showSection(gauge, Direction.UP);
    scene.world.setKineticSpeed(gauge, 0);
    scene.idle(5);
    scene.world.showSection(util.select.fromTo(5, 1, 2, 4, 1, 2), Direction.DOWN);
    scene.idle(10);
    for (int i = 0; i < 3; i++) {
        scene.idle(5);
        scene.world.showSection(util.select.position(3, 1, 2 - i), Direction.DOWN);
        if (i != 0)
            scene.world.showSection(util.select.position(3, 1, 2 + i), Direction.DOWN);
    }
    scene.idle(10);
    scene.world.showSection(util.select.position(gaugePos.east(2)), Direction.DOWN);
    scene.idle(5);
    scene.world.showSection(util.select.position(gaugePos.east()), Direction.DOWN);
    scene.idle(5);
    scene.world.setKineticSpeed(gauge, 64);
    scene.effects.indicateSuccess(gaugePos);
    scene.idle(20);
    scene.overlay.showText(60).text("Chain Drives relay rotation to each other in a row").attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(util.grid.at(3, 1, 4), Direction.WEST));
    scene.idle(60);
    Selection shafts = util.select.fromTo(2, 1, 0, 2, 1, 1);
    BlockPos rotatedECD = util.grid.at(3, 1, 0);
    Selection verticalShaft = util.select.fromTo(rotatedECD.above(), rotatedECD.above(2));
    scene.world.showSection(shafts, Direction.EAST);
    scene.idle(10);
    scene.effects.rotationDirectionIndicator(util.grid.at(2, 1, 0));
    scene.effects.rotationDirectionIndicator(util.grid.at(2, 1, 1));
    scene.idle(20);
    scene.overlay.showText(60).text("All shafts connected like this will rotate in the same direction").attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(util.grid.at(2, 1, 1), Direction.WEST));
    scene.idle(50);
    scene.world.hideSection(shafts, Direction.WEST);
    scene.idle(25);
    scene.addKeyframe();
    scene.overlay.showControls(new InputWindowElement(util.vector.topOf(rotatedECD), Pointing.DOWN).rightClick().withWrench(), 30);
    scene.idle(7);
    scene.world.modifyBlock(rotatedECD, s -> s.setValue(EncasedBeltBlock.AXIS, Axis.Y), true);
    scene.idle(40);
    scene.world.showSection(verticalShaft, Direction.DOWN);
    scene.idle(10);
    scene.effects.rotationDirectionIndicator(util.grid.at(3, 3, 0));
    scene.idle(10);
    scene.overlay.showText(60).text("Any part of the row can be rotated by 90 degrees").placeNearTarget().pointAt(util.vector.centerOf(3, 2, 0));
    scene.markAsFinished();
}
Also used : Selection(com.simibubi.create.foundation.ponder.Selection) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) BlockPos(net.minecraft.core.BlockPos)

Example 84 with Selection

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

the class ChainDriveScenes method adjustableChainGearshift.

public static void adjustableChainGearshift(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("chain_gearshift", "Controlling rotational speed with Chain Gearshifts");
    scene.configureBasePlate(0, 0, 5);
    scene.setSceneOffsetY(-1);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    BlockPos leverPos = util.grid.at(3, 1, 0);
    BlockPos eastDrive = util.grid.at(3, 1, 2);
    BlockPos eastGauge = eastDrive.above(3);
    BlockPos middleGauge = eastGauge.west().below();
    BlockPos westGauge = eastGauge.west(2).below(2);
    ElementLink<WorldSectionElement> lever = scene.world.showIndependentSection(util.select.fromTo(leverPos, leverPos.south()), Direction.UP);
    scene.idle(5);
    scene.world.showSection(util.select.fromTo(4, 1, 3, 4, 2, 3), Direction.DOWN);
    scene.idle(10);
    scene.world.showSection(util.select.fromTo(eastDrive, eastDrive.west(2)).add(util.select.position(eastDrive.above())), Direction.DOWN);
    scene.idle(10);
    scene.overlay.showText(60).text("Unpowered Chain Gearshifts behave exactly like Chain Drives").attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(eastDrive, Direction.NORTH));
    scene.idle(60);
    scene.world.showSection(util.select.fromTo(eastGauge, eastGauge.below()), Direction.DOWN);
    scene.idle(5);
    scene.world.showSection(util.select.fromTo(middleGauge, middleGauge.below()), Direction.DOWN);
    scene.idle(5);
    scene.world.showSection(util.select.position(westGauge), Direction.DOWN);
    scene.idle(5);
    for (BlockPos gauge : new BlockPos[] { eastGauge, middleGauge, westGauge }) {
        scene.idle(5);
        scene.overlay.showText(50).sharedText(gauge == eastGauge ? "rpm16_source" : "rpm16").colored(PonderPalette.MEDIUM).placeNearTarget().pointAt(util.vector.blockSurface(gauge, Direction.NORTH));
    }
    scene.idle(60);
    scene.world.toggleRedstonePower(util.select.fromTo(leverPos, leverPos.south(2)));
    scene.effects.indicateRedstone(leverPos);
    scene.world.modifyKineticSpeed(util.select.fromTo(westGauge.below(), middleGauge), f -> 2 * f);
    scene.idle(10);
    AABB bb = new AABB(eastDrive);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.MEDIUM, eastDrive, bb, 160);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.FAST, eastDrive.west(), bb.move(-2, 0, 0).expandTowards(15 / 16f, 0, 0), 160);
    scene.idle(20);
    scene.overlay.showText(80).text("When Powered, the speed transmitted to other Chain Drives in the row is doubled").attachKeyFrame().placeNearTarget().colored(PonderPalette.FAST).pointAt(util.vector.blockSurface(eastDrive.west(2), Direction.WEST));
    scene.idle(80);
    for (BlockPos gauge : new BlockPos[] { eastGauge, middleGauge, westGauge }) {
        scene.idle(5);
        scene.overlay.showText(70).sharedText(gauge == eastGauge ? "rpm16_source" : "rpm32").colored(gauge == eastGauge ? PonderPalette.MEDIUM : PonderPalette.FAST).placeNearTarget().pointAt(util.vector.blockSurface(gauge, Direction.NORTH));
    }
    scene.idle(80);
    scene.world.hideSection(util.select.fromTo(eastDrive, eastDrive.west(2)), Direction.SOUTH);
    scene.idle(15);
    scene.world.toggleRedstonePower(util.select.fromTo(leverPos, leverPos.south(2)));
    Selection newDriveSelect = util.select.fromTo(eastDrive.south(2), eastDrive.south(2).west(2));
    ElementLink<WorldSectionElement> drives = scene.world.showIndependentSection(newDriveSelect, Direction.NORTH);
    scene.world.modifyKineticSpeed(util.select.fromTo(westGauge.below(), middleGauge), f -> .5f * f);
    scene.world.setKineticSpeed(newDriveSelect, -32);
    scene.world.moveSection(drives, util.vector.of(0, 0, -2), 0);
    scene.world.moveSection(lever, util.vector.of(-2, 0, 0), 10);
    scene.idle(40);
    scene.world.toggleRedstonePower(util.select.fromTo(leverPos, leverPos.south(1)));
    scene.world.toggleRedstonePower(util.select.position(1, 1, 4));
    BlockPos analogPos = leverPos.west(2);
    scene.effects.indicateRedstone(analogPos);
    scene.world.modifyKineticSpeed(util.select.position(westGauge), f -> .5f * f);
    scene.idle(10);
    bb = new AABB(eastDrive);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.MEDIUM, eastDrive, bb.expandTowards(-15 / 16f, 0, 0), 160);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.SLOW, eastDrive.west(), bb.move(-2, 0, 0), 160);
    scene.idle(20);
    scene.overlay.showText(80).text("Whenever the Powered Gearshift is not at the source, its speed will be halved instead").attachKeyFrame().placeNearTarget().colored(PonderPalette.SLOW).pointAt(util.vector.blockSurface(eastDrive.west(2), Direction.WEST));
    scene.idle(80);
    for (BlockPos gauge : new BlockPos[] { eastGauge, middleGauge, westGauge }) {
        scene.idle(5);
        scene.overlay.showText(180).sharedText(gauge == westGauge ? "rpm8" : gauge == eastGauge ? "rpm16_source" : "rpm16").colored(gauge == westGauge ? PonderPalette.SLOW : PonderPalette.MEDIUM).placeNearTarget().pointAt(util.vector.blockSurface(gauge, Direction.NORTH));
    }
    scene.idle(80);
    scene.overlay.showText(100).text("In both cases, Chain Drives in the row always run at 2x the speed of the Powered Gearshift").attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(eastDrive.west(2), Direction.WEST));
    scene.idle(100);
    scene.world.toggleRedstonePower(util.select.fromTo(leverPos, leverPos.south(2)));
    scene.world.toggleRedstonePower(util.select.position(1, 1, 4));
    scene.world.modifyKineticSpeed(util.select.position(westGauge), f -> 2f * f);
    scene.world.hideIndependentSection(lever, Direction.UP);
    scene.idle(15);
    scene.world.showSection(util.select.fromTo(analogPos, analogPos.south()), Direction.DOWN);
    scene.idle(15);
    scene.world.modifyTileNBT(util.select.position(analogPos), AnalogLeverTileEntity.class, nbt -> {
        nbt.putInt("State", 8);
    });
    scene.world.modifyBlock(analogPos.south(), s -> s.setValue(RedStoneWireBlock.POWER, 8), false);
    scene.world.toggleRedstonePower(util.select.position(1, 1, 4));
    scene.world.modifyKineticSpeed(util.select.position(westGauge), f -> .75f * f);
    scene.effects.indicateRedstone(analogPos);
    scene.idle(20);
    scene.overlay.showText(100).text("Using analog signals, the ratio can be adjusted more precisely between 1 and 2").attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(eastDrive.west(2), Direction.WEST));
    scene.idle(40);
    for (BlockPos gauge : new BlockPos[] { eastGauge, middleGauge, westGauge }) {
        scene.idle(5);
        Builder builder = scene.overlay.showText(180).colored(gauge == westGauge ? PonderPalette.SLOW : PonderPalette.MEDIUM).placeNearTarget().pointAt(util.vector.blockSurface(gauge, Direction.NORTH));
        if (gauge == westGauge)
            builder.text("12 RPM");
        else
            builder.sharedText(gauge == eastGauge ? "rpm16_source" : "rpm16");
    }
}
Also used : Selection(com.simibubi.create.foundation.ponder.Selection) SceneBuilder(com.simibubi.create.foundation.ponder.SceneBuilder) Builder(com.simibubi.create.foundation.ponder.element.TextWindowElement.Builder) BlockPos(net.minecraft.core.BlockPos) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement) AABB(net.minecraft.world.phys.AABB)

Example 85 with Selection

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

the class ChuteScenes method smart.

public static void smart(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("smart_chute", "Filtering Items using Smart Chutes");
    scene.configureBasePlate(0, 0, 5);
    scene.scaleSceneView(.9f);
    Selection lever = util.select.fromTo(0, 1, 2, 1, 3, 2);
    BlockPos smarty = util.grid.at(2, 3, 2);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    scene.idle(5);
    scene.world.showSection(util.select.fromTo(2, 1, 2, 2, 2, 2), Direction.DOWN);
    scene.idle(10);
    scene.world.showSection(util.select.position(2, 3, 2), Direction.DOWN);
    scene.idle(5);
    scene.world.showSection(util.select.position(2, 4, 2), Direction.DOWN);
    scene.overlay.showText(60).text("Smart Chutes are vertical chutes with additional control").attachKeyFrame().pointAt(util.vector.blockSurface(smarty, Direction.WEST)).placeNearTarget();
    scene.idle(70);
    Vec3 filter = util.vector.blockSurface(smarty, Direction.NORTH).add(0, 0.25, 0);
    scene.overlay.showFilterSlotInput(filter, 60);
    ItemStack copper = new ItemStack(Items.IRON_INGOT);
    scene.overlay.showControls(new InputWindowElement(filter, Pointing.DOWN).rightClick().withItem(copper), 40);
    scene.idle(7);
    scene.world.setFilterData(util.select.position(smarty), SmartChuteTileEntity.class, copper);
    scene.idle(10);
    scene.rotateCameraY(20);
    scene.overlay.showText(60).text("Items in the filter slot specify what exactly they can extract and transfer").attachKeyFrame().pointAt(filter).placeNearTarget();
    scene.idle(10);
    for (int i = 0; i < 18; i++) {
        scene.idle(10);
        scene.world.createItemOnBeltLike(util.grid.at(2, 2, 2), Direction.UP, copper);
        if (i == 8) {
            scene.rotateCameraY(-20);
            scene.overlay.showControls(new InputWindowElement(filter, Pointing.DOWN).scroll(), 40);
            scene.overlay.showText(50).text("Use the Mouse Wheel to specify the extracted stack size").attachKeyFrame().pointAt(filter).placeNearTarget();
        }
        if (i == 13)
            scene.world.showSection(lever, Direction.NORTH);
    }
    scene.world.toggleRedstonePower(lever.add(util.select.position(smarty)));
    scene.effects.indicateRedstone(util.grid.at(0, 3, 2));
    scene.overlay.showText(50).text("Redstone power will prevent Smart Chutes from acting.").attachKeyFrame().colored(PonderPalette.RED).pointAt(util.vector.blockSurface(util.grid.at(0, 2, 2), Direction.UP)).placeNearTarget();
    scene.idle(70);
    scene.world.toggleRedstonePower(lever.add(util.select.position(smarty)));
    scene.markAsFinished();
    for (int i = 0; i < 8; i++) {
        scene.idle(10);
        scene.world.createItemOnBeltLike(util.grid.at(2, 2, 2), Direction.UP, copper);
    }
}
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)

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