Search in sources :

Example 61 with WorldSectionElement

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

the class DrainScenes method emptying.

public static void emptying(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("item_drain", "Emptying Fluid Containers using Item Drains");
    scene.configureBasePlate(0, 0, 5);
    scene.showBasePlate();
    scene.idle(5);
    Selection drain = util.select.position(3, 1, 2);
    BlockPos drainPos = util.grid.at(3, 1, 2);
    Selection pipes = util.select.fromTo(3, 1, 3, 3, 1, 4).add(util.select.fromTo(3, 2, 4, 2, 2, 4));
    Selection tank = util.select.fromTo(1, 1, 4, 1, 3, 4);
    Selection largeCog = util.select.position(1, 0, 5);
    Selection kinetics = util.select.fromTo(2, 1, 3, 2, 1, 5);
    Selection belt = util.select.fromTo(2, 1, 2, 1, 1, 2);
    BlockPos beltPos = util.grid.at(1, 1, 2);
    ElementLink<WorldSectionElement> drainLink = scene.world.showIndependentSection(drain, Direction.DOWN);
    scene.world.moveSection(drainLink, util.vector.of(-1, 0, 0), 0);
    scene.idle(10);
    scene.overlay.showText(40).text("Item Drains can extract fluids from items").attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(drainPos.west(), Direction.UP));
    scene.idle(50);
    ItemStack lavaBucket = new ItemStack(Items.LAVA_BUCKET);
    scene.overlay.showControls(new InputWindowElement(util.vector.blockSurface(drainPos.west(), Direction.UP), Pointing.DOWN).rightClick().withItem(lavaBucket), 40);
    scene.idle(7);
    scene.world.modifyTileEntity(drainPos, ItemDrainTileEntity.class, te -> {
        te.getBehaviour(SmartFluidTankBehaviour.TYPE).allowInsertion();
        te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY).ifPresent(ifh -> ifh.fill(new FluidStack(Fluids.LAVA, 1000), FluidAction.EXECUTE));
    });
    scene.idle(10);
    scene.overlay.showText(50).text("Right-click it to pour fluids from your held item into it").attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(drainPos.west(), Direction.WEST));
    scene.idle(60);
    scene.world.modifyTileEntity(drainPos, ItemDrainTileEntity.class, te -> te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY).ifPresent(ifh -> ifh.drain(500, FluidAction.EXECUTE)));
    scene.world.moveSection(drainLink, util.vector.of(1, 0, 0), 7);
    scene.world.showSection(largeCog, Direction.UP);
    scene.idle(3);
    scene.world.showSection(kinetics, Direction.NORTH);
    scene.idle(4);
    scene.world.showSection(belt, Direction.SOUTH);
    scene.idle(10);
    scene.overlay.showText(40).text("When items are inserted from the side...").attachKeyFrame().placeNearTarget().pointAt(util.vector.topOf(util.grid.at(2, 1, 2)));
    scene.idle(40);
    scene.overlay.showControls(new InputWindowElement(util.vector.topOf(beltPos), Pointing.DOWN).withItem(lavaBucket), 20);
    scene.idle(7);
    scene.world.createItemOnBelt(beltPos, Direction.NORTH, lavaBucket);
    scene.idle(30);
    scene.overlay.showText(60).text("...they roll across, emptying out their contained fluid").attachKeyFrame().placeNearTarget().pointAt(util.vector.topOf(drainPos));
    scene.idle(40);
    scene.world.showSection(tank, Direction.DOWN);
    scene.idle(5);
    scene.world.showSection(pipes, Direction.NORTH);
    scene.idle(20);
    scene.overlay.showText(90).text("Pipe Networks can now pull the fluid from the drains' internal buffer").attachKeyFrame().placeNearTarget().pointAt(util.vector.topOf(util.grid.at(3, 1, 3)));
    scene.idle(50);
    scene.markAsFinished();
    scene.idle(50);
    for (int i = 0; i < 5; i++) {
        scene.world.createItemOnBelt(beltPos, Direction.NORTH, lavaBucket);
        scene.idle(30);
    }
}
Also used : SmartFluidTankBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.fluid.SmartFluidTankBehaviour) Selection(com.simibubi.create.foundation.ponder.Selection) Items(net.minecraft.world.item.Items) SceneBuilder(com.simibubi.create.foundation.ponder.SceneBuilder) CapabilityFluidHandler(net.minecraftforge.fluids.capability.CapabilityFluidHandler) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) Direction(net.minecraft.core.Direction) FluidAction(net.minecraftforge.fluids.capability.IFluidHandler.FluidAction) SceneBuildingUtil(com.simibubi.create.foundation.ponder.SceneBuildingUtil) Pointing(com.simibubi.create.foundation.utility.Pointing) ItemDrainTileEntity(com.simibubi.create.content.contraptions.fluids.actors.ItemDrainTileEntity) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement) ElementLink(com.simibubi.create.foundation.ponder.ElementLink) BlockPos(net.minecraft.core.BlockPos) FluidStack(net.minecraftforge.fluids.FluidStack) ItemStack(net.minecraft.world.item.ItemStack) Fluids(net.minecraft.world.level.material.Fluids) 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 62 with WorldSectionElement

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

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

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

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

the class FunnelScenes method brass.

