Puzzle 2.0.0 - Multiplatform & Cleaner code

- Removed intrusive branding (previously visible on Title screen and F3 menu)
- De-modularized: Previously, Puzzle was split into multiple modules which complicated the development process and was just unnecessary
- Experimental NeoForge support
- Many small improvements
- puzzle-splashscreen: Improved  background image blending
- puzzle-splashscreen: Added support for custom blend functions for full OptiFine parity
This commit is contained in:
Martin Prokoph
2024-09-06 18:44:27 +02:00
parent 651483af22
commit 35c613a536
80 changed files with 926 additions and 1063 deletions

View File

@@ -1,223 +1,118 @@
// Based on https://github.com/OnyxStudios/Cardinal-Components-API/blob/1.17/build.gradle
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
plugins {
id "fabric-loom" version "1.6-SNAPSHOT" apply false
id "me.shedaniel.unified-publishing" version "0.1.+"
id "maven-publish"
id "java-library"
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
}
group = "net.puzzlemc"
archivesBaseName = "puzzle"
architectury {
minecraft = rootProject.minecraft_version
}
subprojects {
apply plugin: 'fabric-loom'
apply plugin: 'com.matthewprenger.cursegradle'
apply plugin: 'maven-publish'
apply plugin: 'java-library'
archivesBaseName = project.name
group = "${rootProject.group}.${rootProject.archivesBaseName}"
}
allprojects {
apply plugin: "fabric-loom"
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_21
version = System.getenv("TRAVIS_TAG") ?: rootProject.mod_version
configurations {
dev
}
apply plugin: "dev.architectury.loom"
repositories {
maven { url 'https://jitpack.io' }
maven {
url = "https://api.modrinth.com/maven"
}
maven { url "https://maven.terraformersmc.com/releases" }
maven {
name = 'AperLambda'
url = 'https://aperlambda.github.io/maven'
}
mavenCentral()
maven {
name 'Gegy'
url 'https://maven.gegy.dev'
}
maven {
url "https://www.cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven {
name = 'JitPack'
url 'https://jitpack.io'
}
maven {
url "https://maven.shedaniel.me/"
}
maven { url "https://maven.quiltmc.org/repository/release/" }
}
dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
mappings "net.fabricmc:yarn:${rootProject.yarn_mappings}:v2"
modApi "net.fabricmc:fabric-loader:${rootProject.loader_version}"
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_version}"
// The following line declares the yarn mappings you may select this one as well.
mappings loom.layered {
it.mappings("net.fabricmc:yarn:$rootProject.yarn_mappings:v2")
it.mappings("dev.architectury:yarn-mappings-patch-neoforge:$rootProject.yarn_mappings_patch_neoforge_version")
}
modCompileOnlyApi ("maven.modrinth:cull-leaves:${project.cull_leaves_version}")
modCompileOnlyApi ("maven.modrinth:iris:${project.iris_version}")
modCompileOnly ("maven.modrinth:cit-resewn:${project.cit_resewn_version}")
modCompileOnlyApi ("maven.modrinth:continuity:${project.continuity_version}")
modCompileOnlyApi ("maven.modrinth:animatica:${project.animatica_version}")
modCompileOnlyApi ("maven.modrinth:colormatic:${project.colormatic_version}")
modCompileOnlyApi ("maven.modrinth:borderless-mining:${project.borderless_mining_version}")
modCompileOnlyApi ("maven.modrinth:dynamic-fps:${project.dynamic_fps_version}")
modCompileOnlyApi ("com.moandjiezana.toml:toml4j:${project.toml4j_version}")
modCompileOnlyApi ("maven.modrinth:entitytexturefeatures:${project.etf_version}")
modCompileOnlyApi ("maven.modrinth:entity-model-features:${project.emf_version}")
modCompileOnlyApi ("maven.modrinth:completeconfig:${project.complete_config_version}")
//modImplementation ("maven.modrinth:exordium:${project.exordium_version}")
modCompileOnlyApi ("maven.modrinth:lambdynamiclights:${project.ldl_version}")
modCompileOnlyApi ("maven.modrinth:lambdabettergrass:${project.lbg_version}")
modCompileOnlyApi "dev.lambdaurora:spruceui:${project.spruceui_version}"
}
}
processResources {
inputs.property "version", project.version
allprojects {
apply plugin: "java"
apply plugin: "architectury-plugin"
apply plugin: "maven-publish"
filesMatching("fabric.mod.json") {
expand "version": project.version
archivesBaseName = rootProject.archives_base_name
version = rootProject.mod_version
group = rootProject.maven_group
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = 21
}
ext {
releaseChangelog = {
def changes = new StringBuilder()
changes << "## Puzzle v$project.version for $project.minecraft_version\n[View the changelog](https://www.github.com/PuzzleMC/Puzzle/commits/)"
def proc = "git log --max-count=1 --pretty=format:%s".execute()
proc.in.eachLine { line ->
def processedLine = line.toString()
if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) {
changes << "\n- ${processedLine.capitalize()}"
}
}
proc.waitFor()
return changes.toString()
}
}
// ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 21
processResources {
// Minify json resources
doLast {
fileTree(dir: outputs.files.asPath, include: "**/*.json").each {
File file -> file.text = JsonOutput.toJson(new JsonSlurper().parse(file))
}
}
}
java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
}
jar {
}
afterEvaluate {
artifacts {
dev file: file("${project.buildDir}/libs/$archivesBaseName-${version}-dev.jar"), type: "jar", builtBy: sourcesJar
}
}
}
subprojects {
version = rootProject.version
}
subprojects.each { remapJar.dependsOn("${it.path}:remapJar") }
repositories {
maven {
name = "JitPack"
url = "https://jitpack.io"
}
maven {
name = "TerraformersMC"
url = "https://maven.terraformersmc.com/releases"
}
maven {
name = 'AperLambda'
url = 'https://aperlambda.github.io/maven'
}
mavenCentral()
maven {
name 'Gegy'
url 'https://maven.gegy.dev'
}
maven {
url = "https://api.modrinth.com/maven"
}
maven {
url "https://www.cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven {
name = 'JitPack'
url 'https://jitpack.io'
}
maven {
url "https://maven.shedaniel.me/"
}
}
dependencies {
modImplementation ("net.fabricmc.fabric-api:fabric-api:${project.fabric_version}")
modImplementation ("com.terraformersmc:modmenu:${project.mod_menu_version}") {
exclude group: "net.fabricmc.fabric-api"
}
modImplementation ("maven.modrinth:cull-leaves:${project.cull_leaves_version}")
modImplementation ("maven.modrinth:lambdynamiclights:${project.ldl_version}")
modCompileOnlyApi ("maven.modrinth:lambdabettergrass:${project.lbg_version}")
modImplementation ("maven.modrinth:iris:${project.iris_version}")
modCompileOnly ("maven.modrinth:cit-resewn:${project.cit_resewn_version}")
modCompileOnlyApi ("maven.modrinth:continuity:${project.continuity_version}")
modImplementation ("maven.modrinth:animatica:${project.animatica_version}")
modCompileOnlyApi ("maven.modrinth:colormatic:${project.colormatic_version}")
modImplementation ("maven.modrinth:borderless-mining:${project.borderless_mining_version}")
modImplementation ("maven.modrinth:dynamic-fps:${project.dynamic_fps_version}")
modImplementation("com.moandjiezana.toml:toml4j:${project.toml4j_version}")
modImplementation ("maven.modrinth:entitytexturefeatures:${project.etf_version}")
modImplementation ("maven.modrinth:entity-model-features:${project.emf_version}")
modImplementation ("maven.modrinth:completeconfig:${project.complete_config_version}")
//modImplementation ("maven.modrinth:exordium:${project.exordium_version}")
modImplementation("org.aperlambda:lambdajcommon:1.8.1") {
exclude group: 'com.google.code.gson'
exclude group: 'com.google.guava'
}
modImplementation "dev.lambdaurora:spruceui:${project.spruceui_version}"
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
include "maven.modrinth:midnightlib:${project.midnightlib_version}"
subprojects.each {
api project(path: ":${it.name}", configuration: "dev")
include project(":${it.name}")
}
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar")) {
builtBy(remapJar)
}
pom.withXml {
subprojects.each {
depNode.appendNode("groupId", it.group)
depNode.appendNode("artifactId", it.name)
depNode.appendNode("version", it.version)
depNode.appendNode("scope", "compile")
}
}
}
}
}
ext {
releaseChangelog = {
def changes = new StringBuilder()
changes << "## Puzzle v$project.version for $project.minecraft_version\n[View the changelog](https://www.github.com/TeamMidnightDust/Puzzle/commits/)"
def proc = "git log --max-count=1 --pretty=format:%s".execute()
proc.in.eachLine { line ->
def processedLine = line.toString()
if (!processedLine.contains("New translations") && !processedLine.contains("Merge") && !processedLine.contains("branch")) {
changes << "\n- ${processedLine.capitalize()}"
}
}
proc.waitFor()
return changes.toString()
}
}
unifiedPublishing {
project {
displayName = "Puzzle $project.version - $project.minecraft_version"
releaseType = "$project.release_type"
changelog = releaseChangelog()
gameVersions = []
gameLoaders = ["fabric","quilt"]
mainPublication remapJar
relations {
depends {
curseforge = "fabric-api"
modrinth = "fabric-api"
}
includes {
curseforge = "midnightlib"
modrinth = "midnightlib"
}
}
var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN")
if (CURSEFORGE_TOKEN != null) {
curseforge {
token = CURSEFORGE_TOKEN
id = project.curseforge_id
gameVersions.addAll "Java 21", project.minecraft_version
}
}
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
if (MODRINTH_TOKEN != null) {
modrinth {
token = MODRINTH_TOKEN
id = project.modrinth_id
version = "$project.version-$project.name"
gameVersions.addAll project.minecraft_version
}
}
}
}

34
common/build.gradle Normal file
View File

