Search in sources :

Example 16 with EntityElement

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

the class FunnelScenes method directionality.

public static void directionality(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("funnel_direction", "Direction of Transfer");
    scene.configureBasePlate(0, 0, 5);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    scene.world.modifyKineticSpeed(util.select.everywhere(), f -> f / 2f);
    scene.world.setBlocks(util.select.position(3, 1, 1), AllBlocks.ANDESITE_CASING.getDefaultState(), false);
    BlockPos topFunnel = util.grid.at(3, 3, 2);
    Selection topFunnelSelection = util.select.position(topFunnel);
    Selection firstShow = util.select.fromTo(3, 1, 2, 3, 2, 2);
    scene.idle(5);
    scene.world.showSection(firstShow, Direction.DOWN);
    scene.idle(15);
    ItemStack itemStack = AllBlocks.BRASS_BLOCK.asStack();
    Vec3 topCenter = util.vector.centerOf(topFunnel);
    Vec3 topSide = util.vector.blockSurface(topFunnel, Direction.EAST);
    InputWindowElement controlsSneak = new InputWindowElement(topCenter, Pointing.DOWN).rightClick().whileSneaking();
    // Placing funnels without sneak
    scene.world.showSection(topFunnelSelection, Direction.DOWN);
    scene.overlay.showText(80).text("Placed normally, it pulls items from the inventory.").attachKeyFrame().pointAt(topCenter).placeNearTarget();
    scene.idle(45);
    ElementLink<EntityElement> itemLink = scene.world.createItemEntity(topCenter, util.vector.of(0, 4 / 16f, 0), itemStack);
    scene.idle(40);
    scene.world.modifyEntity(itemLink, Entity::discard);
    scene.world.hideSection(topFunnelSelection, Direction.UP);
    scene.idle(20);
    // Placing funnels with sneak
    scene.world.modifyBlock(topFunnel, s -> s.setValue(FunnelBlock.EXTRACTING, false), false);
    scene.idle(5);
    scene.world.showSection(topFunnelSelection, Direction.DOWN);
    scene.overlay.showControls(controlsSneak, 35);
    scene.overlay.showText(80).text("Placed while sneaking, it puts items into the inventory.").attachKeyFrame().pointAt(topCenter).placeNearTarget();
    scene.idle(45);
    itemLink = scene.world.createItemEntity(topCenter.add(0, 3, 0), util.vector.of(0, -0.2, 0), itemStack);
    scene.idle(10);
    scene.world.modifyEntity(itemLink, Entity::discard);
    scene.idle(45);
    // Wrench interaction
    InputWindowElement wrenchControls = new InputWindowElement(topSide, Pointing.RIGHT).rightClick().withWrench();
    scene.overlay.showControls(wrenchControls, 40);
    scene.idle(10);
    scene.world.modifyBlock(topFunnel, s -> s.cycle(FunnelBlock.EXTRACTING), true);
    scene.idle(10);
    scene.overlay.showText(80).text("Using a wrench, the funnel can be flipped after placement.").attachKeyFrame().pointAt(topCenter).placeNearTarget();
    itemLink = scene.world.createItemEntity(topCenter, util.vector.of(0, 4 / 16f, 0), itemStack);
    scene.idle(30);
    scene.overlay.showControls(wrenchControls, 40);
    scene.idle(10);
    scene.world.modifyBlock(topFunnel, s -> s.cycle(FunnelBlock.EXTRACTING), true);
    scene.idle(10);
    scene.world.modifyEntity(itemLink, Entity::discard);
    scene.idle(20);
    // Side funnel
    BlockPos sideFunnel = util.grid.at(3, 2, 1);
    Selection sideFunnelSelection = util.select.fromTo(sideFunnel.below(), sideFunnel);
    Vec3 sideCenter = util.vector.centerOf(sideFunnel);
    scene.world.modifyBlock(sideFunnel, s -> s.cycle(FunnelBlock.EXTRACTING), false);
    scene.world.showSection(sideFunnelSelection, Direction.DOWN);
    scene.overlay.showText(70).text("Same rules will apply for most orientations.").pointAt(sideCenter).placeNearTarget();
    scene.idle(20);
    scene.world.flapFunnel(sideFunnel, true);
    itemLink = scene.world.createItemEntity(sideCenter.subtract(0, .45, 0), util.vector.of(0, 0, -0.1), itemStack);
    scene.idle(60);
    scene.world.hideSection(sideFunnelSelection, Direction.UP);
    scene.world.hideSection(topFunnelSelection, Direction.UP);
    scene.world.modifyEntity(itemLink, Entity::discard);
    scene.idle(20);
    // Belt funnel
    Selection beltFunnelSetup = util.select.fromTo(0, 1, 0, 2, 2, 5);
    Selection gearshiftAndLever = util.select.fromTo(1, 1, 4, 1, 2, 4);
    Selection gearshiftedKinetics = util.select.fromTo(1, 1, 2, 2, 1, 4);
    Vec3 topOfBeltFunnel = util.vector.topOf(2, 2, 2);
    BlockPos beltPos = util.grid.at(2, 1, 2);
    BlockPos cogPos = util.grid.at(1, 1, 3);
    scene.world.showSection(beltFunnelSetup, Direction.DOWN);
    scene.overlay.showText(140).text("Funnels on belts will extract/insert depending on its movement direction.").attachKeyFrame().pointAt(topOfBeltFunnel);
    scene.idle(15);
    for (int i = 0; i < 2; i++) {
        scene.world.createItemOnBelt(beltPos, Direction.EAST, itemStack);
        scene.effects.rotationDirectionIndicator(cogPos);
        scene.idle(50);
        scene.world.modifyBlocks(gearshiftAndLever, s -> s.cycle(BlockStateProperties.POWERED), false);
        scene.world.modifyKineticSpeed(gearshiftedKinetics, f -> -f);
        scene.effects.indicateRedstone(util.grid.at(1, 2, 4));
        scene.effects.rotationDirectionIndicator(cogPos);
        scene.idle(35);
        scene.world.removeItemsFromBelt(beltPos);
        scene.world.flapFunnel(util.grid.at(2, 2, 2), false);
        if (i == 0) {
            scene.idle(50);
            scene.world.modifyBlocks(gearshiftAndLever, s -> s.cycle(BlockStateProperties.POWERED), false);
            scene.world.modifyKineticSpeed(gearshiftedKinetics, f -> -f);
            scene.effects.indicateRedstone(util.grid.at(1, 2, 4));
        }
    }
}
Also used : FunnelTileEntity(com.simibubi.create.content.logistics.block.funnel.FunnelTileEntity) Entity(net.minecraft.world.entity.Entity) ItemEntity(net.minecraft.world.entity.item.ItemEntity) Selection(com.simibubi.create.foundation.ponder.Selection) Vec3(net.minecraft.world.phys.Vec3) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) BlockPos(net.minecraft.core.BlockPos) EntityElement(com.simibubi.create.foundation.ponder.element.EntityElement) ItemStack(net.minecraft.world.item.ItemStack)

