Thinking Arms

- Ponder Scenes for the Mechanical Arm
- Fixed empty basins showing a fluid container tooltip
This commit is contained in:
simibubi 2021-03-22 02:05:47 +01:00
parent 140cd9a85a
commit f7f7b67a7d
15 changed files with 733 additions and 67 deletions

View file

@ -108,9 +108,7 @@ public class AllShapes {
PUMP = shape(2, 0, 2, 14, 5, 14).add(4, 0, 4, 12, 16, 12)
.add(3, 12, 3, 13, 16, 13)
.forDirectional(Direction.UP),
CRUSHING_WHEEL_CONTROLLER_COLLISION = shape(0, 0, 0, 16, 13, 16)
.forDirectional(Direction.DOWN)
CRUSHING_WHEEL_CONTROLLER_COLLISION = shape(0, 0, 0, 16, 13, 16).forDirectional(Direction.DOWN)
;
@ -144,12 +142,12 @@ public class AllShapes {
.add(2, 0, 2, 14, 2, 14)
.build(),
SPEED_CONTROLLER = shape(0, 0, 0, 16, 4, 16).add(1, 1, 1, 15, 13, 15)
.add(0, 8, 0, 16, 14, 16).build(),
.add(0, 8, 0, 16, 14, 16)
.build(),
HEATER_BLOCK_SHAPE = shape(2, 0, 2, 14, 14, 14).add(0, 0, 0, 16, 4, 16)
.build(),
HEATER_BLOCK_SPECIAL_COLLISION_SHAPE = shape(0, 0, 0, 16, 4, 16).build(),
CRUSHING_WHEEL_COLLISION_SHAPE = cuboid(0, 0, 0, 16, 16, 16),
SEAT = cuboid(0, 0, 0, 16, 8, 16),
CRUSHING_WHEEL_COLLISION_SHAPE = cuboid(0, 0, 0, 16, 16, 16), SEAT = cuboid(0, 0, 0, 16, 8, 16),
SEAT_COLLISION = cuboid(0, 0, 0, 16, 6, 16),
MECHANICAL_PROCESSOR_SHAPE = shape(VoxelShapes.fullCube()).erase(4, 0, 4, 12, 16, 12)
.build(),
@ -172,8 +170,10 @@ public class AllShapes {
GAUGE_SHAPE_UP = shape(1, 0, 0, 15, 2, 16).add(2, 2, 1, 14, 14, 15)
.build(),
MECHANICAL_ARM = shape(2, 0, 2, 14, 10, 14).add(3, 0, 3, 13, 14, 13)
.add(0, 0, 0, 16, 6, 16)
.build(),
MECHANICAL_ARM_CEILING = shape(2, 6, 2, 14, 16, 14).add(3, 2, 3, 13, 16, 13)
.add(0, 10, 0, 16, 16, 16)
.build(),
CHUTE = shape(1, 8, 1, 15, 16, 15).add(2, 0, 2, 14, 8, 14)
.build(),

View file

@ -1,6 +1,11 @@
package com.simibubi.create.content.contraptions.goggles;
import java.text.NumberFormat;
import java.util.List;
import java.util.Locale;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
@ -10,10 +15,6 @@ import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler;
import java.text.NumberFormat;
import java.util.List;
import java.util.Locale;
/*
* Implement this Interface in the TileEntity class that wants to add info to the screen
* */
@ -34,7 +35,8 @@ public interface IHaveGoggleInformation {
}
static String format(double d) {
return numberFormat.get().format(d);
return numberFormat.get()
.format(d);
}
default boolean containedFluidTooltip(List<String> tooltip, boolean isPlayerSneaking,
@ -74,7 +76,13 @@ public interface IHaveGoggleInformation {
isEmpty = false;
}
if (tank.getTanks() > 1 || !isEmpty)
if (tank.getTanks() > 1) {
if (isEmpty)
tooltip.remove(tooltip.size() - 1);
return true;
}
if (!isEmpty)
return true;
ITextComponent capacity = new StringTextComponent(Lang.translate("gui.goggles.fluid_container.capacity"))
@ -101,7 +109,10 @@ public interface IHaveGoggleInformation {
}
public void update() {
format = NumberFormat.getInstance(Minecraft.getInstance().getLanguageManager().getCurrentLanguage().getJavaLocale());
format = NumberFormat.getInstance(Minecraft.getInstance()
.getLanguageManager()
.getCurrentLanguage()
.getJavaLocale());
format.setMaximumFractionDigits(2);
format.setMinimumFractionDigits(0);
format.setGroupingUsed(true);

View file

@ -498,7 +498,7 @@ public class ArmTileEntity extends KineticTileEntity {
@Override
protected Vec3d getLocalOffset(BlockState state) {
int yPos = state.get(ArmBlock.CEILING) ? 16 - 3 : 3;
Vec3d location = VecHelper.voxelSpace(8, yPos, 14.5);
Vec3d location = VecHelper.voxelSpace(8, yPos, 15.95);
location = VecHelper.rotateCentered(location, AngleHelper.horizontalAngle(getSide()), Direction.Axis.Y);
return location;
}

View file

@ -0,0 +1,611 @@
package com.simibubi.create.foundation.ponder.content;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllItems;
import com.simibubi.create.AllShapes;
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterTileEntity;
import com.simibubi.create.content.logistics.block.funnel.FunnelTileEntity;
import com.simibubi.create.content.logistics.block.mechanicalArm.ArmTileEntity.Phase;
import com.simibubi.create.foundation.ponder.ElementLink;
import com.simibubi.create.foundation.ponder.SceneBuilder;
import com.simibubi.create.foundation.ponder.SceneBuildingUtil;
import com.simibubi.create.foundation.ponder.Selection;
import com.simibubi.create.foundation.ponder.elements.InputWindowElement;
import com.simibubi.create.foundation.ponder.elements.WorldSectionElement;
import com.simibubi.create.foundation.utility.Pointing;
import net.minecraft.block.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
public class ArmScenes {
public static void setup(SceneBuilder scene, SceneBuildingUtil util) {
scene.title("mechanical_arm", "Setting up Mechanical Arms");
scene.configureBasePlate(0, 0, 5);
scene.showBasePlate();
ItemStack armItem = AllBlocks.MECHANICAL_ARM.asStack();
BlockPos armPos = util.grid.at(2, 1, 2);
Selection armSel = util.select.position(armPos);
BlockPos inputDepot = util.grid.at(4, 2, 1);
Vec3d depotSurface = util.vector.blockSurface(inputDepot, Direction.NORTH);
Vec3d armSurface = util.vector.blockSurface(armPos, Direction.WEST);
scene.idle(20);
scene.world.setKineticSpeed(armSel, 0);
scene.world.showSection(armSel, Direction.DOWN);
scene.idle(10);
scene.effects.indicateRedstone(armPos);
scene.overlay.showSelectionWithText(armSel, 70)
.attachKeyFrame()
.colored(PonderPalette.RED)
.text("Mechanical Arms have to be assigned their in- and outputs before they are placed")
.pointAt(armSurface)
.placeNearTarget();
scene.idle(80);
scene.world.showSection(util.select.fromTo(4, 1, 1, 4, 2, 1), Direction.DOWN);
scene.world.showSection(util.select.fromTo(0, 1, 1, 0, 2, 1), Direction.DOWN);
scene.world.hideSection(armSel, Direction.UP);
scene.idle(20);
scene.overlay.showControls(new InputWindowElement(depotSurface, Pointing.RIGHT).rightClick()
.withItem(armItem), 50);
scene.idle(7);
AxisAlignedBB depotBounds = AllShapes.DEPOT.getBoundingBox();
scene.overlay.chaseBoundingBoxOutline(PonderPalette.INPUT, new Object(), depotBounds.offset(4, 2, 1), 400);
scene.overlay.showText(70)
.attachKeyFrame()
.colored(PonderPalette.INPUT)
.text("Right-Click inventories while holding the Arm to assign them as Targets")
.pointAt(util.vector.blockSurface(inputDepot, Direction.WEST))
.placeNearTarget();
scene.idle(80);
BlockPos outputDepot = util.grid.at(0, 2, 1);
InputWindowElement input =
new InputWindowElement(util.vector.blockSurface(outputDepot, Direction.NORTH), Pointing.RIGHT).rightClick()
.withItem(armItem);
scene.overlay.showControls(input, 20);
scene.idle(7);
Object second = new Object();
scene.overlay.chaseBoundingBoxOutline(PonderPalette.INPUT, second, depotBounds.offset(0, 2, 1), 100);
scene.idle(25);
scene.overlay.showControls(input, 30);
scene.idle(7);
scene.overlay.chaseBoundingBoxOutline(PonderPalette.OUTPUT, second, depotBounds.offset(0, 2, 1), 280);
scene.overlay.showText(70)
.colored(PonderPalette.OUTPUT)
.text("Right-Click again to toggle between Input (Blue) and Output (Orange)")
.pointAt(util.vector.blockSurface(outputDepot, Direction.WEST))
.placeNearTarget();
scene.idle(80);
scene.world.showSection(util.select.position(1, 1, 0), Direction.DOWN);
scene.idle(15);
scene.overlay.chaseBoundingBoxOutline(PonderPalette.INPUT, new Object(), depotBounds.offset(1, 1, 0), 43);
scene.overlay.showText(50)
.colored(PonderPalette.WHITE)
.text("Left-Click components to remove their Selection")
.pointAt(util.vector.blockSurface(util.grid.at(1, 1, 0), Direction.WEST))
.placeNearTarget();
scene.idle(35);
scene.overlay
.showControls(new InputWindowElement(util.vector.topOf(util.grid.at(1, 1, 0)), Pointing.DOWN).leftClick()
.withItem(armItem), 30);
scene.idle(50);
scene.world.showSection(armSel, Direction.DOWN);
scene.idle(10);
Vec3d armTop = armSurface.add(0.5, 1.5, 0);
scene.overlay.showText(70)
.attachKeyFrame()
.colored(PonderPalette.GREEN)
.text("Once placed, the Mechanical Arm will target the blocks selected previously")
.pointAt(armTop)
.placeNearTarget();
scene.idle(80);
scene.effects.indicateSuccess(armPos);
scene.world.showSection(util.select.fromTo(2, 1, 5, 2, 1, 3)
.add(util.select.position(2, 0, 5)), Direction.DOWN);
ItemStack copper = AllItems.COPPER_INGOT.asStack();
scene.world.createItemOnBeltLike(inputDepot, Direction.SOUTH, copper);
scene.idle(10);
scene.world.setKineticSpeed(armSel, -48);
scene.idle(20);
scene.world.instructArm(armPos, Phase.MOVE_TO_INPUT, ItemStack.EMPTY, 0);
scene.idle(24);
scene.world.removeItemsFromBelt(inputDepot);
scene.world.instructArm(armPos, Phase.SEARCH_OUTPUTS, copper, -1);
scene.idle(20);
scene.world.instructArm(armPos, Phase.MOVE_TO_OUTPUT, copper, 0);
scene.idle(24);
scene.world.createItemOnBeltLike(outputDepot, Direction.UP, copper);
scene.world.instructArm(armPos, Phase.SEARCH_INPUTS, ItemStack.EMPTY, -1);
scene.idle(44);
scene.world.showSection(util.select.fromTo(1, 1, 4, 1, 3, 4), Direction.DOWN);
scene.idle(5);
scene.world.showSection(util.select.position(4, 1, 2), Direction.DOWN);
scene.idle(5);
scene.overlay.chaseBoundingBoxOutline(PonderPalette.OUTPUT, new Object(), depotBounds.offset(0, 2, 1), 60);
scene.idle(5);
scene.overlay.chaseBoundingBoxOutline(PonderPalette.INPUT, new Object(), depotBounds.offset(4, 2, 1), 60);
scene.idle(5);
scene.overlay.chaseBoundingBoxOutline(PonderPalette.OUTPUT, new Object(), depotBounds.offset(1, 1, 0), 60);
scene.idle(5);
scene.overlay.chaseBoundingBoxOutline(PonderPalette.INPUT, new Object(), depotBounds.offset(1, 3, 4), 60);
scene.idle(5);
scene.overlay.chaseBoundingBoxOutline(PonderPalette.INPUT, new Object(), depotBounds.offset(4, 1, 2), 60);
scene.idle(5);
scene.overlay.showText(80)
.attachKeyFrame()
.text("They can have any amount of in- and outputs within their range")
.pointAt(util.vector.blockSurface(util.grid.at(1, 3, 4), Direction.WEST))
.placeNearTarget();
inputDepot = util.grid.at(1, 3, 4);
outputDepot = util.grid.at(1, 1, 0);
copper = AllBlocks.COPPER_BLOCK.asStack();
scene.world.createItemOnBeltLike(inputDepot, Direction.SOUTH, copper);
scene.idle(20);
scene.world.instructArm(armPos, Phase.MOVE_TO_INPUT, ItemStack.EMPTY, 2);
scene.idle(24);
scene.world.removeItemsFromBelt(inputDepot);
scene.world.instructArm(armPos, Phase.SEARCH_OUTPUTS, copper, -1);
scene.idle(20);
scene.world.instructArm(armPos, Phase.MOVE_TO_OUTPUT, copper, 2);
scene.idle(24);
scene.world.createItemOnBeltLike(outputDepot, Direction.UP, copper);
scene.world.instructArm(armPos, Phase.SEARCH_INPUTS, ItemStack.EMPTY, -1);
scene.world.hideSection(util.select.fromTo(4, 2, 1, 4, 1, 1), Direction.UP);
scene.idle(2);
scene.world.hideSection(util.select.fromTo(1, 1, 4, 1, 3, 4), Direction.UP);
scene.idle(5);
scene.world.hideSection(util.select.fromTo(0, 1, 1, 0, 2, 1), Direction.UP);
scene.idle(2);
scene.world.hideSection(util.select.position(1, 1, 0), Direction.UP);
scene.idle(5);
scene.world.hideSection(util.select.position(4, 1, 2), Direction.UP);
scene.idle(15);
scene.world.showSection(util.select.fromTo(4, 1, 3, 4, 2, 3), Direction.NORTH);
scene.idle(5);
scene.world.showSection(util.select.fromTo(0, 1, 3, 0, 2, 3), Direction.NORTH);
scene.idle(15);
Object in = new Object();
Object out = new Object();
AxisAlignedBB chestBounds = new AxisAlignedBB(1 / 16f, 0, 1 / 16f, 15 / 16f, 14 / 16f, 15 / 16f);
AxisAlignedBB funnelBounds = new AxisAlignedBB(0, 0, 8 / 16f, 16 / 16f, 16 / 16f, 16 / 16f);
scene.overlay.chaseBoundingBoxOutline(PonderPalette.RED, in, chestBounds.offset(4, 2, 3), 120);
scene.overlay.chaseBoundingBoxOutline(PonderPalette.RED, out, chestBounds.offset(0, 2, 3), 120);
scene.overlay.showText(80)
.attachKeyFrame()
.text("However, not every type of Inventory can be interacted with directly")
.colored(PonderPalette.RED)
.placeNearTarget()
.pointAt(util.vector.blockSurface(util.grid.at(0, 2, 3), Direction.WEST));
scene.idle(90);
scene.world.showSection(util.select.fromTo(4, 1, 2, 4, 2, 2), Direction.SOUTH);
scene.idle(5);
scene.world.showSection(util.select.position(0, 2, 2), Direction.SOUTH);
scene.idle(10);
scene.overlay.chaseBoundingBoxOutline(PonderPalette.INPUT, in, depotBounds.offset(4, 1, 2), 80);
scene.idle(5);
scene.overlay.chaseBoundingBoxOutline(PonderPalette.OUTPUT, out, funnelBounds.offset(0, 2, 2), 80);
scene.idle(5);
scene.overlay.showText(60)
.text("Funnels and Depots can help to Bridge that gap")
.colored(PonderPalette.OUTPUT)
.placeNearTarget()
.pointAt(util.vector.topOf(util.grid.at(0, 2, 2))
.add(0, 0, 0.25));
scene.idle(70);
ItemStack sword = new ItemStack(Items.GOLDEN_SWORD);
inputDepot = util.grid.at(4, 1, 2);
scene.overlay
.showControls(new InputWindowElement(util.vector.topOf(inputDepot), Pointing.RIGHT).withItem(sword), 30);
scene.world.createItemOnBeltLike(inputDepot, Direction.SOUTH, sword);
scene.idle(20);
scene.world.instructArm(armPos, Phase.MOVE_TO_INPUT, ItemStack.EMPTY, 1);
scene.idle(24);
scene.world.removeItemsFromBelt(inputDepot);
scene.world.instructArm(armPos, Phase.SEARCH_OUTPUTS, sword, -1);
scene.idle(20);
scene.world.instructArm(armPos, Phase.MOVE_TO_OUTPUT, sword, 1);
scene.idle(24);
scene.world.flapFunnel(util.grid.at(0, 2, 2), false);
scene.world.instructArm(armPos, Phase.SEARCH_INPUTS, ItemStack.EMPTY, -1);
scene.idle(5);
scene.overlay.showControls(
new InputWindowElement(util.vector.blockSurface(util.grid.at(0, 2, 3), Direction.WEST), Pointing.LEFT)
.withItem(sword),
30);
}
public static void filtering(SceneBuilder scene, SceneBuildingUtil util) {
scene.title("mechanical_arm_filtering", "Filtering Outputs of the Mechanical Arm");
scene.configureBasePlate(0, 0, 6);
scene.scaleSceneView(0.9f);
scene.world.setKineticSpeed(util.select.fromTo(4, 1, 4, 6, 0, 5), 0);
scene.world.showSection(util.select.layer(0), Direction.UP);
scene.idle(10);
scene.world.showSection(util.select.fromTo(4, 1, 4, 5, 1, 5), Direction.DOWN);
scene.idle(10);
for (int x = 0; x < 2; x++) {
scene.idle(3);
scene.world.showSection(util.select.position(x + 1, 1, 4), Direction.DOWN);
}
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++) {
scene.world.showSection(util.select.position(y == 1 ? x + 3 : 5 - x, y + 1, 1), Direction.DOWN);
scene.idle(2);
}
}
scene.world.showSection(util.select.position(2, 1, 1), Direction.EAST);
ItemStack sand = new ItemStack(Items.SAND, 64);
ItemStack sulphur = new ItemStack(Items.GUNPOWDER, 64);
scene.world.createItemOnBeltLike(util.grid.at(2, 1, 4), Direction.SOUTH, sand);
scene.world.createItemOnBeltLike(util.grid.at(1, 1, 4), Direction.SOUTH, sulphur);
scene.overlay.showSelectionWithText(util.select.fromTo(2, 1, 4, 1, 1, 4), 60)
.text("Inputs")
.placeNearTarget()
.colored(PonderPalette.INPUT);
scene.idle(50);
scene.overlay.showSelectionWithText(util.select.fromTo(5, 3, 1, 3, 1, 1), 40)
.text("Outputs")
.placeNearTarget()
.colored(PonderPalette.OUTPUT);
scene.idle(50);
scene.overlay.showText(80)
.attachKeyFrame()
.text("Sometimes it is desirable to restrict targets of the Arm by matching a filter")
.placeNearTarget()
.pointAt(util.vector.blockSurface(util.grid.at(3, 3, 1), Direction.WEST));
scene.idle(90);
scene.rotateCameraY(-90 - 30);
scene.idle(20);
scene.overlay.showSelectionWithText(util.select.position(4, 1, 4), 80)
.colored(PonderPalette.RED)
.text("Mechanical Arms by themselves do not provide any options for filtering")
.placeNearTarget();
scene.idle(90);
for (int y = 0; y < 3; y++) {
scene.world.showSection(util.select.fromTo(5, y + 1, 2, 3, y + 1, 2), Direction.NORTH);
scene.idle(2);
}
Vec3d filterSlot = util.vector.of(3.5, 3.75, 2.6);
scene.overlay.showFilterSlotInput(filterSlot, 80);
scene.idle(10);
scene.overlay.showText(80)
.attachKeyFrame()
.colored(PonderPalette.GREEN)
.pointAt(filterSlot)
.text("Brass Funnels as Targets do however communicate their own filter to the Arm")
.placeNearTarget();
scene.idle(90);
for (int y = 0; y < 3; y++) {
for (int x = 0; x < 3; x++) {
ItemStack item = (x + y) % 2 == 0 ? sulphur : sand;
scene.overlay
.showControls(new InputWindowElement(filterSlot.add(2 - x, -y, 0), Pointing.LEFT).rightClick()
.withItem(item), 5);
scene.idle(7);
scene.world.setFilterData(util.select.position(5 - x, 3 - y, 2), FunnelTileEntity.class, item);
scene.idle(4);
}
}
scene.world.setKineticSpeed(util.select.fromTo(4, 1, 4, 6, 0, 5), 24);
scene.world.multiplyKineticSpeed(util.select.position(5, 1, 5), -1);
scene.world.multiplyKineticSpeed(util.select.position(4, 1, 4), 2);
scene.idle(10);
BlockPos armPos = util.grid.at(4, 1, 4);
scene.world.instructArm(armPos, Phase.MOVE_TO_INPUT, ItemStack.EMPTY, 1);
scene.idle(24);
scene.world.instructArm(armPos, Phase.SEARCH_OUTPUTS, sand, -1);
scene.idle(20);
scene.overlay.showText(80)
.attachKeyFrame()
.pointAt(util.vector.topOf(2, 1, 4))
.text("The Arm is smart enough not to pick up items it couldn't distribute")
.placeNearTarget();
scene.idle(90);
for (int i = 0; i < 4; i++) {
int index = i * 2 + 1;
scene.world.instructArm(armPos, Phase.MOVE_TO_OUTPUT, sand, index);
scene.idle(24);
BlockPos funnelPos = util.grid.at(5 - index % 3, 1 + index / 3, 2);
scene.world.flapFunnel(funnelPos, false);
scene.world.instructArm(armPos, Phase.SEARCH_INPUTS, i == 3 ? ItemStack.EMPTY : sand, -1);
scene.world.modifyTileEntity(funnelPos.north(), MechanicalCrafterTileEntity.class, mct -> mct.getInventory()
.insertItem(0, sand.copy(), false));
scene.idle(10);
}
scene.world.instructArm(armPos, Phase.MOVE_TO_INPUT, ItemStack.EMPTY, 0);
scene.idle(24);
scene.world.instructArm(armPos, Phase.SEARCH_OUTPUTS, sulphur, -1);
scene.idle(20);
scene.rotateCameraY(120);
scene.world.setCraftingResult(util.grid.at(3, 1, 1), new ItemStack(Blocks.TNT));
for (int i = 0; i < 5; i++) {
int index = i * 2;
scene.world.instructArm(armPos, Phase.MOVE_TO_OUTPUT, sulphur, index);
scene.idle(24);
BlockPos funnelPos = util.grid.at(3 + index % 3, 1 + index / 3, 2);
scene.world.flapFunnel(funnelPos, false);
scene.world.instructArm(armPos, Phase.SEARCH_INPUTS, i == 4 ? ItemStack.EMPTY : sulphur, -1);
scene.world.modifyTileEntity(funnelPos.north(), MechanicalCrafterTileEntity.class, mct -> mct.getInventory()
.insertItem(0, sulphur.copy(), false));
scene.idle(10);
}
scene.idle(120);
}
public static void modes(SceneBuilder scene, SceneBuildingUtil util) {
scene.title("mechanical_arm_modes", "Distribution modes of the Mechanical Arm");
scene.configureBasePlate(0, 1, 5);
scene.world.setBlock(util.grid.at(3, 1, 0), Blocks.BARRIER.getDefaultState(), false);
scene.world.showSection(util.select.layer(0), Direction.UP);
scene.idle(5);
scene.world.showSection(util.select.fromTo(3, 1, 4, 4, 1, 5), Direction.DOWN);
scene.idle(5);
scene.world.showSection(util.select.fromTo(1, 1, 4, 1, 2, 5), Direction.NORTH);
scene.idle(5);
scene.world.showSection(util.select.fromTo(1, 1, 1, 5, 1, 2), Direction.SOUTH);
scene.idle(10);
AxisAlignedBB depotBox = AllShapes.DEPOT.getBoundingBox();
AxisAlignedBB beltBox = depotBox.contract(0, -3 / 16f, 0)
.grow(1, 0, 0);
BlockPos depotPos = util.grid.at(1, 1, 4);
BlockPos armPos = util.grid.at(3, 1, 4);
scene.overlay.chaseBoundingBoxOutline(PonderPalette.INPUT, depotBox, depotBox.offset(1, 1, 4), 60);
scene.overlay.showText(30)
.text("Input")
.pointAt(util.vector.blockSurface(depotPos, Direction.WEST))
.placeNearTarget()
.colored(PonderPalette.INPUT);
scene.idle(40);
scene.overlay.chaseBoundingBoxOutline(PonderPalette.OUTPUT, depotBox, beltBox.offset(2, 1, 2), 40);
scene.overlay.showText(40)
.text("Outputs")
.pointAt(util.vector.blockSurface(util.grid.at(1, 1, 2), Direction.WEST))
.placeNearTarget()
.colored(PonderPalette.OUTPUT);
scene.idle(50);
ItemStack item = new ItemStack(Items.SNOWBALL);
scene.world.createItemOnBeltLike(depotPos, Direction.SOUTH, item);
scene.overlay.showText(60)
.attachKeyFrame()
.text("Whenever an Arm has to choose between multiple valid outputs...")
.pointAt(util.vector.blockSurface(util.grid.at(2, 1, 2), Direction.UP))
.placeNearTarget()
.colored(PonderPalette.OUTPUT);
scene.idle(70);
Vec3d scrollSlot = util.vector.of(3.5, 1.25, 4);
scene.overlay.showFilterSlotInput(scrollSlot, 120);
scene.overlay.showText(50)
.text("...it will act according to its setting")
.pointAt(scrollSlot)
.placeNearTarget();
scene.idle(60);
scene.overlay.showControls(new InputWindowElement(scrollSlot, Pointing.RIGHT).scroll()
.withWrench(), 40);
scene.idle(10);
scene.overlay.showText(50)
.text("Scrolling with a Wrench will allow you to configure it")
.pointAt(scrollSlot)
.placeNearTarget();
scene.idle(60);
ElementLink<WorldSectionElement> blockage =
scene.world.showIndependentSection(util.select.position(4, 1, 0), Direction.UP);
scene.world.moveSection(blockage, util.vector.of(-1, 0, 0), 0);
for (int i = 0; i < 20; i++) {
if (i == 2) {
scene.overlay.showText(60)
.attachKeyFrame()
.text("Round Robin mode simply cycles through all outputs that are available")
.pointAt(util.vector.blockSurface(util.grid.at(2, 1, 2), Direction.UP))
.placeNearTarget()
.colored(PonderPalette.OUTPUT);
}
if (i == 6)
continue;
if (i == 7) {
scene.overlay.showText(60)
.attachKeyFrame()
.text("If an output is unable to take more items, it will be skipped")
.pointAt(util.vector.blockSurface(util.grid.at(3, 1, 2), Direction.UP))
.placeNearTarget()
.colored(PonderPalette.GREEN);
}
if (i == 12) {
scene.world.moveSection(blockage, util.vector.of(-1, 0, 0), 10);
scene.world.setBlock(util.grid.at(3, 1, 0), Blocks.BARRIER.getDefaultState(), false);
}
int index = i % 3;
if (i == 13) {
scene.world.setBlock(util.grid.at(2, 1, 0), Blocks.BARRIER.getDefaultState(), false);
ElementLink<WorldSectionElement> blockage2 =
scene.world.showIndependentSection(util.select.position(4, 1, 0), Direction.UP);
scene.world.moveSection(blockage2, util.vector.of(-2, 0, 0), 0);
scene.overlay.showText(60)
.attachKeyFrame()
.text("Prefer First prioritizes the outputs selected earliest when configuring this Arm")
.pointAt(util.vector.blockSurface(util.grid.at(3, 1, 2), Direction.UP))
.placeNearTarget()
.colored(PonderPalette.GREEN);
index = 0;
}
if (i == 14)
index = 1;
if (i == 15)
index = 1;
if (i >= 16)
index = 2;
scene.idle(5);
scene.world.instructArm(armPos, Phase.MOVE_TO_INPUT, ItemStack.EMPTY, 0);
scene.idle(12);
scene.world.instructArm(armPos, Phase.SEARCH_OUTPUTS, item, -1);
scene.world.removeItemsFromBelt(depotPos);
scene.idle(5);
if (i == 9) {
scene.overlay.showText(80)
.attachKeyFrame()
.text("Forced Round Robin mode will never skip outputs, and instead wait until they are free")
.pointAt(util.vector.blockSurface(util.grid.at(3, 1, 2), Direction.UP))
.placeNearTarget()
.colored(PonderPalette.RED);
scene.idle(40);
scene.world.moveSection(blockage, util.vector.of(1, 0, 0), 10);
scene.world.setBlock(util.grid.at(3, 1, 0), Blocks.AIR.getDefaultState(), false);
scene.idle(50);
scene.world.multiplyKineticSpeed(util.select.fromTo(1, 1, 1, 5, 0, 3), 2);
}
scene.world.instructArm(armPos, Phase.MOVE_TO_OUTPUT, item, index);
scene.world.createItemOnBeltLike(depotPos, Direction.SOUTH, item);
scene.idle(12);
scene.world.instructArm(armPos, Phase.SEARCH_INPUTS, ItemStack.EMPTY, -1);
scene.world.createItemOnBelt(util.grid.at(3 - index, 1, 2), Direction.UP, item);
}
}
public static void redstone(SceneBuilder scene, SceneBuildingUtil util) {
scene.title("mechanical_arm_redstone", "Controlling Mechanical Arms with Redstone");
scene.configureBasePlate(0, 0, 5);
scene.world.showSection(util.select.layer(0), Direction.UP);
scene.idle(5);
scene.world.showSection(util.select.fromTo(1, 1, 3, 2, 1, 4), Direction.DOWN);
scene.idle(5);
scene.world.showSection(util.select.fromTo(3, 1, 5, 4, 1, 3), Direction.WEST);
scene.idle(5);
scene.world.showSection(util.select.position(4, 1, 2), Direction.SOUTH);
scene.idle(5);
scene.world.showSection(util.select.fromTo(2, 1, 1, 4, 1, 1), Direction.EAST);
scene.idle(10);
Selection redstone = util.select.fromTo(1, 1, 0, 1, 1, 2);
scene.world.showSection(redstone, Direction.SOUTH);
BlockPos armPos = util.grid.at(1, 1, 3);
BlockPos leverPos = util.grid.at(1, 1, 0);
ItemStack item = new ItemStack(Items.REDSTONE_ORE);
scene.world.createItemOnBeltLike(util.grid.at(4, 1, 1), Direction.SOUTH, item);
for (int i = 0; i < 3; i++) {
scene.idle(12);
if (i == 1) {
scene.world.toggleRedstonePower(redstone);
scene.effects.indicateRedstone(leverPos);
scene.idle(10);
scene.overlay.showText(60)
.colored(PonderPalette.RED)
.attachKeyFrame()
.pointAt(util.vector.topOf(armPos.up()))
.placeNearTarget()
.text("When powered by Redstone, Mechanical Arms will not activate");
scene.idle(70);
scene.world.toggleRedstonePower(redstone);
}
if (i == 2) {
scene.idle(60);
scene.world.toggleRedstonePower(redstone);
scene.idle(3);
scene.world.toggleRedstonePower(redstone);
scene.effects.indicateRedstone(leverPos);
}
scene.world.instructArm(armPos, Phase.MOVE_TO_INPUT, ItemStack.EMPTY, 0);
scene.idle(18);
scene.world.instructArm(armPos, Phase.SEARCH_OUTPUTS, item, -1);
scene.world.removeItemsFromBelt(util.grid.at(3, 1, 1));
scene.idle(5);
if (i == 1) {
scene.world.toggleRedstonePower(redstone);
scene.effects.indicateRedstone(leverPos);
scene.overlay.showText(60)
.pointAt(util.vector.topOf(armPos.up()))
.placeNearTarget()
.text("Before stopping, it will finish any started cycles");
}
scene.idle(10);
if (i == 2) {
scene.overlay.showText(100)
.colored(PonderPalette.GREEN)
.attachKeyFrame()
.pointAt(util.vector.topOf(armPos.up()))
.placeNearTarget()
.text("Thus, a negative pulse can be used to trigger exactly one activation cycle");
}
scene.world.instructArm(armPos, Phase.MOVE_TO_OUTPUT, item, 0);
scene.world.createItemOnBeltLike(util.grid.at(4, 1, 1), Direction.SOUTH, item);
scene.idle(18);
scene.world.instructArm(armPos, Phase.SEARCH_INPUTS, ItemStack.EMPTY, -1);
scene.world.createItemOnBelt(util.grid.at(3, 1, 3), Direction.UP, item);
}
scene.idle(5);
}
}

View file

@ -618,7 +618,7 @@ public class BearingScenes {
.placeNearTarget();
scene.idle(40);
scene.world.configureCenterOfRotation(plank, util.vector.centerOf(bearingPos));
if (!frame) {
scene.world.rotateBearing(bearingPos, 180, 75);
scene.world.rotateSection(plank, 0, 180, 0, 75);
@ -633,11 +633,11 @@ public class BearingScenes {
scene.overlay.showControls(input, 30);
scene.idle(7);
scene.world.setBlock(util.grid.at(2, 3, 1), AllBlocks.DYED_SAILS[DyeColor.BLUE.ordinal()].getDefaultState()
.with(SailBlock.FACING, Direction.WEST), true);
.with(SailBlock.FACING, Direction.WEST), false);
scene.idle(10);
scene.overlay.showText(40)
.colored(PonderPalette.BLUE)
.text("Right Click with Dye to paint them")
.text("Right-Click with Dye to paint them")
.attachKeyFrame()
.pointAt(util.vector.blockSurface(util.grid.at(2, 3, 1), Direction.WEST))
.placeNearTarget();
@ -647,7 +647,32 @@ public class BearingScenes {
scene.world.replaceBlocks(util.select.fromTo(2, 2, 1, 2, 4, 1),
AllBlocks.DYED_SAILS[DyeColor.BLUE.ordinal()].getDefaultState()
.with(SailBlock.FACING, Direction.WEST),
true);
false);
scene.idle(20);
scene.world.rotateBearing(bearingPos, 90, 33);
scene.world.rotateSection(plank, 0, 90, 0, 33);
scene.idle(40);
input =
new InputWindowElement(util.vector.blockSurface(util.grid.at(2, 3, 1), Direction.NORTH), Pointing.RIGHT)
.withItem(new ItemStack(Items.SHEARS));
scene.overlay.showControls(input, 30);
scene.idle(7);
scene.world.setBlock(util.grid.at(3, 3, 2), AllBlocks.SAIL_FRAME.getDefaultState()
.with(SailBlock.FACING, Direction.NORTH), false);
scene.idle(10);
scene.overlay.showText(40)
.text("Right-Click with Shears to turn them back into frames")
.attachKeyFrame()
.pointAt(util.vector.blockSurface(util.grid.at(2, 3, 1), Direction.WEST))
.placeNearTarget();
scene.idle(20);
scene.overlay.showControls(input, 30);
scene.idle(7);
scene.world.replaceBlocks(util.select.fromTo(3, 2, 2, 3, 4, 2), AllBlocks.SAIL_FRAME.getDefaultState()
.with(SailBlock.FACING, Direction.NORTH), false);
scene.idle(20);
}

View file

@ -132,6 +132,13 @@ public class PonderIndex {
PonderRegistry.forComponents(AllBlocks.STICKER)
.addStoryBoard("sticker", RedstoneScenes::sticker, PonderTag.CONTRAPTION_ASSEMBLY);
// Mechanical Arm
PonderRegistry.forComponents(AllBlocks.MECHANICAL_ARM)
.addStoryBoard("mechanical_arm/setup", ArmScenes::setup, PonderTag.ARM_TARGETS)
.addStoryBoard("mechanical_arm/filter", ArmScenes::filtering)
.addStoryBoard("mechanical_arm/modes", ArmScenes::modes)
.addStoryBoard("mechanical_arm/redstone", ArmScenes::redstone);
// Mechanical Piston
PonderRegistry.forComponents(AllBlocks.MECHANICAL_PISTON, AllBlocks.STICKY_MECHANICAL_PISTON)
.addStoryBoard("mechanical_piston/anchor", PistonScenes::movement, PonderTag.KINETIC_APPLIANCES,
@ -296,6 +303,7 @@ public class PonderIndex {
.add(AllBlocks.CREATIVE_FLUID_TANK);
PonderRegistry.tags.forTag(PonderTag.ARM_TARGETS)
.add(AllBlocks.MECHANICAL_ARM)
.add(AllItems.BELT_CONNECTOR)
.add(AllBlocks.CHUTE)
.add(AllBlocks.DEPOT)

View file

@ -13,6 +13,9 @@ public enum PonderPalette {
MEDIUM(0xFF_0084ff),
FAST(0xFF_ff55ff),
INPUT(0xFF_4f8a8b),
OUTPUT(0xFF_ffcb74),
;
private int color;

View file

@ -61,7 +61,7 @@ public class PonderTag implements IScreenRenderable {
SAILS = new PonderTag("windmill_sails").item(AllBlocks.WINDMILL_BEARING.get(), true, true)
.defaultLang("Sails for Windmill Bearings",
"Blocks that count towards the strength of a Windmill Contraption when assembled"),
"Blocks that count towards the strength of a Windmill Contraption when assembled. Each of these have equal efficiency in doing so."),
// FLUID_TRANSFER = new PonderTag("fluid_transfer").idAsIcon(),
//

View file

@ -61,6 +61,12 @@ public class PonderTagScreen extends NavigatableSimiScreen {
items.clear();
PonderRegistry.tags.getItems(tag)
.stream()
.filter(rl -> tag.getMainItem()
.isEmpty()
|| tag.getMainItem()
.getItem()
.getRegistryName()
.equals(rl))
.map(key -> {
Item item = ForgeRegistries.ITEMS.getValue(key);
if (item == null) {

View file

@ -2,6 +2,7 @@
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"2": "create:block/brass_casing_belt",
"6": "create:block/crafter_top",
"7": "create:block/brass_block",
"particle": "create:block/crafter_top"
@ -9,15 +10,15 @@
"elements": [
{
"name": "Base",
"from": [2, 0, 2],
"to": [14, 6, 14],
"from": [0, 0, 0],
"to": [16, 6, 16],
"faces": {
"north": {"uv": [2, 0, 14, 6], "texture": "#6"},
"east": {"uv": [2, 0, 14, 6], "texture": "#6"},
"south": {"uv": [2, 0, 14, 6], "texture": "#6"},
"west": {"uv": [2, 0, 14, 6], "texture": "#6"},
"up": {"uv": [2, 2, 14, 14], "texture": "#7"},
"down": {"uv": [2, 2, 14, 14], "texture": "#6"}
"north": {"uv": [8, 12.5, 16, 15.5], "texture": "#2"},
"east": {"uv": [8, 12.5, 16, 15.5], "texture": "#2"},
"south": {"uv": [8, 12.5, 16, 15.5], "texture": "#2"},
"west": {"uv": [8, 12.5, 16, 15.5], "texture": "#2"},
"up": {"uv": [0, 0, 16, 16], "texture": "#7"},
"down": {"uv": [0, 0, 16, 16], "texture": "#6"}
}
}
],

View file

@ -2,6 +2,7 @@
"credit": "Made with Blockbench",
"parent": "block/block",
"textures": {
"3": "create:block/brass_casing_belt",
"5": "create:block/mechanical_arm",
"6": "create:block/crafter_top",
"7": "create:block/brass_block",
@ -52,9 +53,9 @@
},
{
"name": "ConnectorR",
"from": [5, 12, 0],
"to": [7, 14, 6],
"rotation": {"angle": 45, "axis": "x", "origin": [8, -4, 5]},
"from": [5, 7.02944, 12],
"to": [7, 9.02944, 18],
"rotation": {"angle": 22.5, "axis": "x", "origin": [8, 8, 17]},
"faces": {
"east": {"uv": [15, 0, 16, 3], "rotation": 90, "texture": "#5"},
"south": {"uv": [15, 0, 16, 1], "rotation": 90, "texture": "#5"},
@ -65,9 +66,9 @@
},
{
"name": "ConnectorR",
"from": [9, 12, 0],
"to": [11, 14, 6],
"rotation": {"angle": 45, "axis": "x", "origin": [12, -4, 5]},
"from": [9, 7.02944, 12],
"to": [11, 9.02944, 18],
"rotation": {"angle": 22.5, "axis": "x", "origin": [8, 8, 17]},
"faces": {
"east": {"uv": [15, 0, 16, 3], "rotation": 90, "texture": "#5"},
"south": {"uv": [15, 0, 16, 1], "rotation": 90, "texture": "#5"},
@ -78,9 +79,9 @@
},
{
"name": "UpperBody",
"from": [4.5, 11, -10],
"to": [11.5, 15, 1],
"rotation": {"angle": 45, "axis": "x", "origin": [8, -4, 5]},
"from": [4.5, 6.02944, 2],
"to": [11.5, 10.02944, 13],
"rotation": {"angle": 22.5, "axis": "x", "origin": [8, 8, 17]},
"faces": {
"north": {"uv": [11, 9, 14.5, 11], "texture": "#5"},
"east": {"uv": [14, 3.5, 16, 9], "rotation": 270, "texture": "#5"},
@ -92,9 +93,9 @@
},
{
"name": "Head",
"from": [4, 16.5, 4],
"to": [12, 20.5, 8],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 2, 8]},
"from": [4, 11.59915, 0.63821],
"to": [12, 15.59915, 4.63821],
"rotation": {"angle": -22.5, "axis": "x", "origin": [8, 14, 3]},
"faces": {
"north": {"uv": [7, 9.5, 9, 13.5], "rotation": 90, "texture": "#5"},
"east": {"uv": [7, 13.5, 9, 15.5], "texture": "#5"},
@ -106,23 +107,23 @@
},
{
"name": "Base",
"from": [2, -16, 2],
"to": [14, -10, 14],
"from": [0, -16, 0],
"to": [16, -10, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [8, -8, 8]},
"faces": {
"north": {"uv": [2, 0, 14, 6], "texture": "#6"},
"east": {"uv": [2, 0, 14, 6], "texture": "#6"},
"south": {"uv": [2, 0, 14, 6], "texture": "#6"},
"west": {"uv": [2, 0, 14, 6], "texture": "#6"},
"up": {"uv": [2, 2, 14, 14], "texture": "#7"},
"down": {"uv": [2, 2, 14, 14], "texture": "#6"}
"north": {"uv": [8, 12.5, 16, 15.5], "texture": "#3"},
"east": {"uv": [8, 12.5, 16, 15.5], "texture": "#3"},
"south": {"uv": [8, 12.5, 16, 15.5], "texture": "#3"},
"west": {"uv": [8, 12.5, 16, 15.5], "texture": "#3"},
"up": {"uv": [0, 0, 16, 16], "texture": "#7"},
"down": {"uv": [0, 0, 16, 16], "texture": "#6"}
}
},
{
"name": "ClawBase",
"from": [5, 15.5, 1],
"to": [11, 21.5, 3],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 2, 8]},
"from": [5, 10.59915, -2.36179],
"to": [11, 16.59915, -0.36179],
"rotation": {"angle": -22.5, "axis": "x", "origin": [8, 14, 3]},
"faces": {
"north": {"uv": [12, 0, 15, 3], "texture": "#5"},
"east": {"uv": [12, 0, 13, 3], "texture": "#5"},
@ -134,23 +135,23 @@
},
{
"name": "ClawTop",
"from": [5.5, 20.5, -3],
"to": [10.5, 22.5, 2],
"rotation": {"angle": -22.5, "axis": "x", "origin": [8, 21.5, 2]},
"from": [5.5, 5.96489, -2.07049],
"to": [10.5, 10.96489, -0.07049],
"rotation": {"angle": 45, "axis": "x", "origin": [8, 14, 3]},
"faces": {
"north": {"uv": [9.5, 1.5, 12, 2.5], "rotation": 180, "texture": "#5"},
"east": {"uv": [9.5, 0, 12, 1], "rotation": 180, "texture": "#5"},
"south": {"uv": [9.5, 0, 12, 1], "rotation": 180, "texture": "#5"},
"west": {"uv": [9.5, 0, 12, 1], "rotation": 180, "texture": "#5"},
"up": {"uv": [9.5, 0, 12, 2.5], "rotation": 180, "texture": "#5"},
"down": {"uv": [9.5, 0, 12, 2.5], "rotation": 180, "texture": "#5"}
"north": {"uv": [9.5, 0, 12, 2.5], "texture": "#5"},
"east": {"uv": [9.5, 0, 12, 1], "rotation": 270, "texture": "#5"},
"south": {"uv": [9.5, 0, 12, 2.5], "rotation": 180, "texture": "#5"},
"west": {"uv": [9.5, 0, 12, 1], "rotation": 90, "texture": "#5"},
"up": {"uv": [9.5, 0, 12, 1], "rotation": 180, "texture": "#5"},
"down": {"uv": [9.5, 1.5, 12, 2.5], "texture": "#5"}
}
},
{
"name": "ClawBottom",
"from": [5.5, 14.5, -3],
"to": [10.5, 16.5, 2],
"rotation": {"angle": 22.5, "axis": "x", "origin": [8, 15.5, 2]},
"from": [5.5, 8.18885, -4.72832],
"to": [10.5, 10.18885, 0.27168],
"rotation": {"angle": 0, "axis": "x", "origin": [8, 14, 3]},
"faces": {
"north": {"uv": [9.5, 0, 12, 1], "rotation": 180, "texture": "#5"},
"east": {"uv": [9.5, 1.5, 12, 2.5], "rotation": 180, "texture": "#5"},
@ -162,9 +163,9 @@
},
{
"name": "ClawConnector",
"from": [6.5, 17.5, 3],
"to": [9.5, 19.5, 4],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 2, 8]},
"from": [6.5, 12.59915, -0.36179],
"to": [9.5, 14.59915, 0.63821],
"rotation": {"angle": -22.5, "axis": "x", "origin": [8, 14, 3]},
"faces": {
"east": {"uv": [10.5, 2.5, 11, 3.5], "texture": "#5"},
"west": {"uv": [11.5, 2.5, 12, 3.5], "texture": "#5"},
@ -282,8 +283,8 @@
"scale": [0.25, 0.25, 0.25]
},
"gui": {
"rotation": [30, 225, 0],
"translation": [0, 3, 0],
"rotation": [30, 135, 0],
"translation": [0, 4.25, 0],
"scale": [0.45, 0.45, 0.45]
},
"head": {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.