Search in sources :

Example 6 with Selection

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

the class CrafterScenes method connect.

public static void connect(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("mechanical_crafter_connect", "Connecting Inventories of Crafters");
    scene.configureBasePlate(0, 0, 5);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    for (int y = 0; y < 3; y++) {
        for (int x = 0; x < 2; x++) {
            scene.world.showSection(util.select.position(y == 1 ? x + 1 : 2 - x, y + 1, 2), Direction.DOWN);
            scene.idle(2);
        }
    }
    Class<MechanicalCrafterTileEntity> type = MechanicalCrafterTileEntity.class;
    BlockPos depotPos = util.grid.at(0, 1, 2);
    Selection funnel = util.select.fromTo(4, 1, 5, 4, 1, 2).add(util.select.fromTo(3, 2, 2, 3, 1, 2));
    Selection kinetics = util.select.position(3, 3, 2).add(util.select.fromTo(3, 3, 3, 3, 1, 3));
    scene.idle(5);
    scene.world.showSection(kinetics, Direction.NORTH);
    scene.idle(5);
    scene.world.showSection(util.select.position(depotPos), Direction.EAST);
    scene.idle(10);
    scene.world.showSection(funnel, Direction.WEST);
    scene.rotateCameraY(60);
    ItemStack planks = new ItemStack(Items.OAK_PLANKS);
    scene.world.createItemOnBelt(util.grid.at(4, 1, 2), Direction.EAST, planks.copy());
    scene.idle(22);
    scene.world.modifyTileEntity(util.grid.at(2, 2, 2), type, mct -> mct.getInventory().insertItem(0, planks.copy(), false));
    scene.world.removeItemsFromBelt(util.grid.at(3, 1, 2));
    scene.world.flapFunnel(util.grid.at(3, 2, 2), false);
    scene.overlay.showSelectionWithText(util.select.position(2, 2, 2), 70).attachKeyFrame().placeNearTarget().pointAt(util.vector.blockSurface(util.grid.at(2, 2, 2), Direction.NORTH)).text("Items can be inserted to Crafters automatically");
    scene.idle(80);
    scene.rotateCameraY(-60 - 90 - 30);
    scene.idle(40);
    Vec3 v = util.vector.blockSurface(util.grid.at(2, 2, 2), Direction.WEST);
    AABB bb = new AABB(v, v).inflate(.125f, .5, .5);
    v = v.add(0, 0, .5);
    scene.overlay.chaseBoundingBoxOutline(PonderPalette.WHITE, new Object(), bb, 45);
    scene.overlay.showControls(new InputWindowElement(v, Pointing.LEFT).rightClick().withWrench(), 40);
    scene.idle(7);
    scene.world.connectCrafterInvs(util.grid.at(2, 2, 2), util.grid.at(1, 2, 2));
    scene.idle(40);
    scene.overlay.showSelectionWithText(util.select.fromTo(2, 2, 2, 1, 2, 2), 70).attachKeyFrame().placeNearTarget().pointAt(v).text("Using the Wrench at their backs, Mechanical Crafter inputs can be combined");
    scene.idle(80);
    scene.overlay.showControls(new InputWindowElement(v.add(0, 1, 0), Pointing.LEFT).rightClick().withWrench(), 20);
    scene.idle(7);
    scene.world.connectCrafterInvs(util.grid.at(2, 3, 2), util.grid.at(1, 3, 2));
    scene.idle(20);
    scene.overlay.showControls(new InputWindowElement(v.add(0, -1, 0), Pointing.LEFT).rightClick().withWrench(), 20);
    scene.idle(7);
    scene.world.connectCrafterInvs(util.grid.at(2, 1, 2), util.grid.at(1, 1, 2));
    scene.idle(20);
    scene.overlay.showControls(new InputWindowElement(v.add(.5, -.5, 0), Pointing.LEFT).rightClick().withWrench(), 20);
    scene.idle(7);
    scene.world.connectCrafterInvs(util.grid.at(2, 1, 2), util.grid.at(2, 2, 2));
    scene.idle(10);
    scene.overlay.showControls(new InputWindowElement(v.add(.5, .5, 0), Pointing.LEFT).rightClick().withWrench(), 20);
    scene.idle(7);
    scene.world.connectCrafterInvs(util.grid.at(2, 2, 2), util.grid.at(2, 3, 2));
    scene.idle(20);
    scene.rotateCameraY(90 + 30);
    scene.idle(40);
    scene.overlay.showSelectionWithText(util.select.fromTo(1, 1, 2, 2, 3, 2), 70).attachKeyFrame().placeNearTarget().text("All connected Crafters can now be accessed by the same input location");
    scene.idle(60);
    scene.overlay.showControls(new InputWindowElement(util.vector.centerOf(util.grid.at(4, 2, 2)), Pointing.DOWN).withItem(planks), 40);
    scene.idle(7);
    scene.world.createItemOnBelt(util.grid.at(4, 1, 2), Direction.EAST, ItemHandlerHelper.copyStackWithSize(planks, 16));
    scene.idle(22);
    scene.world.removeItemsFromBelt(util.grid.at(3, 1, 2));
    BlockPos[] positions = new BlockPos[] { util.grid.at(2, 3, 2), util.grid.at(1, 3, 2), util.grid.at(1, 2, 2), util.grid.at(2, 1, 2), util.grid.at(1, 1, 2) };
    scene.world.setCraftingResult(util.grid.at(1, 1, 2), new ItemStack(Items.OAK_DOOR, 3));
    for (BlockPos pos : positions) {
        scene.world.modifyTileEntity(pos, type, mct -> mct.getInventory().insertItem(0, planks.copy(), false));
        scene.idle(1);
    }
}
Also used : Selection(com.simibubi.create.foundation.ponder.Selection) Vec3(net.minecraft.world.phys.Vec3) MechanicalCrafterTileEntity(com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterTileEntity) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) BlockPos(net.minecraft.core.BlockPos) ItemStack(net.minecraft.world.item.ItemStack) AABB(net.minecraft.world.phys.AABB)

