Skip to content

Commit

Permalink
misc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Sep 2, 2024
1 parent ff1d47e commit a84c65f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import dev.ithundxr.createnumismatics.registry.NumismaticsPackets;
import dev.ithundxr.createnumismatics.util.Utils;
import net.minecraft.SharedConstants;
import net.minecraft.Util;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.data.DataGenerator;
import net.minecraft.resources.ResourceLocation;
Expand Down Expand Up @@ -114,7 +115,7 @@ public static ResourceLocation asResource(String path) {

public static void crashDev(String message) {
if (Utils.isDevEnv()) {
throw new RuntimeException(message);
throw Util.pauseInIde(new RuntimeException(message));
} else {
LOGGER.error(message);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,15 +215,7 @@ public static void depositorPricing(SceneBuilder scene, SceneBuildingUtil util)
scene.idle(50);

showIcon(scene, util.vector.topOf(depositor), "amount1x", NumismaticsIcons.I_COIN_SPUR, 40);
scene.effects.indicateSuccess(depositor);

cycleState(depositor, AbstractDepositorBlock.LOCKED, scene);
cycleState(redstoneLamp, RedstoneLampBlock.LIT, scene);
scene.idle(50);

cycleState(depositor, AbstractDepositorBlock.LOCKED, scene);
cycleState(redstoneLamp, RedstoneLampBlock.LIT, scene);
scene.idle(10);
indicateSuccess(scene, depositor, redstoneLamp);

scene.world.hideSection(util.select.position(depositor), Direction.UP);
scene.idle(20);
Expand All @@ -245,17 +237,9 @@ public static void depositorPricing(SceneBuilder scene, SceneBuildingUtil util)
"amount2x", NumismaticsIcons.I_COIN_SPROCKET,
40
);
scene.effects.indicateSuccess(depositor);

cycleState(depositor, AbstractDepositorBlock.LOCKED, scene);
cycleState(redstoneLamp, RedstoneLampBlock.LIT, scene);
scene.idle(50);

cycleState(depositor, AbstractDepositorBlock.LOCKED, scene);
cycleState(redstoneLamp, RedstoneLampBlock.LIT, scene);
scene.idle(10);
indicateSuccess(scene, depositor, redstoneLamp);
}

// <--------------------------------------------> Utilities <-------------------------------------------->
private static <T extends Comparable<T>> void cycleState(BlockPos pos, Property<T> property, SceneBuilder scene) {
scene.world.modifyBlock(pos, state -> state.cycle(property), false);
Expand All @@ -266,6 +250,18 @@ private static void cycleDoorState(BlockPos doorPos, SceneBuilder scene) {
cycleState(doorPos.above(), DoorBlock.OPEN, scene);
}

private static void indicateSuccess(SceneBuilder scene, BlockPos depositorPos, BlockPos lampPos) {
scene.effects.indicateSuccess(depositorPos);

cycleState(depositorPos, AbstractDepositorBlock.LOCKED, scene);
cycleState(lampPos, RedstoneLampBlock.LIT, scene);
scene.idle(50);

cycleState(depositorPos, AbstractDepositorBlock.LOCKED, scene);
cycleState(lampPos, RedstoneLampBlock.LIT, scene);
scene.idle(10);
}

private static InputWindowElement createElement(Vec3 sceneSpace, String sharedTextValue, AllIcons icon) {
InputWindowElement element = new InputWindowElement(sceneSpace, Pointing.DOWN).showing(icon);
((AccessorInputWindowElement) element).numsismatics$setKey(Numismatics.asResource(sharedTextValue));
Expand Down

0 comments on commit a84c65f

Please sign in to comment.