public static void brass(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("brass_funnel", "The Brass Funnel");
    scene.configureBasePlate(0, 0, 5);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    scene.idle(5);
    BlockPos firstDepot = util.grid.at(3, 1, 1);
    BlockPos secondDepot = util.grid.at(1, 1, 1);
    Selection depots = util.select.fromTo(firstDepot, secondDepot);
    Selection beltAndStuff = util.select.fromTo(0, 1, 2, 4, 1, 2).add(util.select.fromTo(0, 1, 3, 0, 2, 5));
    Selection withoutBelt = util.select.layersFrom(1).substract(beltAndStuff).substract(depots);
    scene.world.showSection(withoutBelt, Direction.DOWN);
    ElementLink<WorldSectionElement> independentSection = scene.world.showIndependentSection(depots, Direction.DOWN);
    scene.world.moveSection(independentSection, util.vector.of(0, 0, 1), 0);
    BlockPos andesiteFunnel = util.grid.at(3, 2, 2);
    BlockPos brassFunnel = util.grid.at(1, 2, 2);
    ItemStack itemStack = AllItems.BRASS_INGOT.asStack();
    scene.idle(10);
    scene.overlay.showText(60).text("Andesite Funnels can only ever extract single items.").attachKeyFrame().pointAt(util.vector.topOf(andesiteFunnel)).placeNearTarget();
    scene.idle(10);
    scene.world.createItemOnBeltLike(andesiteFunnel.below().north(), Direction.SOUTH, itemStack);
    scene.world.flapFunnel(andesiteFunnel, true);
    scene.idle(60);
    scene.overlay.showText(60).text("Brass Funnels can extract up to a full stack.").attachKeyFrame().pointAt(util.vector.topOf(brassFunnel)).placeNearTarget();
    scene.idle(10);
    scene.world.createItemOnBeltLike(brassFunnel.below().north(), Direction.SOUTH, ItemHandlerHelper.copyStackWithSize(itemStack, 64));
    scene.world.flapFunnel(brassFunnel, true);
    scene.idle(60);
    AABB filterSlot = new AABB(brassFunnel).inflate(-.35, -.35, -.35).move(0, 0.2, 0);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.WHITE, filterSlot, filterSlot, 80);
    scene.overlay.showControls(new InputWindowElement(util.vector.topOf(brassFunnel), Pointing.DOWN).scroll(), 60);
    scene.idle(10);
    scene.overlay.showText(80).text("Scrolling on the filter slot allows for precise control over the extracted stack size.").attachKeyFrame().pointAt(filterSlot.getCenter()).placeNearTarget();
    scene.idle(90);
    // belt
    scene.world.hideIndependentSection(independentSection, Direction.NORTH);
    scene.world.hideSection(util.select.position(brassFunnel), Direction.UP);
    scene.idle(20);
    scene.world.modifyBlock(brassFunnel, s -> s.cycle(BeltFunnelBlock.SHAPE), false);
    scene.world.showSection(util.select.position(brassFunnel), Direction.DOWN);
    scene.world.showSection(beltAndStuff, Direction.SOUTH);
    scene.idle(10);
    ItemStack dirt = new ItemStack(Items.DIRT);
    ItemStack gravel = new ItemStack(Items.GRAVEL);
    ItemStack emerald = new ItemStack(Items.EMERALD);
    for (int i = 0; i < 14; i++) {
        if (i < 12)
            scene.world.createItemOnBelt(andesiteFunnel.below(), Direction.SOUTH, i % 3 == 0 ? dirt : i % 3 == 1 ? gravel : emerald);
        scene.idle(10);
        if (i > 0 && (i < 3 || i % 3 == 0)) {
            scene.world.removeItemsFromBelt(brassFunnel.below());
            scene.world.flapFunnel(brassFunnel, false);
        }
        scene.world.modifyEntities(ItemEntity.class, e -> {
            if (e.getY() < 1)
                e.discard();
        });
        if (i == 2) {
            scene.overlay.chaseBoundingBoxOutline(PonderPalette.WHITE, filterSlot, filterSlot, 80);
            scene.overlay.showControls(new InputWindowElement(util.vector.topOf(brassFunnel), Pointing.DOWN).rightClick().withItem(emerald), 60);
            scene.idle(10);
            scene.overlay.showText(80).text("Using items on the filter slot will restrict the funnel to only transfer matching stacks.").attachKeyFrame().pointAt(filterSlot.getCenter()).placeNearTarget();
            scene.world.setFilterData(util.select.position(brassFunnel), FunnelTileEntity.class, emerald);
        } else
            scene.idle(10);
        if (i == 8)
            scene.markAsFinished();
    }
}
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) ItemStack(net.minecraft.world.item.ItemStack) AABB(net.minecraft.world.phys.AABB)

Aggregations

WorldSectionElement (com.simibubi.create.foundation.ponder.element.WorldSectionElement)70 BlockPos (net.minecraft.core.BlockPos)64 Selection (com.simibubi.create.foundation.ponder.Selection)60 InputWindowElement (com.simibubi.create.foundation.ponder.element.InputWindowElement)44 Vec3 (net.minecraft.world.phys.Vec3)39 ItemStack (net.minecraft.world.item.ItemStack)34 Entity (net.minecraft.world.entity.Entity)16 Direction (net.minecraft.core.Direction)11 ItemEntity (net.minecraft.world.entity.item.ItemEntity)11 EntityElement (com.simibubi.create.foundation.ponder.element.EntityElement)10 ElementLink (com.simibubi.create.foundation.ponder.ElementLink)9 SceneBuilder (com.simibubi.create.foundation.ponder.SceneBuilder)9 SceneBuildingUtil (com.simibubi.create.foundation.ponder.SceneBuildingUtil)8 AABB (net.minecraft.world.phys.AABB)8 FluidStack (net.minecraftforge.fluids.FluidStack)8 PonderPalette (com.simibubi.create.foundation.ponder.PonderPalette)7 Pointing (com.simibubi.create.foundation.utility.Pointing)6 HarvesterTileEntity (com.simibubi.create.content.contraptions.components.actors.HarvesterTileEntity)5 BeltItemElement (com.simibubi.create.foundation.ponder.element.BeltItemElement)5 BlockState (net.minecraft.world.level.block.state.BlockState)5