@@ -0,0 +1,34 @@
architectury {
common(rootProject.enabled_platforms.split(","))
}
loom {
accessWidenerPath = file("src/main/resources/puzzle-models.accesswidener")
}
dependencies {
// We depend on fabric loader here to use the fabric @Environment annotations and get the mixin dependencies
// Do NOT use other classes from fabric loader
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modCompileOnly "maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric"
modCompileOnly "org.quiltmc:quilt-loader:${rootProject.quilt_loader_version}"
modCompileOnlyApi "org.quiltmc.quilted-fabric-api:quilted-fabric-api:${rootProject.quilt_fabric_api_version}"
modCompileOnlyApi ("org.aperlambda:lambdajcommon:1.8.1") {
exclude group: 'com.google.code.gson'
exclude group: 'com.google.guava'
}
}
publishing {
publications {
mavenCommon(MavenPublication) {
artifactId = rootProject.archives_base_name
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}

View File

@@ -0,0 +1,18 @@
package net.puzzlemc.core;
import net.puzzlemc.core.config.PuzzleConfig;
import net.puzzlemc.gui.PuzzleGui;
import net.puzzlemc.splashscreen.PuzzleSplashScreen;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class PuzzleCore {
public final static String MOD_ID = "puzzle";
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
public static void initModules() {
PuzzleConfig.init(MOD_ID, PuzzleConfig.class);
PuzzleGui.init();
PuzzleSplashScreen.init();
}
}

View File

@@ -0,0 +1,28 @@
package net.puzzlemc.core.config;
import eu.midnightdust.lib.config.MidnightConfig;
import java.util.ArrayList;
import java.util.List;
public class PuzzleConfig extends MidnightConfig {
private static final String GUI = "gui";
private static final String INTERNAL = "internal";
private static final String FEATURES = "features";
@Entry(category = GUI, name = "Disabled integrations") public static List<String> disabledIntegrations = new ArrayList<>();
@Entry(category = GUI, name = "Enable Puzzle button") public static boolean enablePuzzleButton = true;
@Entry(category = FEATURES, name = "puzzle.option.resourcepack_splash_screen") public static boolean resourcepackSplashScreen = true;
@Entry(category = FEATURES, name = "puzzle.option.unlimited_model_rotations") public static boolean unlimitedRotations = true;
@Entry(category = FEATURES, name = "puzzle.option.bigger_custom_models") public static boolean biggerModels = true;
@Entry(category = INTERNAL, name = "Enable debug messages") public static boolean debugMessages = false;
@Entry(category = INTERNAL, name = "Has custom splash screen") public static boolean hasCustomSplashScreen = false;
@Entry(category = INTERNAL, name = "Splash Background Color") public static int backgroundColor = 15675965;
@Entry(category = INTERNAL, name = "Splash Progress Bar Color") public static int progressBarColor = 16777215;
@Entry(category = INTERNAL, name = "Splash Progress Bar Background Color") public static int progressBarBackgroundColor = 15675965;
@Entry(category = INTERNAL, name = "Splash Progress Bar Frame Color") public static int progressFrameColor = 16777215;
@Entry(category = INTERNAL, name = "puzzle.option.better_splash_screen_blend") public static boolean disableBlend = false;
@Entry(category = INTERNAL, name = "Custom Blend Function") public static List<String> customBlendFunction = new ArrayList<>();
}

View File

@@ -2,15 +2,13 @@ package net.puzzlemc.gui;
import net.puzzlemc.core.config.PuzzleConfig;
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.List;
public class PuzzleApi {
private static final Logger LOGGER = LogManager.getLogger("puzzle-gui");
import static net.puzzlemc.core.PuzzleCore.LOGGER;
public class PuzzleApi {
public static List<PuzzleWidget> GRAPHICS_OPTIONS = new ArrayList<>();
public static List<PuzzleWidget> MISC_OPTIONS = new ArrayList<>();
public static List<PuzzleWidget> PERFORMANCE_OPTIONS = new ArrayList<>();
@@ -18,18 +16,22 @@ public class PuzzleApi {
public static void addToGraphicsOptions(PuzzleWidget button) {
GRAPHICS_OPTIONS.add(button);
if (PuzzleConfig.debugMessages) LOGGER.info(button.descriptionText.getContent().toString() + " -> Graphics Options");
if (PuzzleConfig.debugMessages)
LOGGER.info("{} -> Graphics Options", button.descriptionText.getContent().toString());
}
public static void addToMiscOptions(PuzzleWidget button) {
MISC_OPTIONS.add(button);
if (PuzzleConfig.debugMessages) LOGGER.info(button.descriptionText.getContent().toString() + " -> Misc Options");
if (PuzzleConfig.debugMessages)
LOGGER.info("{} -> Misc Options", button.descriptionText.getContent().toString());
}
public static void addToPerformanceOptions(PuzzleWidget button) {
PERFORMANCE_OPTIONS.add(button);
if (PuzzleConfig.debugMessages) LOGGER.info(button.descriptionText.getContent().toString() + "- > Performance Options");
if (PuzzleConfig.debugMessages)
LOGGER.info("{}- > Performance Options", button.descriptionText.getContent().toString());
}
public static void addToResourceOptions(PuzzleWidget button) {
RESOURCE_OPTIONS.add(button);
if (PuzzleConfig.debugMessages) LOGGER.info(button.descriptionText.getContent().toString() + " -> Resource Options");
if (PuzzleConfig.debugMessages)
LOGGER.info("{} -> Resource Options", button.descriptionText.getContent().toString());
}
}

View File

@@ -6,67 +6,60 @@ import net.minecraft.util.Identifier;
import net.puzzlemc.core.config.PuzzleConfig;
import net.puzzlemc.gui.compat.*;
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
import net.fabricmc.api.ClientModInitializer;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.puzzlemc.splashscreen.PuzzleSplashScreen;
public class PuzzleClient implements ClientModInitializer {
import static net.puzzlemc.core.PuzzleCore.LOGGER;
public class PuzzleGui {
public final static String id = "puzzle";
public static final Text YES = Text.translatable("gui.yes").formatted(Formatting.GREEN);
public static final Text NO = Text.translatable("gui.no").formatted(Formatting.RED);
public static final Identifier PUZZLE_BUTTON = Identifier.of(id, "icon/button");
@Override
public void onInitializeClient() {
public static void init() {
MidnightLib.hiddenMods.add("puzzle");
MinecraftClient client = MinecraftClient.getInstance();
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.of("Puzzle")));
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.translatable("puzzle.option.check_for_updates"), (button) -> button.setMessage(PuzzleConfig.checkUpdates ? YES : NO), (button) -> {
PuzzleConfig.checkUpdates = !PuzzleConfig.checkUpdates;
PuzzleConfig.write(id);
}));
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.translatable("puzzle.option.show_version_info"), (button) -> button.setMessage(PuzzleConfig.showPuzzleInfo ? YES : NO), (button) -> {
PuzzleConfig.showPuzzleInfo = !PuzzleConfig.showPuzzleInfo;
PuzzleConfig.write(id);
}));
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.translatable("puzzle.midnightconfig.title"), (button) -> button.setMessage(Text.of("OPEN")), (button) -> {
client.setScreen(PuzzleConfig.getScreen(client.currentScreen, "puzzle"));
}));
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Puzzle")));
if (isActive("puzzle-splashscreen")) {
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("puzzle.option.resourcepack_splash_screen"), (button) -> button.setMessage(PuzzleConfig.resourcepackSplashScreen ? YES : NO), (button) -> {
PuzzleConfig.resourcepackSplashScreen = !PuzzleConfig.resourcepackSplashScreen;
PuzzleConfig.write(id);
PuzzleSplashScreen.resetColors();
MinecraftClient.getInstance().getTextureManager().registerTexture(PuzzleSplashScreen.LOGO, new PuzzleSplashScreen.LogoTexture(PuzzleSplashScreen.LOGO));
}));
}
if (isActive("puzzle-models")) {
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("puzzle.option.unlimited_model_rotations"), (button) -> button.setMessage(PuzzleConfig.unlimitedRotations ? YES : NO), (button) -> {
PuzzleConfig.unlimitedRotations = !PuzzleConfig.unlimitedRotations;
PuzzleConfig.write(id);
}));
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("puzzle.option.bigger_custom_models"), (button) -> button.setMessage(PuzzleConfig.biggerModels ? YES : NO), (button) -> {
PuzzleConfig.biggerModels = !PuzzleConfig.biggerModels;
PuzzleConfig.write(id);
}));
}
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("puzzle.option.resourcepack_splash_screen"), (button) -> button.setMessage(PuzzleConfig.resourcepackSplashScreen ? YES : NO), (button) -> {
PuzzleConfig.resourcepackSplashScreen = !PuzzleConfig.resourcepackSplashScreen;
PuzzleSplashScreen.resetColors();
PuzzleConfig.write(id);
MinecraftClient.getInstance().getTextureManager().registerTexture(PuzzleSplashScreen.LOGO, new PuzzleSplashScreen.LogoTexture(PuzzleSplashScreen.LOGO));
}));
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("puzzle.option.unlimited_model_rotations"), (button) -> button.setMessage(PuzzleConfig.unlimitedRotations ? YES : NO), (button) -> {
PuzzleConfig.unlimitedRotations = !PuzzleConfig.unlimitedRotations;
PuzzleConfig.write(id);
}));
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("puzzle.option.bigger_custom_models"), (button) -> button.setMessage(PuzzleConfig.biggerModels ? YES : NO), (button) -> {
PuzzleConfig.biggerModels = !PuzzleConfig.biggerModels;
PuzzleConfig.write(id);
}));
if (isActive("cullleaves")) CullLeavesCompat.init();
if (isActive("colormatic")) ColormaticCompat.init();
if (isActive("borderlessmining")) BorderlessMiningCompat.init();
if (isActive("iris")) IrisCompat.init();
}
public static boolean lateInitDone = false;
public static void lateInit() { // Some mods are initialized after Puzzle, so we can't access them in our ClientModInitializer
if (isActive("lambdynlights")) LDLCompat.init();
if (isActive("citresewn")) CITRCompat.init();
if (isActive("lambdabettergrass")) LBGCompat.init();
if (isActive("continuity")) ContinuityCompat.init();
if (isActive("entity_texture_features")) ETFCompat.init();
if (isActive("entity_model_features")) EMFCompat.init();
try {
if (isActive("entity_texture_features")) ETFCompat.init();
if (isActive("entity_model_features")) EMFCompat.init();
} catch (Exception e) {
LOGGER.error("ETF/EMF config structure changed. Again...", e);
}
lateInitDone = true;
}
public static boolean isActive(String modid) {

View File

@@ -6,8 +6,8 @@ import net.minecraft.text.Text;
import net.puzzlemc.gui.PuzzleApi;
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
import static net.puzzlemc.gui.PuzzleClient.NO;
import static net.puzzlemc.gui.PuzzleClient.YES;
import static net.puzzlemc.gui.PuzzleGui.NO;
import static net.puzzlemc.gui.PuzzleGui.YES;
public class BorderlessMiningCompat {
public static void init() {

View File

@@ -7,8 +7,8 @@ import net.minecraft.text.Text;
import net.puzzlemc.gui.PuzzleApi;
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
import static net.puzzlemc.gui.PuzzleClient.NO;
import static net.puzzlemc.gui.PuzzleClient.YES;
import static net.puzzlemc.gui.PuzzleGui.NO;
import static net.puzzlemc.gui.PuzzleGui.YES;
public class ColormaticCompat {
public static void init() {

View File

@@ -6,8 +6,8 @@ import net.minecraft.text.Text;
import net.puzzlemc.gui.PuzzleApi;
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
import static net.puzzlemc.gui.PuzzleClient.NO;
import static net.puzzlemc.gui.PuzzleClient.YES;
import static net.puzzlemc.gui.PuzzleGui.NO;
import static net.puzzlemc.gui.PuzzleGui.YES;
public class ContinuityCompat {
public static void init() {

View File

@@ -6,8 +6,8 @@ import net.minecraft.text.Text;
import net.puzzlemc.gui.PuzzleApi;
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
import static net.puzzlemc.gui.PuzzleClient.NO;
import static net.puzzlemc.gui.PuzzleClient.YES;
import static net.puzzlemc.gui.PuzzleGui.NO;
import static net.puzzlemc.gui.PuzzleGui.YES;
public class CullLeavesCompat {
public static void init() {

View File

@@ -13,8 +13,8 @@ import java.util.NavigableSet;
import java.util.Objects;
import java.util.TreeSet;
import static net.puzzlemc.gui.PuzzleClient.NO;
import static net.puzzlemc.gui.PuzzleClient.YES;
import static net.puzzlemc.gui.PuzzleGui.NO;
import static net.puzzlemc.gui.PuzzleGui.YES;
public class EMFCompat {
public static void init() {

View File

@@ -11,8 +11,8 @@ import java.util.NavigableSet;
import java.util.Objects;
import java.util.TreeSet;
import static net.puzzlemc.gui.PuzzleClient.NO;
import static net.puzzlemc.gui.PuzzleClient.YES;
import static net.puzzlemc.gui.PuzzleGui.NO;
import static net.puzzlemc.gui.PuzzleGui.YES;
public class ETFCompat {
public static void init() {

View File

@@ -7,13 +7,13 @@ import net.minecraft.client.gui.screen.Screen;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.puzzlemc.gui.PuzzleApi;
import net.puzzlemc.gui.PuzzleClient;
import net.puzzlemc.gui.PuzzleGui;
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
public class IrisCompat {
public static void init() {
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.of("Iris")));
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("iris.puzzle.option.enableShaders"), (button) -> button.setMessage(IrisApi.getInstance().getConfig().areShadersEnabled() ? PuzzleClient.YES : PuzzleClient.NO), (button) -> {
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("iris.puzzle.option.enableShaders"), (button) -> button.setMessage(IrisApi.getInstance().getConfig().areShadersEnabled() ? PuzzleGui.YES : PuzzleGui.NO), (button) -> {
IrisApiConfig irisConfig = IrisApi.getInstance().getConfig();
irisConfig.setShadersEnabledAndApply(!irisConfig.areShadersEnabled());
}));

View File

@@ -6,8 +6,8 @@ import net.minecraft.text.Text;
import net.puzzlemc.gui.PuzzleApi;
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
import static net.puzzlemc.gui.PuzzleClient.NO;
import static net.puzzlemc.gui.PuzzleClient.YES;
import static net.puzzlemc.gui.PuzzleGui.NO;
import static net.puzzlemc.gui.PuzzleGui.YES;
public class LBGCompat {
public static void init() {

View File

@@ -6,8 +6,8 @@ import net.minecraft.text.Text;
import net.puzzlemc.gui.PuzzleApi;
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
import static net.puzzlemc.gui.PuzzleClient.NO;
import static net.puzzlemc.gui.PuzzleClient.YES;
import static net.puzzlemc.gui.PuzzleGui.NO;
import static net.puzzlemc.gui.PuzzleGui.YES;
public class LDLCompat {
public static void init() {

View File

@@ -0,0 +1,52 @@
package net.puzzlemc.gui.mixin;
import eu.midnightdust.core.config.MidnightLibConfig;
import eu.midnightdust.lib.util.PlatformFunctions;
import net.minecraft.client.gui.widget.TextIconButtonWidget;
import net.minecraft.client.gui.widget.ThreePartsLayoutWidget;
import net.puzzlemc.core.config.PuzzleConfig;
import net.puzzlemc.gui.PuzzleGui;
import net.puzzlemc.gui.screen.PuzzleOptionsScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.option.OptionsScreen;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.Objects;
@Mixin(OptionsScreen.class)
public abstract class MixinOptionsScreen extends Screen {
@Shadow @Final private ThreePartsLayoutWidget layout;
@Unique TextIconButtonWidget puzzle$button = TextIconButtonWidget.builder(Text.translatable("puzzle.screen.title"), (buttonWidget) ->
(Objects.requireNonNull(this.client)).setScreen(new PuzzleOptionsScreen(this)), true)
.dimension(20, 20).texture(PuzzleGui.PUZZLE_BUTTON, 20, 20).build();
private MixinOptionsScreen(Text title) {super(title);}
@Inject(at = @At("HEAD"), method = "init")
public void puzzle$onInit(CallbackInfo ci) {
if (PuzzleConfig.enablePuzzleButton) {
this.puzzle$setButtonPos();
this.addDrawableChild(puzzle$button);
}
}
@Inject(at = @At("TAIL"), method = "initTabNavigation")
public void puzzle$onResize(CallbackInfo ci) {
if (PuzzleConfig.enablePuzzleButton) this.puzzle$setButtonPos();
}
@Unique
public void puzzle$setButtonPos() {
int i = 0;
if (PlatformFunctions.isModLoaded("lod")) i = i + 358;
if (MidnightLibConfig.config_screen_list.equals(MidnightLibConfig.ConfigButton.FALSE)) i = i - 25;
puzzle$button.setPosition(this.width / 2 - 178 + i, layout.getY() + layout.getFooterHeight() - 4);
}
}

View File

@@ -1,7 +1,6 @@
package net.puzzlemc.gui.screen;
import com.google.common.collect.Lists;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.tab.GridScreenTab;
import net.minecraft.client.gui.tab.Tab;
import net.minecraft.client.gui.tab.TabManager;
@@ -9,7 +8,7 @@ import net.minecraft.client.gui.widget.TabNavigationWidget;
import net.minecraft.screen.ScreenTexts;
import net.minecraft.text.Text;
import net.puzzlemc.gui.PuzzleApi;
import net.puzzlemc.gui.PuzzleClient;
import net.puzzlemc.gui.PuzzleGui;
import net.puzzlemc.gui.screen.widget.*;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.ButtonWidget;
@@ -36,7 +35,7 @@ public class PuzzleOptionsScreen extends Screen {
@Override
protected void init() {
if (!PuzzleClient.lateInitDone) PuzzleClient.lateInit();
if (!PuzzleGui.lateInitDone) PuzzleGui.lateInit();
List<Tab> tabs = Lists.newArrayList();
if (!PuzzleApi.GRAPHICS_OPTIONS.isEmpty()) tabs.add(new GridScreenTab(graphicsTab));
@@ -45,27 +44,34 @@ public class PuzzleOptionsScreen extends Screen {
if (!PuzzleApi.MISC_OPTIONS.isEmpty()) tabs.add(new GridScreenTab(miscTab));
tabNavigation = TabNavigationWidget.builder(tabManager, this.width).tabs(tabs.toArray(new Tab[0])).build();
if (tabs.size() > 1) this.addDrawableChild(tabNavigation);
tabNavigation.selectTab(0, false);
tabNavigation.init();
prevTab = tabManager.getCurrentTab();
this.addDrawableChild(tabNavigation);
this.list = new PuzzleOptionListWidget(this.client, this.width, this.height - 57, 24, 25);
fillList();
if (tabs.size() > 1) {
this.addDrawableChild(tabNavigation);
list.renderHeaderSeparator = false;
}
this.addDrawableChild(list);
super.init();
this.addDrawableChild(ButtonWidget.builder(ScreenTexts.DONE, (button) -> Objects.requireNonNull(client).setScreen(parent)).dimensions(this.width / 2 - 100, this.height - 26, 200, 20).build());
}
private void fillList() {
List<PuzzleWidget> options = List.of();
if (tabManager.getCurrentTab() == null) return;
else if (tabManager.getCurrentTab().getTitle().equals(graphicsTab)) options = PuzzleApi.GRAPHICS_OPTIONS;
else if (tabManager.getCurrentTab().getTitle().equals(miscTab)) options = PuzzleApi.MISC_OPTIONS;
else if (tabManager.getCurrentTab().getTitle().equals(performanceTab)) options = PuzzleApi.PERFORMANCE_OPTIONS;
else if (tabManager.getCurrentTab().getTitle().equals(resourcesTab)) options = PuzzleApi.RESOURCE_OPTIONS;
else {
Text title = tabManager.getCurrentTab().getTitle();
if (title.equals(graphicsTab)) options = PuzzleApi.GRAPHICS_OPTIONS;
else if (title.equals(miscTab)) options = PuzzleApi.MISC_OPTIONS;
else if (title.equals(performanceTab))
options = PuzzleApi.PERFORMANCE_OPTIONS;
else if (title.equals(resourcesTab)) options = PuzzleApi.RESOURCE_OPTIONS;
}
list.addAll(options);
}
@Override

View File

@@ -15,8 +15,7 @@ public class PuzzleButtonWidget extends ButtonWidget {
}
@Override
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
try {
title.setTitle(this);
try { title.setTitle(this);
} catch (Exception e) {e.fillInStackTrace(); this.visible = false;}
super.renderWidget(context, mouseX, mouseY, delta);
}

View File

@@ -1,22 +1,22 @@
package net.puzzlemc.gui.screen.widget;
import com.mojang.blaze3d.systems.RenderSystem;
import eu.midnightdust.lib.config.MidnightConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableTextContent;
import net.minecraft.util.Formatting;
import net.puzzlemc.gui.screen.PuzzleOptionsScreen;
import org.apache.logging.log4j.LogManager;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import static net.puzzlemc.core.PuzzleCore.LOGGER;
@Environment(EnvType.CLIENT)
public class PuzzleOptionListWidget extends MidnightConfig.MidnightConfigListWidget {
@@ -27,26 +27,20 @@ public class PuzzleOptionListWidget extends MidnightConfig.MidnightConfigListWid
this.centerListVertically = false;
textRenderer = minecraftClient.textRenderer;
}
// TODO: Make renderHeaderSeperator in MidnightLib public and remove the following code
protected void drawHeaderAndFooterSeparators(DrawContext context) {
RenderSystem.enableBlend();
context.drawTexture(this.client.world == null ? Screen.FOOTER_SEPARATOR_TEXTURE : Screen.INWORLD_FOOTER_SEPARATOR_TEXTURE, this.getX(), this.getBottom(), 0.0F, 0.0F, this.getWidth(), 2, 32, 2);
RenderSystem.disableBlend();
}
public void addAll(List<PuzzleWidget> buttons) {
int buttonX = this.width - 160;
for (PuzzleWidget button : buttons) {
if (button.buttonType == ButtonType.TEXT) {
if (button.buttonType == ButtonType.TEXT)
this.addButton(List.of(), Text.literal(" ").append(button.descriptionText).formatted(Formatting.BOLD));
} else if (button.buttonType == ButtonType.BUTTON) {
else if (button.buttonType == ButtonType.BUTTON)
this.addButton(List.of(new PuzzleButtonWidget(buttonX, 0, 150, 20, button.buttonTextAction, button.onPress)), button.descriptionText);
} else if (button.buttonType == ButtonType.SLIDER) {
else if (button.buttonType == ButtonType.SLIDER)
this.addButton(List.of(new PuzzleSliderWidget(button.min, button.max, buttonX, 0, 150, 20, button.defaultSliderValue.getAsInt(), button.buttonTextAction, button.changeSliderValue)), button.descriptionText);
} else if (button.buttonType == ButtonType.TEXT_FIELD) {
else if (button.buttonType == ButtonType.TEXT_FIELD)
this.addButton(List.of(new PuzzleTextFieldWidget(textRenderer, buttonX, 0, 150, 20, button.setTextValue, button.changeTextValue)), button.descriptionText);
} else
LogManager.getLogger("Puzzle").warn("Button " + button + " is missing the buttonType variable. This shouldn't happen!");
else
LOGGER.warn("Button {} is missing the buttonType variable. This shouldn't happen!", button);
}
}
public void addButton(List<ClickableWidget> buttons, Text text) {
@@ -57,7 +51,8 @@ public class PuzzleOptionListWidget extends MidnightConfig.MidnightConfigListWid
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
super.renderWidget(context, mouseX, mouseY, delta);
MidnightConfig.ButtonEntry e = this.getHoveredEntry();
if (client.currentScreen instanceof PuzzleOptionsScreen page && e != null && !e.buttons.isEmpty() && MidnightConfig.ButtonEntry.buttonsWithText.get(e.buttons.get(0)).getContent() instanceof TranslatableTextContent content) {
if (client.currentScreen instanceof PuzzleOptionsScreen page && e != null && !e.buttons.isEmpty() &&
e.text.getContent() instanceof TranslatableTextContent content) {
ClickableWidget button = e.buttons.getFirst();
String key = null;
if (I18n.hasTranslation(content.getKey() + ".tooltip")) key = content.getKey() + ".tooltip";

View File

@@ -19,7 +19,7 @@ public class PuzzleSliderWidget extends SliderWidget {
this.changeAction = changeAction;
try {
this.updateMessage();
} catch (Exception e) {e.printStackTrace(); this.visible = false;}
} catch (Exception e) {e.fillInStackTrace(); this.visible = false;}
}
public int getInt() {
int difference = max - min;

View File

@@ -14,7 +14,7 @@ public class PuzzleTextFieldWidget extends TextFieldWidget {
this.change = change;
try {
setValueAction.setTextValue(this);
} catch (Exception e) {e.printStackTrace(); this.setVisible(false);}
} catch (Exception e) {e.fillInStackTrace(); this.setVisible(false);}
}
@Override
public void write(String text) {

View File

@@ -1,7 +1,5 @@
package net.puzzlemc.gui.screen.widget;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.gui.widget.ClickableWidget;
import net.minecraft.client.gui.widget.TextFieldWidget;
@@ -65,19 +63,15 @@ public class PuzzleWidget {
this.setTextValue = setValue;
this.changeTextValue = changeAction;
}
@Environment(EnvType.CLIENT)
public interface ChangeTextValueAction {
void onChange(TextFieldWidget textField);
}
@Environment(EnvType.CLIENT)
public interface ChangeSliderValueAction {
void onChange(PuzzleSliderWidget slider);
}
@Environment(EnvType.CLIENT)
public interface SetTextValueAction {
void setTextValue(TextFieldWidget textField);
}
@Environment(EnvType.CLIENT)
public interface TextAction {
void setTitle(ClickableWidget button);
}

View File

@@ -0,0 +1,173 @@
package net.puzzlemc.splashscreen;
import eu.midnightdust.lib.util.MidnightColorUtil;
import eu.midnightdust.lib.util.PlatformFunctions;
import net.minecraft.client.texture.NativeImageBackedTexture;
import net.minecraft.resource.*;
import net.minecraft.util.Util;
import net.puzzlemc.core.config.PuzzleConfig;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.resource.metadata.TextureResourceMetadata;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.texture.ResourceTexture;
import net.minecraft.util.Identifier;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import static net.puzzlemc.core.PuzzleCore.LOGGER;
import static net.puzzlemc.core.PuzzleCore.MOD_ID;
public class PuzzleSplashScreen {
public static final Identifier LOGO = Identifier.of("textures/gui/title/mojangstudios.png");
public static final Identifier BACKGROUND = Identifier.of("puzzle/splash_background.png");
public static File CONFIG_PATH = new File(String.valueOf(PlatformFunctions.getConfigDirectory().resolve(".puzzle_cache")));
public static Path LOGO_TEXTURE = Paths.get(CONFIG_PATH + "/mojangstudios.png");
public static Path BACKGROUND_TEXTURE = Paths.get(CONFIG_PATH + "/splash_background.png");
private static final MinecraftClient client = MinecraftClient.getInstance();
private static boolean keepBackground = false;
public static void init() {
if (!CONFIG_PATH.exists()) { // Run when config directory is nonexistent //
if (CONFIG_PATH.mkdir()) { // Create our custom config directory //
if (Util.getOperatingSystem().equals(Util.OperatingSystem.WINDOWS)) {
try { Files.setAttribute(CONFIG_PATH.toPath(), "dos:hidden", true);
} catch (IOException ignored) {}
}
}
}
}
public static class ReloadListener implements SynchronousResourceReloader {
public static final ReloadListener INSTANCE = new ReloadListener();
private ReloadListener() {}
@Override
public void reload(ResourceManager manager) {
if (PuzzleConfig.resourcepackSplashScreen) {
PuzzleSplashScreen.resetColors();
client.getTextureManager().registerTexture(LOGO, new LogoTexture(LOGO));
client.getTextureManager().registerTexture(BACKGROUND, new LogoTexture(BACKGROUND));
manager.findResources("optifine", path -> path.getPath().contains("color.properties")).forEach((id, resource) -> {
try (InputStream stream = resource.getInputStream()) {
Properties properties = new Properties();
properties.load(stream);
if (properties.get("screen.loading") != null) {
PuzzleConfig.backgroundColor = MidnightColorUtil.hex2Rgb(properties.get("screen.loading").toString()).getRGB();
PuzzleConfig.hasCustomSplashScreen = true;
}
if (properties.get("screen.loading.bar") != null) {
PuzzleConfig.progressBarBackgroundColor = MidnightColorUtil.hex2Rgb(properties.get("screen.loading.bar").toString()).getRGB();
PuzzleConfig.hasCustomSplashScreen = true;
}
if (properties.get("screen.loading.progress") != null) {
PuzzleConfig.progressBarColor = MidnightColorUtil.hex2Rgb(properties.get("screen.loading.progress").toString()).getRGB();
PuzzleConfig.hasCustomSplashScreen = true;
}
if (properties.get("screen.loading.outline") != null) {
PuzzleConfig.progressFrameColor = MidnightColorUtil.hex2Rgb(properties.get("screen.loading.outline").toString()).getRGB();
PuzzleConfig.hasCustomSplashScreen = true;
}
if (properties.get("screen.loading.blend") != null) {
PuzzleConfig.disableBlend = properties.get("screen.loading.blend").toString().equals("off");
PuzzleConfig.customBlendFunction = new ArrayList<>(Arrays.stream(properties.get("screen.loading.blend").toString().split(" ")).toList());
PuzzleConfig.hasCustomSplashScreen = true;
}
} catch (Exception e) {
LOGGER.error("Error occurred while loading color.properties {}", id.toString(), e);
}
});
AtomicInteger logoCount = new AtomicInteger();
manager.findResources("textures", path -> path.getPath().contains("mojangstudios.png")).forEach((id, resource) -> {
try (InputStream stream = resource.getInputStream()) {
Files.copy(stream, LOGO_TEXTURE, StandardCopyOption.REPLACE_EXISTING);
client.getTextureManager().registerTexture(LOGO, new DynamicLogoTexture());
if (logoCount.get() > 0) PuzzleConfig.hasCustomSplashScreen = true;
logoCount.getAndIncrement();
} catch (Exception e) {
LOGGER.error("Error occurred while loading custom minecraft logo {}", id.toString(), e);
}
});
manager.findResources(MOD_ID, path -> path.getPath().contains("splash_background.png")).forEach((id, resource) -> {
try (InputStream stream = resource.getInputStream()) {
Files.copy(stream, BACKGROUND_TEXTURE, StandardCopyOption.REPLACE_EXISTING);
InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.BACKGROUND_TEXTURE));
client.getTextureManager().registerTexture(BACKGROUND, new NativeImageBackedTexture(NativeImage.read(input)));
keepBackground = true;
PuzzleConfig.hasCustomSplashScreen = true;
} catch (Exception e) {
LOGGER.error("Error occurred while loading custom splash background {}", id.toString(), e);
}
});
if (!keepBackground) {
try {
Files.delete(BACKGROUND_TEXTURE);
} catch (Exception ignored) {}
}
keepBackground = false;
PuzzleConfig.write(MOD_ID);
}
}
}
public static void resetColors() {
PuzzleConfig.backgroundColor = 15675965;
PuzzleConfig.progressBarColor = 16777215;
PuzzleConfig.progressBarBackgroundColor = 15675965;
PuzzleConfig.progressFrameColor = 16777215;
PuzzleConfig.disableBlend = false;
PuzzleConfig.customBlendFunction = new ArrayList<>();
PuzzleConfig.hasCustomSplashScreen = false;
}
public static class LogoTexture extends ResourceTexture {
public LogoTexture(Identifier logo) { super(logo); }
protected TextureData loadTextureData(ResourceManager resourceManager) {
MinecraftClient minecraftClient = MinecraftClient.getInstance();
DefaultResourcePack defaultResourcePack = minecraftClient.getDefaultResourcePack();
try {
InputStream inputStream = Objects.requireNonNull(defaultResourcePack.open(ResourceType.CLIENT_RESOURCES, LOGO)).get();
TextureData var6;
try {
var6 = new TextureData(new TextureResourceMetadata(true, true), NativeImage.read(inputStream));
} finally {
if (inputStream != null) {
inputStream.close();
}
}
return var6;
} catch (IOException var18) {
return new TextureData(var18);
}
}
}
public static class DynamicLogoTexture extends ResourceTexture {
public DynamicLogoTexture() {
super(LOGO);
}
protected TextureData loadTextureData(ResourceManager resourceManager) {
try {
InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.LOGO_TEXTURE));
return new TextureData(new TextureResourceMetadata(true, true), NativeImage.read(input));
} catch (IOException e) {
LOGGER.error("Encountered an error during logo loading: ", e);
return TextureData.load(resourceManager, LOGO);
}
}
}
}

View File

@@ -1,11 +1,12 @@
package net.puzzlemc.splashscreen.mixin;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Overlay;
import net.minecraft.client.gui.screen.SplashOverlay;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.render.*;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.texture.NativeImageBackedTexture;
import net.minecraft.util.Identifier;
@@ -25,22 +26,20 @@ import java.io.InputStream;
import java.nio.file.Files;
import java.util.function.IntSupplier;
import static net.puzzlemc.splashscreen.PuzzleSplashScreen.BACKGROUND;
@Mixin(value = SplashOverlay.class, priority = 2000)
public abstract class MixinSplashScreen extends Overlay {
@Shadow @Final static Identifier LOGO;
@Shadow private long reloadCompleteTime;
@Shadow @Final private MinecraftClient client;
@Shadow @Final private boolean reloading;
@Shadow private long reloadStartTime;
@Shadow
private static int withAlpha(int color, int alpha) {
return 0;
}
@Shadow @Final private MinecraftClient client;
@Shadow @Final private boolean reloading;
@Shadow private long reloadStartTime;
@Inject(method = "init(Lnet/minecraft/client/MinecraftClient;)V", at = @At("TAIL"))
private static void puzzle$initSplashscreen(MinecraftClient client, CallbackInfo ci) { // Load our custom textures at game start //
if (PuzzleConfig.resourcepackSplashScreen) {
@@ -50,21 +49,28 @@ public abstract class MixinSplashScreen extends Overlay {
if (PuzzleSplashScreen.BACKGROUND_TEXTURE.toFile().exists()) {
try {
InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.BACKGROUND_TEXTURE));
client.getTextureManager().registerTexture(PuzzleSplashScreen.BACKGROUND, new NativeImageBackedTexture(NativeImage.read(input)));
} catch (IOException ignored) {
}
client.getTextureManager().registerTexture(BACKGROUND, new NativeImageBackedTexture(NativeImage.read(input)));
} catch (IOException ignored) {}
}
}
}
@Redirect(method = "render", at = @At(value = "INVOKE", target = "Ljava/util/function/IntSupplier;getAsInt()I"))
private int puzzle$modifyBackground(IntSupplier instance) { // Set the Progress Bar Frame Color to our configured value //
return (!PuzzleConfig.resourcepackSplashScreen || PuzzleConfig.progressBarBackgroundColor == 15675965) ? instance.getAsInt() : PuzzleConfig.backgroundColor | 255 << 24;
}
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;blendFunc(II)V", shift = At.Shift.AFTER), remap = false)
private void puzzle$betterBlend(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
if (PuzzleConfig.disableBlend && PuzzleConfig.resourcepackSplashScreen) RenderSystem.defaultBlendFunc();
if (PuzzleConfig.resourcepackSplashScreen) {
if (PuzzleConfig.disableBlend) RenderSystem.defaultBlendFunc();
else if (PuzzleConfig.customBlendFunction.size() == 4) RenderSystem.blendFuncSeparate(
GlStateManager.SrcFactor.valueOf(PuzzleConfig.customBlendFunction.get(0)),
GlStateManager.DstFactor.valueOf(PuzzleConfig.customBlendFunction.get(1)),
GlStateManager.SrcFactor.valueOf(PuzzleConfig.customBlendFunction.get(2)),
GlStateManager.DstFactor.valueOf(PuzzleConfig.customBlendFunction.get(3)));
}
}
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;getScaledWindowWidth()I", shift = At.Shift.BEFORE, ordinal = 2))
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;getScaledWindowWidth()I", ordinal = 2))
private void puzzle$renderSplashBackground(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
if (Files.exists(PuzzleSplashScreen.BACKGROUND_TEXTURE) && PuzzleConfig.resourcepackSplashScreen) {
int width = client.getWindow().getScaledWidth();
@@ -73,24 +79,22 @@ public abstract class MixinSplashScreen extends Overlay {
float f = this.reloadCompleteTime > -1L ? (float)(l - this.reloadCompleteTime) / 1000.0F : -1.0F;
float g = this.reloadStartTime> -1L ? (float)(l - this.reloadStartTime) / 500.0F : -1.0F;
float s;
if (f >= 1.0F)
s = 1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F);
else if (reloading)
s = MathHelper.clamp(g, 0.0F, 1.0F);
else
s = 1.0F;
if (f >= 1.0F) s = 1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F);
else if (reloading) s = MathHelper.clamp(g, 0.0F, 1.0F);
else s = 1.0F;
RenderSystem.enableBlend();
RenderSystem.blendEquation(32774);
RenderSystem.defaultBlendFunc();
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, s);
context.drawTexture(PuzzleSplashScreen.BACKGROUND, 0, 0, 0, 0, 0, width, height, width, height);
context.drawTexture(BACKGROUND, 0, 0, 1, 0, 0, width, height, width, height);
RenderSystem.defaultBlendFunc();
RenderSystem.disableBlend();
}
}
@Inject(method = "renderProgressBar", at = @At("HEAD"))
private void puzzle$addProgressBarBackground(DrawContext context, int minX, int minY, int maxX, int maxY, float opacity, CallbackInfo ci) {
context.getMatrices().translate(0, 0, 1f);
if (!PuzzleConfig.resourcepackSplashScreen || PuzzleConfig.progressBarBackgroundColor == 15675965) return;
long l = Util.getMeasuringTimeMs();
float f = this.reloadCompleteTime > -1L ? (float)(l - this.reloadCompleteTime) / 1000.0F : -1.0F;

View File

@@ -0,0 +1,3 @@
{
"accessWidener": "puzzle-models.accesswidener"
}

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -20,7 +20,7 @@
"puzzle.midnightconfig.title":"Puzzle Advanced Config",
"puzzle.midnightconfig.category.gui":"GUI",
"puzzle.midnightconfig.category.features":"Features",
"puzzle.midnightconfig.category.debug":"Debug",
"puzzle.midnightconfig.category.internal":"Internal",
"puzzle.midnightconfig.tooltip":"Options for advanced users only",
"cullleaves.puzzle.option.enabled": "Cull Leaves",

103
fabric/build.gradle Normal file
View File

@@ -0,0 +1,103 @@
plugins {
id 'com.github.johnrengelman.shadow'
id "me.shedaniel.unified-publishing"
}
repositories {
maven { url "https://maven.terraformersmc.com/releases" }
}
architectury {
platformSetupLoomIde()
fabric()
}
configurations {
common
shadowCommon // Don't use shadow from the shadow plugin since it *excludes* files.
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentFabric.extendsFrom common
archivesBaseName = rootProject.archives_base_name + "-fabric"
version = rootProject.mod_version + "+" + rootProject.minecraft_version
}
dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
modImplementation include ("maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric")
modImplementation ("com.terraformersmc:modmenu:${project.modmenu_version}") {
exclude(group: "net.fabricmc.fabric-api")
}
common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
}
processResources {
inputs.property "version", rootProject.version
filesMatching("fabric.mod.json") {
expand "version": rootProject.version
}
}
shadowJar {
exclude "architectury.common.json"
configurations = [project.configurations.shadowCommon]
archiveClassifier = "dev-shadow"
}
remapJar {
input.set shadowJar.archiveFile
dependsOn shadowJar
}
sourcesJar {
def commonSources = project(":common").sourcesJar
dependsOn commonSources
from commonSources.archiveFile.map { zipTree(it) }
}
components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}
unifiedPublishing {
project {
displayName = "Puzzle $rootProject.version - Fabric $project.minecraft_version"
releaseType = "$project.release_type"
changelog = releaseChangelog()
gameVersions = []
gameLoaders = ["fabric","quilt"]
mainPublication remapJar
relations {
depends {
curseforge = "fabric-api"
modrinth = "fabric-api"
}
}
var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN")
if (CURSEFORGE_TOKEN != null) {
curseforge {
token = CURSEFORGE_TOKEN
id = rootProject.curseforge_id
gameVersions.addAll "Java 21", project.minecraft_version, project.supported_versions
}
}
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
if (MODRINTH_TOKEN != null) {
modrinth {
token = MODRINTH_TOKEN
id = rootProject.modrinth_id
version = "$rootProject.version-$project.name"
gameVersions.addAll project.minecraft_version, project.supported_versions
}
}
}
}

View File

@@ -0,0 +1,28 @@
package net.puzzlemc.fabric;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
import net.minecraft.resource.ResourceManager;
import net.minecraft.resource.ResourceType;
import net.minecraft.util.Identifier;
import net.puzzlemc.core.PuzzleCore;
import net.puzzlemc.splashscreen.PuzzleSplashScreen;
public class PuzzleFabric implements ClientModInitializer {
@Override
public void onInitializeClient() {
PuzzleCore.initModules();
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(new SimpleSynchronousResourceReloadListener() {
@Override
public Identifier getFabricId() {
return Identifier.of("puzzle", "splash_screen");
}
@Override
public void reload(ResourceManager manager) {
PuzzleSplashScreen.ReloadListener.INSTANCE.reload(manager);
}
});
}
}

View File

@@ -0,0 +1,12 @@
package net.puzzlemc.fabric.modmenu;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import net.puzzlemc.gui.screen.PuzzleOptionsScreen;
public class ModMenuIntegration implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return PuzzleOptionsScreen::new;
}
}

View File

@@ -1,10 +1,10 @@
{
"schemaVersion": 1,
"id": "puzzle-splashscreen",
"id": "puzzle",
"version": "${version}",
"name": "Puzzle Splash Screen",
"description": "Allows resourcepacks to define a custom splash screen",
"name": "Puzzle",
"description": "Improved resourcepack capabilities.",
"authors": [
"PuzzleMC",
"Motschen"
@@ -19,22 +19,24 @@
"icon": "assets/puzzle/icon.png",
"environment": "client",
"entrypoints": {
"client": [
"net.puzzlemc.splashscreen.PuzzleSplashScreen"
"net.puzzlemc.fabric.PuzzleFabric"
],
"modmenu": [
"net.puzzlemc.fabric.modmenu.ModMenuIntegration"
]
},
"custom": {
"modmenu": {
"parent": "puzzle"
}
},
"mixins": [
"puzzle-gui.mixins.json",
"puzzle-models.mixins.json",
"puzzle-splashscreen.mixins.json"
],
"depends": {
"fabric": "*"
"fabric": "*",
"minecraft": ">=1.21"
}
}

View File

@@ -1,42 +1,47 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx4G
org.gradle.jvmargs=-Xmx2G
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version=1.21
yarn_mappings=1.21+build.2
loader_version=0.15.11
minecraft_version=1.21
supported_versions=1.21.1
yarn_mappings=1.21+build.2
enabled_platforms=fabric,neoforge
# Mod Properties
mod_version = 1.6.3+1.21
maven_group = net.puzzlemc
archives_base_name = puzzle
release_type=release
curseforge_id=563977
modrinth_id=3IuO68q1
mod_version = 2.0.0
maven_group = net.puzzlemc
archives_base_name = puzzle
release_type=release
curseforge_id=563977
modrinth_id=3IuO68q1
# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.100.1+1.21
mod_menu_version = 7.0.1
midnightlib_version = 1.5.7-fabric
cull_leaves_version = 3.0.2-fabric
ldl_version = 2.3.2+1.20.1
lbg_version = 1.5.2+1.20.1
iris_version = 1.6.9+1.20.2
continuity_version = 3.0.0-beta.3+1.20.1
animatica_version = 0.6+1.20
colormatic_version = 3.1.2
borderless_mining_version = 1.1.8+1.20.1
dynamic_fps_version = 3.2.0
toml4j_version = 0.7.2
cit_resewn_version = 1.1.3+1.20
complete_config_version = 2.3.0
spruceui_version=5.0.0+1.20
emf_version=2.0.2
etf_version=6.0.1
exordium_version=1.2.1-1.20.2
# Required for LBG
quilt_loader_version=0.19.0-beta.18
quilt_fabric_api_version=7.0.1+0.83.0-1.20
# Modloaders
fabric_loader_version=0.15.11
fabric_api_version=0.100.1+1.21
neoforge_version=21.0.143
yarn_mappings_patch_neoforge_version = 1.21+build.4
# Libraries
midnightlib_version = 1.6.3
modmenu_version = 11.0.2
# Mod Integrations
cull_leaves_version = 3.0.2-fabric
ldl_version = 2.3.2+1.20.1
lbg_version = 1.5.2+1.20.1
iris_version = 1.8.0-beta.3+1.21-fabric
continuity_version = 3.0.0-beta.5+1.21
animatica_version = 0.6.1+1.21
colormatic_version = 3.1.2
borderless_mining_version = 1.1.8+1.20.1
dynamic_fps_version = 3.6.3
toml4j_version = 0.7.2
cit_resewn_version = 1.1.3+1.20
complete_config_version = 2.3.0
spruceui_version=5.0.0+1.20
emf_version=2.2.3
etf_version=6.2.2
exordium_version=1.2.1-1.20.2
# Required for LBG
quilt_loader_version=0.19.0-beta.18
quilt_fabric_api_version=7.0.1+0.83.0-1.20

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

107
neoforge/build.gradle Normal file
View File

@@ -0,0 +1,107 @@
plugins {
id 'com.github.johnrengelman.shadow'
id "me.shedaniel.unified-publishing"
}
repositories {
maven {
name = 'NeoForged'
url = 'https://maven.neoforged.net/releases'
}
}
architectury {
platformSetupLoomIde()
neoForge()
}
loom {
accessWidenerPath = project(":common").loom.accessWidenerPath
}
configurations {
common {
canBeResolved = true
canBeConsumed = false
}
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentNeoForge.extendsFrom common
// Files in this configuration will be bundled into your mod using the Shadow plugin.
// Don't use the `shadow` configuration from the plugin itself as it's meant for excluding files.
shadowBundle {
canBeResolved = true
canBeConsumed = false
}
archivesBaseName = rootProject.archives_base_name + "-neoforge"
version = rootProject.mod_version + "+" + rootProject.minecraft_version
}
dependencies {
neoForge "net.neoforged:neoforge:$rootProject.neoforge_version"
modImplementation ("maven.modrinth:midnightlib:${rootProject.midnightlib_version}-neoforge")
common(project(path: ':common', configuration: 'namedElements')) { transitive false }
shadowBundle project(path: ':common', configuration: 'transformProductionNeoForge')
}
processResources {
inputs.property 'version', rootProject.version
filesMatching('META-INF/neoforge.mods.toml') {
expand version: rootProject.version
}
}
shadowJar {
configurations = [project.configurations.shadowBundle]
archiveClassifier = 'dev-shadow'
}
remapJar {
input.set shadowJar.archiveFile
}
sourcesJar {
def commonSources = project(":common").sourcesJar
dependsOn commonSources
from commonSources.archiveFile.map { zipTree(it) }
}
components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}
unifiedPublishing {
project {
displayName = "Puzzle $rootProject.version - NeoForge $project.minecraft_version"
releaseType = "alpha"
changelog = releaseChangelog()
gameVersions = []
gameLoaders = ["neoforge"]
mainPublication remapJar
var CURSEFORGE_TOKEN = project.findProperty("CURSEFORGE_TOKEN") ?: System.getenv("CURSEFORGE_TOKEN")
if (CURSEFORGE_TOKEN != null) {
curseforge {
token = CURSEFORGE_TOKEN
id = rootProject.curseforge_id
gameVersions.addAll "Java 21", project.minecraft_version, project.supported_versions
}
}
var MODRINTH_TOKEN = project.findProperty("MODRINTH_TOKEN") ?: System.getenv("MODRINTH_TOKEN")
if (MODRINTH_TOKEN != null) {
modrinth {
token = MODRINTH_TOKEN
id = rootProject.modrinth_id
version = "$rootProject.version-$project.name"
gameVersions.addAll project.minecraft_version, project.supported_versions
}
}
}
}

View File

@@ -0,0 +1 @@
loom.platform=neoforge

View File

@@ -0,0 +1,30 @@
package net.puzzlemc.neoforge;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.ModList;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.client.event.RegisterClientReloadListenersEvent;
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
import net.puzzlemc.core.PuzzleCore;
import net.puzzlemc.gui.screen.PuzzleOptionsScreen;
import net.puzzlemc.splashscreen.PuzzleSplashScreen;
import static net.puzzlemc.core.PuzzleCore.MOD_ID;
@Mod(value = MOD_ID, dist = Dist.CLIENT)
public class PuzzleNeoForge {
public PuzzleNeoForge() {
PuzzleCore.initModules();
ModList.get().getModContainerById(MOD_ID).orElseThrow().registerExtensionPoint(IConfigScreenFactory.class, (client, parent) -> new PuzzleOptionsScreen(parent));
}
@EventBusSubscriber(modid = MOD_ID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public static class MidnightLibBusEvents {
@SubscribeEvent
public static void onResourceReload(RegisterClientReloadListenersEvent event) {
event.registerReloadListener(PuzzleSplashScreen.ReloadListener.INSTANCE);
}
}
}

View File

@@ -0,0 +1,30 @@
package net.puzzlemc.neoforge.mixin.splashscreen;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.SplashOverlay;
import net.minecraft.resource.ResourceReload;
import net.neoforged.neoforge.client.loading.NeoForgeLoadingOverlay;
import net.puzzlemc.core.config.PuzzleConfig;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.Optional;
import java.util.function.Consumer;
@Mixin(NeoForgeLoadingOverlay.class)
public class MixinNeoForgeLoadingOverlay extends SplashOverlay {
public MixinNeoForgeLoadingOverlay(MinecraftClient client, ResourceReload monitor, Consumer<Optional<Throwable>> exceptionHandler, boolean reloading) {
super(client, monitor, exceptionHandler, reloading);
}
@Inject(method = "render", at = @At("HEAD"), cancellable = true) // Replaces the NeoForge loading screen in later stages with the (customized) vanilla version
private void redirectNeoForgeLoading(DrawContext context, int mouseX, int mouseY, float tickDelta, CallbackInfo ci) {
if (PuzzleConfig.resourcepackSplashScreen && PuzzleConfig.hasCustomSplashScreen) {
super.render(context, mouseX, mouseY, tickDelta);
ci.cancel();
}
}
}

View File

@@ -0,0 +1,37 @@
modLoader = "javafml"
loaderVersion = "[2,)"
#issueTrackerURL = ""
license = "MIT License"
[[mods]]
modId = "puzzle"
version = "${version}"
displayName = "Puzzle"
logoFile = "puzzle.png"
authors = "PuzzleMC, Motschen"
description = '''
Improved resourcepack capabilities.
'''
[[mixins]]
config = "puzzle-gui.mixins.json"
[[mixins]]
config = "puzzle-models.mixins.json"
[[mixins]]
config = "puzzle-splashscreen.mixins.json"
[[mixins]]
config = "puzzle-splashscreen_neoforge.mixins.json"
[[dependencies.puzzle]]
modId = "neoforge"
mandatory = true
versionRange = "[21.0,)"
ordering = "NONE"
side = "CLIENT"
[[dependencies.puzzle]]
modId = "minecraft"
mandatory = true
versionRange = "[1.21,)"
ordering = "NONE"
side = "CLIENT"

View File

@@ -1,10 +1,9 @@
{
"required": true,
"package": "net.puzzlemc.core.mixin",
"package": "net.puzzlemc.neoforge.mixin",
"compatibilityLevel": "JAVA_17",
"client": [
"MixinTitleScreen",
"MixinDebugHud"
"splashscreen.MixinNeoForgeLoadingOverlay"
],
"injectors": {
"defaultRequire": 1

View File

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -1,11 +0,0 @@
archivesBaseName = "puzzle-base"
repositories {
maven { url "https://maven.terraformersmc.com/releases" }
maven {
url = "https://api.modrinth.com/maven"
}
}
dependencies {
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
modImplementation ("com.terraformersmc:modmenu:${project.mod_menu_version}")
}

View File

@@ -1,23 +0,0 @@
package net.puzzlemc.core;
import net.fabricmc.loader.api.FabricLoader;
import net.puzzlemc.core.config.PuzzleConfig;
import net.puzzlemc.core.util.UpdateChecker;
import net.fabricmc.api.ClientModInitializer;
public class PuzzleCore implements ClientModInitializer {
public final static String version = "Puzzle "+ (FabricLoader.getInstance().getModContainer("puzzle").isPresent() ? FabricLoader.getInstance().getModContainer("puzzle").get().getMetadata().getVersion() : "Test");
public final static String name = "Puzzle";
public final static String id = "puzzle";
public final static String website = "https://github.com/PuzzleMC/Puzzle";
public final static String updateURL = "https://modrinth.com/mod/puzzle";
public final static String UPDATE_CHECKER_URL = "https://raw.githubusercontent.com/PuzzleMC/Puzzle-Versions/main/puzzle_versions.json";
@Override
public void onInitializeClient() {
PuzzleConfig.init(id, PuzzleConfig.class);
if (PuzzleConfig.checkUpdates) UpdateChecker.init();
}
}

View File

@@ -1,24 +0,0 @@
package net.puzzlemc.core.config;
import eu.midnightdust.lib.config.MidnightConfig;
import java.util.ArrayList;
import java.util.List;
public class PuzzleConfig extends MidnightConfig {
@Entry(category = "gui", name = "Disabled integrations") public static List<String> disabledIntegrations = new ArrayList<>();
@Entry(category = "gui", name = "Enable Puzzle button") public static boolean enablePuzzleButton = true;
@Entry(category = "debug", name = "Enable debug messages") public static boolean debugMessages = false;
@Entry(category = "debug", name = "puzzle.option.check_for_updates") public static boolean checkUpdates = true;
@Entry(category = "gui", name = "puzzle.option.show_version_info") public static boolean showPuzzleInfo = true;
@Entry(category = "features", name = "puzzle.option.resourcepack_splash_screen") public static boolean resourcepackSplashScreen = true;
@Entry(category = "features", name = "puzzle.option.unlimited_model_rotations") public static boolean unlimitedRotations = true;
@Entry(category = "features", name = "puzzle.option.bigger_custom_models") public static boolean biggerModels = true;
@Entry(category = "features", name = "Splash Background Color") public static int backgroundColor = 15675965;
@Entry(category = "features", name = "Splash Progress Bar Color") public static int progressBarColor = 16777215;
@Entry(category = "features", name = "Splash Progress Bar Background Color") public static int progressBarBackgroundColor = 15675965;
@Entry(category = "features", name = "Splash Progress Bar Frame Color") public static int progressFrameColor = 16777215;
@Entry(category = "features", name = "puzzle.option.better_splash_screen_blend") public static boolean disableBlend = false;
}

View File

@@ -1,37 +0,0 @@
package net.puzzlemc.core.mixin;
import com.mojang.blaze3d.platform.GlDebugInfo;
import net.puzzlemc.core.PuzzleCore;
import net.puzzlemc.core.config.PuzzleConfig;
import net.puzzlemc.core.util.UpdateChecker;
import net.minecraft.client.gui.hud.DebugHud;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.List;
@Mixin(DebugHud.class)
public abstract class MixinDebugHud {
@Inject(at = @At("RETURN"), method = "getRightText")
private void puzzle$getRightText(CallbackInfoReturnable<List<String>> cir) {
if (PuzzleConfig.showPuzzleInfo) {
List<String> entries = cir.getReturnValue();
String message;
if (UpdateChecker.isUpToDate) {
message = "Puzzle is up to date (" + PuzzleCore.version + ")";
} else {
message = "Puzzle is outdated (" + PuzzleCore.version + " -> " + UpdateChecker.latestVersion + ")";
}
for (int i = 0; i < entries.size(); i++) {
String str = entries.get(i);
if (str.startsWith(GlDebugInfo.getVersion())) {
entries.add(i + 1, message);
break;
}
}
}
}
}

View File

@@ -1,57 +0,0 @@
package net.puzzlemc.core.mixin;
import eu.midnightdust.lib.util.PlatformFunctions;
import net.minecraft.client.gui.widget.PressableTextWidget;
import net.puzzlemc.core.PuzzleCore;
import net.puzzlemc.core.config.PuzzleConfig;
import net.puzzlemc.core.util.ModMenuUtil;
import net.puzzlemc.core.util.UpdateChecker;
import net.minecraft.client.gui.screen.*;
import net.minecraft.text.Text;
import net.minecraft.util.Util;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.Objects;
@Mixin(TitleScreen.class)
public abstract class MixinTitleScreen extends Screen {
private final String versionText = PuzzleCore.version.replace("+", " for ");
protected MixinTitleScreen(Text title) {
super(title);
}
@Inject(at = @At("TAIL"), method = "init")
private void puzzle$init(CallbackInfo ci) {
int yOffset = 8;
if (PlatformFunctions.isModLoaded("modmenu") && ModMenuUtil.hasClassicButton()) {
yOffset += 12;
}
Text puzzleText;
if (UpdateChecker.isUpToDate) {
puzzleText = Text.literal(versionText);
}
else {
puzzleText = Text.literal("").append(Text.of(versionText+" | ")).append(Text.translatable("puzzle.text.update_available"));
}
if (PuzzleConfig.showPuzzleInfo) {
PressableTextWidget text = this.addDrawableChild(new PressableTextWidget(2, this.height - 12 - yOffset, this.textRenderer.getWidth(puzzleText), 10, puzzleText, (button) -> {
if (Objects.requireNonNull(this.client).options.getChatLinksPrompt().getValue()) {
this.client.setScreen(new ConfirmLinkScreen(this::confirmLink, PuzzleCore.updateURL, true));
} else {
Util.getOperatingSystem().open(PuzzleCore.updateURL);
}
}, this.textRenderer));
if (UpdateChecker.isUpToDate) text.active = false;
}
}
private void confirmLink(boolean open) {
if (open) {
Util.getOperatingSystem().open(PuzzleCore.updateURL);
}
Objects.requireNonNull(this.client).setScreen(this);
}
}

View File

@@ -1,9 +0,0 @@
package net.puzzlemc.core.util;
import com.terraformersmc.modmenu.config.ModMenuConfig;
public class ModMenuUtil {
public static boolean hasClassicButton() {
return ModMenuConfig.MODIFY_TITLE_SCREEN.getValue() && ModMenuConfig.MODS_BUTTON_STYLE.getValue() == ModMenuConfig.TitleMenuButtonStyle.CLASSIC;
}
}

View File

@@ -1,54 +0,0 @@
package net.puzzlemc.core.util;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import net.puzzlemc.core.PuzzleCore;
import net.minecraft.client.MinecraftClient;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.lang.reflect.Type;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.*;
import java.util.concurrent.CompletableFuture;
public class UpdateChecker {
private static final Gson GSON = new Gson();
private static final String minecraftVersion = MinecraftClient.getInstance().getGameVersion();
public static final Logger logger = LogManager.getLogger(PuzzleCore.name);
public static final Type UPDATE_TYPE_TOKEN = new TypeToken<Map<String, String>>(){}.getType();
public static String latestVersion;
public static boolean isUpToDate = true;
public static void init() {
CompletableFuture.supplyAsync(() -> {
try (Reader reader = new InputStreamReader(new URL(PuzzleCore.UPDATE_CHECKER_URL).openStream())) {
return GSON.<Map<String, String>>fromJson(reader, UPDATE_TYPE_TOKEN);
} catch (MalformedURLException error) {
logger.log(Level.ERROR, "Unable to check for updates because of connection problems: " + error.getMessage());
} catch (IOException error) {
logger.log(Level.ERROR, "Unable to check for updates because of an I/O Exception: " + error.getMessage());
}
return null;
}).thenAcceptAsync(versionMap -> {
if (versionMap != null && versionMap.containsKey(minecraftVersion)) {
latestVersion = versionMap.get(minecraftVersion);
if (!latestVersion.equals(PuzzleCore.version)) {
isUpToDate = false;
logger.log(Level.INFO, "There is a newer version of "+ PuzzleCore.name +" available: " + latestVersion);
logger.log(Level.INFO, "Please update immediately!");
}
} else {
logger.log(Level.WARN, "A problem with the database occurred, could not check for updates.");
}
}, MinecraftClient.getInstance());
}
}

View File

@@ -1,40 +0,0 @@
{
"schemaVersion": 1,
"id": "puzzle-base",
"version": "${version}",
"name": "Puzzle Base",
"description": "Shared code between all Puzzle modules",
"authors": [
"PuzzleMC",
"Motschen"
],
"contact": {
"homepage": "https://www.midnightdust.eu/",
"sources": "https://github.com/TeamMidnightDust/Puzzle",
"issues": "https://github.com/TeamMidnightDust/Puzzle/issues"
},
"license": "MIT",
"icon": "assets/puzzle/icon.png",
"environment": "client",
"entrypoints": {
"client": [
"net.puzzlemc.core.PuzzleCore"
]
},
"custom": {
"modmenu": {
"parent": "puzzle"
}
},
"mixins": [
"puzzle-base.mixins.json"
],
"depends": {
"fabric": "*"
}
}

View File

@@ -1,63 +0,0 @@
archivesBaseName = "puzzle-gui"
repositories {
maven { url "https://maven.terraformersmc.com/releases" }
maven {
name = 'AperLambda'
url = 'https://aperlambda.github.io/maven'
}
mavenCentral()
maven {
name 'Gegy'
url 'https://maven.gegy.dev'
}
maven {
url = "https://api.modrinth.com/maven"
}
maven {
url "https://www.cursemaven.com"
content {
includeGroup "curse.maven"
}
}
maven {
name = 'JitPack'
url 'https://jitpack.io'
}
maven {
url "https://maven.shedaniel.me/"
}
maven { url "https://maven.quiltmc.org/repository/release/" }
}
dependencies {
api project(":puzzle-base")
api project(":puzzle-splashscreen")
modImplementation "dev.lambdaurora:spruceui:${project.spruceui_version}"
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
modImplementation ("com.terraformersmc:modmenu:${project.mod_menu_version}")
modImplementation ("maven.modrinth:cull-leaves:${project.cull_leaves_version}")
modImplementation ("maven.modrinth:lambdynamiclights:${project.ldl_version}")
modCompileOnlyApi ("maven.modrinth:lambdabettergrass:${project.lbg_version}")
modCompileOnly "org.quiltmc:quilt-loader:${rootProject.quilt_loader_version}"
modCompileOnlyApi "org.quiltmc.quilted-fabric-api:quilted-fabric-api:${rootProject.quilt_fabric_api_version}"
modCompileOnlyApi ("maven.modrinth:iris:${project.iris_version}")
modCompileOnly ("maven.modrinth:cit-resewn:${project.cit_resewn_version}")
modCompileOnlyApi ("maven.modrinth:continuity:${project.continuity_version}")
modCompileOnlyApi ("maven.modrinth:animatica:${project.animatica_version}")
modCompileOnlyApi ("maven.modrinth:colormatic:${project.colormatic_version}")
modImplementation ("maven.modrinth:borderless-mining:${project.borderless_mining_version}")
modImplementation ("maven.modrinth:dynamic-fps:${project.dynamic_fps_version}")
modImplementation("com.moandjiezana.toml:toml4j:${project.toml4j_version}")
modImplementation ("maven.modrinth:entitytexturefeatures:${project.etf_version}")
modImplementation ("maven.modrinth:entity-model-features:${project.emf_version}")
modImplementation ("maven.modrinth:completeconfig:${project.complete_config_version}")
//modImplementation ("maven.modrinth:exordium:${project.exordium_version}")
modImplementation("org.aperlambda:lambdajcommon:1.8.1") {
exclude group: 'com.google.code.gson'
exclude group: 'com.google.guava'
}
}

View File

@@ -1,31 +0,0 @@
package net.puzzlemc.gui.config;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import net.puzzlemc.gui.screen.PuzzleOptionsScreen;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import java.util.HashMap;
import java.util.Map;
@Environment(EnvType.CLIENT)
public class ModMenuIntegration implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return PuzzleOptionsScreen::new;
}
//Used to set the config screen for all modules //
@Override
public Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories() {
Map<String, ConfigScreenFactory<?>> map = new HashMap<>();
map.put("puzzle-gui",PuzzleOptionsScreen::new);
map.put("puzzle-blocks",PuzzleOptionsScreen::new);
map.put("puzzle-base",PuzzleOptionsScreen::new);
map.put("puzzle-models",PuzzleOptionsScreen::new);
map.put("puzzle-splashscreen",PuzzleOptionsScreen::new);
map.put("puzzle",PuzzleOptionsScreen::new);
return map;
}
}

View File

@@ -1,36 +0,0 @@
package net.puzzlemc.gui.mixin;
import eu.midnightdust.core.config.MidnightLibConfig;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.gui.widget.TextIconButtonWidget;
import net.puzzlemc.core.config.PuzzleConfig;
import net.puzzlemc.gui.PuzzleClient;
import net.puzzlemc.gui.screen.PuzzleOptionsScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.option.OptionsScreen;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.Objects;
@Mixin(OptionsScreen.class)
public abstract class MixinOptionsScreen extends Screen {
protected MixinOptionsScreen(Text title) {
super(title);
}
@Inject(at = @At("HEAD"), method = "init")
private void puzzle$init(CallbackInfo ci) {
if (PuzzleConfig.enablePuzzleButton) {
int i = 0;
if (FabricLoader.getInstance().isModLoaded("lod")) i = i + 358;
if (MidnightLibConfig.config_screen_list.equals(MidnightLibConfig.ConfigButton.FALSE)) i = i - 25;
TextIconButtonWidget iconButton = TextIconButtonWidget.builder(Text.translatable("puzzle.screen.title"), (buttonWidget) -> (Objects.requireNonNull(this.client)).setScreen(new PuzzleOptionsScreen(this)), true).dimension(20, 20).texture(PuzzleClient.PUZZLE_BUTTON, 20, 20).build();
iconButton.setPosition(this.width / 2 - 178 + i, this.height / 6 - 12);
this.addDrawableChild(iconButton);
}
}
}

View File

@@ -1,48 +0,0 @@
{
"schemaVersion": 1,
"id": "puzzle-gui",
"version": "${version}",
"name": "Puzzle GUI",
"description": "Unites optifine replacement mods in a clean & vanilla-style gui",
"authors": [
"PuzzleMC",
"Motschen"
],
"contact": {
"homepage": "https://www.midnightdust.eu/",
"sources": "https://github.com/TeamMidnightDust/Puzzle",
"issues": "https://github.com/TeamMidnightDust/Puzzle/issues"
},
"license": "MIT",
"icon": "assets/puzzle/icon.png",
"environment": "client",
"entrypoints": {
"client": [
"net.puzzlemc.gui.PuzzleClient"
],
"modmenu": [
"net.puzzlemc.gui.config.ModMenuIntegration"
]
},
"custom": {
"modmenu": {
"parent": "puzzle"
}
},
"mixins": [
"puzzle-gui.mixins.json"
],
"depends": {
"fabric": "*",
"midnightlib": "*"
},
"breaks": {
"citresewn": "<=1.0.0+1.18.2",
"entity_texture_features": "<3.0.0"
}
}

View File

@@ -1,15 +0,0 @@
archivesBaseName = "puzzle-models"
loom {
accessWidenerPath = file("src/main/resources/puzzle-models.accesswidener")
}
repositories {
maven { url "https://maven.terraformersmc.com/releases" }
maven {
url = "https://api.modrinth.com/maven"
}
}
dependencies {
api project(":puzzle-base")
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -1,35 +0,0 @@
{
"schemaVersion": 1,
"id": "puzzle-models",
"version": "${version}",
"name": "Puzzle Models",
"description": "Provides more freedom for item and block models!",
"authors": [
"PuzzleMC",
"Motschen"
],
"contact": {
"homepage": "https://www.midnightdust.eu/",
"sources": "https://github.com/TeamMidnightDust/Puzzle",
"issues": "https://github.com/TeamMidnightDust/Puzzle/issues"
},
"custom": {
"modmenu": {
"parent": "puzzle"
}
},
"license": "MIT",
"icon": "assets/puzzle/icon.png",
"environment": "client",
"accessWidener" : "puzzle-models.accesswidener",
"mixins": [
"puzzle-models.mixins.json"
],
"depends": {
"fabric": "*"
}
}

View File

@@ -1,11 +0,0 @@
archivesBaseName = "puzzle-splashscreen"
repositories {
maven { url "https://maven.terraformersmc.com/releases" }
maven {
url = "https://api.modrinth.com/maven"
}
}
dependencies {
api project(":puzzle-base")
modImplementation "maven.modrinth:midnightlib:${project.midnightlib_version}"
}

View File

@@ -1,166 +0,0 @@
package net.puzzlemc.splashscreen;
import eu.midnightdust.lib.util.MidnightColorUtil;
import net.fabricmc.api.ClientModInitializer;
import net.minecraft.client.texture.NativeImageBackedTexture;
import net.minecraft.util.Util;
import net.puzzlemc.core.config.PuzzleConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.resource.ResourceManagerHelper;
import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.resource.metadata.TextureResourceMetadata;
import net.minecraft.client.texture.NativeImage;
import net.minecraft.client.texture.ResourceTexture;
import net.minecraft.resource.DefaultResourcePack;
import net.minecraft.resource.ResourceManager;
import net.minecraft.resource.ResourceType;
import net.minecraft.util.Identifier;
import org.apache.logging.log4j.LogManager;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.Objects;
import java.util.Properties;
public class PuzzleSplashScreen implements ClientModInitializer {
public static final Identifier LOGO = Identifier.of("textures/gui/title/mojangstudios.png");
public static final Identifier BACKGROUND = Identifier.of("optifine/splash_background.png");
public static File CONFIG_PATH = new File(String.valueOf(FabricLoader.getInstance().getConfigDir().resolve(".puzzle_cache")));
public static Path LOGO_TEXTURE = Paths.get(CONFIG_PATH + "/mojangstudios.png");
public static Path BACKGROUND_TEXTURE = Paths.get(CONFIG_PATH + "/splash_background.png");
private static final MinecraftClient client = MinecraftClient.getInstance();
private static boolean keepBackground = true;
public static void resetColors() {
PuzzleConfig.backgroundColor = 15675965;
PuzzleConfig.progressBarColor = 16777215;
PuzzleConfig.progressBarBackgroundColor = 15675965;
PuzzleConfig.progressFrameColor = 16777215;
PuzzleConfig.disableBlend = false;
PuzzleConfig.write("puzzle");
}
public void onInitializeClient() {
if (!CONFIG_PATH.exists()) { // Run when config directory is nonexistent //
if (CONFIG_PATH.mkdir()) { // Create our custom config directory //
if (Util.getOperatingSystem().equals(Util.OperatingSystem.WINDOWS)) {
try {
Files.setAttribute(CONFIG_PATH.toPath(), "dos:hidden", true);
} catch (IOException ignored) {
}
}
}
}
ResourceManagerHelper.get(ResourceType.CLIENT_RESOURCES).registerReloadListener(new SimpleSynchronousResourceReloadListener() {
@Override
public Identifier getFabricId() {
return Identifier.of("puzzle", "splash_screen");
}
@Override
public void reload(ResourceManager manager) {
if (PuzzleConfig.resourcepackSplashScreen) {
PuzzleSplashScreen.resetColors();
client.getTextureManager().registerTexture(LOGO, new LogoTexture(LOGO));
client.getTextureManager().registerTexture(BACKGROUND, new LogoTexture(BACKGROUND));
manager.findResources("optifine", path -> path.getPath().contains("color.properties")).forEach((id, resource) -> {
try (InputStream stream = manager.getResource(id).get().getInputStream()) {
Properties properties = new Properties();
properties.load(stream);
if (properties.get("screen.loading") != null) {
PuzzleConfig.backgroundColor = MidnightColorUtil.hex2Rgb(properties.get("screen.loading").toString()).getRGB();
}
if (properties.get("screen.loading.bar") != null) {
PuzzleConfig.progressBarBackgroundColor = MidnightColorUtil.hex2Rgb(properties.get("screen.loading.bar").toString()).getRGB();
}
if (properties.get("screen.loading.progress") != null) {
PuzzleConfig.progressBarColor = MidnightColorUtil.hex2Rgb(properties.get("screen.loading.progress").toString()).getRGB();
}
if (properties.get("screen.loading.outline") != null) {
PuzzleConfig.progressFrameColor = MidnightColorUtil.hex2Rgb(properties.get("screen.loading.outline").toString()).getRGB();
}
if (properties.get("screen.loading.blend") != null) {
PuzzleConfig.disableBlend = properties.get("screen.loading.blend").toString().equals("off");
PuzzleConfig.progressFrameColor = MidnightColorUtil.hex2Rgb(properties.get("screen.loading.outline").toString()).getRGB();
}
PuzzleConfig.write("puzzle");
} catch (Exception e) {
LogManager.getLogger("Puzzle").error("Error occurred while loading color.properties " + id.toString(), e);
}
});
manager.findResources("textures", path -> path.getPath().contains("mojangstudios.png")).forEach((id, resource) -> {
try (InputStream stream = manager.getResource(id).get().getInputStream()) {
Files.copy(stream, LOGO_TEXTURE, StandardCopyOption.REPLACE_EXISTING);
client.getTextureManager().registerTexture(LOGO, new DynamicLogoTexture());
} catch (Exception e) {
LogManager.getLogger("Puzzle").error("Error occurred while loading custom minecraft logo " + id.toString(), e);
}
});
manager.findResources("puzzle", path -> path.getPath().contains("splash_background.png")).forEach((id, resource) -> {
try (InputStream stream = manager.getResource(id).get().getInputStream()) {
Files.copy(stream, BACKGROUND_TEXTURE, StandardCopyOption.REPLACE_EXISTING);
InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.BACKGROUND_TEXTURE));
client.getTextureManager().registerTexture(BACKGROUND, new NativeImageBackedTexture(NativeImage.read(input)));
keepBackground = true;
} catch (Exception e) {
LogManager.getLogger("Puzzle").error("Error occurred while loading custom splash background " + id.toString(), e);
}
});
if (!keepBackground) {
try {
Files.delete(BACKGROUND_TEXTURE);
} catch (Exception ignored) {}
}
keepBackground = false;
}
}
});
}
@Environment(EnvType.CLIENT)
public static class LogoTexture extends ResourceTexture {
public LogoTexture(Identifier logo) { super(logo); }
protected TextureData loadTextureData(ResourceManager resourceManager) {
MinecraftClient minecraftClient = MinecraftClient.getInstance();
DefaultResourcePack defaultResourcePack = minecraftClient.getDefaultResourcePack();
try {
InputStream inputStream = Objects.requireNonNull(defaultResourcePack.open(ResourceType.CLIENT_RESOURCES, LOGO)).get();
TextureData var6;
try {
var6 = new TextureData(new TextureResourceMetadata(true, true), NativeImage.read(inputStream));
} finally {
if (inputStream != null) {
inputStream.close();
}
}
return var6;
} catch (IOException var18) {
return new TextureData(var18);
}
}
}
@Environment(EnvType.CLIENT)
public static class DynamicLogoTexture extends ResourceTexture {
public DynamicLogoTexture() {
super(LOGO);
}
protected TextureData loadTextureData(ResourceManager resourceManager) {
try {
InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.LOGO_TEXTURE));
return new TextureData(new TextureResourceMetadata(true, true), NativeImage.read(input));
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -1,15 +1,15 @@
pluginManagement {
repositories {
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
}
maven { url "https://maven.fabricmc.net/" }
maven { url "https://maven.architectury.dev/" }
maven { url "https://maven.neoforged.net/releases" }
gradlePluginPortal()
}
}
include 'puzzle-base'
include 'puzzle-splashscreen'
include 'puzzle-models'
include 'puzzle-gui'
include("common")
include("fabric")
include("neoforge")
//include("quilt")
rootProject.name = "puzzle"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

View File

@@ -1,27 +0,0 @@
{
"schemaVersion": 1,
"id": "puzzle",
"version": "${version}",
"name": "Puzzle",
"description": "Fancy and performance-improving features.",
"authors": [
"PuzzleMC",
"Motschen"
],
"contact": {
"homepage": "https://www.midnightdust.eu/",
"sources": "https://github.com/TeamMidnightDust/Puzzle",
"issues": "https://github.com/TeamMidnightDust/Puzzle/issues"
},
"license": "MIT",
"icon": "assets/puzzle/icon.png",
"environment": "client",
"depends": {
"fabric": "*",
"minecraft": ">=1.20.2"
}
}