From b7a082c408fd806f96994483f5db1fb94312aaa7 Mon Sep 17 00:00:00 2001 From: StormDragon_64 <80718549+StormDragon-64@users.noreply.github.com> Date: Mon, 3 Jul 2023 07:05:06 -0700 Subject: [PATCH] Add a few new ponder instructions (#4926) - Additional method overloads for commonly used ponder instructions - Rotation indicator instructions can now be given custom display locations --- .../foundation/ponder/SceneBuilder.java | 32 ++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) 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 dd150d664..05ce35ad0 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java @@ -296,7 +296,7 @@ public class SceneBuilder { addInstruction(scene -> SuperGlueItem.spawnParticles(scene.getWorld(), pos, side, fullBlock)); } - private void rotationIndicator(BlockPos pos, boolean direction) { + private void rotationIndicator(BlockPos pos, boolean direction, BlockPos displayPos) { addInstruction(scene -> { BlockState blockState = scene.getWorld() .getBlockState(pos); @@ -318,7 +318,7 @@ public class SceneBuilder { int particleSpeed = speedLevel.getParticleSpeed(); particleSpeed *= Math.signum(speed); - Vec3 location = VecHelper.getCenterOf(pos); + Vec3 location = VecHelper.getCenterOf(displayPos); RotationIndicatorParticleData particleData = new RotationIndicatorParticleData(color, particleSpeed, kb.getParticleInitialRadius(), kb.getParticleTargetRadius(), 20, rotationAxis.name() .charAt(0)); @@ -330,11 +330,19 @@ public class SceneBuilder { } public void rotationSpeedIndicator(BlockPos pos) { - rotationIndicator(pos, false); + rotationIndicator(pos, false, pos); } public void rotationDirectionIndicator(BlockPos pos) { - rotationIndicator(pos, true); + rotationIndicator(pos, true, pos); + } + + public void rotationSpeedIndicator(BlockPos pos, BlockPos displayPos) { + rotationIndicator(pos, false, displayPos); + } + + public void rotationDirectionIndicator(BlockPos pos, BlockPos displayPos) { + rotationIndicator(pos, true, displayPos); } public void indicateRedstone(BlockPos pos) { @@ -523,6 +531,13 @@ public class SceneBuilder { return instruction.createLink(scene); } + public ElementLink showIndependentSection(Selection selection, Direction fadeInDirection, int duration) { + DisplayWorldSectionInstruction instruction = + new DisplayWorldSectionInstruction(duration, fadeInDirection, selection, Optional.empty()); + addInstruction(instruction); + return instruction.createLink(scene); + } + public ElementLink showIndependentSectionImmediately(Selection selection) { DisplayWorldSectionInstruction instruction = new DisplayWorldSectionInstruction(0, Direction.DOWN, selection, Optional.empty()); @@ -549,6 +564,15 @@ public class SceneBuilder { addInstruction(new FadeOutOfSceneInstruction<>(15, fadeOutDirection, link)); } + public void hideIndependentSection(ElementLink link, Direction fadeOutDirection, int duration) { + addInstruction(new FadeOutOfSceneInstruction<>(duration, fadeOutDirection, link)); + } + + public void hideIndependentSectionImmediately(ElementLink link) { + addInstruction(new FadeOutOfSceneInstruction<>(0, Direction.DOWN, link)); + } + + public void restoreBlocks(Selection selection) { addInstruction(scene -> scene.getWorld() .restoreBlocks(selection));