Search in sources :

Example 46 with Selection

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

the class HosePulleyScenes method level.

public static void level(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("hose_pulley_level", "Fill and Drain level of Hose Pulleys");
    scene.configureBasePlate(0, 0, 3);
    scene.setSceneOffsetY(-1.5f);
    scene.scaleSceneView(.9f);
    scene.showBasePlate();
    List<BlockPos> blocks = new LinkedList<>();
    for (int y = 1; y < 4; 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(5);
    Selection water = util.select.fromTo(2, 1, 0, 0, 4, 2);
    scene.world.showSection(water, Direction.UP);
    scene.idle(10);
    Selection cogs = util.select.fromTo(3, 1, 2, 3, 2, 2);
    Selection pipes = util.select.fromTo(3, 1, 1, 3, 6, 1).add(util.select.position(2, 6, 1));
    BlockPos hosePos = util.grid.at(1, 6, 1);
    Selection hose = util.select.position(1, 6, 1);
    Selection crank = util.select.position(0, 6, 1);
    ElementLink<WorldSectionElement> hoselink = scene.world.showIndependentSection(hose, Direction.DOWN);
    scene.world.moveSection(hoselink, util.vector.of(0, -1, 0), 0);
    scene.idle(10);
    scene.world.showSectionAndMerge(crank, Direction.EAST, hoselink);
    scene.idle(20);
    scene.overlay.showSelectionWithText(util.select.position(hosePos.below()), 50).text("While fully retracted, the Hose Pulley cannot operate").placeNearTarget().colored(PonderPalette.RED).attachKeyFrame().pointAt(util.vector.blockSurface(hosePos.below(), Direction.UP));
    scene.idle(55);
    Selection kinetics = util.select.fromTo(1, 6, 1, 0, 6, 1);
    scene.world.setKineticSpeed(kinetics, 32);
    scene.idle(50);
    scene.world.setKineticSpeed(kinetics, 0);
    scene.overlay.showText(40).text("Draining runs from top to bottom").attachKeyFrame().placeNearTarget().pointAt(util.vector.centerOf(hosePos.below(3)));
    scene.idle(10);
    scene.world.showSectionAndMerge(cogs, Direction.NORTH, hoselink);
    scene.world.showSectionAndMerge(pipes, Direction.WEST, hoselink);
    scene.world.multiplyKineticSpeed(util.select.fromTo(3, 1, 2, 3, 2, 1), -1);
    scene.world.modifyTileEntity(util.grid.at(1, 6, 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));
    Vec3 surface = util.vector.topOf(1, 3, 1).subtract(0, 2 / 8f, 0);
    AABB bb = new AABB(surface, surface).inflate(1.5, 0, 1.5);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.MEDIUM, bb, bb, 3);
    scene.idle(3);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.MEDIUM, bb, bb.expandTowards(0, -2, 0), 70);
    scene.idle(20);
    Collections.reverse(blocks);
    int i = 0;
    for (BlockPos blockPos : blocks) {
        if (i++ == 18)
            break;
        scene.world.destroyBlock(blockPos);
        scene.idle(3);
    }
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.WHITE, bb, bb.move(0, -2, 0), 60);
    scene.overlay.showText(60).text("The surface level will end up just below where the hose ends").attachKeyFrame().placeNearTarget().pointAt(util.vector.of(0, 2 - 1 / 8f, 1.5f));
    scene.idle(30);
    scene.idle(10);
    scene.world.multiplyKineticSpeed(util.select.fromTo(3, 1, 2, 3, 2, 1), -1);
    scene.world.propagatePipeChange(util.grid.at(3, 2, 1));
    scene.idle(30);
    scene.world.hideSection(water, Direction.SOUTH);
    scene.idle(15);
    for (BlockPos blockPos : blocks) scene.world.destroyBlock(blockPos);
    scene.world.showSection(water, Direction.UP);
    scene.idle(15);
    scene.world.setKineticSpeed(kinetics, -32);
    scene.idle(16);
    scene.world.setKineticSpeed(kinetics, 0);
    scene.overlay.showText(40).text("Filling runs from bottom to top").attachKeyFrame().placeNearTarget().pointAt(util.vector.centerOf(hosePos.below(3)));
    scene.idle(10);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.MEDIUM, bb, bb.move(0, -3 + 2 / 8f, 0), 3);
    scene.idle(3);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.MEDIUM, bb, bb.expandTowards(0, -3 + 2 / 8f, 0), 120);
    scene.idle(20);
    scene.world.setBlock(util.grid.at(1, 3, 1), Blocks.WATER.defaultBlockState(), false);
    scene.idle(3);
    scene.world.setBlock(util.grid.at(1, 2, 1), Blocks.WATER.defaultBlockState(), false);
    scene.idle(3);
    Collections.reverse(blocks);
    for (BlockPos blockPos : blocks) {
        scene.world.setBlock(blockPos, Blocks.WATER.defaultBlockState(), false);
        scene.idle(3);
    }
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.WHITE, bb, bb, 100);
    scene.overlay.showText(100).text("The filled pool will not grow beyond the layer above the hose end").attachKeyFrame().placeNearTarget().pointAt(util.vector.of(0, 4 - 1 / 8f, 1.5f));
    scene.idle(80);
}
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) AABB(net.minecraft.world.phys.AABB)

