Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed Jun 21, 2024
1 parent 66fac0c commit b2482ea
Show file tree
Hide file tree
Showing 18 changed files with 83 additions and 67 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@
@Mixin(MinecraftClient.class)
public class MinecraftClientMixin {
@Inject(method = "setScreen", at = @At("HEAD"))
private void onScreenPre(Screen screen, CallbackInfo ci) {
private void obsidianui_onScreenPre(Screen screen, CallbackInfo ci) {
OpenScreenCallback.PRE.invoker().apply((MinecraftClient) (Object) this, screen);
}

@Inject(method = "setScreen", at = @At("RETURN"))
private void onScreenChange(Screen screen, CallbackInfo ci) {
private void obsidianui_onScreenChange(Screen screen, CallbackInfo ci) {
OpenScreenCallback.POST.invoker().apply((MinecraftClient) (Object) this, screen);
}

@Inject(method = "onResolutionChanged", at = @At("RETURN"))
private void onResolutionChanged(CallbackInfo ci) {
private void obsidianui_onResolutionChanged(CallbackInfo ci) {
ResolutionChangeCallback.EVENT.invoker().apply((MinecraftClient) (Object) this);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* Copyright © 2020 LambdAurora <[email protected]>
* Copyright © 2020~2024 LambdAurora <[email protected]>
* Copyright © 2024 ThinkingStudio
*
* This file is part of SpruceUI.
* This file is part of ObsidianUI.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
Expand All @@ -26,12 +27,12 @@
import java.util.function.Consumer;

/**
* Represents the SpruceUI test mod.
* Represents the ObsidianUI test mod on Fabric.
*
* @author LambdAurora
*/
public class ObsidianUITest implements ClientModInitializer {
private static ObsidianUITest INSTANCE;
public class ObsidianUITestFabric implements ClientModInitializer {
private static ObsidianUITestFabric INSTANCE;

private final SpruceOption booleanOption;
private final SpruceOption checkboxOption;
Expand All @@ -55,7 +56,7 @@ public class ObsidianUITest implements ClientModInitializer {

public Consumer<SpruceButtonWidget> resetConsumer;

public ObsidianUITest() {
public ObsidianUITestFabric() {
this.booleanOption = new SpruceBooleanOption("obsidianui_test.option.boolean",
() -> this.aBoolean,
newValue -> this.aBoolean = newValue,
Expand Down Expand Up @@ -203,7 +204,7 @@ public static SpruceContainerWidget buildTextAreaContainer(Position position, in
return container;
}

public static ObsidianUITest get() {
public static ObsidianUITestFabric get() {
return INSTANCE;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* Copyright © 2020 LambdAurora <[email protected]>
* Copyright © 2020~2024 LambdAurora <[email protected]>
* Copyright © 2024 ThinkingStudio
*
* This file is part of SpruceUI.
* This file is part of ObsidianUI.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* Copyright © 2020 LambdAurora <[email protected]>
* Copyright © 2020~2024 LambdAurora <[email protected]>
* Copyright © 2024 ThinkingStudio
*
* This file is part of SpruceUI.
* This file is part of ObsidianUI.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
Expand All @@ -19,7 +20,7 @@
import org.jetbrains.annotations.Nullable;

/**
* Represents a screen to navigate to the different SpruceUI test screens.
* Represents a screen to navigate to the different ObsidianUI test screens.
*
* @author LambdAurora
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* Copyright © 2020 LambdAurora <[email protected]>
* Copyright © 2020~2024 LambdAurora <[email protected]>
* Copyright © 2024 ThinkingStudio
*
* This file is part of SpruceUI.
* This file is part of ObsidianUI.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
Expand All @@ -13,7 +14,7 @@
import org.thinkingstudio.obsidianui.SpruceTexts;
import org.thinkingstudio.obsidianui.option.SpruceOption;
import org.thinkingstudio.obsidianui.screen.SpruceScreen;
import org.thinkingstudio.obsidianui.test.fabric.ObsidianUITest;
import org.thinkingstudio.obsidianui.test.fabric.ObsidianUITestFabric;
import org.thinkingstudio.obsidianui.widget.SpruceButtonWidget;
import org.thinkingstudio.obsidianui.widget.container.SpruceOptionListWidget;
import net.minecraft.client.gui.DrawContext;
Expand Down Expand Up @@ -47,8 +48,8 @@ protected void init() {

// Button list.
//this.list = new ButtonListWidget(this.client, this.width, this.height, 43, this.height - 29 - this.getTextHeight(), 25);
this.list = ObsidianUITest.get().buildOptionList(Position.of(0, 22), this.width, this.height - 35 - 22);
ObsidianUITest.get().resetConsumer = btn -> {
this.list = ObsidianUITestFabric.get().buildOptionList(Position.of(0, 22), this.width, this.height - 35 - 22);
ObsidianUITestFabric.get().resetConsumer = btn -> {
// Re-initialize the screen to update all the values.
this.init(this.client, this.client.getWindow().getScaledWidth(), this.client.getWindow().getScaledHeight());
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* Copyright © 2020 LambdAurora <[email protected]>
* Copyright © 2020~2024 LambdAurora <[email protected]>
* Copyright © 2024 ThinkingStudio
*
* This file is part of SpruceUI.
* This file is part of ObsidianUI.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
Expand All @@ -12,7 +13,7 @@
import org.thinkingstudio.obsidianui.Position;
import org.thinkingstudio.obsidianui.SpruceTexts;
import org.thinkingstudio.obsidianui.screen.SpruceScreen;
import org.thinkingstudio.obsidianui.test.fabric.ObsidianUITest;
import org.thinkingstudio.obsidianui.test.fabric.ObsidianUITestFabric;
import org.thinkingstudio.obsidianui.widget.SpruceButtonWidget;
import org.thinkingstudio.obsidianui.widget.SpruceLabelWidget;
import org.thinkingstudio.obsidianui.widget.container.SpruceContainerWidget;
Expand All @@ -28,7 +29,7 @@ public class SpruceTabbedTestScreen extends SpruceScreen {
private SpruceTabbedWidget tabbedWidget;

protected SpruceTabbedTestScreen(@Nullable Screen parent) {
super(Text.literal("ObsidianUI Test Tabbed Screen"));
super(Text.literal("Test Tabbed Screen"));
this.parent = parent;
}

Expand All @@ -52,9 +53,9 @@ protected void init() {
});
this.tabbedWidget.addSeparatorEntry(Text.literal("Separator"));
this.tabbedWidget.addTabEntry(Text.literal("Option Test"), Text.literal("useful for config stuff.").formatted(Formatting.GRAY),
(width, height) -> ObsidianUITest.get().buildOptionList(Position.origin(), width, height));
(width, height) -> ObsidianUITestFabric.get().buildOptionList(Position.origin(), width, height));
this.tabbedWidget.addTabEntry(Text.literal("Text Area"), Text.literal("to edit stuff on multiple lines.").formatted(Formatting.GRAY),
(width, height) -> ObsidianUITest.buildTextAreaContainer(Position.origin(), width, height,
(width, height) -> ObsidianUITestFabric.buildTextAreaContainer(Position.origin(), width, height,
textArea -> {
}, null));
this.addDrawableChild(this.tabbedWidget);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* Copyright © 2020 LambdAurora <[email protected]>
* Copyright © 2020~2024 LambdAurora <[email protected]>
* Copyright © 2024 ThinkingStudio
*
* This file is part of SpruceUI.
* This file is part of ObsidianUI.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
Expand All @@ -11,7 +12,7 @@

import org.thinkingstudio.obsidianui.Position;
import org.thinkingstudio.obsidianui.screen.SpruceScreen;
import org.thinkingstudio.obsidianui.test.fabric.ObsidianUITest;
import org.thinkingstudio.obsidianui.test.fabric.ObsidianUITestFabric;
import org.thinkingstudio.obsidianui.widget.text.SpruceTextAreaWidget;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
Expand All @@ -37,7 +38,7 @@ protected void init() {
super.init();

var containerWidget =
ObsidianUITest.buildTextAreaContainer(Position.of(this, 0, 50), this.width, this.height - 50,
ObsidianUITestFabric.buildTextAreaContainer(Position.of(this, 0, 50), this.width, this.height - 50,
textArea -> {
if (this.textArea != null) {
textArea.setText(this.textArea.getText());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* Copyright © 2020 LambdAurora <[email protected]>
* Copyright © 2020~2024 LambdAurora <[email protected]>
* Copyright © 2024 ThinkingStudio
*
* This file is part of SpruceUI.
* This file is part of ObsidianUI.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* Copyright © 2020 LambdAurora <[email protected]>
* Copyright © 2020~2024 LambdAurora <[email protected]>
* Copyright © 2024 ThinkingStudio
*
* This file is part of SpruceUI.
* This file is part of ObsidianUI.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
Expand Down
2 changes: 1 addition & 1 deletion test-fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"environment": "client",
"entrypoints": {
"client": [
"org.thinkingstudio.obsidianui.test.fabric.ObsidianUITest"
"org.thinkingstudio.obsidianui.test.fabric.ObsidianUITestFabric"
]
},
"mixins": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* Copyright © 2020 LambdAurora <[email protected]>
* Copyright © 2020~2024 LambdAurora <[email protected]>
* Copyright © 2024 ThinkingStudio
*
* This file is part of SpruceUI.
* This file is part of ObsidianUI.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
Expand All @@ -27,13 +28,13 @@
import java.util.function.Consumer;

/**
* Represents the SpruceUI test mod.
* Represents the ObsidianUI test mod on NeoForge.
*
* @author LambdAurora
* @author TexTrue, LambdAurora
*/
@Mod(value = "obsidianui_test", dist = Dist.CLIENT)
public class ObsidianUITest {
private static ObsidianUITest INSTANCE;
public class ObsidianUITestNeoForge {
private static ObsidianUITestNeoForge INSTANCE;

private final SpruceOption booleanOption;
private final SpruceOption checkboxOption;
Expand All @@ -57,7 +58,7 @@ public class ObsidianUITest {

public Consumer<SpruceButtonWidget> resetConsumer;

public ObsidianUITest() {
public ObsidianUITestNeoForge() {
INSTANCE = this;

this.booleanOption = new SpruceBooleanOption("obsidianui_test.option.boolean",
Expand Down Expand Up @@ -202,7 +203,7 @@ public static SpruceContainerWidget buildTextAreaContainer(Position position, in
return container;
}

public static ObsidianUITest get() {
public static ObsidianUITestNeoForge get() {
return INSTANCE;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* Copyright © 2020 LambdAurora <[email protected]>
* Copyright © 2020~2024 LambdAurora <[email protected]>
* Copyright © 2024 ThinkingStudio
*
* This file is part of SpruceUI.
* This file is part of ObsidianUI.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* Copyright © 2020 LambdAurora <[email protected]>
* Copyright © 2020~2024 LambdAurora <[email protected]>
* Copyright © 2024 ThinkingStudio
*
* This file is part of SpruceUI.
* This file is part of ObsidianUI.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
Expand All @@ -19,7 +20,7 @@
import org.jetbrains.annotations.Nullable;

/**
* Represents a screen to navigate to the different SpruceUI test screens.
* Represents a screen to navigate to the different ObsidianUI test screens.
*
* @author LambdAurora
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* Copyright © 2020 LambdAurora <[email protected]>
* Copyright © 2020~2024 LambdAurora <[email protected]>
* Copyright © 2024 ThinkingStudio
*
* This file is part of SpruceUI.
* This file is part of ObsidianUI.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
Expand All @@ -13,7 +14,7 @@
import org.thinkingstudio.obsidianui.SpruceTexts;
import org.thinkingstudio.obsidianui.option.SpruceOption;
import org.thinkingstudio.obsidianui.screen.SpruceScreen;
import org.thinkingstudio.obsidianui.test.neoforge.ObsidianUITest;
import org.thinkingstudio.obsidianui.test.neoforge.ObsidianUITestNeoForge;
import org.thinkingstudio.obsidianui.widget.SpruceButtonWidget;
import org.thinkingstudio.obsidianui.widget.container.SpruceOptionListWidget;
import net.minecraft.client.gui.DrawContext;
Expand Down Expand Up @@ -47,8 +48,8 @@ protected void init() {

// Button list.
//this.list = new ButtonListWidget(this.client, this.width, this.height, 43, this.height - 29 - this.getTextHeight(), 25);
this.list = ObsidianUITest.get().buildOptionList(Position.of(0, 22), this.width, this.height - 35 - 22);
ObsidianUITest.get().resetConsumer = btn -> {
this.list = ObsidianUITestNeoForge.get().buildOptionList(Position.of(0, 22), this.width, this.height - 35 - 22);
ObsidianUITestNeoForge.get().resetConsumer = btn -> {
// Re-initialize the screen to update all the values.
this.init(this.client, this.client.getWindow().getScaledWidth(), this.client.getWindow().getScaledHeight());
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/*
* Copyright © 2020 LambdAurora <[email protected]>
* Copyright © 2020~2024 LambdAurora <[email protected]>
* Copyright © 2024 ThinkingStudio
*
* This file is part of SpruceUI.
* This file is part of ObsidianUI.
*
* Licensed under the MIT license. For more information,
* see the LICENSE file.
Expand All @@ -12,7 +13,7 @@
import org.thinkingstudio.obsidianui.Position;
import org.thinkingstudio.obsidianui.SpruceTexts;
import org.thinkingstudio.obsidianui.screen.SpruceScreen;
import org.thinkingstudio.obsidianui.test.neoforge.ObsidianUITest;
import org.thinkingstudio.obsidianui.test.neoforge.ObsidianUITestNeoForge;
import org.thinkingstudio.obsidianui.widget.SpruceButtonWidget;
import org.thinkingstudio.obsidianui.widget.SpruceLabelWidget;
import org.thinkingstudio.obsidianui.widget.container.SpruceContainerWidget;
Expand All @@ -28,7 +29,7 @@ public class SpruceTabbedTestScreen extends SpruceScreen {
private SpruceTabbedWidget tabbedWidget;

protected SpruceTabbedTestScreen(@Nullable Screen parent) {
super(Text.literal("ObsidianUI Test Tabbed Screen"));
super(Text.literal("Test Tabbed Screen"));
this.parent = parent;
}

Expand All @@ -52,9 +53,9 @@ protected void init() {
});
this.tabbedWidget.addSeparatorEntry(Text.literal("Separator"));
this.tabbedWidget.addTabEntry(Text.literal("Option Test"), Text.literal("useful for config stuff.").formatted(Formatting.GRAY),
(width, height) -> ObsidianUITest.get().buildOptionList(Position.origin(), width, height));
(width, height) -> ObsidianUITestNeoForge.get().buildOptionList(Position.origin(), width, height));
this.tabbedWidget.addTabEntry(Text.literal("Text Area"), Text.literal("to edit stuff on multiple lines.").formatted(Formatting.GRAY),
(width, height) -> ObsidianUITest.buildTextAreaContainer(Position.origin(), width, height,
(width, height) -> ObsidianUITestNeoForge.buildTextAreaContainer(Position.origin(), width, height,
textArea -> {
}, null));
this.addDrawableChild(this.tabbedWidget);
Expand Down
Loading

0 comments on commit b2482ea

Please sign in to comment.