Skip to content

Commit

Permalink
Stable?
Browse files Browse the repository at this point in the history
  • Loading branch information
XyperCode committed Mar 24, 2024
1 parent a78501a commit 4eea61e
Show file tree
Hide file tree
Showing 45 changed files with 582 additions and 190 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2022 Qboi123 (https://github.com/Qboi123)
Copyright (c) 2022 XyperCode (https://github.com/XyperCode)

Ultreon API License (v1.0)
---------------------------
Expand Down
33 changes: 28 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//file:noinspection GroovyAccessibility
plugins {
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.3-SNAPSHOT" apply false
id "dev.architectury.loom" version "1.5-SNAPSHOT" apply false
}
repositories {
gradlePluginPortal()
Expand All @@ -12,15 +12,14 @@ architectury {
minecraft = rootProject.minecraft_version
}

version = mod_version

@SuppressWarnings('unused')
Object getModDescription() {
return "${mod_description}"
}

subprojects {
apply plugin: "dev.architectury.loom"
apply plugin: "maven-publish"

loom {
silentMojangMappingsLicense()
Expand All @@ -36,6 +35,19 @@ subprojects {

compileOnly 'com.google.errorprone:error_prone_annotations:2.16'
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/Ultreon/advanced-debug")
credentials {
username = project.findProperty("gpr.user") == null ? System.getenv("USERNAME") : project.findProperty("gpr.user")
password = project.findProperty("gpr.key") == null ? System.getenv("TOKEN") : project.findProperty("gpr.key")
}
}
}
}
}

allprojects {
Expand All @@ -44,7 +56,11 @@ allprojects {
apply plugin: "maven-publish"

archivesBaseName = rootProject.archives_base_name
version = rootProject.version
if (snapshot == "true") {
version = mod_version + "+snapshot." + new Date().format("yyyy.MM.dd.HH.mm")
} else {
version = mod_version
}
group = rootProject.maven_group

repositories {
Expand All @@ -57,7 +73,14 @@ allprojects {
maven { url "https://jitpack.io" }
maven { url "https://cursemaven.com" }
maven { url "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/" }

maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/Ultreon/ultreonlib")
credentials {
username = project.findProperty("gpr.user") == null ? System.getenv("USERNAME") : project.findProperty("gpr.user")
password = project.findProperty("gpr.key") == null ? System.getenv("TOKEN") : project.findProperty("gpr.key")
}
}
maven {
name "Fuzs Mod Resources"
url "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/"
Expand Down
30 changes: 14 additions & 16 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//file:noinspection GradlePackageUpdate
architectury {
common("fabric", "forge")
common("fabric", "forge", "neoforge")
}

loom {
Expand All @@ -18,24 +18,22 @@ dependencies {
// 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"
modApi "com.ultreon.mods:ultreonlib-common:$ultreonlib_version"

api "com.github.Ultreon:ultreon-data:$ultreon_data_version"
api "io.github.ultreon:ubo:$ultreon_data_version"

api "com.github.Ultreon.corelibs:corelibs-collections-v0:$corelibs_version"
api "com.github.Ultreon.corelibs:corelibs-commons-v0:$corelibs_version"
api "com.github.Ultreon.corelibs:corelibs-crash-v0:$corelibs_version"
api "com.github.Ultreon.corelibs:corelibs-datetime-v0:$corelibs_version"
api "com.github.Ultreon.corelibs:corelibs-events-v1:$corelibs_version"
api "com.github.Ultreon.corelibs:corelibs-functions-v0:$corelibs_version"
api "com.github.Ultreon.corelibs:corelibs-registries-v0:$corelibs_version"
api "com.github.Ultreon.corelibs:corelibs-resources-v0:$corelibs_version"
api "com.github.Ultreon.corelibs:corelibs-text-v0:$corelibs_version"
api "com.github.Ultreon.corelibs:corelibs-translations-v0:$corelibs_version"
api "io.github.ultreon.corelibs:collections-v0:$corelibs_version"
api "io.github.ultreon.corelibs:commons-v0:$corelibs_version"
api "io.github.ultreon.corelibs:crash-v0:$corelibs_version"
api "io.github.ultreon.corelibs:datetime-v0:$corelibs_version"
api "io.github.ultreon.corelibs:events-v1:$corelibs_version"
api "io.github.ultreon.corelibs:functions-v0:$corelibs_version"
api "io.github.ultreon.corelibs:registries-v0:$corelibs_version"
api "io.github.ultreon.corelibs:resources-v0:$corelibs_version"
api "io.github.ultreon.corelibs:text-v0:$corelibs_version"
api "io.github.ultreon.corelibs:translations-v0:$corelibs_version"

modImplementation "fuzs.forgeconfigapiport:forgeconfigapiport-fabric:$forge_config_api_port_version"
modCompileOnly 'com.electronwill.night-config:core:3.6.3'
modCompileOnly 'com.electronwill.night-config:toml:3.6.3'
api "com.github.Ultreon:json5-api:d0a559bc9b"

// ImGui
implementation "io.github.spair:imgui-java-binding:$imgui_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.ultreon.mods.advanceddebug.api.client.menu.IDebugGui;
import com.ultreon.mods.advanceddebug.api.client.registry.IFormatterRegistry;
import com.ultreon.mods.advanceddebug.api.init.ModDebugFormatters;
import com.ultreon.mods.advanceddebug.client.Config;
import com.ultreon.mods.advanceddebug.client.input.KeyBindingList;
import com.ultreon.mods.advanceddebug.client.menu.DebugGui;
import com.ultreon.mods.advanceddebug.client.registry.FormatterRegistry;
Expand All @@ -15,6 +16,7 @@
import com.ultreon.mods.advanceddebug.util.TargetUtils;
import dev.architectury.event.events.client.ClientLifecycleEvent;
import dev.architectury.event.events.client.ClientTickEvent;
import io.github.xypercode.craftyconfig.CraftyConfig;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.server.IntegratedServer;
Expand All @@ -28,8 +30,6 @@
import org.slf4j.LoggerFactory;

public class AdvancedDebug implements IAdvancedDebug {
public static final String MOD_ID = "advanced_debug";

// Directly reference a log4j logger.
public static final Logger LOGGER = LoggerFactory.getLogger("AdvancedDebug");
private static AdvancedDebug instance;
Expand All @@ -38,19 +38,28 @@ public class AdvancedDebug implements IAdvancedDebug {

public final InspectionRoot<Minecraft> inspections = new InspectionRoot<>(Minecraft.getInstance());

public static AdvancedDebug getInstance() {
return instance;
}
private final Config config = new Config();

@SuppressWarnings("ConstantConditions")
public AdvancedDebug() {
instance = this;

config.load();
}

public static AdvancedDebug getInstance() {
return instance;
}

private static void tick(Minecraft minecraft) {
DebugGui.get().tick();
}

@Override
public CraftyConfig getConfig() {
return config;
}

public void init() {
ModOverlays.registerAll();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import com.ultreon.mods.advanceddebug.api.client.menu.IDebugGui;
import com.ultreon.mods.advanceddebug.api.client.registry.IFormatterRegistry;
import com.ultreon.mods.advanceddebug.client.Config;
import io.github.xypercode.craftyconfig.CraftyConfig;

import java.lang.reflect.InvocationTargetException;

public interface IAdvancedDebug {
String MOD_ID = "advanced_debug";

static IAdvancedDebug get() {
try {
return (IAdvancedDebug) Class.forName("com.ultreon.mods.advanceddebug.AdvancedDebug").getDeclaredMethod("getInstance").invoke(null);
Expand All @@ -16,6 +19,8 @@ static IAdvancedDebug get() {
}
}

CraftyConfig getConfig();

IDebugGui getGui();

IFormatterRegistry getFormatterRegistry();
Expand All @@ -24,28 +29,28 @@ static IAdvancedDebug get() {

@Deprecated(forRemoval = true)
default boolean isSpacedNamespace() {
return Config.SPACED_NAMESPACES.get();
return Config.spacedNamespaces;
}

@Deprecated(forRemoval = true)
default boolean isSpacedEnumConstants() {
return Config.SPACED_ENUM_CONSTANTS.get();
return Config.spacedEnumConstants;
}

@Deprecated(forRemoval = true)
default boolean enableBubbleBlasterID() {
return Config.ENABLE_BUBBLE_BLASTER_ID.get();
return Config.enableBubbleBlasterId;
}

default boolean isNamespaceSpaced() {
return Config.SPACED_NAMESPACES.get();
return Config.spacedNamespaces;
}

default boolean isEnumConstantsSpaced() {
return Config.SPACED_ENUM_CONSTANTS.get();
return Config.spacedEnumConstants;
}

default boolean isBubbleBlasterIdEnabled() {
return Config.ENABLE_BUBBLE_BLASTER_ID.get();
return Config.enableBubbleBlasterId;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Use {@link #getValue() getValue} or {@link #setValue(double) setValue} for getting / settings the normalized value.<br>
* <br>
*
* @author Qboi123
* @author XyperCode
*/
public final class Percentage implements IFormattable {
private double percentage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* Note: this is modified to use type parameters. - Qboi123
* Note: this is modified to use type parameters. - XyperCode
*
*/
import org.jetbrains.annotations.NotNull;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,14 +406,6 @@ public void format(BlockEntityType obj, IFormatterContext context) {
.other(BuiltInRegistries.BLOCK_ENTITY_TYPE.getKey(obj));
}
});
public static final Formatter<Advancement> ADVANCEMENT = REGISTRY.register(new Formatter<>(Advancement.class, new ResourceLocation(IAdvancedDebug.get().getModId(), "minecraft/advancement")) {
@Override
public void format(Advancement obj, IFormatterContext context) {
context.className("advancement")
.space()
.other(obj.getId());
}
});
public static final Formatter<Stat> STAT = REGISTRY.register(new Formatter<>(Stat.class, new ResourceLocation(IAdvancedDebug.get().getModId(), "minecraft/stat")) {
@Override
public void format(Stat obj, IFormatterContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/**
* Public math utilities.
*
* @author Qboi123
* @author XyperCode
*/
public class MathUtil {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,50 +1,32 @@
package com.ultreon.mods.advanceddebug.client;

import com.ultreon.libs.commons.v0.Identifier;
import com.ultreon.mods.advanceddebug.api.client.menu.DebugPage;
import com.ultreon.mods.advanceddebug.client.menu.DebugGui;
import dev.architectury.injectables.annotations.ExpectPlatform;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.common.ForgeConfigSpec;

import java.util.ArrayList;
import java.util.List;

public class Config {
public static final ForgeConfigSpec.BooleanValue SHOW_FPS_ON_DEFAULT_PAGE;
public static final ForgeConfigSpec.BooleanValue SHOW_CURRENT_PAGE;
public static final ForgeConfigSpec.BooleanValue USE_CUSTOM_SCALE;
public static final ForgeConfigSpec.IntValue CUSTOM_SCALE;
public static final ForgeConfigSpec.BooleanValue SPACED_NAMESPACES;
public static final ForgeConfigSpec.BooleanValue SPACED_ENUM_CONSTANTS;
public static final ForgeConfigSpec.BooleanValue ENABLE_BUBBLE_BLASTER_ID;
public static final ForgeConfigSpec.ConfigValue<List<? extends String>> ENABLED_PAGES;

static final ForgeConfigSpec.Builder CLIENT_BUILDER = new ForgeConfigSpec.Builder();


static {
SHOW_FPS_ON_DEFAULT_PAGE = CLIENT_BUILDER.comment("Show FPS on default page").define("show_fps_on_default_page", false);
SHOW_CURRENT_PAGE = CLIENT_BUILDER.comment("Show current page").define("show_current_page", true);
USE_CUSTOM_SCALE = CLIENT_BUILDER.comment("Use scale other than in options").define("use_custom_scale", false);
CUSTOM_SCALE = CLIENT_BUILDER.comment("Custom scale to set").defineInRange("custom_scale", 2, 1, 4);

List<String> pages = DebugGui.get().getPages().stream().map(DebugPage::getId).map(Identifier::toString).toList();
ENABLED_PAGES = CLIENT_BUILDER.comment("Enabled pages").defineList("enabled_pages", new ArrayList<>(pages), page -> page instanceof String pageName && pages.contains(pageName));

CLIENT_BUILDER.push("formatting");
SPACED_NAMESPACES = CLIENT_BUILDER.comment("Spaced namespaces").define("spaced_namespaces", true);
SPACED_ENUM_CONSTANTS = CLIENT_BUILDER.comment("Spaced enum constants").define("spaced_enum_constants", true);
ENABLE_BUBBLE_BLASTER_ID = CLIENT_BUILDER.comment("Enable Bubble Blaster ID (Easter Egg)").define("enable_bubble_blaster_id", false);
CLIENT_BUILDER.pop();
}

@ExpectPlatform
public static void register(Object context) {

}

public static ForgeConfigSpec build() {
return CLIENT_BUILDER.build();
}
import com.ultreon.mods.advanceddebug.api.IAdvancedDebug;
import io.github.xypercode.craftyconfig.ConfigEntry;
import io.github.xypercode.craftyconfig.ConfigInfo;
import io.github.xypercode.craftyconfig.CraftyConfig;
import io.github.xypercode.craftyconfig.Ranged;

@ConfigInfo(fileName = "advanced-debug", modId = IAdvancedDebug.MOD_ID)
public class Config extends CraftyConfig {
@ConfigEntry(path = "showFpsOnDefaultPage", comment = "Show FPS on default page")
public static boolean showFpsOnDefaultPage = false;

@ConfigEntry(path = "showCurrentPage", comment = "Show current page")
public static boolean showCurrentPage = true;

@ConfigEntry(path = "useCustomScale", comment = "Use scale other than in options")
public static boolean useCustomScale = false;

@ConfigEntry(path = "customScale", comment = "Custom scale to set")
@Ranged(min = 1, max = 4)
public static int customScale = 2;

@ConfigEntry(path = "spacedNamespaces", comment = "Spaced namespaces")
public static boolean spacedNamespaces = true;

@ConfigEntry(path = "spacedEnumConstants", comment = "Spaced enum constants")
public static boolean spacedEnumConstants = true;

@ConfigEntry(path = "enableBubbleBlasterId", comment = "Enable Bubble Blaster ID")
public static boolean enableBubbleBlasterId = false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Keybinding list class.
*
* @author Qboi123
* @author XyperCode
*/
public class KeyBindingList {
public static final List<KeyMapping> KEY_BINDINGS = new ArrayList<>();
Expand Down
Loading

0 comments on commit 4eea61e

Please sign in to comment.