Skip to content

Commit

Permalink
fix #84
Browse files Browse the repository at this point in the history
  • Loading branch information
JunePrimavera committed Jul 31, 2024
1 parent 313776d commit a01ed15
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ loader_version=0.15.11
fabric_version=0.100.1+1.21

# Mod Properties
mod_version = 4.0.2
mod_version = 4.0.3
maven_group = xyz.sillyjune
archives_base_name = Notebook

Expand Down
9 changes: 6 additions & 3 deletions src/main/java/xyz/sillyjune/notebook/NotebookScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ protected void goToNextPage() {
this.updatePageButtons();
}

String getBookNameText() {
return this.bookNameField.getText().replace(" ", "-");
}
// Innit mate
protected void init() {
DATA = NotebookData.read("default.json");
Expand All @@ -129,7 +132,7 @@ protected void init() {
buttonNext = this.addDrawableChild(new TexturedButtonWidget(5, 30, 20, 20, NEXT_BOOK_ICON, (button) -> next_book()));
buttonLast = this.addDrawableChild(new TexturedButtonWidget(30, 30, 20, 20, LAST_BOOK_ICON, (button) -> last_book()));
buttonGo = this.addDrawableChild(new TexturedButtonWidget(55, 30, 20, 20, RENAME_BOOK_ICON, (button) -> {
if (!this.bookNameField.getText().isEmpty()) { DATA = new NotebookData(DATA.content, this.bookNameField.getText() + ".json"); }}
if (!this.bookNameField.getText().isEmpty()) { DATA = new NotebookData(DATA.content, getBookNameText() + ".json"); }}
));

this.updatePageButtons();
Expand Down Expand Up @@ -202,9 +205,9 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) {
super.render(context, mouseX, mouseY, delta);
if (GAY) { context.drawText(this.textRenderer, Text.translatable("notebook.gay"), 5, this.height - 22, Colors.WHITE, true); }
if (CONFIG.debug()) {
context.drawText(this.textRenderer, Text.of("Notebook v4.0.2 - " + Text.translatable("devwarning.info").getString()), 5, this.height - 10, Colors.WHITE, true);
context.drawText(this.textRenderer, Text.of("Notebook v4.0.3 - " + Text.translatable("devwarning.info").getString()), 5, this.height - 10, Colors.WHITE, true);
} else {
context.drawText(this.textRenderer, Text.of("Notebook v4.0.2"), 5, this.height - 10, Colors.WHITE, true);
context.drawText(this.textRenderer, Text.of("Notebook v4.0.3"), 5, this.height - 10, Colors.WHITE, true);
}
}
public void renderBackground(DrawContext context, int mouseX, int mouseY, float delta) {
Expand Down

0 comments on commit a01ed15

Please sign in to comment.