Search in sources :

Example 11 with SceneBuildingUtil

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

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

Aggregations

SceneBuilder (com.simibubi.create.foundation.ponder.SceneBuilder)12 SceneBuildingUtil (com.simibubi.create.foundation.ponder.SceneBuildingUtil)12 ElementLink (com.simibubi.create.foundation.ponder.ElementLink)11 Selection (com.simibubi.create.foundation.ponder.Selection)11 WorldSectionElement (com.simibubi.create.foundation.ponder.element.WorldSectionElement)11 BlockPos (net.minecraft.core.BlockPos)11 Direction (net.minecraft.core.Direction)11 PonderPalette (com.simibubi.create.foundation.ponder.PonderPalette)10 Pointing (com.simibubi.create.foundation.utility.Pointing)10 InputWindowElement (com.simibubi.create.foundation.ponder.element.InputWindowElement)9 ItemStack (net.minecraft.world.item.ItemStack)9 Vec3 (net.minecraft.world.phys.Vec3)9 Items (net.minecraft.world.item.Items)8 AllBlocks (com.simibubi.create.AllBlocks)7 Blocks (net.minecraft.world.level.block.Blocks)7 FluidStack (net.minecraftforge.fluids.FluidStack)6 CapabilityFluidHandler (net.minecraftforge.fluids.capability.CapabilityFluidHandler)6 FluidAction (net.minecraftforge.fluids.capability.IFluidHandler.FluidAction)6 BasinTileEntity (com.simibubi.create.content.contraptions.processing.BasinTileEntity)5 Fluids (net.minecraft.world.level.material.Fluids)5