Search in sources :

Example 26 with InputWindowElement

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

the class ProcessingScenes method millstone.

public static void millstone(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("millstone", "Processing Items in the Millstone");
    scene.configureBasePlate(0, 0, 5);
    Selection belt = util.select.fromTo(1, 1, 5, 0, 1, 2).add(util.select.position(1, 2, 2));
    Selection beltCog = util.select.position(2, 0, 5);
    scene.world.showSection(util.select.layer(0).substract(beltCog), Direction.UP);
    BlockPos millstone = util.grid.at(2, 2, 2);
    Selection millstoneSelect = util.select.position(2, 2, 2);
    Selection cogs = util.select.fromTo(3, 1, 2, 3, 2, 2);
    scene.world.setKineticSpeed(millstoneSelect, 0);
    scene.idle(5);
    scene.world.showSection(util.select.position(4, 1, 3), Direction.DOWN);
    scene.world.showSection(util.select.position(2, 1, 2), Direction.DOWN);
    scene.idle(10);
    scene.world.showSection(util.select.position(millstone), Direction.DOWN);
    scene.idle(10);
    Vec3 millstoneTop = util.vector.topOf(millstone);
    scene.overlay.showText(60).attachKeyFrame().text("Millstones process items by grinding them").pointAt(millstoneTop).placeNearTarget();
    scene.idle(70);
    scene.world.showSection(cogs, Direction.DOWN);
    scene.idle(10);
    scene.world.setKineticSpeed(millstoneSelect, 32);
    scene.effects.indicateSuccess(millstone);
    scene.idle(10);
    scene.overlay.showText(60).attachKeyFrame().colored(PonderPalette.GREEN).text("They can be powered from the side using cogwheels").pointAt(util.vector.topOf(millstone.east())).placeNearTarget();
    scene.idle(70);
    ItemStack itemStack = new ItemStack(Items.WHEAT);
    Vec3 entitySpawn = util.vector.topOf(millstone.above(3));
    ElementLink<EntityElement> entity1 = scene.world.createItemEntity(entitySpawn, util.vector.of(0, 0.2, 0), itemStack);
    scene.idle(18);
    scene.world.modifyEntity(entity1, Entity::discard);
    scene.world.modifyTileEntity(millstone, MillstoneTileEntity.class, ms -> ms.inputInv.setStackInSlot(0, itemStack));
    scene.idle(10);
    scene.overlay.showControls(new InputWindowElement(millstoneTop, Pointing.DOWN).withItem(itemStack), 30);
    scene.idle(7);
    scene.overlay.showText(40).attachKeyFrame().text("Throw or Insert items at the top").pointAt(millstoneTop).placeNearTarget();
    scene.idle(60);
    scene.world.modifyTileEntity(millstone, MillstoneTileEntity.class, ms -> ms.inputInv.setStackInSlot(0, ItemStack.EMPTY));
    scene.overlay.showText(50).text("After some time, the result can be obtained via Right-click").pointAt(util.vector.blockSurface(millstone, Direction.WEST)).placeNearTarget();
    scene.idle(60);
    ItemStack flour = AllItems.WHEAT_FLOUR.asStack();
    scene.overlay.showControls(new InputWindowElement(util.vector.blockSurface(millstone, Direction.NORTH), Pointing.RIGHT).rightClick().withItem(flour), 40);
    scene.idle(50);
    scene.addKeyframe();
    scene.world.showSection(beltCog, Direction.UP);
    scene.world.showSection(belt, Direction.EAST);
    scene.idle(15);
    BlockPos beltPos = util.grid.at(1, 1, 2);
    scene.world.createItemOnBelt(beltPos, Direction.EAST, flour);
    scene.idle(15);
    scene.world.createItemOnBelt(beltPos, Direction.EAST, new ItemStack(Items.WHEAT_SEEDS));
    scene.idle(20);
    scene.overlay.showText(50).text("The outputs can also be extracted by automation").pointAt(util.vector.blockSurface(millstone, Direction.WEST).add(-.5, .4, 0)).placeNearTarget();
    scene.idle(60);
}
Also used : BasinTileEntity(com.simibubi.create.content.contraptions.processing.BasinTileEntity) MechanicalPressTileEntity(com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity) DeployerTileEntity(com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity) Entity(net.minecraft.world.entity.Entity) ItemEntity(net.minecraft.world.entity.item.ItemEntity) MillstoneTileEntity(com.simibubi.create.content.contraptions.components.millstone.MillstoneTileEntity) MechanicalMixerTileEntity(com.simibubi.create.content.contraptions.components.mixer.MechanicalMixerTileEntity) 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)

