Skip to content

Commit

Permalink
added reset commands to starcount and yearlength, changed version to …
Browse files Browse the repository at this point in the history
…1.0.5
  • Loading branch information
Nettakrim committed May 23, 2023
1 parent 309ccf4 commit f45c466
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 18 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx4G
loader_version=0.14.19

# Mod Properties
mod_version = 1.0.4-mc1.19.4
mod_version = 1.0.5-mc1.19.4
maven_group = com.nettakrim.spyglass_astronomy
archives_base_name = spyglass_astronomy

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public SpaceDataManager(ClientWorld world) {
if (useDefault) {
starSeed = seedHash;
planetSeed = seedHash;
yearLength = 8;
yearLength = 8f;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ public static LiteralCommandNode<FabricClientCommandSource> getCommandNode() {
.literal("starcount")
.build();

LiteralCommandNode<FabricClientCommandSource> queryNode = ClientCommandManager
.literal("query")
.executes(StarCountCommand::queryStarCount)
.build();

LiteralCommandNode<FabricClientCommandSource> resetNode = ClientCommandManager
.literal("reset")
.executes(StarCountCommand::resetStarCount)
.build();

LiteralCommandNode<FabricClientCommandSource> setNode = ClientCommandManager
.literal("set")
.then(
Expand All @@ -26,20 +36,23 @@ public static LiteralCommandNode<FabricClientCommandSource> getCommandNode() {
)
.build();

LiteralCommandNode<FabricClientCommandSource> queryNode = ClientCommandManager
.literal("query")
.executes(StarCountCommand::queryStarCount)
.build();

starCountNode.addChild(setNode);
starCountNode.addChild(queryNode);
starCountNode.addChild(resetNode);
starCountNode.addChild(setNode);
return starCountNode;
}

public static final ArrayList<Constellation> invalidatedConstellations = new ArrayList<>();

private static int setStarCount(CommandContext<FabricClientCommandSource> context) {
int amount = IntegerArgumentType.getInteger(context, "amount");
return setStarCount(IntegerArgumentType.getInteger(context, "amount"));
}

private static int resetStarCount(CommandContext<FabricClientCommandSource> context) {
return setStarCount(1024);
}

private static int setStarCount(int amount) {
boolean reducedStars = amount < SpyglassAstronomyClient.getStarCount();
SpyglassAstronomyClient.say("commands.admin.starcount.set", Integer.toString(amount), Integer.toString(SpyglassAstronomyClient.getStarCount()));
SpyglassAstronomyClient.setStarCount(amount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ public static LiteralCommandNode<FabricClientCommandSource> getCommandNode() {
.literal("yearlength")
.build();

LiteralCommandNode<FabricClientCommandSource> queryNode = ClientCommandManager
.literal("query")
.executes(YearLengthCommand::queryYearLength)
.build();

LiteralCommandNode<FabricClientCommandSource> resetNode = ClientCommandManager
.literal("reset")
.executes(YearLengthCommand::resetYearLength)
.build();

LiteralCommandNode<FabricClientCommandSource> setNode = ClientCommandManager
.literal("set")
.then(
Expand All @@ -22,26 +32,29 @@ public static LiteralCommandNode<FabricClientCommandSource> getCommandNode() {
)
.build();

LiteralCommandNode<FabricClientCommandSource> queryNode = ClientCommandManager
.literal("query")
.executes(YearLengthCommand::queryYearLength)
.build();

yearLengthNode.addChild(setNode);
yearLengthNode.addChild(queryNode);
yearLengthNode.addChild(resetNode);
yearLengthNode.addChild(setNode);
return yearLengthNode;
}

public static int setYearLength(CommandContext<FabricClientCommandSource> context) {
float yearLength = FloatArgumentType.getFloat(context, "days");
private static int setYearLength(CommandContext<FabricClientCommandSource> context) {
return setYearLength(FloatArgumentType.getFloat(context, "days"));
}

private static int resetYearLength(CommandContext<FabricClientCommandSource> context) {
return setYearLength(8f);
}

public static int setYearLength(float yearLength) {
SpyglassAstronomyClient.say("commands.admin.yearlength.set", Float.toString(yearLength), Float.toString(SpyglassAstronomyClient.spaceDataManager.getYearLength()));
SpyglassAstronomyClient.spaceDataManager.setYearLength(yearLength);
SpyglassAstronomyClient.generatePlanets(null, true);
SpaceDataManager.makeChange();
return 1;
}

public static int queryYearLength(CommandContext<FabricClientCommandSource> context) {
private static int queryYearLength(CommandContext<FabricClientCommandSource> context) {
SpyglassAstronomyClient.say("commands.admin.yearlength.query", Float.toString(SpyglassAstronomyClient.spaceDataManager.getYearLength()));
return 1;
}
Expand Down

0 comments on commit f45c466

Please sign in to comment.