Example 47 with Selection

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

the class PipeScenes method interaction.

public static void interaction(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("fluid_pipe_interaction", "Draining and Filling fluid containers");
    scene.configureBasePlate(0, 1, 5);
    scene.showBasePlate();
    scene.idle(5);
    BlockPos pumpPos = util.grid.at(2, 1, 4);
    Selection largeCog = util.select.position(5, 0, 4);
    Selection kinetics = util.select.fromTo(5, 1, 5, 2, 1, 5);
    Selection pipes = util.select.fromTo(1, 1, 4, 3, 1, 3).add(util.select.position(3, 1, 2));
    Selection tank = util.select.fromTo(4, 1, 3, 4, 2, 3);
    Selection drain = util.select.position(1, 1, 2);
    Selection basin = util.select.position(3, 1, 1);
    Selection waterSourceS = util.select.position(1, 1, 1);
    Selection waterTargetS = util.select.position(4, 1, 1);
    Selection waterTarget2S = util.select.fromTo(4, 0, 0, 4, 1, 0);
    scene.world.setKineticSpeed(util.select.position(pumpPos), 0);
    scene.world.showSection(pipes, Direction.DOWN);
    scene.idle(10);
    scene.world.showSection(basin, Direction.SOUTH);
    scene.idle(5);
    scene.world.showSection(drain, Direction.SOUTH);
    scene.idle(5);
    scene.world.showSection(tank, Direction.WEST);
    scene.overlay.showText(60).text("Endpoints of a pipe network can interact with a variety of blocks").attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(util.grid.at(1, 1, 3), Direction.NORTH));
    scene.idle(60);
    scene.world.showSection(largeCog, Direction.UP);
    scene.idle(5);
    scene.world.showSection(kinetics, Direction.NORTH);
    scene.idle(10);
    scene.world.setKineticSpeed(util.select.position(pumpPos), 64);
    BlockPos drainPos = util.grid.at(1, 1, 2);
    scene.world.modifyTileEntity(drainPos, ItemDrainTileEntity.class, te -> te.getBehaviour(SmartFluidTankBehaviour.TYPE).allowInsertion().getPrimaryHandler().fill(new FluidStack(Fluids.WATER, 1500), FluidAction.EXECUTE));
    scene.idle(50);
    scene.overlay.showOutline(PonderPalette.MEDIUM, new Object(), drain, 40);
    scene.idle(5);
    scene.overlay.showOutline(PonderPalette.MEDIUM, new Object(), tank, 40);
    scene.idle(5);
    scene.overlay.showOutline(PonderPalette.MEDIUM, new Object(), basin, 40);
    scene.idle(5);
    scene.overlay.showText(60).text("Any block with fluid storage capabilities can be filled or drained").attachKeyFrame().colored(PonderPalette.MEDIUM).placeNearTarget().pointAt(util.vector.blockSurface(drainPos, Direction.UP));
    scene.idle(100);
    scene.world.hideSection(drain, Direction.NORTH);
    scene.idle(5);
    scene.world.hideSection(tank, Direction.EAST);
    scene.idle(5);
    scene.world.setBlock(drainPos, Blocks.AIR.defaultBlockState(), false);
    scene.world.propagatePipeChange(pumpPos);
    scene.world.hideSection(basin, Direction.NORTH);
    scene.idle(5);
    scene.world.setBlock(util.grid.at(3, 1, 1), Blocks.AIR.defaultBlockState(), false);
    scene.idle(5);
    scene.world.setBlock(util.grid.at(3, 1, 3), AllBlocks.GLASS_FLUID_PIPE.getDefaultState().setValue(AxisPipeBlock.AXIS, Axis.Z), false);
    scene.idle(10);
    scene.world.multiplyKineticSpeed(util.select.everywhere(), 2);
    scene.world.propagatePipeChange(pumpPos);
    ElementLink<WorldSectionElement> water = scene.world.showIndependentSection(waterSourceS, Direction.DOWN);
    scene.world.moveSection(water, util.vector.of(0, 0, 1), 0);
    scene.idle(10);
    scene.world.setBlock(drainPos, Blocks.WATER.defaultBlockState(), false);
    scene.idle(20);
    scene.overlay.showText(60).text("Source blocks right in front of an open end can be picked up...").attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(drainPos, Direction.SOUTH));
    scene.idle(40);
    scene.world.setBlock(drainPos.north(), Blocks.AIR.defaultBlockState(), false);
    scene.idle(40);
    ElementLink<WorldSectionElement> target = scene.world.showIndependentSection(waterTargetS, Direction.UP);
    scene.world.moveSection(target, util.vector.of(-1, 0, 0), 0);
    scene.idle(5);
    scene.world.showSectionAndMerge(waterTarget2S, Direction.UP, target);
    scene.overlay.showText(60).text("...while spilling into empty spaces can create fluid sources").attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(util.grid.at(3, 1, 2), Direction.NORTH));
    scene.idle(80);
    scene.world.hideIndependentSection(target, Direction.DOWN);
    scene.idle(5);
    scene.world.setBlock(drainPos, Blocks.BEE_NEST.defaultBlockState().setValue(BeehiveBlock.HONEY_LEVEL, 5), false);
    scene.world.showSection(drain, Direction.DOWN);
    scene.world.setBlock(util.grid.at(3, 1, 2), AllBlocks.FLUID_TANK.getDefaultState(), false);
    scene.world.propagatePipeChange(pumpPos);
    scene.idle(15);
    scene.overlay.showText(60).text("Pipes can also extract fluids from a handful of other blocks directly").attachKeyFrame().placeNearTarget().pointAt(util.vector.topOf(drainPos));
    scene.idle(60);
    scene.world.setBlock(drainPos, Blocks.BEE_NEST.defaultBlockState().setValue(BeehiveBlock.HONEY_LEVEL, 0), false);
}
Also used : Selection(com.simibubi.create.foundation.ponder.Selection) FluidStack(net.minecraftforge.fluids.FluidStack) BlockPos(net.minecraft.core.BlockPos) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement)