Example 27 with InputWindowElement

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

the class ProcessingScenes method basin.

public static void basin(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("basin", "Processing Items in the Basin");
    scene.configureBasePlate(0, 0, 5);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    scene.idle(5);
    scene.world.showSection(util.select.position(1, 1, 2), Direction.DOWN);
    scene.idle(10);
    BlockPos basinPos = util.grid.at(1, 2, 2);
    scene.world.modifyBlock(basinPos, s -> s.setValue(BasinBlock.FACING, Direction.DOWN), false);
    scene.world.showSection(util.select.position(basinPos), Direction.DOWN);
    scene.idle(10);
    Vec3 basinSide = util.vector.blockSurface(basinPos, Direction.WEST);
    scene.overlay.showText(80).attachKeyFrame().text("A Basin can hold Items and Fluids for Processing").pointAt(basinSide).placeNearTarget();
    scene.idle(10);
    ItemStack stack = new ItemStack(Items.BRICK);
    for (int i = 0; i < 4; i++) {
        scene.world.createItemEntity(util.vector.centerOf(basinPos.above(3)), util.vector.of(0, 0, 0), stack);
        scene.idle(10);
    }
    scene.idle(10);
    scene.overlay.showControls(new InputWindowElement(util.vector.topOf(basinPos), Pointing.DOWN).withItem(stack), 30);
    scene.idle(30);
    for (Direction d : Iterate.horizontalDirections) {
        scene.overlay.showOutline(PonderPalette.GREEN, new Object(), util.select.position(basinPos.below().relative(d)), 60);
        scene.idle(4);
    }
    scene.overlay.showText(80).attachKeyFrame().colored(PonderPalette.GREEN).text("After a processing step, basins try to output below to the side of them").pointAt(basinSide).placeNearTarget();
    scene.idle(90);
    ElementLink<WorldSectionElement> depot = scene.world.showIndependentSection(util.select.position(3, 1, 1), Direction.EAST);
    scene.world.moveSection(depot, util.vector.of(-2, 0, 0), 0);
    scene.idle(10);
    scene.world.modifyBlock(basinPos, s -> s.setValue(BasinBlock.FACING, Direction.NORTH), false);
    scene.idle(10);
    scene.overlay.showText(80).attachKeyFrame().colored(PonderPalette.GREEN).text("When a valid component is present, the Basin will show an output faucet").pointAt(basinSide.add(0.15, 0, -0.5)).placeNearTarget();
    scene.idle(90);
    scene.world.hideIndependentSection(depot, Direction.EAST);
    scene.idle(15);
    depot = scene.world.showIndependentSection(util.select.position(0, 1, 1), Direction.EAST);
    scene.world.moveSection(depot, util.vector.of(1, 0, 0), 0);
    scene.idle(20);
    scene.world.hideIndependentSection(depot, Direction.EAST);
    scene.overlay.showText(80).text("A number of options are applicable here").pointAt(util.vector.centerOf(util.grid.at(1, 1, 1))).placeNearTarget();
    scene.idle(15);
    depot = scene.world.showIndependentSection(util.select.position(1, 1, 0), Direction.EAST);
    scene.world.moveSection(depot, util.vector.of(0, 0, 1), 0);
    scene.idle(20);
    scene.world.hideIndependentSection(depot, Direction.EAST);
    scene.idle(15);
    depot = scene.world.showIndependentSection(util.select.position(1, 1, 1), Direction.EAST);
    scene.idle(20);
    scene.world.hideIndependentSection(depot, Direction.EAST);
    scene.idle(15);
    depot = scene.world.showIndependentSection(util.select.fromTo(3, 1, 0, 2, 1, 0), Direction.EAST);
    scene.world.moveSection(depot, util.vector.of(-2, 0, 1), 0);
    scene.idle(20);
    scene.world.hideIndependentSection(depot, Direction.EAST);
    scene.idle(15);
    depot = scene.world.showIndependentSection(util.select.position(2, 1, 1), Direction.EAST);
    scene.world.moveSection(depot, util.vector.of(-1, 0, 0), 0);
    scene.idle(25);
    BlockPos pressPos = util.grid.at(1, 4, 2);
    scene.world.showSection(util.select.position(pressPos), Direction.DOWN);
    scene.idle(5);
    scene.world.showSection(util.select.fromTo(1, 4, 3, 1, 1, 5), Direction.NORTH);
    scene.idle(10);
    Class<MechanicalPressTileEntity> type = MechanicalPressTileEntity.class;
    scene.world.modifyTileEntity(pressPos, type, pte -> pte.start(Mode.BASIN));
    scene.idle(30);
    scene.world.modifyTileEntity(pressPos, type, pte -> pte.makeCompactingParticleEffect(util.vector.centerOf(basinPos), stack));
    scene.world.modifyTileNBT(util.select.position(basinPos), BasinTileEntity.class, nbt -> {
        nbt.put("VisualizedItems", NBTHelper.writeCompoundList(ImmutableList.of(IntAttached.with(1, new ItemStack(Blocks.BRICKS))), ia -> ia.getValue().serializeNBT()));
    });
    scene.idle(4);
    scene.overlay.showControls(new InputWindowElement(util.vector.topOf(basinPos.below().north()), Pointing.RIGHT).withItem(new ItemStack(Items.BRICKS)), 30);
    scene.overlay.showText(60).attachKeyFrame().colored(PonderPalette.GREEN).text("Outputs will be caught by the inventory below").pointAt(basinSide.add(0, -1, -1)).placeNearTarget();
    scene.idle(70);
    scene.world.hideIndependentSection(depot, Direction.NORTH);
    scene.idle(10);
    scene.world.modifyBlock(basinPos, s -> s.setValue(BasinBlock.FACING, Direction.DOWN), false);
    scene.idle(20);
    scene.overlay.showText(80).attachKeyFrame().text("Without output faucet, the Basin will retain items created in its processing").pointAt(basinSide).placeNearTarget();
    scene.idle(50);
    ItemStack nugget = AllItems.COPPER_NUGGET.asStack();
    scene.overlay.showControls(new InputWindowElement(util.vector.topOf(basinPos), Pointing.RIGHT).withItem(nugget), 30);
    scene.idle(30);
    scene.world.modifyTileEntity(pressPos, type, pte -> pte.start(Mode.BASIN));
    scene.idle(30);
    scene.world.modifyTileEntity(pressPos, type, pte -> pte.makeCompactingParticleEffect(util.vector.centerOf(basinPos), nugget));
    ItemStack ingot = new ItemStack(Items.COPPER_INGOT);
    scene.idle(30);
    scene.overlay.showControls(new InputWindowElement(util.vector.topOf(basinPos), Pointing.RIGHT).withItem(ingot), 30);
    scene.idle(30);
    scene.world.modifyTileEntity(pressPos, type, pte -> pte.start(Mode.BASIN));
    scene.idle(30);
    scene.world.modifyTileEntity(pressPos, type, pte -> pte.makeCompactingParticleEffect(util.vector.centerOf(basinPos), ingot));
    ItemStack block = new ItemStack(Items.COPPER_BLOCK);
    scene.idle(30);
    scene.overlay.showControls(new InputWindowElement(util.vector.topOf(basinPos), Pointing.RIGHT).withItem(block), 30);
    scene.overlay.showText(70).attachKeyFrame().colored(PonderPalette.GREEN).text("This can be useful if outputs should be re-used as ingredients").pointAt(basinSide).placeNearTarget();
    scene.idle(80);
    scene.world.showSection(util.select.fromTo(2, 2, 5, 4, 1, 2), Direction.DOWN);
    scene.rotateCameraY(70);
    scene.world.createItemOnBelt(util.grid.at(2, 1, 2), Direction.WEST, block);
    scene.idle(40);
    scene.overlay.showText(70).text("Desired outputs will then have to be extracted from the basin").pointAt(util.vector.topOf(util.grid.at(3, 1, 2)).subtract(0, 3 / 16f, 0)).placeNearTarget();
    scene.idle(80);
    Vec3 filter = util.vector.of(2.5, 2.85, 2.5);
    scene.overlay.showFilterSlotInput(filter, 80);
    scene.overlay.showText(70).text("A Filter might be necessary to avoid pulling out un-processed items").pointAt(filter).placeNearTarget();
    scene.idle(40);
    scene.markAsFinished();
}
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) EntityType(net.minecraft.world.entity.EntityType) BasinTileEntity(com.simibubi.create.content.contraptions.processing.BasinTileEntity) Pointing(com.simibubi.create.foundation.utility.Pointing) MechanicalPressTileEntity(com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity) ItemParticleOption(net.minecraft.core.particles.ItemParticleOption) AllItems(com.simibubi.create.AllItems) ElementLink(com.simibubi.create.foundation.ponder.ElementLink) ImmutableList(com.google.common.collect.ImmutableList) BasinBlock(com.simibubi.create.content.contraptions.processing.BasinBlock) PonderPalette(com.simibubi.create.foundation.ponder.PonderPalette) BeltItemElement(com.simibubi.create.foundation.ponder.element.BeltItemElement) DeployerTileEntity(com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity) AllBlocks(com.simibubi.create.AllBlocks) Selection(com.simibubi.create.foundation.ponder.Selection) Iterate(com.simibubi.create.foundation.utility.Iterate) Mode(com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity.Mode) EntityElement(com.simibubi.create.foundation.ponder.element.EntityElement) Emitter(com.simibubi.create.foundation.ponder.instruction.EmitParticlesInstruction.Emitter) Blaze(net.minecraft.world.entity.monster.Blaze) SceneBuildingUtil(com.simibubi.create.foundation.ponder.SceneBuildingUtil) BlazeBurnerBlock(com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock) HeatLevel(com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel) IntAttached(com.simibubi.create.foundation.utility.IntAttached) 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) LitBlazeBurnerBlock(com.simibubi.create.content.contraptions.processing.burner.LitBlazeBurnerBlock) NBTHelper(com.simibubi.create.foundation.utility.NBTHelper) ItemStack(net.minecraft.world.item.ItemStack) MillstoneTileEntity(com.simibubi.create.content.contraptions.components.millstone.MillstoneTileEntity) MechanicalMixerTileEntity(com.simibubi.create.content.contraptions.components.mixer.MechanicalMixerTileEntity) ParticleTypes(net.minecraft.core.particles.ParticleTypes) Vec3(net.minecraft.world.phys.Vec3) 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) Direction(net.minecraft.core.Direction) MechanicalPressTileEntity(com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity)

