From ccd245f37c826c8506471c9ab11e189cbceced22 Mon Sep 17 00:00:00 2001 From: Qboi123 Date: Fri, 22 Sep 2023 14:58:31 +0200 Subject: [PATCH] Move to UltreonLib test screens for DV tests --- build.gradle | 7 +- common/build.gradle | 1 + .../core/client/debug/ClientAppDebug.java | 65 ++++++++++--------- .../com/ultreon/devices/tests/DvTest1.java | 24 +++++++ .../com/ultreon/devices/tests/DvTest2.java | 27 ++++++++ ...mods.lib.client.gui.screen.test.TestScreen | 2 + fabric/build.gradle | 2 + forge/build.gradle | 1 + gradle.properties | 1 + 9 files changed, 97 insertions(+), 33 deletions(-) create mode 100644 common/src/main/java/com/ultreon/devices/tests/DvTest1.java create mode 100644 common/src/main/java/com/ultreon/devices/tests/DvTest2.java create mode 100644 common/src/main/resources/META-INF/services/com.ultreon.mods.lib.client.gui.screen.test.TestScreen diff --git a/build.gradle b/build.gradle index 53df05d49..99dd3accb 100644 --- a/build.gradle +++ b/build.gradle @@ -55,13 +55,18 @@ subprojects { url 'https://maven.quiltmc.org/repository/release/' } - maven { url "https://cursemaven.com" content { includeGroup "curse.maven" } } + + maven { + name "Jitpack" + url "https://jitpack.io" + } + maven { // location of the maven that hosts JEI files name = "Progwml6 maven" diff --git a/common/build.gradle b/common/build.gradle index cda5cac3d..c5b3df7f0 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -17,6 +17,7 @@ dependencies { modImplementation "net.fabricmc:fabric-loader:$fabric_loader_version" // Remove the next line if you don't want to depend on the API modApi "dev.architectury:architectury:$architectury_version" + modApi "com.github.Ultreon.ultreonlib:ultreon-lib:$ultreonlib_version" implementation "org.jetbrains.kotlin:kotlin-reflect:1.7.10" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10" diff --git a/common/src/main/java/com/ultreon/devices/core/client/debug/ClientAppDebug.java b/common/src/main/java/com/ultreon/devices/core/client/debug/ClientAppDebug.java index f08ee09d0..33697da83 100644 --- a/common/src/main/java/com/ultreon/devices/core/client/debug/ClientAppDebug.java +++ b/common/src/main/java/com/ultreon/devices/core/client/debug/ClientAppDebug.java @@ -19,39 +19,40 @@ * Adds a button to the title screen to test system applications that don't require the system */ public class ClientAppDebug { + @Deprecated(forRemoval = true) public static void register() { - ClientGuiEvent.INIT_POST.register(((screen, access) -> { - if (DeviceConfig.DEBUG_BUTTON.get()) { - if (!(screen instanceof TitleScreen)) return; - var rowHeight = 24; - var y = screen.height / 4 + 48; - - var a = Button.builder(Component.literal("DV TEST"), (button) -> Minecraft.getInstance().setScreen(new Laptop(new LaptopBlockEntity(new BlockPos(0, 0, 0), DeviceBlocks.LAPTOPS.of(DyeColor.WHITE).get().defaultBlockState()), true))).bounds(screen.width / 2 - 100, y + rowHeight * -1, 200, 20) - .createNarration((output) -> Component.empty()) - .build(); - access.addRenderableWidget(a); - } - })); - - ClientGuiEvent.INIT_POST.register(((screen, access) -> { - if (DeviceConfig.DEBUG_BUTTON.get()) { - if (!(screen instanceof TitleScreen)) return; - var rowHeight = 24; - var y = screen.height / 4 + 48; - - var a = Button.builder(Component.literal("DV TEST #2"), (button) -> { - var serverLaptop = new ServerLaptop(); - ServerLaptop.laptops.put(serverLaptop.getUuid(), serverLaptop); - var clientLaptop = new ClientLaptop(); - clientLaptop.setUuid(serverLaptop.getUuid()); - ClientLaptop.laptops.put(clientLaptop.getUuid(), clientLaptop); - Minecraft.getInstance().setScreen(new ClientLaptopScreen(clientLaptop)); - }).bounds(screen.width / 2 - 100, y + rowHeight * -2, 200, 20) - .createNarration((output) -> Component.empty()) - .build(); - access.addRenderableWidget(a); - } - })); +// ClientGuiEvent.INIT_POST.register(((screen, access) -> { +// if (DeviceConfig.DEBUG_BUTTON.get()) { +// if (!(screen instanceof TitleScreen)) return; +// var rowHeight = 24; +// var y = screen.height / 4 + 48; +// +// var a = Button.builder(Component.literal("DV TEST"), (button) -> Minecraft.getInstance().setScreen(new Laptop(new LaptopBlockEntity(new BlockPos(0, 0, 0), DeviceBlocks.LAPTOPS.of(DyeColor.WHITE).get().defaultBlockState()), true))).bounds(screen.width / 2 - 100, y + rowHeight * -1, 200, 20) +// .createNarration((output) -> Component.empty()) +// .build(); +// access.addRenderableWidget(a); +// } +// })); +// +// ClientGuiEvent.INIT_POST.register(((screen, access) -> { +// if (DeviceConfig.DEBUG_BUTTON.get()) { +// if (!(screen instanceof TitleScreen)) return; +// var rowHeight = 24; +// var y = screen.height / 4 + 48; +// +// var a = Button.builder(Component.literal("DV TEST #2"), (button) -> { +// var serverLaptop = new ServerLaptop(); +// ServerLaptop.laptops.put(serverLaptop.getUuid(), serverLaptop); +// var clientLaptop = new ClientLaptop(); +// clientLaptop.setUuid(serverLaptop.getUuid()); +// ClientLaptop.laptops.put(clientLaptop.getUuid(), clientLaptop); +// Minecraft.getInstance().setScreen(new ClientLaptopScreen(clientLaptop)); +// }).bounds(screen.width / 2 - 100, y + rowHeight * -2, 200, 20) +// .createNarration((output) -> Component.empty()) +// .build(); +// access.addRenderableWidget(a); +// } +// })); } } diff --git a/common/src/main/java/com/ultreon/devices/tests/DvTest1.java b/common/src/main/java/com/ultreon/devices/tests/DvTest1.java new file mode 100644 index 000000000..fdd504bce --- /dev/null +++ b/common/src/main/java/com/ultreon/devices/tests/DvTest1.java @@ -0,0 +1,24 @@ +package com.ultreon.devices.tests; + +import com.ultreon.devices.block.entity.LaptopBlockEntity; +import com.ultreon.devices.core.Laptop; +import com.ultreon.devices.init.DeviceBlocks; +import com.ultreon.mods.lib.client.gui.screen.test.TestLaunchContext; +import com.ultreon.mods.lib.client.gui.screen.test.TestScreen; +import com.ultreon.mods.lib.client.gui.screen.test.TestScreenInfo; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; +import net.minecraft.core.BlockPos; +import net.minecraft.world.item.DyeColor; + +@TestScreenInfo("DV TEST") +public class DvTest1 extends Screen implements TestScreen { + public DvTest1() { + super(TestLaunchContext.get().title); + } + + @Override + protected void init() { + Minecraft.getInstance().setScreen(new Laptop(new LaptopBlockEntity(new BlockPos(0, 0, 0), DeviceBlocks.LAPTOPS.of(DyeColor.WHITE).get().defaultBlockState()), true)); + } +} diff --git a/common/src/main/java/com/ultreon/devices/tests/DvTest2.java b/common/src/main/java/com/ultreon/devices/tests/DvTest2.java new file mode 100644 index 000000000..d697756c4 --- /dev/null +++ b/common/src/main/java/com/ultreon/devices/tests/DvTest2.java @@ -0,0 +1,27 @@ +package com.ultreon.devices.tests; + +import com.ultreon.devices.core.laptop.client.ClientLaptop; +import com.ultreon.devices.core.laptop.client.ClientLaptopScreen; +import com.ultreon.devices.core.laptop.server.ServerLaptop; +import com.ultreon.mods.lib.client.gui.screen.test.TestLaunchContext; +import com.ultreon.mods.lib.client.gui.screen.test.TestScreen; +import com.ultreon.mods.lib.client.gui.screen.test.TestScreenInfo; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.screens.Screen; + +@TestScreenInfo("DV TEST #2") +public class DvTest2 extends Screen implements TestScreen { + public DvTest2() { + super(TestLaunchContext.get().title); + } + + @Override + protected void init() { + var serverLaptop = new ServerLaptop(); + ServerLaptop.laptops.put(serverLaptop.getUuid(), serverLaptop); + var clientLaptop = new ClientLaptop(); + clientLaptop.setUuid(serverLaptop.getUuid()); + ClientLaptop.laptops.put(clientLaptop.getUuid(), clientLaptop); + Minecraft.getInstance().setScreen(new ClientLaptopScreen(clientLaptop)); + } +} diff --git a/common/src/main/resources/META-INF/services/com.ultreon.mods.lib.client.gui.screen.test.TestScreen b/common/src/main/resources/META-INF/services/com.ultreon.mods.lib.client.gui.screen.test.TestScreen new file mode 100644 index 000000000..00e899f76 --- /dev/null +++ b/common/src/main/resources/META-INF/services/com.ultreon.mods.lib.client.gui.screen.test.TestScreen @@ -0,0 +1,2 @@ +com.ultreon.devices.tests.DvTest1 +com.ultreon.devices.tests.DvTest2 \ No newline at end of file diff --git a/fabric/build.gradle b/fabric/build.gradle index 115c62483..5a139907d 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -43,11 +43,13 @@ dependencies { modApi "net.fabricmc.fabric-api:fabric-api:$fabric_api_version" // Remove the next line if you don't want to depend on the API modApi "dev.architectury:architectury-fabric:$architectury_version" + modApi "com.github.Ultreon.ultreonlib:ultreon-lib-fabric:$ultreonlib_version" modApi "fuzs.forgeconfigapiport:forgeconfigapiport-fabric:8.0.0" modImplementation 'com.electronwill.night-config:core:3.6.5' modImplementation 'com.electronwill.night-config:toml:3.6.5' + // include(implementation("org.jetbrains.kotlin:kotlin-reflect:1.7.10")) // include(implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.10")) // include(implementation("com.ultreon:ultranlang:0.1.0+6")) diff --git a/forge/build.gradle b/forge/build.gradle index 2b3b9798a..16c1f6fda 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -32,6 +32,7 @@ dependencies { forge "net.minecraftforge:forge:$minecraft_version-$forge_version" // Remove the next line if you don't want to depend on the API modApi "dev.architectury:architectury-forge:$architectury_version" + modApi "com.github.Ultreon.ultreonlib:ultreon-lib-forge:$ultreonlib_version" common(project(path: ":common", configuration: "namedElements")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive = false } diff --git a/gradle.properties b/gradle.properties index 4d64bffd0..407037e49 100644 --- a/gradle.properties +++ b/gradle.properties @@ -23,3 +23,4 @@ geckolib_version_forge=4.2.1 # Dependency related architectury_version=9.1.12 fabric_api_version=0.86.1+1.20.1 +ultreonlib_version=1.5.0