Skip to content

Commit

Permalink
Move to UltreonLib test screens for DV tests
Browse files Browse the repository at this point in the history
  • Loading branch information
XyperCode committed Sep 22, 2023
1 parent a5119dd commit ccd245f
Show file tree
Hide file tree
Showing 9 changed files with 97 additions and 33 deletions.
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
// }
// }));
}
}

24 changes: 24 additions & 0 deletions common/src/main/java/com/ultreon/devices/tests/DvTest1.java
Original file line number Diff line number Diff line change
@@ -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));
}
}
27 changes: 27 additions & 0 deletions common/src/main/java/com/ultreon/devices/tests/DvTest2.java
Original file line number Diff line number Diff line change
@@ -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));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
com.ultreon.devices.tests.DvTest1
com.ultreon.devices.tests.DvTest2
2 changes: 2 additions & 0 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
1 change: 1 addition & 0 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ccd245f

Please sign in to comment.