From 6b999fa7d40daee595ade1ec674a499ca4af8556 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Tue, 9 Mar 2021 17:32:01 +0100 Subject: [PATCH 1/2] Tag hopping - Ponder UIs opened from a tag screen now skip to the first scene with a matching tag if available --- .../foundation/gui/AbstractSimiScreen.java | 11 ++-- .../create/foundation/gui/ScreenOpener.java | 12 +++-- .../foundation/ponder/PonderRegistry.java | 30 ++++++++--- .../create/foundation/ponder/PonderUI.java | 34 +++++++++++++ .../ponder/content/PonderIndex.java | 50 ++++++++++++------- .../ponder/content/PonderTagScreen.java | 4 +- .../foundation/ponder/ui/PonderButton.java | 2 +- 7 files changed, 104 insertions(+), 39 deletions(-) diff --git a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java index 874bfeba7..fd3982b1b 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java @@ -2,6 +2,7 @@ package com.simibubi.create.foundation.gui; import java.util.ArrayList; import java.util.List; +import java.util.Optional; import java.util.stream.Collectors; import org.apache.commons.lang3.mutable.MutableBoolean; @@ -145,7 +146,7 @@ public abstract class AbstractSimiScreen extends Screen { return true; if (code == GLFW.GLFW_KEY_BACKSPACE) { - ScreenOpener.openPreviousScreen(this); + ScreenOpener.openPreviousScreen(this, Optional.empty()); return true; } @@ -242,9 +243,7 @@ public abstract class AbstractSimiScreen extends Screen { private static String screenTitle(Screen screen) { if (screen instanceof AbstractSimiScreen) return ((AbstractSimiScreen) screen).getBreadcrumbTitle(); - - return screen.getClass() - .getSimpleName(); + return "<"; } protected String getBreadcrumbTitle() { @@ -275,9 +274,11 @@ public abstract class AbstractSimiScreen extends Screen { double mouseY = minecraft.mouseHelper.getMouseY() * w.getScaledHeight() / w.getHeight(); centerScalingOn((int) mouseX, (int) mouseY); } - + public boolean isEquivalentTo(AbstractSimiScreen other) { return false; } + public void shareContextWith(AbstractSimiScreen other) {} + } diff --git a/src/main/java/com/simibubi/create/foundation/gui/ScreenOpener.java b/src/main/java/com/simibubi/create/foundation/gui/ScreenOpener.java index 82f736791..dbecc7e51 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/ScreenOpener.java +++ b/src/main/java/com/simibubi/create/foundation/gui/ScreenOpener.java @@ -4,6 +4,7 @@ import java.util.ArrayDeque; import java.util.ArrayList; import java.util.Deque; import java.util.List; +import java.util.Optional; import javax.annotation.Nullable; @@ -34,14 +35,17 @@ public class ScreenOpener { openScreen(toOpen); } - public static void openPreviousScreen(Screen current) { + public static void openPreviousScreen(Screen current, Optional screenWithContext) { if (backStack.isEmpty()) return; backSteppedFrom = current; Screen previousScreen = backStack.pop(); - if (previousScreen instanceof AbstractSimiScreen) - ((AbstractSimiScreen) previousScreen).transition.startWithValue(-0.1) + if (previousScreen instanceof AbstractSimiScreen) { + AbstractSimiScreen previousAbstractSimiScreen = (AbstractSimiScreen) previousScreen; + screenWithContext.ifPresent(s -> s.shareContextWith(previousAbstractSimiScreen)); + previousAbstractSimiScreen.transition.startWithValue(-0.1) .chase(-1, .4f, LerpedFloat.Chaser.EXP); + } openScreen(previousScreen); } @@ -65,7 +69,7 @@ public class ScreenOpener { if (!screen.isEquivalentTo((AbstractSimiScreen) previouslyRenderedScreen)) return false; - openPreviousScreen(Minecraft.getInstance().currentScreen); + openPreviousScreen(Minecraft.getInstance().currentScreen, Optional.of(screen)); return true; } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderRegistry.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderRegistry.java index 74f7e7ec5..6c7bf9cbb 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderRegistry.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderRegistry.java @@ -39,15 +39,20 @@ public class PonderRegistry { public static final PonderChapterRegistry chapters = new PonderChapterRegistry(); public static Map> all = new HashMap<>(); - public static PonderSceneBuilder addStoryBoard(ItemProviderEntry component, String schematic, PonderStoryBoard storyBoard) { + public static PonderSceneBuilder addStoryBoard(ItemProviderEntry component, String schematic, + PonderStoryBoard storyBoard, PonderTag... tags) { ResourceLocation id = component.getId(); PonderStoryBoardEntry entry = new PonderStoryBoardEntry(storyBoard, schematic, id); PonderSceneBuilder builder = new PonderSceneBuilder(entry); - all.computeIfAbsent(id, _$ -> new ArrayList<>()).add(entry); + if (tags.length > 0) + builder.highlightTags(tags); + all.computeIfAbsent(id, _$ -> new ArrayList<>()) + .add(entry); return builder; } - public static PonderSceneBuilder addStoryBoard(PonderChapter chapter, ResourceLocation component, String schematic, PonderStoryBoard storyBoard) { + public static PonderSceneBuilder addStoryBoard(PonderChapter chapter, ResourceLocation component, String schematic, + PonderStoryBoard storyBoard) { if (component == null) component = new ResourceLocation("minecraft", "stick"); @@ -94,7 +99,8 @@ public class PonderRegistry { public static PonderScene compileScene(int i, PonderStoryBoardEntry sb, PonderWorld world) { PonderScene scene = new PonderScene(world, sb.getComponent(), sb.getTags()); SceneBuilder builder = scene.builder(); - sb.getBoard().program(builder, scene.getSceneBuildingUtil()); + sb.getBoard() + .program(builder, scene.getSceneBuildingUtil()); return scene; } @@ -135,10 +141,16 @@ public class PonderRegistry { } public MultiSceneBuilder addStoryBoard(String schematicPath, PonderStoryBoard storyBoard) { - return addStoryBoard(schematicPath, storyBoard, PonderSceneBuilder::highlightAllTags); + return addStoryBoard(schematicPath, storyBoard, $ -> { + }); } - public MultiSceneBuilder addStoryBoard(String schematicPath, PonderStoryBoard storyBoard, Consumer extras) { + public MultiSceneBuilder addStoryBoard(String schematicPath, PonderStoryBoard storyBoard, PonderTag... tags) { + return addStoryBoard(schematicPath, storyBoard, sb -> sb.highlightTags(tags)); + } + + public MultiSceneBuilder addStoryBoard(String schematicPath, PonderStoryBoard storyBoard, + Consumer extras) { components.forEach(c -> extras.accept(PonderRegistry.addStoryBoard(c, schematicPath, storyBoard))); return this; } @@ -154,12 +166,14 @@ public class PonderRegistry { } public PonderSceneBuilder highlightAllTags() { - entry.getTags().add(PonderTag.Highlight.ALL); + entry.getTags() + .add(PonderTag.Highlight.ALL); return this; } public PonderSceneBuilder highlightTags(PonderTag... tags) { - entry.getTags().addAll(Arrays.asList(tags)); + entry.getTags() + .addAll(Arrays.asList(tags)); return this; } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java index 1e5b8bca9..29f877017 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java @@ -77,6 +77,7 @@ public class PonderUI extends AbstractSimiScreen { private LerpedFloat lazyIndex; private int index = 0; + private PonderTag referredToByTag; private PonderButton left, right, scan, chap; @@ -85,6 +86,13 @@ public class PonderUI extends AbstractSimiScreen { .getRegistryName())); } + public static PonderUI of(ItemStack item, PonderTag tag) { + PonderUI ponderUI = new PonderUI(PonderRegistry.compile(item.getItem() + .getRegistryName())); + ponderUI.referredToByTag = tag; + return ponderUI; + } + public static PonderUI of(PonderChapter chapter) { PonderUI ui = new PonderUI(PonderRegistry.compile(chapter)); ui.chapter = chapter; @@ -186,6 +194,26 @@ public class PonderUI extends AbstractSimiScreen { @Override public void tick() { super.tick(); + + if (referredToByTag != null) { + for (int i = 0; i < scenes.size(); i++) { + PonderScene ponderScene = scenes.get(i); + if (!ponderScene.tags.contains(referredToByTag)) + continue; + if (i == index) + break; + scenes.get(index) + .fadeOut(); + index = i; + scenes.get(index) + .begin(); + lazyIndex.chase(index, 1 / 4f, Chaser.EXP); + identifyMode = false; + break; + } + referredToByTag = null; + } + PonderScene activeScene = scenes.get(index); if (!identifyMode) activeScene.tick(); @@ -743,4 +771,10 @@ public class PonderUI extends AbstractSimiScreen { return super.isEquivalentTo(other); } + @Override + public void shareContextWith(AbstractSimiScreen other) { + if (other instanceof PonderUI) + ((PonderUI) other).referredToByTag = referredToByTag; + } + } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndex.java b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndex.java index 63ad820b8..40cad7990 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndex.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndex.java @@ -16,20 +16,22 @@ public class PonderIndex { // (!) Modifications inside storyboard methods only require re-opening the ui PonderRegistry.forComponents(AllBlocks.SHAFT) - .addStoryBoard("shaft/relay", KineticsScenes::shaftAsRelay); + .addStoryBoard("shaft/relay", KineticsScenes::shaftAsRelay, PonderTag.KINETIC_RELAYS); PonderRegistry.forComponents(AllBlocks.SHAFT, AllBlocks.ANDESITE_ENCASED_SHAFT, AllBlocks.BRASS_ENCASED_SHAFT) .addStoryBoard("shaft/encasing", KineticsScenes::shaftsCanBeEncased); PonderRegistry.forComponents(AllBlocks.COGWHEEL) - .addStoryBoard("cog/small", KineticsScenes::cogAsRelay) + .addStoryBoard("cog/small", KineticsScenes::cogAsRelay, PonderTag.KINETIC_RELAYS) .addStoryBoard("cog/speedup", KineticsScenes::cogsSpeedUp); + PonderRegistry.forComponents(AllBlocks.LARGE_COGWHEEL) .addStoryBoard("cog/speedup", KineticsScenes::cogsSpeedUp) - .addStoryBoard("cog/large", KineticsScenes::largeCogAsRelay); + .addStoryBoard("cog/large", KineticsScenes::largeCogAsRelay, PonderTag.KINETIC_RELAYS); + PonderRegistry.forComponents(AllItems.BELT_CONNECTOR) - .addStoryBoard("belt/connect", BeltScenes::beltConnector) + .addStoryBoard("belt/connect", BeltScenes::beltConnector, PonderTag.KINETIC_RELAYS) .addStoryBoard("belt/directions", BeltScenes::directions) - .addStoryBoard("belt/transport", BeltScenes::transport) + .addStoryBoard("belt/transport", BeltScenes::transport, PonderTag.LOGISTICS) .addStoryBoard("belt/encasing", BeltScenes::beltsCanBeEncased); PonderRegistry.forComponents(AllBlocks.ANDESITE_CASING, AllBlocks.BRASS_CASING) @@ -37,31 +39,38 @@ public class PonderIndex { .addStoryBoard("belt/encasing", BeltScenes::beltsCanBeEncased); PonderRegistry.forComponents(AllBlocks.GEARBOX, AllItems.VERTICAL_GEARBOX) - .addStoryBoard("gearbox", KineticsScenes::gearbox); - PonderRegistry.addStoryBoard(AllBlocks.CLUTCH, "clutch", KineticsScenes::clutch); - PonderRegistry.addStoryBoard(AllBlocks.GEARSHIFT, "gearshift", KineticsScenes::gearshift); + .addStoryBoard("gearbox", KineticsScenes::gearbox, PonderTag.KINETIC_RELAYS); + + PonderRegistry.addStoryBoard(AllBlocks.CLUTCH, "clutch", KineticsScenes::clutch, PonderTag.KINETIC_RELAYS); + PonderRegistry.addStoryBoard(AllBlocks.GEARSHIFT, "gearshift", KineticsScenes::gearshift, + PonderTag.KINETIC_RELAYS); PonderRegistry.forComponents(AllBlocks.ENCASED_FAN) - .addStoryBoard("fan/direction", FanScenes::direction) + .addStoryBoard("fan/direction", FanScenes::direction, PonderTag.KINETIC_APPLIANCES) .addStoryBoard("fan/processing", FanScenes::processing) - .addStoryBoard("fan/source", FanScenes::source); + .addStoryBoard("fan/source", FanScenes::source, PonderTag.KINETIC_SOURCES); - PonderRegistry.addStoryBoard(AllBlocks.CREATIVE_MOTOR, "creative_motor", KineticsScenes::creativeMotor); - PonderRegistry.addStoryBoard(AllBlocks.WATER_WHEEL, "water_wheel", KineticsScenes::waterWheel); - PonderRegistry.addStoryBoard(AllBlocks.HAND_CRANK, "hand_crank", KineticsScenes::handCrank); - PonderRegistry.addStoryBoard(AllBlocks.COPPER_VALVE_HANDLE, "valve_handle", KineticsScenes::valveHandle); + PonderRegistry.addStoryBoard(AllBlocks.CREATIVE_MOTOR, "creative_motor", KineticsScenes::creativeMotor, + PonderTag.KINETIC_SOURCES); + PonderRegistry.addStoryBoard(AllBlocks.WATER_WHEEL, "water_wheel", KineticsScenes::waterWheel, + PonderTag.KINETIC_SOURCES); + PonderRegistry.addStoryBoard(AllBlocks.HAND_CRANK, "hand_crank", KineticsScenes::handCrank, + PonderTag.KINETIC_SOURCES); + + PonderRegistry.addStoryBoard(AllBlocks.COPPER_VALVE_HANDLE, "valve_handle", KineticsScenes::valveHandle, + PonderTag.KINETIC_SOURCES); PonderRegistry.forComponents(AllBlocks.DYED_VALVE_HANDLES) .addStoryBoard("valve_handle", KineticsScenes::valveHandle); PonderRegistry.addStoryBoard(AllBlocks.ENCASED_CHAIN_DRIVE, "chain_drive/relay", - ChainDriveScenes::chainDriveAsRelay); + ChainDriveScenes::chainDriveAsRelay, PonderTag.KINETIC_RELAYS); PonderRegistry.forComponents(AllBlocks.ENCASED_CHAIN_DRIVE, AllBlocks.ADJUSTABLE_CHAIN_GEARSHIFT) .addStoryBoard("chain_drive/gearshift", ChainDriveScenes::adjustableChainGearshift); // Funnels PonderRegistry.addStoryBoard(AllBlocks.BRASS_FUNNEL, "funnels/brass", FunnelScenes::brass); PonderRegistry.forComponents(AllBlocks.ANDESITE_FUNNEL, AllBlocks.BRASS_FUNNEL) - .addStoryBoard("funnels/intro", FunnelScenes::intro) + .addStoryBoard("funnels/intro", FunnelScenes::intro, PonderTag.LOGISTICS) .addStoryBoard("funnels/direction", FunnelScenes::directionality) .addStoryBoard("funnels/compat", FunnelScenes::compat) .addStoryBoard("funnels/redstone", FunnelScenes::redstone) @@ -69,8 +78,11 @@ public class PonderIndex { PonderRegistry.addStoryBoard(AllBlocks.ANDESITE_FUNNEL, "funnels/brass", FunnelScenes::brass); // Gantries - PonderRegistry.addStoryBoard(AllBlocks.GANTRY_SHAFT, "gantry/intro", GantryScenes::introForShaft); - PonderRegistry.addStoryBoard(AllBlocks.GANTRY_CARRIAGE, "gantry/intro", GantryScenes::introForPinion); + PonderRegistry.addStoryBoard(AllBlocks.GANTRY_SHAFT, "gantry/intro", GantryScenes::introForShaft, + PonderTag.KINETIC_APPLIANCES, PonderTag.MOVEMENT_ANCHOR); + PonderRegistry.addStoryBoard(AllBlocks.GANTRY_CARRIAGE, "gantry/intro", GantryScenes::introForPinion, + PonderTag.KINETIC_APPLIANCES, PonderTag.MOVEMENT_ANCHOR); + PonderRegistry.forComponents(AllBlocks.GANTRY_SHAFT, AllBlocks.GANTRY_CARRIAGE) .addStoryBoard("gantry/redstone", GantryScenes::redstone) .addStoryBoard("gantry/direction", GantryScenes::direction) @@ -78,7 +90,7 @@ public class PonderIndex { // Movement Actors PonderRegistry.forComponents(AllBlocks.PORTABLE_STORAGE_INTERFACE) - .addStoryBoard("portable_interface/transfer", MovementActorScenes::psiTransfer) + .addStoryBoard("portable_interface/transfer", MovementActorScenes::psiTransfer, PonderTag.CONTRAPTION_ACTOR) .addStoryBoard("portable_interface/redstone", MovementActorScenes::psiRedstone); // Debug scenes, can be found in game via the Brass Hand diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagScreen.java b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagScreen.java index 822f0e59b..8c03321c9 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagScreen.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagScreen.java @@ -82,7 +82,7 @@ public class PonderTagScreen extends AbstractSimiScreen { if (!PonderRegistry.all.containsKey(i.getRegistryName())) return; centerScalingOn(mouseX, mouseY); - ScreenOpener.transitionTo(PonderUI.of(new ItemStack(i))); + ScreenOpener.transitionTo(PonderUI.of(new ItemStack(i), tag)); }).showing(new ItemStack(i)); button.fade(1); @@ -99,7 +99,7 @@ public class PonderTagScreen extends AbstractSimiScreen { .getRegistryName())) return; centerScalingOn(mouseX, mouseY); - ScreenOpener.transitionTo(PonderUI.of(tag.getMainItem())); + ScreenOpener.transitionTo(PonderUI.of(tag.getMainItem(), tag)); }).showing(tag.getMainItem()); button.fade(1); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderButton.java b/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderButton.java index 1c007367e..c5ff15c2a 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderButton.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderButton.java @@ -95,7 +95,7 @@ public class PonderButton extends AbstractSimiWidget { float flashValue = flash.getValue(partialTicks); if (flashValue > .1f) - fade *= 3 * flashValue + ((Math.sin(AnimationTickHolder.getTicks() + partialTicks) / 6)) / 1f; + fade *= 3 * flashValue + Math.sin((AnimationTickHolder.getTicks() + partialTicks) / 6); int backgroundColor = ColorHelper.applyAlpha(0xdd000000, fade); int borderColorStart = ColorHelper.applyAlpha(isHovered ? 0x70ffffff : 0x40aa9999, fade); From cb063d161c8aa4eca680d231a3e73b093aaa77f7 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Tue, 9 Mar 2021 21:17:02 +0100 Subject: [PATCH 2/2] Pondering about Windmills --- .../components/actors/HarvesterRenderer.java | 34 +-- .../actors/HarvesterTileEntity.java | 11 +- .../foundation/ponder/SceneBuilder.java | 9 + .../ponder/content/BearingScenes.java | 198 ++++++++++++++++++ .../ponder/content/PonderIndex.java | 6 + .../ponder/windmill_bearing/source.nbt | Bin 0 -> 820 bytes .../ponder/windmill_bearing/structure.nbt | Bin 0 -> 1120 bytes 7 files changed, 242 insertions(+), 16 deletions(-) create mode 100644 src/main/java/com/simibubi/create/foundation/ponder/content/BearingScenes.java create mode 100644 src/main/resources/ponder/windmill_bearing/source.nbt create mode 100644 src/main/resources/ponder/windmill_bearing/structure.nbt diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterRenderer.java index d3455237d..7a39b6233 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterRenderer.java @@ -35,7 +35,8 @@ public class HarvesterRenderer extends SafeTileEntityRenderer type) { super(type); } - + @Override public boolean hasFastRenderer() { return true; - } + } + + // For simulations such as Ponder + float manuallyAnimatedSpeed; + + public void setAnimatedSpeed(float speed) { + manuallyAnimatedSpeed = speed; + } } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java b/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java index 7dc616f67..17ea8d9a0 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java @@ -596,6 +596,15 @@ public class SceneBuilder { modifyTileNBT(selection, teType, consumer, false); } + public void modifyTileEntity(BlockPos position, Class teType, + Consumer consumer) { + addInstruction(scene -> { + TileEntity tileEntity = scene.world.getTileEntity(position); + if (teType.isInstance(tileEntity)) + consumer.accept(teType.cast(tileEntity)); + }); + } + public void modifyTileNBT(Selection selection, Class teType, Consumer consumer, boolean reDrawBlocks) { addInstruction(new TileEntityDataInstruction(selection, teType, nbt -> { diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/BearingScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/BearingScenes.java new file mode 100644 index 000000000..6358cf7ab --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/BearingScenes.java @@ -0,0 +1,198 @@ +package com.simibubi.create.foundation.ponder.content; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.content.contraptions.components.actors.HarvesterTileEntity; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.SailBlock; +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.Iterate; +import com.simibubi.create.foundation.utility.Pointing; + +import net.minecraft.util.Direction; +import net.minecraft.util.Direction.Axis; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; + +public class BearingScenes { + + public static void windmillsAsSource(SceneBuilder scene, SceneBuildingUtil util) { + scene.title("windmill_source", "Generating Rotational Force using Windmill Bearings"); + scene.world.showSection(util.select.fromTo(1, 0, 1, 5, 0, 5), Direction.UP); + scene.world.setBlock(util.grid.at(2, -1, 0), AllBlocks.SAIL.getDefaultState() + .with(SailBlock.FACING, Direction.NORTH), false); + scene.idle(5); + Selection kinetics = util.select.fromTo(3, 1, 1, 4, 1, 4); + Selection largeCog = util.select.position(3, 2, 2); + BlockPos windmill = util.grid.at(3, 2, 1); + scene.world.showSection(kinetics.add(largeCog), Direction.DOWN); + scene.idle(10); + + scene.world.showSection(util.select.position(windmill), Direction.DOWN); + scene.idle(10); + + BlockPos anchorPos = windmill.north(); + scene.overlay.showSelectionWithText(util.select.position(anchorPos), 60) + .colored(PonderPalette.GREEN) + .pointAt(util.vector.blockSurface(windmill, Direction.WEST)) + .placeNearTarget() + .text("Windmill Bearings attach to the block in front of them"); + scene.idle(50); + + ElementLink structure = + scene.world.showIndependentSection(util.select.position(anchorPos), Direction.SOUTH); + scene.idle(10); + for (Direction d : Iterate.directions) + if (d.getAxis() != Axis.Z) + scene.world.showSectionAndMerge(util.select.fromTo(anchorPos.offset(d, 1), anchorPos.offset(d, 2)), + d.getOpposite(), structure); + scene.idle(10); + + scene.world.showSectionAndMerge(util.select.fromTo(anchorPos.up() + .east(), + anchorPos.up(3) + .east()), + Direction.WEST, structure); + scene.world.showSectionAndMerge(util.select.fromTo(anchorPos.down() + .west(), + anchorPos.down(3) + .west()), + Direction.EAST, structure); + scene.world.showSectionAndMerge(util.select.fromTo(anchorPos.east() + .down(), + anchorPos.east(3) + .down()), + Direction.UP, structure); + scene.world.showSectionAndMerge(util.select.fromTo(anchorPos.west() + .up(), + anchorPos.west(3) + .up()), + Direction.DOWN, structure); + + scene.idle(5); + for (Direction d : Iterate.directions) + if (d.getAxis() != Axis.Z) + scene.effects.superGlue(anchorPos.offset(d, 1), d.getOpposite(), false); + scene.idle(10); + + scene.overlay.showText(60) + .pointAt(util.vector.blockSurface(anchorPos, Direction.NORTH)) + .placeNearTarget() + .text("If enough Sail-like blocks are attached to the block, it can act as a Windmill"); + scene.idle(70); + + scene.rotateCameraY(-90); + scene.idle(20); + + scene.overlay.showControls(new InputWindowElement(util.vector.topOf(windmill), Pointing.DOWN).rightClick(), 60); + scene.idle(7); + scene.world.rotateBearing(windmill, 360, 200); + scene.world.rotateSection(structure, 0, 0, 360, 200); + scene.world.setKineticSpeed(largeCog, 4); + scene.world.setKineticSpeed(kinetics, -8); + scene.effects.rotationDirectionIndicator(windmill.south()); + BlockPos gaugePos = util.grid.at(4, 1, 4); + scene.effects.indicateSuccess(gaugePos); + scene.idle(10); + + scene.overlay.showText(60) + .pointAt(util.vector.topOf(windmill)) + .placeNearTarget() + .text("Once Activated, the Windmill Bearing will start providing Rotational Force"); + scene.idle(70); + + scene.overlay.showText(60) + .pointAt(util.vector.blockSurface(gaugePos, Direction.WEST)) + .colored(PonderPalette.SLOW) + .placeNearTarget() + .text("The Amount of Sail Blocks determine its Rotation Speed"); + scene.idle(90); + + Vec3d surface = util.vector.blockSurface(windmill, Direction.WEST); + AxisAlignedBB point = new AxisAlignedBB(surface, surface); + AxisAlignedBB expanded = point.grow(1 / 16f, 1 / 4f, 1 / 4f); + + scene.overlay.showControls(new InputWindowElement(surface, Pointing.DOWN).scroll() + .withWrench(), 60); + scene.overlay.chaseBoundingBoxOutline(PonderPalette.WHITE, point, point, 1); + scene.idle(1); + scene.overlay.chaseBoundingBoxOutline(PonderPalette.WHITE, point, expanded, 50); + scene.overlay.showText(60) + .pointAt(surface) + .placeNearTarget() + .text("Use a Wrench to configure its rotation direction"); + scene.idle(35); + + scene.world.rotateBearing(windmill, -90 - 45, 75); + scene.world.rotateSection(structure, 0, 0, -90 - 45, 75); + scene.world.modifyKineticSpeed(largeCog, f -> -f); + scene.world.modifyKineticSpeed(kinetics, f -> -f); + scene.effects.rotationDirectionIndicator(windmill.south()); + scene.idle(69); + + scene.overlay.showControls(new InputWindowElement(util.vector.topOf(windmill), Pointing.DOWN).rightClick(), 60); + scene.idle(7); + scene.world.rotateBearing(windmill, -45, 0); + scene.world.rotateSection(structure, 0, 0, -45, 0); + scene.world.setKineticSpeed(largeCog, 0); + scene.world.setKineticSpeed(kinetics, 0); + scene.idle(10); + scene.overlay.showText(60) + .pointAt(util.vector.topOf(windmill)) + .placeNearTarget() + .text("Right-click the Bearing anytime to stop and edit the Structure again"); + + } + + public static void windmillsAnyStructure(SceneBuilder scene, SceneBuildingUtil util) { + scene.title("windmill_structure", "Windmill Contraptions"); + scene.world.showSection(util.select.layer(0), Direction.UP); + scene.idle(5); + + BlockPos bearingPos = util.grid.at(3, 1, 3); + scene.world.showSection(util.select.position(bearingPos), Direction.DOWN); + scene.idle(10); + ElementLink contraption = + scene.world.showIndependentSection(util.select.position(bearingPos.up()), Direction.DOWN); + scene.idle(10); + scene.world.showSectionAndMerge(util.select.fromTo(3, 2, 2, 3, 3, 1), Direction.SOUTH, contraption); + scene.world.showSectionAndMerge(util.select.fromTo(3, 2, 4, 3, 3, 5), Direction.NORTH, contraption); + scene.idle(5); + scene.world.showSectionAndMerge(util.select.position(3, 1, 5), Direction.NORTH, contraption); + scene.world.showSectionAndMerge(util.select.position(3, 4, 2), Direction.DOWN, contraption); + scene.idle(5); + scene.world.showSectionAndMerge(util.select.position(2, 1, 5), Direction.EAST, contraption); + scene.world.showSectionAndMerge(util.select.position(3, 3, 3), Direction.DOWN, contraption); + scene.idle(5); + scene.effects.superGlue(bearingPos.up(), Direction.SOUTH, true); + scene.effects.superGlue(bearingPos.up(), Direction.NORTH, true); + scene.idle(5); + scene.effects.superGlue(util.grid.at(3, 1, 5), Direction.UP, true); + scene.idle(5); + scene.effects.superGlue(util.grid.at(3, 3, 3), Direction.DOWN, true); + scene.idle(10); + + scene.overlay.showOutline(PonderPalette.BLUE, bearingPos, util.select.fromTo(3, 2, 1, 3, 3, 2), 80); + scene.overlay.showSelectionWithText(util.select.fromTo(3, 2, 4, 3, 3, 5), 80) + .colored(PonderPalette.BLUE) + .text("Any Structure can count as a valid Windmill, as long as it contains at least 8 sail-like Blocks."); + + scene.idle(90); + scene.overlay.showControls( + new InputWindowElement(util.vector.blockSurface(bearingPos, Direction.WEST), Pointing.LEFT).rightClick(), + 40); + scene.idle(7); + scene.world.rotateBearing(bearingPos, -720, 400); + scene.world.rotateSection(contraption, 0, -720, 0, 400); + scene.world.modifyTileEntity(util.grid.at(2, 1, 5), HarvesterTileEntity.class, + hte -> hte.setAnimatedSpeed(-150)); + scene.markAsFinished(); + scene.idle(400); + scene.world.modifyTileEntity(util.grid.at(2, 1, 5), HarvesterTileEntity.class, hte -> hte.setAnimatedSpeed(0)); + } + +} diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndex.java b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndex.java index 40cad7990..63438e8ec 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndex.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndex.java @@ -77,6 +77,12 @@ public class PonderIndex { .addStoryBoard("funnels/transposer", FunnelScenes::transposer); PonderRegistry.addStoryBoard(AllBlocks.ANDESITE_FUNNEL, "funnels/brass", FunnelScenes::brass); + // Windmill Bearing + PonderRegistry.forComponents(AllBlocks.WINDMILL_BEARING) + .addStoryBoard("windmill_bearing/source", BearingScenes::windmillsAsSource, PonderTag.KINETIC_SOURCES) + .addStoryBoard("windmill_bearing/structure", BearingScenes::windmillsAnyStructure, + PonderTag.MOVEMENT_ANCHOR); + // Gantries PonderRegistry.addStoryBoard(AllBlocks.GANTRY_SHAFT, "gantry/intro", GantryScenes::introForShaft, PonderTag.KINETIC_APPLIANCES, PonderTag.MOVEMENT_ANCHOR); diff --git a/src/main/resources/ponder/windmill_bearing/source.nbt b/src/main/resources/ponder/windmill_bearing/source.nbt new file mode 100644 index 0000000000000000000000000000000000000000..7426cb759b0f4772e35b997be901d16eb98e21e7 GIT binary patch literal 820 zcmV-41Izp$iwFP!000000L50{Z__Xkb`qz*wy}Zu`I=``A?*e24GqK#8i5JKhMhr3t)4$*)L z!wjPumDdpUCR`?$dIW!thbYLUu8qpuN7X~94KZ|O(ZqOYd3gb?c%`> zJfQ;HfnS4z&mzYO#$6JMe@KJhf)*kZ0_W=WRUL zfhTm}sWpcVc@7=&yp0Dt@Pt;L5eme_geW}EDV>(*#eZhBO*g&&7frKa`;KnFY1dT&C;Qm$$1$#te-UDWHeImCatrBCd{c>(%G0h9hE1b!AU&l70$Oq`CG>r+DB8_KEX|p0-Q`sh)Taq8wNv`T!?xSr(oDn{Q1G+Ru&O2i3 z=dz%x@uK#IDQuCz0dxXkqZYTCUu}GPu=VFtDL14q6$D1+58}QfbM?o~S(=$RRpfe0 y`tBsYpts^%1^?UR-ADNzNJ29U&LxDy+~8RPdr61TR5PDk2C$f}nyRo^lfL2WwUT zn3+swdJ8hLyENTh_1^csdf%&h&6EHr0x0P&@c;nkn$j0C_ag8KS5#3VOZvS~0v_K` zMNn7~iV9vx?MMDOpsN3GneRSs0&mO<=^^XoHFY)a*<0Qfxi~tvS zb2M_!I>5ik&qt!oYZ|&(rA@-64h7;+hu1`;Fk29U)kG&A)D$lXg$*4;*)?M~J~sTz zi-2UT(1D3%*cKYux%9Zc!W%y}g zGF;7*0p`e1d0=8Pygfhl&R<(Ud~?7uY@@HPO`lrs+RO0L#AN8^$>8S604FBHhci2S zpZ{8N4p@eZzx`V$;f0gdG6XXdli}q&8Bm@KC+iN~Opar$*cy>vxVk3k!EgpD&~<5}Q93mjyD zlW`ifaYxvALpB~5y>>T;k2}I<6rcTYpal-Hz{xndIqT}#<>V(@yJw-hXQ6u@4z$2Q z7C0GaXrULh&?^rITHqiHoQxB+s8wiDtH?qxWT96c4z$2Q7C60LF<=A7OFAiau^B5u3&xgn#tr;ekeVa zJCxU&l(Arg;7B_laNn|SN9T!YKq?70X0?MAj8c|&h4YhehtqIj14~KenA{8^7J5w; zEh*BJpwIpOCgmiI@TSsuM5-}a97LN+(Gq|oDVqk4wzWTrM%34^p8kj^rhW#`o}&Jr zYGFo{BBlkEd;nK*lYr?y<4%Jr5`=XRi;cn2; z?S2$M5+a^0fznzebmKL@CTLTH6o!+%p~a#ny;STU`nj(gK|2}^%qS8Kozw~e^82cHrOL`JS7w18pSNgDr}fa zN83bteRW;aS=4N8&=Ayks@o!WDfkcf4lAZP5&!^X^&-yz literal 0 HcmV?d00001