Example 48 with Selection

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

the class PipeScenes method smart.

public static void smart(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("smart_pipe", "Controlling Fluid flow using Smart Pipes");
    scene.configureBasePlate(1, 0, 5);
    scene.showBasePlate();
    scene.idle(5);
    Selection tank1 = util.select.fromTo(4, 1, 3, 4, 2, 3);
    Selection tank2 = util.select.fromTo(4, 1, 4, 4, 2, 4);
    Selection additionalPipes = util.select.fromTo(3, 1, 4, 1, 1, 4);
    Selection mainPipes = util.select.fromTo(3, 1, 3, 1, 1, 1);
    Selection kinetics1 = util.select.fromTo(0, 0, 2, 0, 0, 5);
    Selection kinetics2 = util.select.position(1, 0, 5);
    BlockPos basinPos = util.grid.at(4, 1, 1);
    BlockPos pumpPos = util.grid.at(1, 1, 2);
    Selection pump = util.select.position(1, 1, 2);
    Selection basin = util.select.position(basinPos);
    BlockPos smartPos = util.grid.at(3, 1, 1);
    scene.world.modifyTileEntity(basinPos, BasinTileEntity.class, te -> te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY).ifPresent(ifh -> ifh.fill(new FluidStack(ForgeMod.MILK.get(), 1000), FluidAction.EXECUTE)));
    scene.world.setBlock(util.grid.at(3, 1, 3), AllBlocks.FLUID_PIPE.get().getAxisState(Axis.X), false);
    scene.world.setBlock(smartPos, AllBlocks.FLUID_PIPE.get().getAxisState(Axis.X), false);
    scene.world.setBlock(util.grid.at(2, 1, 3), AllBlocks.GLASS_FLUID_PIPE.getDefaultState().setValue(GlassFluidPipeBlock.AXIS, Axis.X), false);
    scene.world.setBlock(util.grid.at(1, 1, 3), AllBlocks.FLUID_PIPE.get().getAxisState(Axis.X).setValue(FluidPipeBlock.NORTH, true).setValue(FluidPipeBlock.WEST, false), false);
    scene.world.showSection(basin, Direction.DOWN);
    scene.idle(5);
    scene.world.showSection(tank1, Direction.DOWN);
    scene.idle(5);
    scene.world.showSection(mainPipes, Direction.EAST);
    scene.idle(15);
    scene.world.destroyBlock(smartPos);
    scene.world.restoreBlocks(util.select.position(smartPos));
    Vec3 filterVec = util.vector.topOf(smartPos).subtract(0.25, 0, 0);
    scene.overlay.showText(50).placeNearTarget().text("Smart pipes can help control flows by fluid type").attachKeyFrame().pointAt(filterVec);
    scene.idle(60);
    scene.overlay.showSelectionWithText(util.select.position(basinPos), 80).placeNearTarget().colored(PonderPalette.GREEN).text("When placed directly at the source, they can specify the type of fluid to extract").attachKeyFrame().pointAt(filterVec);
    scene.idle(90);
    FluidStack chocolate = new FluidStack(FluidHelper.convertToStill(AllFluids.CHOCOLATE.get()), 1000);
    ItemStack bucket = AllFluids.CHOCOLATE.get().getAttributes().getBucket(chocolate);
    ItemStack milkBucket = new ItemStack(Items.MILK_BUCKET);
    scene.overlay.showControls(new InputWindowElement(filterVec, Pointing.DOWN).rightClick().withItem(bucket), 80);
    scene.idle(7);
    scene.world.setFilterData(util.select.position(3, 1, 1), SmartFluidPipeTileEntity.class, bucket);
    scene.idle(10);
    scene.overlay.showText(60).placeNearTarget().attachKeyFrame().text("Simply Right-Click their filter slot with any item containing the desired fluid").pointAt(filterVec);
    scene.idle(50);
    scene.world.showSection(kinetics2, Direction.WEST);
    scene.world.setKineticSpeed(kinetics2, 64);
    scene.idle(5);
    scene.world.showSection(kinetics1, Direction.EAST);
    scene.world.setKineticSpeed(kinetics1, -64);
    scene.idle(10);
    scene.world.setKineticSpeed(pump, 128);
    scene.world.propagatePipeChange(pumpPos);
    scene.idle(120);
    scene.world.setKineticSpeed(util.select.everywhere(), 0);
    scene.world.propagatePipeChange(pumpPos);
    scene.effects.rotationSpeedIndicator(pumpPos);
    scene.idle(15);
    scene.world.showSection(tank2, Direction.DOWN);
    scene.world.showSection(additionalPipes, Direction.NORTH);
    scene.world.setBlock(util.grid.at(3, 1, 1), AllBlocks.FLUID_PIPE.get().getAxisState(Axis.X), true);
    scene.idle(10);
    for (int i = 0; i < 3; i++) {
        BlockPos pos = util.grid.at(1 + i, 1, 3);
        scene.world.destroyBlock(pos);
        scene.world.restoreBlocks(util.select.position(pos));
        scene.idle(2);
    }
    scene.idle(15);
    scene.world.modifyTileEntity(basinPos, BasinTileEntity.class, te -> te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY).ifPresent(ifh -> ifh.fill(chocolate, FluidAction.EXECUTE)));
    scene.idle(10);
    scene.overlay.showText(80).placeNearTarget().colored(PonderPalette.GREEN).text("When placed further down a pipe network, smart pipes will only let matching fluids continue").attachKeyFrame().pointAt(filterVec.add(-1, 0, 2));
    scene.idle(90);
    scene.overlay.showControls(new InputWindowElement(filterVec.add(-1, 0, 3), Pointing.DOWN).rightClick().withItem(milkBucket), 30);
    scene.idle(7);
    scene.world.setFilterData(util.select.position(2, 1, 4), SmartFluidPipeTileEntity.class, milkBucket);
    scene.idle(30);
    scene.overlay.showControls(new InputWindowElement(filterVec.add(-1, 0, 2), Pointing.DOWN).rightClick().withItem(bucket), 30);
    scene.idle(7);
    scene.world.setFilterData(util.select.position(2, 1, 3), SmartFluidPipeTileEntity.class, bucket);
    scene.idle(30);
    scene.world.setKineticSpeed(kinetics2, 64);
    scene.world.setKineticSpeed(kinetics1, -64);
    scene.world.setKineticSpeed(pump, 128);
    scene.world.propagatePipeChange(pumpPos);
    scene.effects.rotationSpeedIndicator(pumpPos);
    scene.idle(40);
}
Also used : SmartFluidTankBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.fluid.SmartFluidTankBehaviour) AllFluids(com.simibubi.create.AllFluids) FluidValveBlock(com.simibubi.create.content.contraptions.fluids.pipes.FluidValveBlock) GlassFluidPipeBlock(com.simibubi.create.content.contraptions.fluids.pipes.GlassFluidPipeBlock) Items(net.minecraft.world.item.Items) AABB(net.minecraft.world.phys.AABB) SceneBuilder(com.simibubi.create.foundation.ponder.SceneBuilder) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) Direction(net.minecraft.core.Direction) FluidAction(net.minecraftforge.fluids.capability.IFluidHandler.FluidAction) ForgeMod(net.minecraftforge.common.ForgeMod) BasinTileEntity(com.simibubi.create.content.contraptions.processing.BasinTileEntity) Pointing(com.simibubi.create.foundation.utility.Pointing) BlockState(net.minecraft.world.level.block.state.BlockState) BeehiveBlock(net.minecraft.world.level.block.BeehiveBlock) Axis(net.minecraft.core.Direction.Axis) BooleanProperty(net.minecraft.world.level.block.state.properties.BooleanProperty) ElementLink(com.simibubi.create.foundation.ponder.ElementLink) PonderPalette(com.simibubi.create.foundation.ponder.PonderPalette) PumpBlock(com.simibubi.create.content.contraptions.fluids.PumpBlock) FluidPipeBlock(com.simibubi.create.content.contraptions.fluids.pipes.FluidPipeBlock) 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) SmartFluidPipeTileEntity(com.simibubi.create.content.contraptions.fluids.pipes.SmartFluidPipeTileEntity) SceneBuildingUtil(com.simibubi.create.foundation.ponder.SceneBuildingUtil) FluidHelper(com.simibubi.create.foundation.fluid.FluidHelper) ItemDrainTileEntity(com.simibubi.create.content.contraptions.fluids.actors.ItemDrainTileEntity) Blocks(net.minecraft.world.level.block.Blocks) AxisPipeBlock(com.simibubi.create.content.contraptions.fluids.pipes.AxisPipeBlock) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement) BlockPos(net.minecraft.core.BlockPos) Vec3(net.minecraft.world.phys.Vec3) FluidValveTileEntity(com.simibubi.create.content.contraptions.fluids.pipes.FluidValveTileEntity) 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) 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)

