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
This commit is contained in:
StormDragon_64 2023-07-03 07:05:06 -07:00 committed by GitHub
parent 2bcc12b096
commit b7a082c408
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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<WorldSectionElement> showIndependentSection(Selection selection, Direction fadeInDirection, int duration) {
DisplayWorldSectionInstruction instruction =
new DisplayWorldSectionInstruction(duration, fadeInDirection, selection, Optional.empty());
addInstruction(instruction);
return instruction.createLink(scene);
}
public ElementLink<WorldSectionElement> 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<WorldSectionElement> link, Direction fadeOutDirection, int duration) {
addInstruction(new FadeOutOfSceneInstruction<>(duration, fadeOutDirection, link));
}
public void hideIndependentSectionImmediately(ElementLink<WorldSectionElement> link) {
addInstruction(new FadeOutOfSceneInstruction<>(0, Direction.DOWN, link));
}
public void restoreBlocks(Selection selection) {
addInstruction(scene -> scene.getWorld()
.restoreBlocks(selection));