Example 28 with InputWindowElement

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

the class RedstoneScenes method pulseRepeater.

public static void pulseRepeater(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("pulse_repeater", "Controlling signals using Pulse Repeaters");
    scene.configureBasePlate(0, 0, 5);
    scene.world.showSection(util.select.layer(0), Direction.UP);
    BlockPos circuitPos = util.grid.at(2, 1, 2);
    BlockPos leverPos = util.grid.at(4, 1, 2);
    scene.world.modifyTileNBT(util.select.position(circuitPos), PulseRepeaterTileEntity.class, nbt -> nbt.putInt("ScrollValue", 30));
    scene.world.showSection(util.select.layersFrom(1).substract(util.select.position(circuitPos)), Direction.UP);
    scene.idle(10);
    scene.world.showSection(util.select.position(circuitPos), Direction.DOWN);
    scene.idle(20);
    Vec3 circuitTop = util.vector.blockSurface(circuitPos, Direction.DOWN).add(0, 3 / 16f, 0);
    scene.effects.indicateRedstone(leverPos);
    scene.world.toggleRedstonePower(util.select.fromTo(4, 1, 2, 2, 1, 2));
    scene.idle(30);
    scene.world.cycleBlockProperty(circuitPos, BrassDiodeBlock.POWERING);
    scene.world.toggleRedstonePower(util.select.fromTo(1, 1, 2, 0, 1, 2));
    scene.idle(2);
    scene.world.cycleBlockProperty(circuitPos, BrassDiodeBlock.POWERING);
    scene.world.toggleRedstonePower(util.select.position(1, 1, 2));
    scene.idle(1);
    scene.world.toggleRedstonePower(util.select.position(0, 1, 2));
    scene.idle(15);
    scene.overlay.showText(60).text("Pulse Repeaters emit a short pulse at a delay").attachKeyFrame().placeNearTarget().pointAt(circuitTop);
    scene.world.toggleRedstonePower(util.select.fromTo(4, 1, 2, 2, 1, 2));
    scene.idle(70);
    scene.overlay.showRepeaterScrollInput(circuitPos, 60);
    scene.overlay.showControls(new InputWindowElement(circuitTop, Pointing.DOWN).scroll(), 60);
    scene.idle(10);
    scene.overlay.showText(60).text("Using the mouse wheel, the charge time can be configured").attachKeyFrame().placeNearTarget().pointAt(circuitTop);
    scene.world.modifyTileNBT(util.select.position(circuitPos), PulseRepeaterTileEntity.class, nbt -> nbt.putInt("ScrollValue", 120));
    scene.idle(70);
    scene.effects.indicateRedstone(leverPos);
    scene.world.toggleRedstonePower(util.select.fromTo(4, 1, 2, 2, 1, 2));
    scene.idle(60);
    scene.overlay.showText(50).text("Configured delays can range up to 30 minutes").placeNearTarget().pointAt(circuitTop);
    scene.idle(60);
    scene.world.cycleBlockProperty(circuitPos, BrassDiodeBlock.POWERING);
    scene.world.toggleRedstonePower(util.select.fromTo(1, 1, 2, 0, 1, 2));
    scene.idle(2);
    scene.world.cycleBlockProperty(circuitPos, BrassDiodeBlock.POWERING);
    scene.world.toggleRedstonePower(util.select.position(1, 1, 2));
    scene.idle(1);
    scene.world.toggleRedstonePower(util.select.position(0, 1, 2));
}
Also used : Vec3(net.minecraft.world.phys.Vec3) InputWindowElement(com.simibubi.create.foundation.ponder.element.InputWindowElement) BlockPos(net.minecraft.core.BlockPos)