Example 49 with Selection

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

the class PumpScenes method flow.

public static void flow(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("mechanical_pump_flow", "Fluid Transportation using Mechanical Pumps");
    scene.configureBasePlate(0, 0, 5);
    scene.showBasePlate();
    scene.world.multiplyKineticSpeed(util.select.everywhere(), -1);
    scene.idle(5);
    BlockPos pumpPos = util.grid.at(2, 1, 1);
    Selection tank1 = util.select.fromTo(0, 2, 3, 0, 1, 3);
    Selection tank2 = util.select.fromTo(4, 2, 3, 4, 1, 3);
    Selection pipes = util.select.fromTo(3, 1, 3, 1, 1, 1);
    Selection largeCog = util.select.position(5, 0, 1);
    Selection kinetics = util.select.fromTo(5, 1, 0, 2, 1, 0);
    BlockPos leverPos = util.grid.at(4, 2, 0);
    Selection pump = util.select.position(pumpPos);
    scene.world.setBlock(pumpPos, AllBlocks.FLUID_PIPE.get().getAxisState(Axis.X), false);
    scene.world.showSection(tank1, Direction.DOWN);
    scene.idle(5);
    scene.world.showSection(tank2, Direction.DOWN);
    scene.idle(5);
    scene.world.showSection(pipes, Direction.NORTH);
    scene.idle(15);
    scene.world.destroyBlock(pumpPos);
    scene.world.restoreBlocks(pump);
    scene.world.setKineticSpeed(pump, 0);
    scene.idle(15);
    scene.overlay.showText(60).text("Mechanical Pumps govern the flow of their attached pipe networks").attachKeyFrame().placeNearTarget().pointAt(util.vector.topOf(pumpPos));
    scene.idle(70);
    scene.world.showSection(largeCog, Direction.UP);
    scene.idle(5);
    scene.world.showSection(kinetics, Direction.SOUTH);
    scene.world.showSection(util.select.position(leverPos), Direction.SOUTH);
    scene.idle(10);
    scene.world.setKineticSpeed(pump, 64);
    scene.world.propagatePipeChange(pumpPos);
    scene.effects.rotationDirectionIndicator(pumpPos.north());
    scene.idle(15);
    scene.overlay.showText(60).text("When powered, their arrow indicates the direction of flow").attachKeyFrame().placeNearTarget().pointAt(util.vector.topOf(pumpPos).subtract(0.5f, 0.125f, 0));
    AABB bb1 = new AABB(Vec3.ZERO, Vec3.ZERO).inflate(.25, .25, 0).move(0, 0, .25);
    AABB bb2 = new AABB(Vec3.ZERO, Vec3.ZERO).inflate(.25, .25, 1.25);
    scene.idle(65);
    Object in = new Object();
    Object out = new Object();
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.INPUT, in, bb1.move(util.vector.centerOf(3, 1, 3)), 3);
    scene.idle(2);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.INPUT, in, bb2.move(util.vector.centerOf(3, 1, 2)), 50);
    scene.idle(10);
    scene.overlay.showText(50).text("The network behind is now pulling fluids...").attachKeyFrame().placeNearTarget().colored(PonderPalette.INPUT).pointAt(util.vector.centerOf(3, 1, 2));
    scene.idle(60);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.OUTPUT, out, bb1.move(util.vector.centerOf(1, 1, 1).add(0, 0, -.5)), 3);
    scene.idle(2);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.OUTPUT, out, bb2.move(util.vector.centerOf(1, 1, 2)), 50);
    scene.idle(10);
    scene.overlay.showText(50).text("...while the network in front is transferring it outward").placeNearTarget().colored(PonderPalette.OUTPUT).pointAt(util.vector.centerOf(1, 1, 2));
    scene.idle(70);
    scene.world.toggleRedstonePower(util.select.fromTo(4, 2, 0, 4, 1, 0));
    scene.effects.indicateRedstone(leverPos);
    scene.world.multiplyKineticSpeed(util.select.fromTo(3, 1, 0, 2, 1, 1), -1);
    scene.effects.rotationDirectionIndicator(pumpPos.north());
    scene.world.propagatePipeChange(pumpPos);
    scene.idle(15);
    scene.overlay.showText(70).text("Reversing the input rotation reverses the direction of flow").placeNearTarget().attachKeyFrame().pointAt(util.vector.topOf(pumpPos).subtract(0.5f, 0.125f, 0));
    scene.idle(25);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.INPUT, in, bb1.move(util.vector.centerOf(1, 1, 3)), 3);
    scene.idle(2);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.INPUT, in, bb2.move(util.vector.centerOf(1, 1, 2)), 30);
    scene.idle(15);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.OUTPUT, out, bb1.move(util.vector.centerOf(3, 1, 1).add(0, 0, -.5)), 3);
    scene.idle(2);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.OUTPUT, out, bb2.move(util.vector.centerOf(3, 1, 2)), 30);
    scene.idle(55);
    scene.overlay.showControls(new InputWindowElement(util.vector.topOf(pumpPos), Pointing.DOWN).rightClick().withWrench(), 40);
    scene.idle(7);
    scene.world.modifyBlock(pumpPos, s -> s.setValue(PumpBlock.FACING, Direction.EAST), true);
    scene.overlay.showText(70).attachKeyFrame().pointAt(util.vector.centerOf(2, 1, 1)).placeNearTarget().text("Use a Wrench to reverse the orientation of pumps manually");
    scene.world.propagatePipeChange(pumpPos);
    scene.idle(40);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.INPUT, in, bb1.move(util.vector.centerOf(3, 1, 3)), 3);
    scene.idle(2);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.INPUT, in, bb2.move(util.vector.centerOf(3, 1, 2)), 30);
    scene.idle(15);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.OUTPUT, out, bb1.move(util.vector.centerOf(1, 1, 1).add(0, 0, -.5)), 3);
    scene.idle(2);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.OUTPUT, out, bb2.move(util.vector.centerOf(1, 1, 2)), 30);
    scene.idle(25);
}
Also used : Selection(com.simibubi.create.foundation.ponder.Selection) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) BlockPos(net.minecraft.core.BlockPos) AABB(net.minecraft.world.phys.AABB)