Aggregations

EntityElement (com.simibubi.create.foundation.ponder.element.EntityElement)16 ItemStack (net.minecraft.world.item.ItemStack)15 BlockPos (net.minecraft.core.BlockPos)14 Entity (net.minecraft.world.entity.Entity)14 InputWindowElement (com.simibubi.create.foundation.ponder.element.InputWindowElement)13 Vec3 (net.minecraft.world.phys.Vec3)13 Selection (com.simibubi.create.foundation.ponder.Selection)10 ItemEntity (net.minecraft.world.entity.item.ItemEntity)9 WorldSectionElement (com.simibubi.create.foundation.ponder.element.WorldSectionElement)8 DeployerTileEntity (com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity)3 MechanicalPressTileEntity (com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity)3 MillstoneTileEntity (com.simibubi.create.content.contraptions.components.millstone.MillstoneTileEntity)2 MechanicalMixerTileEntity (com.simibubi.create.content.contraptions.components.mixer.MechanicalMixerTileEntity)2 BasinTileEntity (com.simibubi.create.content.contraptions.processing.BasinTileEntity)2 HarvesterTileEntity (com.simibubi.create.content.contraptions.components.actors.HarvesterTileEntity)1 PortableItemInterfaceTileEntity (com.simibubi.create.content.contraptions.components.actors.PortableItemInterfaceTileEntity)1 PortableStorageInterfaceTileEntity (com.simibubi.create.content.contraptions.components.actors.PortableStorageInterfaceTileEntity)1 MechanicalCrafterTileEntity (com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterTileEntity)1 SawTileEntity (com.simibubi.create.content.contraptions.components.saw.SawTileEntity)1 SpoutTileEntity (com.simibubi.create.content.contraptions.fluids.actors.SpoutTileEntity)1