Skip to content

Commit

Permalink
😳 Fix stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
XyperCode committed Jun 7, 2024
1 parent 027f288 commit 3fe8acc
Show file tree
Hide file tree
Showing 135 changed files with 355 additions and 418 deletions.
3 changes: 0 additions & 3 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ dependencies {
modCompileOnly "fuzs.forgeconfigapiport:forgeconfigapiport-common:8.0.0"
modCompileOnly 'com.electronwill.night-config:core:3.6.3'
modCompileOnly 'com.electronwill.night-config:toml:3.6.3'
modImplementation "com.github.Ultreon.advanced-debug:advanced-debug:$advanced_debug_version"
implementation "io.github.spair:imgui-java-binding:1.86.10" // FIXME make dep an api(...) in advanced debug.

}

sourceSets {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
package com.jab125.classloader.api;

import com.jab125.classloader.impl.CustomClassLoader;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.impl.launch.knot.Knot;

import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.nio.file.Paths;
import java.util.jar.JarFile;

public class ClassLoaderApi {
public static ClassLoaderApi INSTANCE = new ClassLoaderApi();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.jab125.classloader.api;

import org.spongepowered.asm.mixin.injection.ModifyConstant;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
Expand Down
184 changes: 92 additions & 92 deletions common/src/main/java/com/ultreon/devices/compat/AdvancedDebugExt.java
Original file line number Diff line number Diff line change
@@ -1,92 +1,92 @@
package com.ultreon.devices.compat;

import com.ultreon.devices.Devices;
import com.ultreon.devices.block.entity.*;
import com.ultreon.mods.advanceddebug.api.extension.Extension;
import com.ultreon.mods.advanceddebug.api.extension.ExtensionInfo;
import com.ultreon.mods.advanceddebug.util.ImGuiEx;
import imgui.ImGui;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.entity.BlockEntity;

import java.util.Objects;

/**
* This class represents an advanced debugging extension.
*/
@ExtensionInfo(Devices.MOD_ID)
public class AdvancedDebugExt implements Extension {
@Override
public void handleBlockEntity(BlockEntity blockEntity) {
if (!(blockEntity instanceof DeviceBlockEntity device) || !ImGui.collapsingHeader("Network Device")) {
return;
}
displayCommonDeviceDetails(device);

if (blockEntity instanceof DeviceBlockEntity.Colored colored) {
handleColoredDevice(colored);
}
if (blockEntity instanceof NetworkDeviceBlockEntity networkDevice && ImGui.collapsingHeader("Connection")) {
handleNetworkDevice(networkDevice);
}
if (blockEntity instanceof PrinterBlockEntity printer && ImGui.collapsingHeader("Printer")) {
handlePrinter(printer);
}
if (blockEntity instanceof ComputerBlockEntity computer && ImGui.collapsingHeader("Printer")) {
handleComputer(computer);
}
if (blockEntity instanceof RouterBlockEntity router && ImGui.collapsingHeader("Printer")) {
handleRouter(router);
}

ImGui.treePop();
}

private void displayCommonDeviceDetails(DeviceBlockEntity device) {
ImGui.treePush();
ImGuiEx.text("Display Name: ", () -> device.getDisplayName());
ImGuiEx.text("Device Name: ", () -> device.getDeviceName());
ImGuiEx.nbt("Pipeline: ", () -> device.getPipeline());
ImGuiEx.editString("Custom Name: ", createDevicePropertyIdentifier(device, "customName"), () -> device.hasCustomName() ? device.getCustomName() : "", device::setCustomName);
}

private void handleColoredDevice(DeviceBlockEntity.Colored colored) {
ImGuiEx.editEnum("Color: ", createDevicePropertyIdentifier(colored, "color"), colored::getColor, colored::setColor);
}

private void handleNetworkDevice(NetworkDeviceBlockEntity networkDevice) {
ImGui.treePush();
ImGuiEx.bool("Is Connected: ", () -> networkDevice.getConnection().isConnected());
ImGuiEx.text("Router ID: ", () -> networkDevice.getConnection().getRouterId());
ImGuiEx.text("Router Position: ", () -> Objects.requireNonNull(networkDevice.getConnection().getRouterPos()).toShortString());
ImGui.treePop();
}

private void handlePrinter(PrinterBlockEntity printer) {
ImGui.treePush();
ImGuiEx.editEnum("State: ", createDevicePropertyIdentifier(printer, "state"), printer::getState, printer::setState);
ImGuiEx.button("Add Paper: ", createDevicePropertyIdentifier(printer, "addPaper"), () -> printer.addPaper(new ItemStack(Items.PAPER), true));
ImGui.treePop();
}

private void handleComputer(ComputerBlockEntity computer) {
ImGui.treePush();
ImGuiEx.nbt("Application Data: ", () -> computer.getApplicationData());
ImGuiEx.nbt("System Data: ", () -> computer.getSystemData());
ImGuiEx.editEnum("External Drive Color: ", createDevicePropertyIdentifier(computer, "externalDriveColor"), computer::getExternalDriveColor, v -> {
});
ImGui.treePop();
}

private void handleRouter(RouterBlockEntity router) {
ImGui.treePush();
ImGuiEx.text("UUID: ", () -> router.getRouter().getId());
ImGuiEx.text("Pos: ", () -> router.getRouter().getPos());
ImGui.treePop();
}

private String createDevicePropertyIdentifier(DeviceBlockEntity device, String propertyName) {
return "$$BlockEntity[" + device.getId() + "]::" + propertyName;
}
}
//package com.ultreon.devices.compat;
//
//import com.ultreon.devices.Devices;
//import com.ultreon.devices.block.entity.*;
//import com.ultreon.mods.advanceddebug.api.extension.Extension;
//import com.ultreon.mods.advanceddebug.api.extension.ExtensionInfo;
//import com.ultreon.mods.advanceddebug.util.ImGuiEx;
//import imgui.ImGui;
//import net.minecraft.world.item.ItemStack;
//import net.minecraft.world.item.Items;
//import net.minecraft.world.level.block.entity.BlockEntity;
//
//import java.util.Objects;
//
///**
// * This class represents an advanced debugging extension.
// */
//@ExtensionInfo(Devices.MOD_ID)
//public class AdvancedDebugExt implements Extension {
// @Override
// public void handleBlockEntity(BlockEntity blockEntity) {
// if (!(blockEntity instanceof DeviceBlockEntity device) || !ImGui.collapsingHeader("Network Device")) {
// return;
// }
// displayCommonDeviceDetails(device);
//
// if (blockEntity instanceof DeviceBlockEntity.Colored colored) {
// handleColoredDevice(colored);
// }
// if (blockEntity instanceof NetworkDeviceBlockEntity networkDevice && ImGui.collapsingHeader("Connection")) {
// handleNetworkDevice(networkDevice);
// }
// if (blockEntity instanceof PrinterBlockEntity printer && ImGui.collapsingHeader("Printer")) {
// handlePrinter(printer);
// }
// if (blockEntity instanceof ComputerBlockEntity computer && ImGui.collapsingHeader("Printer")) {
// handleComputer(computer);
// }
// if (blockEntity instanceof RouterBlockEntity router && ImGui.collapsingHeader("Printer")) {
// handleRouter(router);
// }
//
// ImGui.treePop();
// }
//
// private void displayCommonDeviceDetails(DeviceBlockEntity device) {
// ImGui.treePush();
// ImGuiEx.text("Display Name: ", () -> device.getDisplayName());
// ImGuiEx.text("Device Name: ", () -> device.getDeviceName());
// ImGuiEx.nbt("Pipeline: ", () -> device.getPipeline());
// ImGuiEx.editString("Custom Name: ", createDevicePropertyIdentifier(device, "customName"), () -> device.hasCustomName() ? device.getCustomName() : "", device::setCustomName);
// }
//
// private void handleColoredDevice(DeviceBlockEntity.Colored colored) {
// ImGuiEx.editEnum("Color: ", createDevicePropertyIdentifier(colored, "color"), colored::getColor, colored::setColor);
// }
//
// private void handleNetworkDevice(NetworkDeviceBlockEntity networkDevice) {
// ImGui.treePush();
// ImGuiEx.bool("Is Connected: ", () -> networkDevice.getConnection().isConnected());
// ImGuiEx.text("Router ID: ", () -> networkDevice.getConnection().getRouterId());
// ImGuiEx.text("Router Position: ", () -> Objects.requireNonNull(networkDevice.getConnection().getRouterPos()).toShortString());
// ImGui.treePop();
// }
//
// private void handlePrinter(PrinterBlockEntity printer) {
// ImGui.treePush();
// ImGuiEx.editEnum("State: ", createDevicePropertyIdentifier(printer, "state"), printer::getState, printer::setState);
// ImGuiEx.button("Add Paper: ", createDevicePropertyIdentifier(printer, "addPaper"), () -> printer.addPaper(new ItemStack(Items.PAPER), true));
// ImGui.treePop();
// }
//
// private void handleComputer(ComputerBlockEntity computer) {
// ImGui.treePush();
// ImGuiEx.nbt("Application Data: ", () -> computer.getApplicationData());
// ImGuiEx.nbt("System Data: ", () -> computer.getSystemData());
// ImGuiEx.editEnum("External Drive Color: ", createDevicePropertyIdentifier(computer, "externalDriveColor"), computer::getExternalDriveColor, v -> {
// });
// ImGui.treePop();
// }
//
// private void handleRouter(RouterBlockEntity router) {
// ImGui.treePush();
// ImGuiEx.text("UUID: ", () -> router.getRouter().getId());
// ImGuiEx.text("Pos: ", () -> router.getRouter().getPos());
// ImGui.treePop();
// }
//
// private String createDevicePropertyIdentifier(DeviceBlockEntity device, String propertyName) {
// return "$$BlockEntity[" + device.getId() + "]::" + propertyName;
// }
//}
5 changes: 2 additions & 3 deletions common/src/main/java/dev/ultreon/devices/BuiltinApps.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package dev.ultreon.devices;

import dev.architectury.platform.Platform;
import dev.ultreon.devices.api.ApplicationManager;
import dev.ultreon.devices.mineos.apps.BoatRacersApp;
import dev.ultreon.devices.mineos.apps.NoteStashApp;
Expand All @@ -8,10 +9,8 @@
import dev.ultreon.devices.mineos.apps.email.EmailApp;
import dev.ultreon.devices.mineos.apps.gitweb.GitWebApp;
import dev.ultreon.devices.mineos.apps.snake.SnakeApp;
import dev.ultreon.devices.mineos.apps.system.VulnerabilityApp;
import dev.ultreon.devices.mineos.apps.themes.ThemesApp;
import dev.ultreon.devices.mineos.apps.system.*;
import dev.architectury.platform.Platform;
import dev.ultreon.devices.mineos.apps.themes.ThemesApp;
import net.minecraft.resources.ResourceLocation;

public class BuiltinApps {
Expand Down
16 changes: 8 additions & 8 deletions common/src/main/java/dev/ultreon/devices/ClientModEvents.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package dev.ultreon.devices;

import com.mojang.blaze3d.platform.NativeImage;
import dev.architectury.platform.Platform;
import dev.architectury.registry.ReloadListenerRegistry;
import dev.architectury.registry.client.level.entity.EntityModelLayerRegistry;
import dev.architectury.registry.client.rendering.BlockEntityRendererRegistry;
import dev.architectury.registry.client.rendering.RenderTypeRegistry;
import dev.architectury.registry.registries.RegistrarManager;
import dev.ultreon.devices.api.ApplicationManager;
import dev.ultreon.devices.block.entity.renderer.*;
import dev.ultreon.devices.client.RenderRegistry;
import dev.ultreon.devices.mineos.client.MineOS;
import dev.ultreon.devices.debug.DebugFlags;
import dev.ultreon.devices.debug.DebugUtils;
import dev.ultreon.devices.debug.DumpType;
import dev.ultreon.devices.init.DeviceBlockEntities;
import dev.ultreon.devices.init.DeviceBlocks;
import dev.ultreon.devices.object.AppInfo;
import dev.ultreon.devices.mineos.apps.system.object.ColorSchemePresets;
import dev.architectury.platform.Platform;
import dev.architectury.registry.ReloadListenerRegistry;
import dev.architectury.registry.client.level.entity.EntityModelLayerRegistry;
import dev.architectury.registry.client.rendering.BlockEntityRendererRegistry;
import dev.architectury.registry.client.rendering.RenderTypeRegistry;
import dev.architectury.registry.registries.RegistrarManager;
import dev.ultreon.devices.mineos.client.MineOS;
import dev.ultreon.devices.object.AppInfo;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.texture.DynamicTexture;
Expand Down
2 changes: 1 addition & 1 deletion common/src/main/java/dev/ultreon/devices/DeviceTab.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package dev.ultreon.devices;

import dev.ultreon.devices.init.DeviceItems;
import dev.architectury.registry.CreativeTabRegistry;
import dev.architectury.registry.registries.DeferredSupplier;
import dev.architectury.registry.registries.RegistrySupplier;
import dev.ultreon.devices.init.DeviceItems;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package dev.ultreon.devices;

import dev.architectury.injectables.targets.ArchitecturyTarget;
import dev.architectury.platform.Platform;

public class LaunchException extends RuntimeException {
@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package dev.ultreon.devices;

import dev.architectury.registry.registries.RegistrySupplier;
import dev.ultreon.devices.api.os.OperatingSystem;
import dev.ultreon.devices.core.BootLoader;
import dev.ultreon.devices.mineos.client.MineOS;
import dev.architectury.registry.registries.RegistrySupplier;

import java.util.function.Supplier;

Expand Down
41 changes: 18 additions & 23 deletions common/src/main/java/dev/ultreon/devices/UltreonDevicesMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
import com.google.common.collect.ImmutableList;
import com.google.gson.*;
import com.mojang.serialization.Lifecycle;
import dev.architectury.event.events.client.ClientPlayerEvent;
import dev.architectury.event.events.common.LifecycleEvent;
import dev.architectury.event.events.common.PlayerEvent;
import dev.architectury.injectables.targets.ArchitecturyTarget;
import dev.architectury.platform.Platform;
import dev.architectury.registry.registries.DeferredSupplier;
import dev.architectury.registry.registries.Registrar;
import dev.architectury.registry.registries.RegistrarManager;
import dev.architectury.utils.Env;
import dev.architectury.utils.EnvExecutor;
import dev.ultreon.devices.api.ApplicationManager;
import dev.ultreon.devices.api.ApplicationSupplier;
import dev.ultreon.devices.api.app.Application;
Expand All @@ -12,48 +22,34 @@
import dev.ultreon.devices.api.task.TaskManager;
import dev.ultreon.devices.api.util.Vulnerability;
import dev.ultreon.devices.api.utils.OnlineRequest;
import dev.ultreon.devices.mineos.apps.email.task.TaskRegisterEmailAccount;
import dev.ultreon.devices.mineos.apps.email.task.*;
import dev.ultreon.devices.mineos.apps.system.task.TaskAdd;
import dev.ultreon.devices.core.BootLoader;
import dev.ultreon.devices.core.client.ClientNotification;
import dev.ultreon.devices.core.io.task.*;
import dev.ultreon.devices.core.network.task.TaskConnect;
import dev.ultreon.devices.core.network.task.TaskGetDevices;
import dev.ultreon.devices.core.network.task.TaskPing;
import dev.ultreon.devices.core.print.task.TaskPrint;
import dev.ultreon.devices.core.task.TaskInstallApp;
import dev.ultreon.devices.block.PrinterBlock;
import dev.ultreon.devices.core.io.task.*;
import dev.ultreon.devices.debug.DebugLog;
import dev.ultreon.devices.mineos.apps.system.task.*;
import dev.ultreon.devices.network.PacketHandler;
import dev.ultreon.devices.network.task.SyncApplicationPacket;
import dev.ultreon.devices.network.task.SyncConfigPacket;
import dev.ultreon.devices.object.AppInfo;
import dev.ultreon.devices.object.TrayItem;
import dev.ultreon.devices.mineos.apps.IconsApp;
import dev.ultreon.devices.mineos.apps.PixelPainterApp;
import dev.ultreon.devices.mineos.apps.TestApp;
import dev.ultreon.devices.mineos.apps.auction.task.TaskAddAuction;
import dev.ultreon.devices.mineos.apps.auction.task.TaskBuyItem;
import dev.ultreon.devices.mineos.apps.auction.task.TaskGetAuctions;
import dev.ultreon.devices.mineos.apps.debug.TextAreaApp;
import dev.ultreon.devices.mineos.apps.email.task.*;
import dev.ultreon.devices.mineos.apps.example.ExampleApp;
import dev.ultreon.devices.mineos.apps.example.task.TaskNotificationTest;
import dev.ultreon.devices.mineos.apps.system.SystemApp;
import dev.ultreon.devices.mineos.apps.system.task.*;
import dev.ultreon.devices.network.PacketHandler;
import dev.ultreon.devices.network.task.SyncApplicationPacket;
import dev.ultreon.devices.network.task.SyncConfigPacket;
import dev.ultreon.devices.object.AppInfo;
import dev.ultreon.devices.object.TrayItem;
import dev.ultreon.devices.util.SiteRegistration;
import dev.ultreon.devices.util.VulnerabilityUtil;
import dev.architectury.event.EventResult;
import dev.architectury.event.events.client.ClientPlayerEvent;
import dev.architectury.event.events.common.LifecycleEvent;
import dev.architectury.event.events.common.PlayerEvent;
import dev.architectury.injectables.targets.ArchitecturyTarget;
import dev.architectury.platform.Platform;
import dev.architectury.registry.registries.DeferredSupplier;
import dev.architectury.registry.registries.Registrar;
import dev.architectury.registry.registries.RegistrarManager;
import dev.architectury.utils.Env;
import dev.architectury.utils.EnvExecutor;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.core.MappedRegistry;
Expand Down Expand Up @@ -198,7 +194,6 @@ private void registerApplications() {
TaskManager.registerTask(TaskConnect::new);
TaskManager.registerTask(TaskPing::new);
TaskManager.registerTask(TaskGetDevices::new);
TaskManager.registerTask(TaskGetRouters::new);

// Bank
TaskManager.registerTask(TaskDeposit::new);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import dev.ultreon.devices.api.app.Application;
import dev.ultreon.devices.object.AppInfo;
import net.minecraft.resources.ResourceLocation;
import org.jetbrains.annotations.Nullable;
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;

import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package dev.ultreon.devices.api.app;

import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.resources.ResourceLocation;
Expand Down
Loading

0 comments on commit 3fe8acc

Please sign in to comment.