Example 50 with Selection

use of com.simibubi.create.foundation.ponder.Selection in project SteamPowered by TeamMoegMC.

the class SPScenes method steamEngine.

public static void steamEngine(SceneBuilder scene, SceneBuildingUtil util, boolean flywheel) {
    scene.title(flywheel ? "flywheel" : "steam_engine", "Generating Rotational Force using the " + (flywheel ? "Flywheel" : "Steam Engine"));
    scene.configureBasePlate(0, 0, 6);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    BlockPos cogPos = util.grid.at(1, 1, 2);
    BlockPos wheelPos = util.grid.at(1, 1, 3);
    BlockPos gaugePos = util.grid.at(1, 1, 1);
    BlockPos enginePos = util.grid.at(3, 1, 3);
    scene.idle(5);
    Selection f2Select = util.select.fromTo(1, 1, 3, 3, 1, 3);
    Selection b2Select = util.select.fromTo(5, 1, 3, 5, 2, 3);
    scene.world.showSection(util.select.position(enginePos), Direction.DOWN);
    // scene.idle(10);
    // scene.world.showSection(util.select.position(enginePos.west()), Direction.DOWN);
    scene.idle(20);
    scene.world.showSection(util.select.position(wheelPos), Direction.EAST);
    scene.idle(10);
    scene.world.showSection(util.select.fromTo(3, 2, 3, 4, 3, 4), Direction.WEST);
    scene.world.setKineticSpeed(util.select.position(4, 2, 3), 64F);
    scene.world.setKineticSpeed(util.select.fromTo(3, 3, 4, 4, 3, 4), 32F);
    scene.idle(10);
    scene.world.showSection(b2Select, Direction.UP);
    scene.world.modifyBlock(util.grid.at(5, 1, 3), state -> state.setValue(BurnerBlock.LIT, true), false);
    scene.idle(10);
    String text = flywheel ? "Flywheels are required for generating rotational force with the Steam Engine" : "Steam Engines generate Rotational Force while Steam is provided";
    scene.overlay.showText(80).attachKeyFrame().placeNearTarget().pointAt(util.vector.topOf(enginePos.west(flywheel ? 3 : 1))).text(text);
    scene.idle(7);
    scene.world.cycleBlockProperty(enginePos, SteamEngineBlock.LIT);
    scene.idle(90);
    scene.world.setKineticSpeed(util.select.fromTo(1, 1, 3, 1, 1, 1), 32.0F);
    scene.idle(40);
    scene.world.showSection(util.select.position(cogPos), Direction.SOUTH);
    scene.idle(15);
    scene.effects.rotationSpeedIndicator(cogPos);
    scene.world.showSection(util.select.position(gaugePos), Direction.SOUTH);
    scene.idle(15);
    scene.overlay.showText(80).attachKeyFrame().placeNearTarget().colored(PonderPalette.GREEN).pointAt(util.vector.blockSurface(gaugePos, Direction.WEST)).text("The provided Rotational Force has a very large stress capacity");
    scene.idle(90);
    scene.world.hideSection(f2Select, Direction.DOWN);
    scene.world.hideSection(b2Select, Direction.DOWN);
    scene.idle(15);
    scene.world.setBlock(util.grid.at(5, 1, 3), SPBlocks.CAST_IRON_BURNER.getDefaultState().setValue(BurnerBlock.LIT, true), false);
    scene.world.setBlock(util.grid.at(5, 2, 3), SPBlocks.CAST_IRON_BOILER.getDefaultState(), false);
    scene.world.setBlock(enginePos, SPBlocks.CAST_IRON_STEAM_ENGINE.getDefaultState().setValue(SteamEngineBlock.FACING, Direction.WEST).setValue(SteamEngineBlock.LIT, true), false);
    scene.world.setBlock(wheelPos, SPBlocks.CAST_IRON_FLYWHEEL.getDefaultState().setValue(SteamEngineBlock.FACING, Direction.SOUTH).setValue(FlywheelBlock.CONNECTION, ConnectionState.LEFT), false);
    scene.world.showSection(f2Select, Direction.DOWN);
    scene.world.showSection(b2Select, Direction.DOWN);
    scene.idle(30);
    scene.world.setKineticSpeed(util.select.fromTo(1, 1, 3, 1, 1, 1), SPConfig.COMMON.castIronFlywheelSpeed.get());
    scene.idle(50);
    scene.world.hideSection(f2Select, Direction.DOWN);
    scene.world.hideSection(b2Select, Direction.DOWN);
    scene.idle(15);
    scene.world.setBlock(util.grid.at(5, 1, 3), SPBlocks.STEEL_BURNER.getDefaultState().setValue(BurnerBlock.LIT, true), false);
    scene.world.setBlock(util.grid.at(5, 2, 3), SPBlocks.STEEL_BOILER.getDefaultState(), false);
    scene.world.setBlock(enginePos, SPBlocks.STEEL_STEAM_ENGINE.get().defaultBlockState().setValue(SteamEngineBlock.FACING, Direction.WEST).setValue(SteamEngineBlock.LIT, true), false);
    scene.world.setBlock(wheelPos, SPBlocks.STEEL_FLYWHEEL.get().defaultBlockState().setValue(SteamEngineBlock.FACING, Direction.SOUTH).setValue(FlywheelBlock.CONNECTION, ConnectionState.LEFT), false);
    scene.world.showSection(f2Select, Direction.DOWN);
    scene.world.showSection(b2Select, Direction.DOWN);
    scene.idle(30);
    scene.world.setKineticSpeed(util.select.fromTo(1, 1, 3, 1, 1, 1), SPConfig.COMMON.steelFlywheelSpeed.get());
    scene.idle(5);
    scene.effects.rotationSpeedIndicator(cogPos);
    scene.idle(5);
    String text3 = flywheel ? "Using Flywheels made of Steel or Cast Iron will increase efficiency and generated capacity of the Flywheel" : "Using Steam Engines made of Steel or Cast Iron will increase efficiency and generated capacity of the Flywheel";
    scene.overlay.showOutline(PonderPalette.MEDIUM, new Object(), f2Select, 80);
    scene.overlay.showText(80).placeNearTarget().colored(PonderPalette.MEDIUM).pointAt(util.vector.topOf(enginePos.west())).text(text3);
    scene.idle(80);
    String text4 = "However, power up higher level of " + (flywheel ? "flywheel" : "engine") + " require higher amount of steam, boiler and burner should match the level.";
    scene.overlay.showText(80).placeNearTarget().colored(PonderPalette.RED).text(text4).pointAt(util.vector.topOf(5, 2, 3));
    scene.idle(80);
}
Also used : Selection(com.simibubi.create.foundation.ponder.Selection) BlockPos(net.minecraft.util.math.BlockPos)

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