Example 29 with InputWindowElement

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

the class RedstoneScenes method redstoneLink.

public static void redstoneLink(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("redstone_link", "Using Redstone Links");
    scene.configureBasePlate(0, 0, 5);
    scene.world.showSection(util.select.layer(0).add(util.select.fromTo(3, 1, 1, 2, 1, 1)), Direction.UP);
    scene.idle(5);
    scene.world.showSection(util.select.fromTo(4, 1, 3, 0, 2, 3), Direction.DOWN);
    scene.idle(10);
    Selection redstone = util.select.fromTo(3, 1, 1, 1, 1, 1);
    BlockPos leverPos = util.grid.at(3, 1, 1);
    BlockPos link1Pos = util.grid.at(1, 1, 1);
    BlockPos link2Pos = util.grid.at(1, 2, 2);
    BlockPos link3Pos = util.grid.at(3, 2, 2);
    Selection link1Select = util.select.position(link1Pos);
    Selection link2Select = util.select.position(link2Pos);
    Selection link3Select = util.select.position(link3Pos);
    Vec3 link1Vec = util.vector.blockSurface(link1Pos, Direction.DOWN).add(0, 3 / 16f, 0);
    Vec3 link2Vec = util.vector.blockSurface(link2Pos, Direction.SOUTH).add(0, 0, -3 / 16f);
    Vec3 link3Vec = util.vector.blockSurface(link3Pos, Direction.SOUTH).add(0, 0, -3 / 16f);
    scene.world.showSection(link1Select, Direction.DOWN);
    scene.idle(5);
    scene.world.showSection(link2Select, Direction.DOWN);
    scene.idle(5);
    scene.world.showSection(link3Select, Direction.DOWN);
    scene.idle(10);
    scene.overlay.showText(50).attachKeyFrame().text("Redstone Links can transmit redstone signals wirelessly").placeNearTarget().pointAt(link1Vec);
    scene.idle(60);
    scene.overlay.showControls(new InputWindowElement(link2Vec, Pointing.UP).rightClick().whileSneaking(), 40);
    scene.idle(7);
    scene.world.modifyBlock(link2Pos, s -> s.cycle(RedstoneLinkBlock.RECEIVER), true);
    scene.idle(10);
    scene.overlay.showText(50).text("Right-click while Sneaking to toggle receive mode").placeNearTarget().pointAt(link2Vec);
    scene.idle(60);
    scene.overlay.showControls(new InputWindowElement(link3Vec, Pointing.UP).rightClick().withWrench(), 40);
    scene.idle(7);
    scene.world.modifyBlock(link3Pos, s -> s.cycle(RedstoneLinkBlock.RECEIVER), true);
    scene.idle(10);
    scene.overlay.showText(50).text("A simple Right-click with a Wrench can do the same").placeNearTarget().pointAt(link3Vec);
    scene.idle(70);
    scene.addKeyframe();
    scene.idle(10);
    scene.world.toggleRedstonePower(redstone);
    scene.effects.indicateRedstone(leverPos);
    scene.idle(5);
    scene.world.toggleRedstonePower(util.select.fromTo(3, 2, 3, 1, 2, 2));
    scene.effects.indicateRedstone(link2Pos);
    scene.effects.indicateRedstone(link3Pos);
    scene.idle(10);
    scene.overlay.showText(70).colored(PonderPalette.GREEN).text("Receivers emit the redstone power of transmitters within 128 blocks").placeNearTarget().pointAt(link2Vec);
    scene.idle(80);
    scene.world.toggleRedstonePower(redstone);
    scene.idle(5);
    scene.world.toggleRedstonePower(util.select.fromTo(3, 2, 3, 1, 2, 2));
    scene.idle(20);
    Vec3 frontSlot = link1Vec.add(.18, -.05, -.15);
    Vec3 backSlot = link1Vec.add(.18, -.05, .15);
    Vec3 top2Slot = link2Vec.add(-.09, .15, 0);
    Vec3 bottom2Slot = link2Vec.add(-.09, -.2, 0);
    Vec3 top3Slot = link3Vec.add(-.09, .15, 0);
    Vec3 bottom3Slot = link3Vec.add(-.09, -.2, 0);
    scene.addKeyframe();
    scene.idle(10);
    scene.overlay.showFilterSlotInput(frontSlot, 100);
    scene.overlay.showFilterSlotInput(backSlot, 100);
    scene.idle(10);
    scene.overlay.showText(50).text("Placing items in the two slots can specify a Frequency").placeNearTarget().pointAt(backSlot);
    scene.idle(60);
    ItemStack iron = new ItemStack(Items.IRON_INGOT);
    ItemStack gold = new ItemStack(Items.GOLD_INGOT);
    ItemStack sapling = new ItemStack(Items.OAK_SAPLING);
    scene.overlay.showControls(new InputWindowElement(backSlot, Pointing.DOWN).withItem(iron), 40);
    scene.idle(7);
    scene.overlay.showControls(new InputWindowElement(frontSlot, Pointing.UP).withItem(sapling), 40);
    scene.world.modifyTileNBT(link1Select, RedstoneLinkTileEntity.class, nbt -> nbt.put("FrequencyLast", iron.save(new CompoundTag())));
    scene.idle(7);
    scene.world.modifyTileNBT(link1Select, RedstoneLinkTileEntity.class, nbt -> nbt.put("FrequencyFirst", sapling.save(new CompoundTag())));
    scene.idle(20);
    scene.overlay.showControls(new InputWindowElement(top2Slot, Pointing.DOWN).withItem(iron), 40);
    scene.idle(7);
    scene.overlay.showControls(new InputWindowElement(bottom2Slot, Pointing.UP).withItem(sapling), 40);
    scene.world.modifyTileNBT(link2Select, RedstoneLinkTileEntity.class, nbt -> nbt.put("FrequencyLast", iron.save(new CompoundTag())));
    scene.idle(7);
    scene.world.modifyTileNBT(link2Select, RedstoneLinkTileEntity.class, nbt -> nbt.put("FrequencyFirst", sapling.save(new CompoundTag())));
    scene.idle(20);
    scene.overlay.showControls(new InputWindowElement(top3Slot, Pointing.DOWN).withItem(gold), 40);
    scene.idle(7);
    scene.overlay.showControls(new InputWindowElement(bottom3Slot, Pointing.UP).withItem(sapling), 40);
    scene.world.modifyTileNBT(link3Select, RedstoneLinkTileEntity.class, nbt -> nbt.put("FrequencyLast", gold.save(new CompoundTag())));
    scene.idle(7);
    scene.world.modifyTileNBT(link3Select, RedstoneLinkTileEntity.class, nbt -> nbt.put("FrequencyFirst", sapling.save(new CompoundTag())));
    scene.idle(20);
    scene.world.toggleRedstonePower(redstone);
    scene.effects.indicateRedstone(leverPos);
    scene.idle(5);
    scene.world.toggleRedstonePower(util.select.fromTo(1, 2, 2, 1, 2, 3));
    scene.effects.indicateRedstone(link2Pos);
    scene.overlay.showText(90).attachKeyFrame().text("Only the links with matching Frequencies will communicate").placeNearTarget().pointAt(link2Vec);
    scene.idle(100);
}
Also used : 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) ItemStack(net.minecraft.world.item.ItemStack) CompoundTag(net.minecraft.nbt.CompoundTag)

