Search in sources :

Example 6 with ElementLink

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

the class MovementActorScenes method harvester.

public static void harvester(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("mechanical_harvester", "Using Mechanical Harvesters on Contraptions");
    scene.configureBasePlate(0, 0, 6);
    scene.scaleSceneView(0.9f);
    Selection crops = util.select.fromTo(4, 1, 2, 3, 1, 2).add(util.select.fromTo(3, 1, 1, 2, 1, 1).add(util.select.position(2, 1, 3)).add(util.select.position(1, 1, 2)));
    scene.world.setBlocks(crops, Blocks.WHEAT.defaultBlockState().setValue(CropBlock.AGE, 7), false);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    BlockPos bearingPos = util.grid.at(4, 1, 4);
    scene.idle(5);
    scene.world.showSection(crops, Direction.UP);
    scene.world.showSection(util.select.position(bearingPos), Direction.DOWN);
    scene.idle(5);
    ElementLink<WorldSectionElement> contraption = scene.world.showIndependentSection(util.select.fromTo(4, 2, 4, 2, 2, 5).add(util.select.fromTo(2, 1, 5, 0, 1, 5)), Direction.DOWN);
    scene.world.configureCenterOfRotation(contraption, util.vector.centerOf(bearingPos));
    scene.idle(10);
    for (int i = 0; i < 3; i++) {
        scene.world.showSectionAndMerge(util.select.position(i, 1, 4), Direction.SOUTH, contraption);
        scene.idle(5);
    }
    scene.overlay.showText(60).attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(util.grid.at(1, 1, 4), Direction.SOUTH)).text("Whenever Harvesters are moved as part of an animated Contraption...");
    scene.idle(70);
    for (int i = 0; i < 3; i++) scene.world.modifyTileEntity(util.grid.at(i, 1, 4), HarvesterTileEntity.class, hte -> hte.setAnimatedSpeed(-150));
    scene.world.rotateBearing(bearingPos, -360, 140);
    scene.world.rotateSection(contraption, 0, -360, 0, 140);
    BlockState harvested = Blocks.WHEAT.defaultBlockState();
    ItemStack wheatItem = new ItemStack(Items.WHEAT);
    scene.idle(5);
    BlockPos current = util.grid.at(2, 1, 3);
    scene.world.setBlock(current, harvested, true);
    scene.world.createItemEntity(util.vector.centerOf(current), util.vector.of(0, 0.3, -.2), wheatItem);
    scene.idle(5);
    current = util.grid.at(1, 1, 2);
    scene.world.setBlock(current, harvested, true);
    scene.world.createItemEntity(util.vector.centerOf(current), util.vector.of(0, 0.3, -.2), wheatItem);
    scene.idle(5);
    current = util.grid.at(3, 1, 2);
    scene.world.setBlock(current, harvested, true);
    scene.world.createItemEntity(util.vector.centerOf(current), util.vector.of(.1, 0.3, -.1), wheatItem);
    current = util.grid.at(2, 1, 1);
    scene.world.setBlock(current, harvested, true);
    scene.world.createItemEntity(util.vector.centerOf(current), util.vector.of(.1, 0.3, -.1), wheatItem);
    scene.idle(5);
    current = util.grid.at(3, 1, 1);
    scene.world.setBlock(current, harvested, true);
    scene.world.createItemEntity(util.vector.centerOf(current), util.vector.of(.1, 0.3, -.1), wheatItem);
    scene.idle(5);
    current = util.grid.at(4, 1, 2);
    scene.world.setBlock(current, harvested, true);
    scene.world.createItemEntity(util.vector.centerOf(current), util.vector.of(.2, 0.3, 0), wheatItem);
    scene.overlay.showText(80).pointAt(util.vector.topOf(1, 0, 2)).text("They will harvest and reset any mature crops on their way").placeNearTarget();
    scene.idle(101);
    scene.world.hideSection(crops, Direction.DOWN);
    scene.idle(15);
    scene.world.modifyEntities(ItemEntity.class, Entity::discard);
    scene.world.setBlocks(crops, Blocks.WHEAT.defaultBlockState().setValue(CropBlock.AGE, 7), false);
    scene.world.showSection(crops, Direction.UP);
    for (int i = 0; i < 3; i++) scene.world.modifyTileEntity(util.grid.at(i, 1, 4), HarvesterTileEntity.class, hte -> hte.setAnimatedSpeed(0));
    scene.idle(10);
    scene.world.cycleBlockProperty(util.grid.at(1, 1, 5), LinearChassisBlock.STICKY_TOP);
    scene.world.glueBlockOnto(util.grid.at(1, 2, 5), Direction.DOWN, contraption);
    scene.overlay.showText(60).attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(util.grid.at(1, 2, 5), Direction.WEST)).sharedText("storage_on_contraption");
    scene.idle(70);
    for (int i = 0; i < 3; i++) scene.world.modifyTileEntity(util.grid.at(i, 1, 4), HarvesterTileEntity.class, hte -> hte.setAnimatedSpeed(-150));
    scene.world.rotateBearing(bearingPos, -360, 140);
    scene.world.rotateSection(contraption, 0, -360, 0, 140);
    scene.idle(5);
    current = util.grid.at(2, 1, 3);
    scene.world.setBlock(current, harvested, true);
    scene.idle(5);
    current = util.grid.at(1, 1, 2);
    scene.world.setBlock(current, harvested, true);
    scene.idle(5);
    current = util.grid.at(3, 1, 2);
    scene.world.setBlock(current, harvested, true);
    current = util.grid.at(2, 1, 1);
    scene.world.setBlock(current, harvested, true);
    scene.idle(5);
    current = util.grid.at(3, 1, 1);
    scene.world.setBlock(current, harvested, true);
    scene.idle(5);
    current = util.grid.at(4, 1, 2);
    scene.world.setBlock(current, harvested, true);
    scene.idle(116);
    scene.overlay.showControls(new InputWindowElement(util.vector.topOf(1, 2, 5), Pointing.DOWN).withItem(wheatItem), 50);
    for (int i = 0; i < 3; i++) scene.world.modifyTileEntity(util.grid.at(i, 1, 4), HarvesterTileEntity.class, hte -> hte.setAnimatedSpeed(0));
}
Also used : Items(net.minecraft.world.item.Items) SceneBuilder(com.simibubi.create.foundation.ponder.SceneBuilder) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) Direction(net.minecraft.core.Direction) Pointing(com.simibubi.create.foundation.utility.Pointing) BlockState(net.minecraft.world.level.block.state.BlockState) LinearChassisBlock(com.simibubi.create.content.contraptions.components.structureMovement.chassis.LinearChassisBlock) CropBlock(net.minecraft.world.level.block.CropBlock) ElementLink(com.simibubi.create.foundation.ponder.ElementLink) PonderPalette(com.simibubi.create.foundation.ponder.PonderPalette) FlappyPose(com.simibubi.create.foundation.ponder.element.ParrotElement.FlappyPose) Selection(com.simibubi.create.foundation.ponder.Selection) EntityElement(com.simibubi.create.foundation.ponder.element.EntityElement) SceneBuildingUtil(com.simibubi.create.foundation.ponder.SceneBuildingUtil) HarvesterTileEntity(com.simibubi.create.content.contraptions.components.actors.HarvesterTileEntity) ParrotElement(com.simibubi.create.foundation.ponder.element.ParrotElement) Blocks(net.minecraft.world.level.block.Blocks) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement) Entity(net.minecraft.world.entity.Entity) BlockPos(net.minecraft.core.BlockPos) ItemEntity(net.minecraft.world.entity.item.ItemEntity) Vec3(net.minecraft.world.phys.Vec3) PortableItemInterfaceTileEntity(com.simibubi.create.content.contraptions.components.actors.PortableItemInterfaceTileEntity) ItemStack(net.minecraft.world.item.ItemStack) PortableStorageInterfaceTileEntity(com.simibubi.create.content.contraptions.components.actors.PortableStorageInterfaceTileEntity) HarvesterTileEntity(com.simibubi.create.content.contraptions.components.actors.HarvesterTileEntity) Entity(net.minecraft.world.entity.Entity) ItemEntity(net.minecraft.world.entity.item.ItemEntity) PortableItemInterfaceTileEntity(com.simibubi.create.content.contraptions.components.actors.PortableItemInterfaceTileEntity) PortableStorageInterfaceTileEntity(com.simibubi.create.content.contraptions.components.actors.PortableStorageInterfaceTileEntity) HarvesterTileEntity(com.simibubi.create.content.contraptions.components.actors.HarvesterTileEntity) BlockState(net.minecraft.world.level.block.state.BlockState) 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)