Example 7 with Selection

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

the class CrafterScenes method covers.

public static void covers(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("mechanical_crafter_covers", "Covering slots of Mechanical Crafters");
    scene.configureBasePlate(0, 0, 5);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    scene.world.setBlock(util.grid.at(2, 2, 2), Blocks.AIR.defaultBlockState(), false);
    Selection kinetics = util.select.fromTo(3, 1, 2, 3, 1, 5);
    scene.world.setKineticSpeed(util.select.fromTo(1, 2, 2, 3, 1, 2), 0);
    scene.world.showSection(util.select.position(3, 2, 2), Direction.EAST);
    scene.idle(5);
    scene.world.showSection(util.select.position(2, 1, 2), Direction.DOWN);
    scene.idle(5);
    scene.world.showSection(util.select.position(1, 2, 2), Direction.WEST);
    scene.idle(5);
    ItemStack iron = new ItemStack(Items.IRON_INGOT);
    Class<MechanicalCrafterTileEntity> type = MechanicalCrafterTileEntity.class;
    scene.world.modifyTileEntity(util.grid.at(3, 2, 2), type, mct -> mct.getInventory().insertItem(0, iron.copy(), false));
    scene.idle(5);
    scene.world.modifyTileEntity(util.grid.at(2, 1, 2), type, mct -> mct.getInventory().insertItem(0, iron.copy(), false));
    scene.idle(5);
    scene.world.modifyTileEntity(util.grid.at(1, 2, 2), type, mct -> mct.getInventory().insertItem(0, iron.copy(), false));
    scene.idle(5);
    Selection emptyCrafter = util.select.position(2, 2, 2);
    scene.overlay.showSelectionWithText(emptyCrafter, 90).attachKeyFrame().colored(PonderPalette.RED).text("Some recipes will require additional Crafters to bridge gaps in the path").placeNearTarget();
    scene.idle(70);
    scene.world.restoreBlocks(emptyCrafter);
    scene.world.setCraftingResult(util.grid.at(2, 2, 2), new ItemStack(Items.BUCKET));
    scene.world.showSection(emptyCrafter, Direction.DOWN);
    scene.idle(10);
    scene.world.showSection(util.select.position(2, 3, 2), Direction.DOWN);
    scene.world.showSection(kinetics, Direction.NORTH);
    scene.idle(5);
    scene.world.setKineticSpeed(util.select.fromTo(3, 1, 2, 1, 2, 2), -32);
    scene.world.setKineticSpeed(util.select.position(3, 1, 2).add(emptyCrafter), 32);
    scene.idle(20);
    scene.overlay.showText(90).attachKeyFrame().colored(PonderPalette.GREEN).pointAt(util.vector.blockSurface(util.grid.at(2, 2, 2), Direction.NORTH)).text("Using Slot Covers, Crafters can be set to act as an Empty Slot in the arrangement").placeNearTarget();
    scene.idle(100);
    scene.overlay.showControls(new InputWindowElement(util.vector.blockSurface(util.grid.at(2, 2, 2), Direction.NORTH).add(0.5, 0, 0), Pointing.RIGHT).withItem(AllItems.CRAFTER_SLOT_COVER.asStack()).rightClick(), 50);
    scene.idle(7);
    scene.world.modifyTileNBT(emptyCrafter, type, compound -> compound.putBoolean("Cover", true));
    scene.idle(130);
    scene.overlay.showControls(new InputWindowElement(util.vector.blockSurface(util.grid.at(2, 3, 2), Direction.WEST), Pointing.LEFT).withItem(new ItemStack(Items.BUCKET)), 40);
    scene.idle(50);
    scene.world.showSection(util.select.position(4, 2, 2), Direction.DOWN);
    scene.world.connectCrafterInvs(util.grid.at(3, 2, 2), util.grid.at(2, 2, 2));
    scene.idle(5);
    scene.world.connectCrafterInvs(util.grid.at(2, 1, 2), util.grid.at(2, 2, 2));
    scene.idle(5);
    scene.world.connectCrafterInvs(util.grid.at(1, 2, 2), util.grid.at(2, 2, 2));
    scene.idle(10);
    scene.overlay.showSelectionWithText(util.select.fromTo(3, 2, 2, 1, 2, 2).add(util.select.position(2, 1, 2)), 80).attachKeyFrame().pointAt(util.vector.blockSurface(util.grid.at(2, 2, 2), Direction.NORTH)).text("Shared Inputs created with the Wrench at the back can also reach across covered Crafters").placeNearTarget();
    scene.idle(60);
    ElementLink<EntityElement> ingot = scene.world.createItemEntity(util.vector.centerOf(4, 4, 2), util.vector.of(0, 0.2, 0), iron);
    scene.idle(17);
    scene.world.modifyEntity(ingot, Entity::discard);
    scene.world.modifyTileEntity(util.grid.at(3, 2, 2), type, mct -> mct.getInventory().insertItem(0, iron.copy(), false));
    ingot = scene.world.createItemEntity(util.vector.centerOf(4, 4, 2), util.vector.of(0, 0.2, 0), iron);
    scene.idle(17);
    scene.world.modifyEntity(ingot, Entity::discard);
    scene.world.modifyTileEntity(util.grid.at(2, 1, 2), type, mct -> mct.getInventory().insertItem(0, iron.copy(), false));
    ingot = scene.world.createItemEntity(util.vector.centerOf(4, 4, 2), util.vector.of(0, 0.2, 0), iron);
    scene.idle(17);
    scene.world.modifyEntity(ingot, Entity::discard);
    scene.world.modifyTileEntity(util.grid.at(1, 2, 2), type, mct -> mct.getInventory().insertItem(0, iron.copy(), false));
}
Also used : MechanicalCrafterTileEntity(com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterTileEntity) Entity(net.minecraft.world.entity.Entity) Selection(com.simibubi.create.foundation.ponder.Selection) MechanicalCrafterTileEntity(com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterTileEntity) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) EntityElement(com.simibubi.create.foundation.ponder.element.EntityElement) ItemStack(net.minecraft.world.item.ItemStack)