Example 30 with InputWindowElement

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

the class RedstoneScenes method analogLever.

public static void analogLever(SceneBuilder scene, SceneBuildingUtil util) {
    scene.title("analog_lever", "Controlling signals using the Analog Lever");
    scene.configureBasePlate(0, 0, 5);
    BlockPos[] wireLocations = new BlockPos[] { util.grid.at(2, 1, 1), util.grid.at(2, 1, 0), util.grid.at(1, 1, 0), util.grid.at(0, 1, 0), util.grid.at(0, 1, 1), util.grid.at(0, 1, 2), util.grid.at(0, 1, 3), util.grid.at(0, 1, 4), util.grid.at(1, 1, 4), util.grid.at(2, 1, 4), util.grid.at(3, 1, 4), util.grid.at(4, 1, 4), util.grid.at(4, 1, 3), util.grid.at(4, 1, 2), util.grid.at(4, 1, 1) };
    Selection leverSelection = util.select.fromTo(2, 1, 2, 2, 2, 2);
    Selection lamp = util.select.position(4, 1, 0);
    BlockPos leverPos = util.grid.at(2, 2, 2);
    Vec3 leverVec = util.vector.centerOf(leverPos).add(0, -.25, 0);
    scene.world.showSection(util.select.layersFrom(0).substract(lamp).substract(leverSelection), Direction.UP);
    scene.idle(5);
    scene.world.showSection(lamp, Direction.DOWN);
    scene.idle(10);
    scene.world.showSection(leverSelection, Direction.DOWN);
    scene.idle(20);
    scene.overlay.showText(60).text("Analog Levers make for a compact and precise source of redstone power").placeNearTarget().attachKeyFrame().pointAt(leverVec);
    scene.idle(70);
    IntegerProperty power = RedStoneWireBlock.POWER;
    scene.overlay.showControls(new InputWindowElement(leverVec, Pointing.DOWN).rightClick(), 40);
    scene.idle(7);
    for (int i = 0; i < 7; i++) {
        scene.idle(2);
        final int state = i + 1;
        scene.world.modifyTileNBT(leverSelection, AnalogLeverTileEntity.class, nbt -> nbt.putInt("State", state));
        scene.world.modifyBlock(wireLocations[i], s -> s.setValue(power, 7 - state), false);
        scene.effects.indicateRedstone(wireLocations[i]);
    }
    scene.idle(20);
    scene.overlay.showText(60).attachKeyFrame().text("Right-click to increase its analog power output").placeNearTarget().pointAt(leverVec);
    scene.idle(70);
    scene.overlay.showControls(new InputWindowElement(leverVec, Pointing.DOWN).rightClick().whileSneaking(), 40);
    scene.idle(7);
    for (int i = 7; i > 0; i--) {
        scene.idle(2);
        final int state = i - 1;
        if (i > 3) {
            scene.world.modifyTileNBT(leverSelection, AnalogLeverTileEntity.class, nbt -> nbt.putInt("State", state));
            scene.effects.indicateRedstone(wireLocations[i]);
        }
        scene.world.modifyBlock(wireLocations[i], s -> s.setValue(power, state > 2 ? 0 : 3 - state), false);
    }
    scene.world.modifyBlock(wireLocations[0], s -> s.setValue(power, 3), false);
    scene.idle(20);
    scene.overlay.showText(60).attachKeyFrame().text("Right-click while Sneaking to decrease the power output again").placeNearTarget().pointAt(leverVec);
    scene.idle(70);
    scene.overlay.showControls(new InputWindowElement(leverVec, Pointing.DOWN).rightClick(), 40);
    scene.idle(7);
    for (int i = 0; i < 15; i++) {
        scene.idle(2);
        final int state = i + 1;
        if (i >= 4) {
            scene.world.modifyTileNBT(leverSelection, AnalogLeverTileEntity.class, nbt -> nbt.putInt("State", state));
            scene.effects.indicateRedstone(wireLocations[i]);
        }
        scene.world.modifyBlock(wireLocations[i], s -> s.setValue(power, 15 - state), false);
    }
    scene.world.toggleRedstonePower(lamp);
    scene.effects.indicateRedstone(leverPos);
    scene.effects.indicateRedstone(util.grid.at(4, 1, 1));
    scene.idle(20);
}
Also used : IntegerProperty(net.minecraft.world.level.block.state.properties.IntegerProperty) 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)

