Skip to content

Commit

Permalink
added /sga:hide daytime to toggle all rendering showing up during day…
Browse files Browse the repository at this point in the history
… and rain instead of just at night
  • Loading branch information
Nettakrim committed Sep 20, 2023
1 parent 2256268 commit 2175da7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class SpaceRenderingManager {
public static boolean starsVisible;
public static boolean orbitingBodiesVisible;
public static boolean oldStarsVisible;
public static boolean starsAlwaysVisible;

private float starVisibility;

Expand All @@ -48,6 +49,7 @@ public SpaceRenderingManager() {
starsVisible = true;
orbitingBodiesVisible = true;
oldStarsVisible = false;
starsAlwaysVisible = false;
}

public void updateSpace(int ticks) {
Expand Down Expand Up @@ -139,7 +141,7 @@ private void updateDrawingConstellation() {
}

public void Render(MatrixStack matrices, Matrix4f projectionMatrix, float tickDelta, Camera camera, boolean bl, Runnable runnable) {
starVisibility = SpyglassAstronomyClient.world.method_23787(tickDelta) * (1.0f - SpyglassAstronomyClient.world.getRainGradient(tickDelta));
starVisibility = starsAlwaysVisible ? 1 : SpyglassAstronomyClient.world.method_23787(tickDelta) * (1.0f - SpyglassAstronomyClient.world.getRainGradient(tickDelta));
if (starVisibility > 0) {
matrices.pop();
matrices.push();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,16 @@ public static LiteralCommandNode<FabricClientCommandSource> getCommandNode() {
.executes(HideCommand::hideOldStars)
.build();

LiteralCommandNode<FabricClientCommandSource> dayTimeHideNode = ClientCommandManager
.literal("daytime")
.executes(HideCommand::hideDaytime)
.build();

hideNode.addChild(constellationsHideNode);
hideNode.addChild(starsHideNode);
hideNode.addChild(orbitingBodiesHideNode);
hideNode.addChild(oldStarsHideNode);
hideNode.addChild(dayTimeHideNode);

return hideNode;
}
Expand Down Expand Up @@ -80,6 +86,13 @@ private static int hideOldStars(CommandContext<FabricClientCommandSource> contex
return 1;
}

private static int hideDaytime(CommandContext<FabricClientCommandSource> context) {
SpaceRenderingManager.starsAlwaysVisible = !SpaceRenderingManager.starsAlwaysVisible;
sayHideUpdate("daytime", SpaceRenderingManager.starsAlwaysVisible);
return 1;
}


private static void sayHideUpdate(String base, boolean active) {
SpyglassAstronomyClient.say("commands.hide."+base+(active ? ".show" :".hide"));
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/spyglass_astronomy/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
"spyglass_astronomy.commands.hide.planets.show" : "Planets and Comets shown, run /sga:hide planets again to hide",
"spyglass_astronomy.commands.hide.vanillastars.hide" : "Vanilla Stars hidden, run /sga:hide vanillastars again to show",
"spyglass_astronomy.commands.hide.vanillastars.show" : "Vanilla Stars shown, run /sga:hide vanillastars again to hide",
"spyglass_astronomy.commands.hide.daytime.hide" : "All night-only, run /sga:hide daytime again to show all during day",
"spyglass_astronomy.commands.hide.daytime.show" : "All shown during day, run /sga:hide daytime again for night-only",

"spyglass_astronomy.commands.name.constellation" : "Named new Constellation \"%s\"",
"spyglass_astronomy.commands.name.constellation.rename" : "Renamed Constellation \"%s\" to \"%s\"",
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/assets/spyglass_astronomy/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
"spyglass_astronomy.commands.hide.planets.show" : "行星和彗星已全部显示,再次运行/sga:hide planets 以隐藏",
"spyglass_astronomy.commands.hide.vanillastars.hide" : "原版星辰已全部隐藏,再次运行/sga:hide vanillastars 以显示",
"spyglass_astronomy.commands.hide.vanillastars.show" : "原版星辰已全部显示,再次运行/sga:hide vanillastars 以隐藏",
"spyglass_astronomy.commands.hide.daytime.hide" : "#All night-only, run /sga:hide daytime again to show all during day",
"spyglass_astronomy.commands.hide.daytime.show" : "#All shown during day, run /sga:hide daytime again for night-only",

"spyglass_astronomy.commands.name.constellation" : "新星座被命名为 \"%s\"",
"spyglass_astronomy.commands.name.constellation.rename" : "星座 \"%s\" 被重命名为 \"%s\"",
Expand Down

0 comments on commit 2175da7

Please sign in to comment.