Example 8 with Selection

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

the class FunnelScenes method transposer.

public static void transposer(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("funnel_transfer", "Direct transfer");
    scene.configureBasePlate(0, 0, 5);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    scene.idle(5);
    BlockPos funnelPos = util.grid.at(2, 2, 2);
    Selection funnelSelect = util.select.position(funnelPos);
    ElementLink<WorldSectionElement> rightChest = scene.world.showIndependentSection(util.select.position(0, 2, 2), Direction.DOWN);
    ElementLink<WorldSectionElement> leftChest = scene.world.showIndependentSection(util.select.position(4, 2, 2), Direction.DOWN);
    scene.world.moveSection(rightChest, util.vector.of(2, 1, 0), 0);
    scene.world.moveSection(leftChest, util.vector.of(-2, -1, 0), 0);
    scene.idle(5);
    scene.world.showSection(funnelSelect, Direction.DOWN);
    scene.idle(20);
    scene.overlay.showSelectionWithText(funnelSelect, 40).colored(PonderPalette.RED).text("Funnels cannot ever transfer between closed inventories directly.").attachKeyFrame().placeNearTarget();
    scene.idle(50);
    scene.world.hideSection(funnelSelect, Direction.SOUTH);
    scene.idle(20);
    scene.world.setBlocks(funnelSelect, AllBlocks.CHUTE.getDefaultState(), false);
    scene.world.showSection(funnelSelect, Direction.NORTH);
    scene.idle(10);
    scene.overlay.showText(40).colored(PonderPalette.GREEN).text("Chutes or Smart chutes might be more suitable for such purposes.").attachKeyFrame().pointAt(util.vector.centerOf(funnelPos)).placeNearTarget();
    scene.idle(50);
    scene.world.hideSection(funnelSelect, Direction.UP);
    scene.world.hideIndependentSection(leftChest, Direction.UP);
    scene.world.hideIndependentSection(rightChest, Direction.UP);
    scene.idle(20);
    Selection belt = util.select.layer(1);
    scene.world.setBlocks(funnelSelect, Blocks.AIR.defaultBlockState(), false);
    scene.world.showSection(belt, Direction.DOWN);
    scene.world.showSection(util.select.fromTo(0, 2, 2, 4, 2, 2), Direction.DOWN);
    scene.overlay.showText(120).colored(PonderPalette.GREEN).text("Same applies for horizontal movement. A mechanical belt should help here.").pointAt(util.vector.topOf(1, 2, 2)).placeNearTarget();
    scene.markAsFinished();
}
Also used : Selection(com.simibubi.create.foundation.ponder.Selection) BlockPos(net.minecraft.core.BlockPos) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement)