Aggregations

InputWindowElement (com.simibubi.create.foundation.ponder.element.InputWindowElement)85 BlockPos (net.minecraft.core.BlockPos)75 Vec3 (net.minecraft.world.phys.Vec3)63 Selection (com.simibubi.create.foundation.ponder.Selection)61 ItemStack (net.minecraft.world.item.ItemStack)60 WorldSectionElement (com.simibubi.create.foundation.ponder.element.WorldSectionElement)47 Entity (net.minecraft.world.entity.Entity)25 ItemEntity (net.minecraft.world.entity.item.ItemEntity)18 EntityElement (com.simibubi.create.foundation.ponder.element.EntityElement)17 AABB (net.minecraft.world.phys.AABB)16 Direction (net.minecraft.core.Direction)12 ElementLink (com.simibubi.create.foundation.ponder.ElementLink)11 MechanicalPressTileEntity (com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity)9 PonderPalette (com.simibubi.create.foundation.ponder.PonderPalette)9 SceneBuilder (com.simibubi.create.foundation.ponder.SceneBuilder)9 SceneBuildingUtil (com.simibubi.create.foundation.ponder.SceneBuildingUtil)9 Pointing (com.simibubi.create.foundation.utility.Pointing)9 DeployerTileEntity (com.simibubi.create.content.contraptions.components.deployer.DeployerTileEntity)8 Items (net.minecraft.world.item.Items)8 BlockState (net.minecraft.world.level.block.state.BlockState)8