Example 7 with ElementLink

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

the class TunnelScenes method andesite.

public static void andesite(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("andesite_tunnel", "Using Andesite Tunnels");
    scene.configureBasePlate(0, 0, 5);
    scene.world.cycleBlockProperty(util.grid.at(2, 1, 2), BeltBlock.CASING);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    scene.idle(5);
    scene.world.showSection(util.select.fromTo(4, 1, 5, 4, 1, 3), Direction.DOWN);
    scene.idle(5);
    scene.world.showSection(util.select.fromTo(4, 1, 2, 0, 1, 2), Direction.SOUTH);
    scene.idle(10);
    Vector<ElementLink<WorldSectionElement>> tunnels = new Vector<>(3);
    for (int i = 0; i < 3; i++) {
        tunnels.add(scene.world.showIndependentSection(util.select.position(1 + i, 2, 4), Direction.DOWN));
        scene.world.moveSection(tunnels.get(i), util.vector.of(0, 0, -2), 0);
        scene.idle(4);
    }
    for (int i = 0; i < 3; i++) {
        scene.world.cycleBlockProperty(util.grid.at(1 + i, 1, 2), BeltBlock.CASING);
        scene.world.modifyTileNBT(util.select.position(1 + i, 1, 2), BeltTileEntity.class, nbt -> NBTHelper.writeEnum(nbt, "Casing", BeltTileEntity.CasingType.ANDESITE), true);
        scene.idle(4);
    }
    scene.overlay.showText(60).attachKeyFrame().pointAt(util.vector.topOf(util.grid.at(1, 2, 2))).placeNearTarget().text("Andesite Tunnels can be used to cover up your belts");
    scene.idle(70);
    for (int i = 0; i < 3; i++) {
        scene.world.cycleBlockProperty(util.grid.at(1 + i, 1, 2), BeltBlock.CASING);
        scene.world.hideIndependentSection(tunnels.get(i), Direction.UP);
        scene.idle(4);
    }
    scene.idle(10);
    scene.world.showSection(util.select.fromTo(2, 1, 0, 0, 1, 1), Direction.SOUTH);
    scene.idle(10);
    scene.world.showSection(util.select.position(2, 2, 2), Direction.DOWN);
    scene.idle(10);
    scene.world.cycleBlockProperty(util.grid.at(2, 1, 2), BeltBlock.CASING);
    scene.overlay.showText(60).attachKeyFrame().pointAt(util.vector.blockSurface(util.grid.at(2, 2, 2), Direction.NORTH)).placeNearTarget().text("Whenever an Andesite Tunnel has connections to the sides...");
    scene.idle(70);
    scene.overlay.showControls(new InputWindowElement(util.vector.topOf(util.grid.at(4, 1, 2)), Pointing.DOWN).withItem(new ItemStack(Items.COPPER_INGOT)), 20);
    scene.idle(7);
    scene.world.createItemOnBelt(util.grid.at(4, 1, 2), Direction.UP, new ItemStack(Items.COPPER_INGOT, 64));
    scene.idle(40);
    scene.world.multiplyKineticSpeed(util.select.everywhere(), 1 / 16f);
    scene.overlay.showText(80).attachKeyFrame().text("...they will split exactly one item off of any passing stacks").pointAt(util.vector.blockSurface(util.grid.at(2, 1, 0), Direction.WEST)).placeNearTarget();
    scene.idle(90);
    scene.overlay.showText(80).text("The remainder will continue on its path").pointAt(util.vector.blockSurface(util.grid.at(0, 1, 2), Direction.UP)).placeNearTarget();
    scene.idle(90);
    scene.world.multiplyKineticSpeed(util.select.everywhere(), 16f);
}
Also used : ElementLink(com.simibubi.create.foundation.ponder.ElementLink) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) ItemStack(net.minecraft.world.item.ItemStack) Vector(java.util.Vector)

Example 8 with ElementLink

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

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

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

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