Example 9 with Selection

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

the class FunnelScenes method compat.

public static void compat(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("funnel_compat", "Funnel compatibility");
    scene.configureBasePlate(0, 0, 5);
    BlockPos sawFunnel = util.grid.at(4, 2, 1);
    BlockPos depotFunnel = util.grid.at(2, 2, 2);
    BlockPos drainFunnel = util.grid.at(0, 2, 3);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    Selection firstShow = util.select.layer(1).add(util.select.position(sawFunnel.south())).add(util.select.position(depotFunnel.south())).add(util.select.position(drainFunnel.south()));
    scene.idle(5);
    scene.world.showSection(firstShow, Direction.DOWN);
    scene.idle(8);
    scene.overlay.showText(360).text("Funnels should also interact nicely with a handful of other components.").attachKeyFrame().independent(0);
    scene.idle(40);
    scene.world.showSection(util.select.position(sawFunnel), Direction.DOWN);
    scene.overlay.showText(40).text("Vertical Saws").colored(PonderPalette.BLUE).placeNearTarget().pointAt(util.vector.centerOf(sawFunnel.below()));
    scene.idle(8);
    scene.world.createItemOnBeltLike(sawFunnel.below(), Direction.SOUTH, new ItemStack(Blocks.OAK_LOG));
    scene.idle(40);
    scene.world.showSection(util.select.position(depotFunnel), Direction.DOWN);
    scene.overlay.showText(40).text("Depots").colored(PonderPalette.BLUE).placeNearTarget().pointAt(util.vector.centerOf(depotFunnel.below()));
    scene.idle(8);
    scene.world.createItemOnBeltLike(depotFunnel.below(), Direction.SOUTH, new ItemStack(Items.GOLDEN_PICKAXE));
    scene.idle(40);
    scene.world.showSection(util.select.position(drainFunnel), Direction.DOWN);
    scene.overlay.showText(40).text("Item Drains").colored(PonderPalette.BLUE).placeNearTarget().pointAt(util.vector.centerOf(drainFunnel.below()));
    scene.idle(8);
    scene.world.createItemOnBeltLike(drainFunnel.below(), Direction.SOUTH, new ItemStack(Items.WATER_BUCKET));
    scene.idle(40);
    scene.markAsFinished();
}
Also used : Selection(com.simibubi.create.foundation.ponder.Selection) BlockPos(net.minecraft.core.BlockPos) ItemStack(net.minecraft.world.item.ItemStack)

Example 10 with Selection

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

the class FunnelScenes method intro.

public static void intro(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("funnel_intro", "Using funnels");
    scene.configureBasePlate(0, 1, 5);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    scene.world.modifyKineticSpeed(util.select.everywhere(), f -> f / 2f);
    scene.idle(10);
    Selection verticalFunnel = util.select.fromTo(2, -1, 4, 2, 4, 4).add(util.select.fromTo(1, 1, 4, 1, 4, 4));
    Selection beltFunnels = util.select.fromTo(1, 2, 2, 3, 2, 2);
    Selection beltFunnelEnv = util.select.fromTo(0, 1, 0, 5, 2, 2).substract(beltFunnels);
    scene.world.showSection(beltFunnelEnv, Direction.DOWN);
    scene.idle(20);
    scene.world.showSection(beltFunnels, Direction.DOWN);
    BlockPos entryBeltPos = util.grid.at(3, 1, 2);
    BlockPos exitBeltPos = util.grid.at(1, 1, 2);
    ItemStack itemStack = AllBlocks.BRASS_BLOCK.asStack();
    for (int i = 0; i < 8; i++) {
        scene.idle(8);
        scene.world.removeItemsFromBelt(exitBeltPos);
        scene.world.flapFunnel(exitBeltPos.above(), false);
        if (i == 2)
            scene.rotateCameraY(70);
        if (i < 6)
            scene.world.createItemOnBelt(entryBeltPos, Direction.EAST, itemStack);
    }
    scene.rotateCameraY(-70);
    scene.idle(10);
    Selection outputFunnel = util.select.position(1, 2, 4);
    scene.world.setBlocks(outputFunnel, Blocks.AIR.defaultBlockState(), false);
    scene.world.setBlocks(util.select.fromTo(2, -1, 4, 2, 0, 4), AllBlocks.ANDESITE_CASING.getDefaultState(), true);
    ElementLink<WorldSectionElement> independentSection = scene.world.showIndependentSection(verticalFunnel, Direction.UP);
    Vec3 topItemSpawn = util.vector.centerOf(2, 6, 4);
    Vec3 sideItemSpawn = util.vector.centerOf(1, 3, 4).add(0.15f, -0.45f, 0);
    ElementLink<EntityElement> lastItemEntity = null;
    for (int i = 0; i < 4; i++) {
        if (lastItemEntity != null)
            scene.world.modifyEntity(lastItemEntity, Entity::discard);
        if (i < 3)
            lastItemEntity = scene.world.createItemEntity(topItemSpawn, util.vector.of(0, -0.4, 0), itemStack);
        scene.idle(8);
    }
    scene.world.moveSection(independentSection, util.vector.of(0, 1, 0), 15);
    scene.idle(10);
    scene.world.setBlocks(outputFunnel, AllBlocks.ANDESITE_FUNNEL.getDefaultState().setValue(FunnelBlock.FACING, Direction.WEST).setValue(FunnelBlock.EXTRACTING, true), false);
    for (int i = 0; i < 3; i++) {
        scene.idle(8);
        scene.world.flapFunnel(util.grid.at(1, 2, 4), false);
        scene.world.createItemEntity(sideItemSpawn, util.vector.of(-.05, 0, 0), itemStack);
    }
    scene.idle(8);
    scene.overlay.showText(360).text("Funnels are ideal for transferring items from and to inventories.").independent();
    scene.markAsFinished();
}
Also used : Selection(com.simibubi.create.foundation.ponder.Selection) Vec3(net.minecraft.world.phys.Vec3) BlockPos(net.minecraft.core.BlockPos) WorldSectionElement(com.simibubi.create.foundation.ponder.element.WorldSectionElement) EntityElement(com.simibubi.create.foundation.ponder.element.EntityElement) ItemStack(net.minecraft.world.item.ItemStack)

Aggregations

Selection (com.simibubi.create.foundation.ponder.Selection)94 BlockPos (net.minecraft.core.BlockPos)84 WorldSectionElement (com.simibubi.create.foundation.ponder.element.WorldSectionElement)59 InputWindowElement (com.simibubi.create.foundation.ponder.element.InputWindowElement)57 Vec3 (net.minecraft.world.phys.Vec3)51 ItemStack (net.minecraft.world.item.ItemStack)46 Entity (net.minecraft.world.entity.Entity)15 AABB (net.minecraft.world.phys.AABB)14 EntityElement (com.simibubi.create.foundation.ponder.element.EntityElement)11 ItemEntity (net.minecraft.world.entity.item.ItemEntity)11 FluidStack (net.minecraftforge.fluids.FluidStack)10 SceneBuilder (com.simibubi.create.foundation.ponder.SceneBuilder)8 Direction (net.minecraft.core.Direction)8 ElementLink (com.simibubi.create.foundation.ponder.ElementLink)7 PonderPalette (com.simibubi.create.foundation.ponder.PonderPalette)7 SceneBuildingUtil (com.simibubi.create.foundation.ponder.SceneBuildingUtil)7 BlockState (net.minecraft.world.level.block.state.BlockState)7 CapabilityFluidHandler (net.minecraftforge.fluids.capability.CapabilityFluidHandler)6 FluidAction (net.minecraftforge.fluids.capability.IFluidHandler.FluidAction)6 ParrotElement (com.simibubi.create.foundation.ponder.element.ParrotElement)5