diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..153d416 --- /dev/null +++ b/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. \ No newline at end of file diff --git a/README.md b/README.md index 4b6ad6d..424078b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# Mechanical Lemon UI +# Mechanical UI +> I love Create and its many utility and classes. I can't live without. - This library mod is a stripped version of Create ui foundation which is licensed under the MIT license. See Create's license for more information. - All the credits go to the Creators of Create team. - https://github.com/Creators-of-Create/Create diff --git a/build.gradle b/build.gradle index f2a3539..6a57df2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,193 +1,182 @@ plugins { - id 'eclipse' - id 'idea' - id 'net.minecraftforge.gradle' version '[6.0.16,6.2)' - id 'maven-publish' + id "idea" + id "net.neoforged.moddev" version "2.0.74" + id "dev.ithundxr.silk" version "0.11.15" + id "me.modmuss50.mod-publish-plugin" version "0.8.3" + id "maven-publish" } +apply from: "./gradle/java.gradle" +apply from: "gradle/property_loader.gradle" -group = "com.${author}.${modid}" +group = "com.${mod_author}.${mod_id}" version = "${minecraft_version}-${mod_version}" -archivesBaseName = modid +archivesBaseName = mod_id -java { - toolchain.languageVersion = JavaLanguageVersion.of(17) +idea { + module { + downloadJavadoc = true + downloadSources = true + } } -minecraft { - // The mappings can be changed at any time and must be in the following format. - // Channel: Version: - // official MCVersion Official field/method names from Mojang mapping files - // parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official - // - // You must be aware of the Mojang license when using the 'official' or 'parchment' mappings. - // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md - // - // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge - // Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started - // - // Use non-default mappings at your own risk. They may not always work. - // Simply re-run your setup task after changing the mappings to update your workspace. - mappings channel: mapping_channel, version: mapping_version +neoForge { + version = project.neo_version - // When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game. - // In most cases, it is not necessary to enable. - // enableEclipsePrepareRuns = true - // enableIdeaPrepareRuns = true + accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg') - // This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game. - // It is REQUIRED to be set to true for this template to function. - // See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html - copyIdeResources = true - - // When true, this property will add the folder name of all declared run configurations to generated IDE run configurations. - // The folder name can be set on a run configuration using the "folderName" property. - // By default, the folder name of a run configuration is the name of the Gradle project containing it. - // generateRunFolders = true - - // This property enables access transformers for use in development. - // They will be applied to the Minecraft artifact. - // The access transformer file can be anywhere in the project. - // However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge. - // This default location is a best practice to automatically put the file in the right place in the final jar. - // See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information. - // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') - - // Default run configurations. - // These can be tweaked, removed, or duplicated as needed. + parchment { + minecraftVersion = project.parchment_minecraft_version + mappingsVersion = project.parchment_version + } + mods { + "$mod_id" { + sourceSet sourceSets.main + } + } runs { // applies to all the run configs below configureEach { - workingDirectory project.file('run') + systemProperty 'forge.logging.markers', '' + systemProperty 'forge.logging.console.level', 'info' + jvmArguments = ["-XX:+IgnoreUnrecognizedVMOptions", "-XX:+AllowEnhancedClassRedefinition"] + //jvmArgs("-XX:-OmitStackTraceInFastThrow") // uncomment when you get exceptions with null messages etc + //jvmArgs '-XX:+UnlockCommercialFeatures' // uncomment for profiling - // Recommended logging data for a userdev environment - // The markers can be added/remove as needed separated by commas. - // "SCAN": For mods scan. - // "REGISTRIES": For firing of registry events. - // "REGISTRYDUMP": For getting the contents of all registries. - property 'forge.logging.markers', 'REGISTRIES' + systemProperty 'mixin.debug.export', 'true' + systemProperty 'mixin.debug.verbose', 'true' + programArgument '-mixin.config=create.mixins.json' + //programArgument '-mixin.config=ponder.mixins.json' + //systemProperty("mixin.env.remapRefMap", "true") + //systemProperty("mixin.env.refMapRemappingFile", "${projectDir}/build/createSrgToMcp/output.srg") - - // Recommended logging level for the console - // You can set various levels here. - // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels - property 'forge.logging.console.level', 'debug' - - mods { - "${modid}" { - source sourceSets.main - } - } } client { - // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. - property 'forge.enabledGameTestNamespaces', modid + client() + gameDirectory = project.file('run') } server { - property 'forge.enabledGameTestNamespaces', modid - args '--nogui' - } + server() - // This run config launches GameTestServer and runs all registered gametests, then exits. - // By default, the server will crash when no gametests are provided. - // The gametest system is also enabled by default for other run configs under the /test command. - gameTestServer { - property 'forge.enabledGameTestNamespaces', modid + gameDirectory = project.file('run/server') } data { - // example of overriding the workingDirectory set in configureEach above - workingDirectory project.file('run-data') + data() - // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. - args '--mod', modid, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') + gameDirectory = project.file('run') + systemProperty 'forge.logging.markers', 'REGISTRIES,REGISTRYDUMP' + systemProperty 'forge.logging.console.level', 'debug' + programArguments.addAll("--mod", mod_id as String, "--all", "--output", file("src/generated/resources/").getAbsolutePath(), "--existing", file("src/main/resources").getAbsolutePath()) + } + + gameTestServer { + type = "gameTestServer" + + gameDirectory = project.file('run/gametest') + // setForceExit false <- FIXME 1.20 } } } -// Include resources generated by data generators. -sourceSets.main.resources { srcDir 'src/generated/resources' } +sourceSets.main { + resources { + srcDir 'src/generated/resources' + exclude '.cache/' + } +} repositories { - maven { - // location of the maven for Registrate and Flywheel - name = 'tterrag maven' - url = 'https://maven.tterrag.com' - } - maven { - // location of the maven that hosts JEI files since January 2023 - // location of the maven for Vazkii's mods - name = "Jared's maven" - url = "https://maven.blamejared.com/" - } + maven { url = "https://maven.createmod.net" } // Create, Ponder, Flywheel + maven { url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/" } // ForgeConfigAPIPort + maven { url = "https://mvn.devos.one/snapshots" } // Registrate + maven { url = "https://maven.blamejared.com" } // JEI, Vazkii's Mods + maven { // location of the maven for Curios API url = "https://maven.theillusivec4.top/" } + maven { + // location of maven for CC: Tweaked + name = "squiddev" + url = "https://squiddev.cc/maven/" + } + maven { url = 'https://www.cursemaven.com' content { includeGroup "curse.maven" } } + maven { + name = "Modrinth" + url = "https://api.modrinth.com/maven" + content { + includeGroup "maven.modrinth" + } + } + maven { + url "https://jitpack.io" + content { + includeGroup "com.github.llamalad7.mixinextras" + } + } + + maven { + url "https://maven.latvian.dev/releases" + content { + includeGroup "dev.latvian.mods" + includeGroup "dev.latvian.apps" + } + } + maven { + url "https://maven.architectury.dev/" + content { + includeGroup "dev.architectury" + } + } + mavenLocal() + flatDir { + dirs 'libs' + } } dependencies { implementation 'org.jetbrains:annotations:22.0.0' - minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" + implementation("net.createmod.ponder:Ponder-NeoForge-${minecraft_version}:${ponder_version}") - - compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-common-api:${jei_version}") + /*compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-common-api:${jei_version}") compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-forge-api:${jei_version}") runtimeOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}-forge:${jei_version}") +*/ + /*implementation fg.deobf("curse.maven:jade-324717:${jade_id}")*/ - implementation fg.deobf("curse.maven:jade-324717:${jade_id}") +} - if (System.getProperty('idea.sync.active') != 'true') { - annotationProcessor "org.spongepowered:mixin:${mixin_version}:processor" +processResources { + def buildProps = project.properties.clone() + + // Replaces FML's magic file.jarVersion string with the correct version at build time. + buildProps.put('file', [jarVersion: project.version]) + + filesMatching(['META-INF/neoforge.mods.toml', 'pack.mcmeta']) { + expand buildProps } } - -// This block of code expands all declared replace properties in the specified resource targets. -// A missing property will result in an error. Properties are expanded using ${} Groovy notation. -// When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments. -// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html -tasks.named('processResources', ProcessResources).configure { - var replaceProperties = [minecraft_version : minecraft_version, minecraft_version_range: minecraft_version_range, - forge_version : forge_version, forge_version_range: forge_version_range, - loader_version_range: loader_version_range, - modid : modid, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, - author : author, mod_description: mod_description,] - - inputs.properties replaceProperties - - filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { - expand replaceProperties + [project: project] - } +compileJava { + options.compilerArgs = ['-Xdiags:verbose'] } -// Example for how to get properties into the manifest for reading at runtime. -tasks.named('jar', Jar).configure { - manifest { - attributes(["Specification-Title" : modid, - "Specification-Vendor" : author, - "Specification-Version" : "1", // We are version 1 of ourselves - "Implementation-Title" : project.name, - "Implementation-Version" : project.jar.archiveVersion, - "Implementation-Vendor" : author, - "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")]) +jar { + from('LICENSE') { + rename { "${it}_${archivesBaseName}" } } - // This is the preferred method to reobfuscate your jar file - finalizedBy 'reobfJar' } -tasks.withType(JavaCompile).configureEach { - options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation -} publishing { // other settings of publication publications { diff --git a/gradle.properties b/gradle.properties index 41d850d..acdcf90 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,28 +1,21 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -minecraft_version=1.20.1 -minecraft_version_range=[1.20.1,1.21) -forge_version=47.3.7 -forge_version_range=[47,) -loader_version_range=[47,) -mapping_channel=official -mapping_version=1.20.1 -mixin_version = 0.8.5 +minecraft_version = 1.21.1 +minecraft_version_range=[1.21.1] +neo_version = 21.1.125 +neo_version_range=[21.1.125,) -modid=mechanical_lemon_ui -mod_name=Mechanical Lemon UI -mod_license=MIT -mod_version=0.1.8 +parchment_minecraft_version = 1.21.1 +parchment_version = 2024.11.17 + +mod_id=mechanicals_ui +mod_name=Mechanicals UI +mod_license=LGPL3 +mod_version=0.0.2 mod_group_id=com.oierbravo -author=oierbravo -mod_description=Library +mod_author=oierbravo +mod_description=Ui Library - -jei_minecraft_version = 1.20.1 -jei_version = 15.2.0.22 -curios_minecraft_version = 1.20.1 -curios_version = 5.2.0-beta.3 - -jade_id = 5672013 \ No newline at end of file +ponder_version = 1.0.46 diff --git a/gradle/java.gradle b/gradle/java.gradle new file mode 100644 index 0000000..e7a4bd0 --- /dev/null +++ b/gradle/java.gradle @@ -0,0 +1,39 @@ +apply plugin: 'java' + +java.toolchain.languageVersion = JavaLanguageVersion.of(21) +java.withSourcesJar() +java.withJavadocJar() + +jar { + manifest { + attributes([ + 'Specification-Title' : mod_name, + 'Specification-Vendor' : mod_author, + 'Specification-Version' : project.jar.archiveVersion, + 'Implementation-Title' : project.name, + 'Implementation-Version' : project.jar.archiveVersion, + 'Implementation-Vendor' : mod_author, + 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), + 'Timestampe' : System.currentTimeMillis(), + 'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})", + 'Built-On-Minecraft' : minecraft_version + ]) + } +} + +tasks.withType(JavaCompile).configureEach { + it.options.encoding = 'UTF-8' + it.options.release = 21 +} + +// Disables Gradle's custom module metadata from being published to maven. The +// metadata includes mapped dependencies which are not reasonably consumable by +// other mod developers. +tasks.withType(GenerateModuleMetadata) { + enabled = false +} + +javadoc { + // Suppress annoying warnings when generating JavaDoc files. + options.addStringOption('Xdoclint:none', '-quiet') +} diff --git a/gradle/property_loader.gradle b/gradle/property_loader.gradle new file mode 100644 index 0000000..a0154ef --- /dev/null +++ b/gradle/property_loader.gradle @@ -0,0 +1,48 @@ +/* + This module can inject build properties from a JSON file. Each property in the + JSON file will be mapped to a build property using the key of that property. + Property keys ending with _comment will be skipped. + + If a secretFile property exists and points to a valid JSON file that file will + be automatically loaded. You can manually load a file using the loadProperties + method. +*/ +import groovy.json.JsonSlurper + +// Auto detects a secret file and injects it. +if (project.rootProject.hasProperty("secretFile")) { + project.logger.lifecycle("Automatically loading properties from the secretFile") + final def secretsFile = project.rootProject.file(project.rootProject.getProperty("secretFile")) + + if (secretsFile.exists() && secretsFile.name.endsWith(".json")) { + loadProperties(secretsFile) + } +} + +// Loads properties using a specified json file. +def loadProperties(propertyFile) { + if (propertyFile.exists()) { + propertyFile.withReader { + Map propMap = new JsonSlurper().parse it + + for (entry in propMap) { + + // Filter entries that use _comment in the key. + if (!entry.key.endsWith("_comment")) { + + project.ext.set(entry.key, entry.value) + } + } + + project.logger.lifecycle("Successfully loaded " + propMap.size() + " properties") + propMap.clear() + } + } else { + project.logger.warn("The property file " + propertyFile.getName() + " could not be loaded. It does not exist.") + } +} + +// Allows other scripts to use these methods. +ext { + loadProperties = this.&loadProperties +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 396089d..3e4b54e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -12,4 +12,4 @@ plugins { id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' } -rootProject.name = 'MechanicalLemonUI' +rootProject.name = 'MechanicalsUI' diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/MechanicalLemonUI.java b/src/main/java/com/oierbravo/mechanical_lemon_ui/MechanicalLemonUI.java deleted file mode 100644 index ced4aea..0000000 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/MechanicalLemonUI.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.oierbravo.mechanical_lemon_ui; - -import com.mojang.logging.LogUtils; -import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.eventbus.api.IEventBus; -import net.minecraftforge.fml.ModLoadingContext; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.config.ModConfig; -import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import org.slf4j.Logger; - -// The value here should match an entry in the META-INF/mods.toml file -@Mod(MechanicalLemonUI.MODID) -public class MechanicalLemonUI { - - public static final String MODID = "mechanical_lemon_ui"; - private static final Logger LOGGER = LogUtils.getLogger(); - - public MechanicalLemonUI() { - IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); - - - MinecraftForge.EVENT_BUS.register(this); - } - - public static ResourceLocation asResource(String path) { - return new ResourceLocation(MODID, path); - } - -} diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/UIRenderHelper.java b/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/UIRenderHelper.java deleted file mode 100644 index dabce9e..0000000 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/UIRenderHelper.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.gui; -/* - * Credits: Creators of create - * https://github.com/Creators-of-Create/Create - * License: MIT - */ -import com.mojang.blaze3d.pipeline.RenderTarget; -import com.mojang.blaze3d.platform.Window; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.BufferBuilder; -import com.mojang.blaze3d.vertex.DefaultVertexFormat; -import com.mojang.blaze3d.vertex.Tesselator; -import com.mojang.blaze3d.vertex.VertexFormat; -import com.oierbravo.mechanical_lemon_ui.foundation.utility.Color; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.renderer.GameRenderer; -import org.joml.Matrix4f; - -public class UIRenderHelper { - public static CustomRenderTarget framebuffer; - - public UIRenderHelper() { - } - - public static void init() { - RenderSystem.recordRenderCall(() -> { - Window mainWindow = Minecraft.getInstance().getWindow(); - framebuffer = UIRenderHelper.CustomRenderTarget.create(mainWindow); - }); - } - - public static void updateWindowSize(Window mainWindow) { - if (framebuffer != null) { - framebuffer.resize(mainWindow.getWidth(), mainWindow.getHeight(), Minecraft.ON_OSX); - } - - } - public static void drawColoredTexture(GuiGraphics graphics, Color c, int x, int y, int tex_left, int tex_top, int width, int height) { - drawColoredTexture(graphics, c, x, y, 0, (float) tex_left, (float) tex_top, width, height, 256, 256); - } - - public static void drawColoredTexture(GuiGraphics graphics, Color c, int x, int y, int z, float tex_left, float tex_top, int width, int height, int sheet_width, int sheet_height) { - drawColoredTexture(graphics, c, x, x + width, y, y + height, z, width, height, tex_left, tex_top, sheet_width, sheet_height); - } - private static void drawColoredTexture(GuiGraphics graphics, Color c, int left, int right, int top, int bot, int z, int tex_width, int tex_height, float tex_left, float tex_top, int sheet_width, int sheet_height) { - drawTexturedQuad(graphics.pose().last().pose(), c, left, right, top, bot, z, (tex_left + 0.0F) / (float)sheet_width, (tex_left + (float)tex_width) / (float)sheet_width, (tex_top + 0.0F) / (float)sheet_height, (tex_top + (float)tex_height) / (float)sheet_height); - } - - private static void drawTexturedQuad(Matrix4f m, Color c, int left, int right, int top, int bot, int z, float u1, float u2, float v1, float v2) { - Tesselator tesselator = Tesselator.getInstance(); - BufferBuilder bufferbuilder = tesselator.getBuilder(); - RenderSystem.enableBlend(); - RenderSystem.defaultBlendFunc(); - RenderSystem.setShader(GameRenderer::getPositionColorTexShader); - bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX); - bufferbuilder.vertex(m, (float)left, (float)bot, (float)z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).uv(u1, v2).endVertex(); - bufferbuilder.vertex(m, (float)right, (float)bot, (float)z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).uv(u2, v2).endVertex(); - bufferbuilder.vertex(m, (float)right, (float)top, (float)z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).uv(u2, v1).endVertex(); - bufferbuilder.vertex(m, (float)left, (float)top, (float)z).color(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha()).uv(u1, v1).endVertex(); - tesselator.end(); - RenderSystem.disableBlend(); - } - - public static class CustomRenderTarget extends RenderTarget { - public CustomRenderTarget(boolean useDepth) { - super(useDepth); - } - - public static CustomRenderTarget create(Window mainWindow) { - CustomRenderTarget framebuffer = new CustomRenderTarget(true); - framebuffer.resize(mainWindow.getWidth(), mainWindow.getHeight(), Minecraft.ON_OSX); - framebuffer.setClearColor(0.0F, 0.0F, 0.0F, 0.0F); - framebuffer.enableStencil(); - return framebuffer; - } - - public void renderWithAlpha(float alpha) { - Window window = Minecraft.getInstance().getWindow(); - float vx = (float)window.getGuiScaledWidth(); - float vy = (float)window.getGuiScaledHeight(); - float tx = (float)this.viewWidth / (float)this.width; - float ty = (float)this.viewHeight / (float)this.height; - RenderSystem.enableDepthTest(); - RenderSystem.setShader(() -> { - return Minecraft.getInstance().gameRenderer.blitShader; - }); - RenderSystem.getShader().setSampler("DiffuseSampler", this.colorTextureId); - this.bindRead(); - Tesselator tessellator = Tesselator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuilder(); - bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX); - bufferbuilder.vertex(0.0, (double)vy, 0.0).color(1.0F, 1.0F, 1.0F, alpha).uv(0.0F, 0.0F).endVertex(); - bufferbuilder.vertex((double)vx, (double)vy, 0.0).color(1.0F, 1.0F, 1.0F, alpha).uv(tx, 0.0F).endVertex(); - bufferbuilder.vertex((double)vx, 0.0, 0.0).color(1.0F, 1.0F, 1.0F, alpha).uv(tx, ty).endVertex(); - bufferbuilder.vertex(0.0, 0.0, 0.0).color(1.0F, 1.0F, 1.0F, alpha).uv(0.0F, ty).endVertex(); - tessellator.end(); - this.unbindRead(); - } - } -} diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/Color.java b/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/Color.java deleted file mode 100644 index f7b9a6f..0000000 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/Color.java +++ /dev/null @@ -1,243 +0,0 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.utility; -/* - * Credits: Creators of create - * https://github.com/Creators-of-Create/Create - * License: MIT - */ - -import com.google.common.hash.Hashing; -import net.minecraft.util.Mth; -import net.minecraft.world.phys.Vec3; -import org.joml.Vector3f; - -import javax.annotation.Nonnull; -import java.util.function.UnaryOperator; - -public class Color { - public static final Color TRANSPARENT_BLACK = (new Color(0, 0, 0, 0)).setImmutable(); - public static final Color BLACK = (new Color(0, 0, 0)).setImmutable(); - public static final Color WHITE = (new Color(255, 255, 255)).setImmutable(); - public static final Color RED = (new Color(255, 0, 0)).setImmutable(); - public static final Color GREEN = (new Color(0, 255, 0)).setImmutable(); - public static final Color SPRING_GREEN = (new Color(0, 255, 187)).setImmutable(); - protected boolean mutable; - protected int value; - - public Color(int r, int g, int b) { - this(r, g, b, 255); - } - - public Color(int r, int g, int b, int a) { - this.mutable = true; - this.value = (a & 255) << 24 | (r & 255) << 16 | (g & 255) << 8 | (b & 255) << 0; - } - - public Color(float r, float g, float b, float a) { - this((int)(0.5 + (double)(255.0F * Mth.clamp(r, 0.0F, 1.0F))), (int)(0.5 + (double)(255.0F * Mth.clamp(g, 0.0F, 1.0F))), (int)(0.5 + (double)(255.0F * Mth.clamp(b, 0.0F, 1.0F))), (int)(0.5 + (double)(255.0F * Mth.clamp(a, 0.0F, 1.0F)))); - } - - public Color(int rgba) { - this.mutable = true; - this.value = rgba; - } - - public Color(int rgb, boolean hasAlpha) { - this.mutable = true; - if (hasAlpha) { - this.value = rgb; - } else { - this.value = rgb | -16777216; - } - - } - - public Color copy() { - return this.copy(true); - } - - public Color copy(boolean mutable) { - return mutable ? new Color(this.value) : (new Color(this.value)).setImmutable(); - } - - public Color setImmutable() { - this.mutable = false; - return this; - } - - public int getRed() { - return this.getRGB() >> 16 & 255; - } - - public int getGreen() { - return this.getRGB() >> 8 & 255; - } - - public int getBlue() { - return this.getRGB() >> 0 & 255; - } - - public int getAlpha() { - return this.getRGB() >> 24 & 255; - } - - public float getRedAsFloat() { - return (float)this.getRed() / 255.0F; - } - - public float getGreenAsFloat() { - return (float)this.getGreen() / 255.0F; - } - - public float getBlueAsFloat() { - return (float)this.getBlue() / 255.0F; - } - - public float getAlphaAsFloat() { - return (float)this.getAlpha() / 255.0F; - } - - public int getRGB() { - return this.value; - } - - public Vec3 asVector() { - return new Vec3((double)this.getRedAsFloat(), (double)this.getGreenAsFloat(), (double)this.getBlueAsFloat()); - } - - public Vector3f asVectorF() { - return new Vector3f(this.getRedAsFloat(), this.getGreenAsFloat(), this.getBlueAsFloat()); - } - - public Color setRed(int r) { - return this.ensureMutable().setRedUnchecked(r); - } - - public Color setGreen(int g) { - return this.ensureMutable().setGreenUnchecked(g); - } - - public Color setBlue(int b) { - return this.ensureMutable().setBlueUnchecked(b); - } - - public Color setAlpha(int a) { - return this.ensureMutable().setAlphaUnchecked(a); - } - - public Color setRed(float r) { - return this.ensureMutable().setRedUnchecked((int)(255.0F * Mth.clamp(r, 0.0F, 1.0F))); - } - - public Color setGreen(float g) { - return this.ensureMutable().setGreenUnchecked((int)(255.0F * Mth.clamp(g, 0.0F, 1.0F))); - } - - public Color setBlue(float b) { - return this.ensureMutable().setBlueUnchecked((int)(255.0F * Mth.clamp(b, 0.0F, 1.0F))); - } - - public Color setAlpha(float a) { - return this.ensureMutable().setAlphaUnchecked((int)(255.0F * Mth.clamp(a, 0.0F, 1.0F))); - } - - public Color scaleAlpha(float factor) { - return this.ensureMutable().setAlphaUnchecked((int)((float)this.getAlpha() * Mth.clamp(factor, 0.0F, 1.0F))); - } - - public Color mixWith(Color other, float weight) { - return this.ensureMutable().setRedUnchecked((int)((float)this.getRed() + (float)(other.getRed() - this.getRed()) * weight)).setGreenUnchecked((int)((float)this.getGreen() + (float)(other.getGreen() - this.getGreen()) * weight)).setBlueUnchecked((int)((float)this.getBlue() + (float)(other.getBlue() - this.getBlue()) * weight)).setAlphaUnchecked((int)((float)this.getAlpha() + (float)(other.getAlpha() - this.getAlpha()) * weight)); - } - - public Color darker() { - int a = this.getAlpha(); - return this.ensureMutable().mixWith(BLACK, 0.25F).setAlphaUnchecked(a); - } - - public Color brighter() { - int a = this.getAlpha(); - return this.ensureMutable().mixWith(WHITE, 0.25F).setAlphaUnchecked(a); - } - - public Color setValue(int value) { - return this.ensureMutable().setValueUnchecked(value); - } - - public Color modifyValue(UnaryOperator function) { - int newValue = (Integer)function.apply(this.value); - return newValue == this.value ? this : this.ensureMutable().setValueUnchecked(newValue); - } - - protected Color ensureMutable() { - return this.mutable ? this : new Color(this.value); - } - - protected Color setRedUnchecked(int r) { - this.value = this.value & -16711681 | (r & 255) << 16; - return this; - } - - protected Color setGreenUnchecked(int g) { - this.value = this.value & -65281 | (g & 255) << 8; - return this; - } - - protected Color setBlueUnchecked(int b) { - this.value = this.value & -256 | (b & 255) << 0; - return this; - } - - protected Color setAlphaUnchecked(int a) { - this.value = this.value & 16777215 | (a & 255) << 24; - return this; - } - - protected Color setValueUnchecked(int value) { - this.value = value; - return this; - } - - public static Color mixColors(@Nonnull Color c1, @Nonnull Color c2, float w) { - return new Color((int)((float)c1.getRed() + (float)(c2.getRed() - c1.getRed()) * w), (int)((float)c1.getGreen() + (float)(c2.getGreen() - c1.getGreen()) * w), (int)((float)c1.getBlue() + (float)(c2.getBlue() - c1.getBlue()) * w), (int)((float)c1.getAlpha() + (float)(c2.getAlpha() - c1.getAlpha()) * w)); - } - - public static Color mixColors(@Nonnull Couple colors, float w) { - return mixColors((Color)colors.getFirst(), (Color)colors.getSecond(), w); - } - - public static int mixColors(int color1, int color2, float w) { - int a1 = color1 >> 24; - int r1 = color1 >> 16 & 255; - int g1 = color1 >> 8 & 255; - int b1 = color1 & 255; - int a2 = color2 >> 24; - int r2 = color2 >> 16 & 255; - int g2 = color2 >> 8 & 255; - int b2 = color2 & 255; - return ((int)((float)a1 + (float)(a2 - a1) * w) << 24) + ((int)((float)r1 + (float)(r2 - r1) * w) << 16) + ((int)((float)g1 + (float)(g2 - g1) * w) << 8) + ((int)((float)b1 + (float)(b2 - b1) * w) << 0); - } - - public static Color rainbowColor(int timeStep) { - int localTimeStep = Math.abs(timeStep) % 1536; - int timeStepInPhase = localTimeStep % 256; - int phaseBlue = localTimeStep / 256; - int red = colorInPhase(phaseBlue + 4, timeStepInPhase); - int green = colorInPhase(phaseBlue + 2, timeStepInPhase); - int blue = colorInPhase(phaseBlue, timeStepInPhase); - return new Color(red, green, blue); - } - - private static int colorInPhase(int phase, int progress) { - phase %= 6; - if (phase <= 1) { - return 0; - } else if (phase == 2) { - return progress; - } else { - return phase <= 4 ? 255 : 255 - progress; - } - } - - public static Color generateFromLong(long l) { - return rainbowColor(Hashing.crc32().hashLong(l).asInt()).mixWith(WHITE, 0.5F); - } -} diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/Lang.java b/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/Lang.java deleted file mode 100644 index 415477d..0000000 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/Lang.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.utility; -/* - * Credits: Creators of create - * https://github.com/Creators-of-Create/Create - * License: MIT - */ -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.block.state.BlockState; -import net.minecraftforge.fluids.FluidStack; - -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - -public class Lang { - public Lang() { - } - - public static MutableComponent translateDirect(String key, Object... args) { - return Components.translatable("create." + key, resolveBuilders(args)); - } - - public static String asId(String name) { - return name.toLowerCase(Locale.ROOT); - } - - public static String nonPluralId(String name) { - String asId = asId(name); - return asId.endsWith("s") ? asId.substring(0, asId.length() - 1) : asId; - } - - public static List translatedOptions(String prefix, String... keys) { - List result = new ArrayList(keys.length); - String[] var3 = keys; - int var4 = keys.length; - - for(int var5 = 0; var5 < var4; ++var5) { - String key = var3[var5]; - result.add(translate((prefix != null ? prefix + "." : "") + key).component()); - } - - return result; - } - - public static LangBuilder builder() { - return new LangBuilder("create"); - } - - public static LangBuilder builder(String namespace) { - return new LangBuilder(namespace); - } - - public static LangBuilder blockName(BlockState state) { - return builder().add(state.getBlock().getName()); - } - - public static LangBuilder itemName(ItemStack stack) { - return builder().add(stack.getHoverName().copy()); - } - - public static LangBuilder fluidName(FluidStack stack) { - return builder().add(stack.getDisplayName().copy()); - } - - public static LangBuilder number(double d) { - return builder().text(LangNumberFormat.format(d)); - } - - public static LangBuilder translate(String langKey, Object... args) { - return builder().translate(langKey, args); - } - - public static LangBuilder text(String text) { - return builder().text(text); - } - - public static Object[] resolveBuilders(Object[] args) { - for(int i = 0; i < args.length; ++i) { - Object var3 = args[i]; - if (var3 instanceof LangBuilder cb) { - args[i] = cb.component(); - } - } - - return args; - } -} diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/LangBuilder.java b/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/LangBuilder.java deleted file mode 100644 index 3583b0a..0000000 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/LangBuilder.java +++ /dev/null @@ -1,194 +0,0 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.utility; -/* - * Credits: Creators of create - * https://github.com/Creators-of-Create/Create - * License: MIT - */ -import joptsimple.internal.Strings; -import net.minecraft.ChatFormatting; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Font; -import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.player.Player; - -import java.util.List; - -public class LangBuilder { - - String namespace; - MutableComponent component; - - public LangBuilder(String namespace) { - this.namespace = namespace; - } - - public LangBuilder space() { - return text(" "); - } - - public LangBuilder newLine() { - return text("\n"); - } - - /** - * Appends a localised component
- * To add an independently formatted localised component, use add() and a nested - * builder - * - * @param langKey - * @param args - * @return - */ - public LangBuilder translate(String langKey, Object... args) { - return add(Components.translatable(namespace + "." + langKey, Lang.resolveBuilders(args))); - } - - /** - * Appends a text component - * - * @param literalText - * @return - */ - public LangBuilder text(String literalText) { - return add(Components.literal(literalText)); - } - - /** - * Appends a colored text component - * - * @param format - * @param literalText - * @return - */ - public LangBuilder text(ChatFormatting format, String literalText) { - return add(Components.literal(literalText).withStyle(format)); - } - - /** - * Appends a colored text component - * - * @param color - * @param literalText - * @return - */ - public LangBuilder text(int color, String literalText) { - return add(Components.literal(literalText).withStyle(s -> s.withColor(color))); - } - - /** - * Appends the contents of another builder - * - * @param otherBuilder - * @return - */ - public LangBuilder add(LangBuilder otherBuilder) { - return add(otherBuilder.component()); - } - - /** - * Appends a component - * - * @param customComponent - * @return - */ - public LangBuilder add(MutableComponent customComponent) { - component = component == null ? customComponent : component.append(customComponent); - return this; - } - - /** - * Appends a component - * - * @param component the component to append - * @return this builder - */ - public LangBuilder add(Component component) { - if (component instanceof MutableComponent mutableComponent) - return add(mutableComponent); - else - return add(component.copy()); - } - - // - - /** - * Applies the format to all added components - * - * @param format - * @return - */ - public LangBuilder style(ChatFormatting format) { - assertComponent(); - component = component.withStyle(format); - return this; - } - - /** - * Applies the color to all added components - * - * @param color - * @return - */ - public LangBuilder color(int color) { - assertComponent(); - component = component.withStyle(s -> s.withColor(color)); - return this; - } - - // - - public MutableComponent component() { - assertComponent(); - return component; - } - - public String string() { - return component().getString(); - } - - public String json() { - return Component.Serializer.toJson(component()); - } - - public void sendStatus(Player player) { - player.displayClientMessage(component(), true); - } - - public void sendChat(Player player) { - player.displayClientMessage(component(), false); - } - - public void addTo(List tooltip) { - tooltip.add(component()); - } - - public void forGoggles(List tooltip) { - forGoggles(tooltip, 0); - } - - public void forGoggles(List tooltip, int indents) { - tooltip.add(Lang.builder() - .text(Strings.repeat(' ', getIndents(Minecraft.getInstance().font, 4 + indents))) - .add(this) - .component()); - } - - public static final float DEFAULT_SPACE_WIDTH = 4.0F; // space width in vanilla's default font - static int getIndents(Font font, int defaultIndents) { - int spaceWidth = font.width(" "); - if (DEFAULT_SPACE_WIDTH == spaceWidth) { - return defaultIndents; - } - return Mth.ceil(DEFAULT_SPACE_WIDTH * defaultIndents / spaceWidth); - } - - // - - private void assertComponent() { - if (component == null) - throw new IllegalStateException("No components were added to builder"); - } - -} diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/ScreenElement.java b/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/ScreenElement.java deleted file mode 100644 index 54a8bd8..0000000 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/ScreenElement.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.utility; -/* - * Credits: Creators of create - * https://github.com/Creators-of-Create/Create - * License: MIT - */ -import net.minecraft.client.gui.GuiGraphics; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; - -public interface ScreenElement { - @OnlyIn(Dist.CLIENT) - void render(GuiGraphics var1, int var2, int var3); -} diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/VoxelShaper.java b/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/VoxelShaper.java deleted file mode 100644 index 7044612..0000000 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/VoxelShaper.java +++ /dev/null @@ -1,146 +0,0 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.utility; -/* - * Credits: Creators of create - * https://github.com/Creators-of-Create/Create - * License: MIT - */ -import net.minecraft.core.Direction; -import net.minecraft.core.Direction.Axis; -import net.minecraft.core.Direction.AxisDirection; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.phys.Vec3; -import net.minecraft.world.phys.shapes.Shapes; -import net.minecraft.world.phys.shapes.VoxelShape; -import org.apache.commons.lang3.mutable.MutableObject; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; -import java.util.function.Function; - -public class VoxelShaper { - - private Map shapes = new HashMap<>(); - - public VoxelShape get(Direction direction) { - return shapes.get(direction); - } - - public VoxelShape get(Axis axis) { - return shapes.get(axisAsFace(axis)); - } - - public static VoxelShaper forHorizontal(VoxelShape shape, Direction facing) { - return forDirectionsWithRotation(shape, facing, Direction.Plane.HORIZONTAL, new HorizontalRotationValues()); - } - - public static VoxelShaper forHorizontalAxis(VoxelShape shape, Axis along) { - return forDirectionsWithRotation(shape, axisAsFace(along), Arrays.asList(Direction.SOUTH, Direction.EAST), - new HorizontalRotationValues()); - } - - public static VoxelShaper forDirectional(VoxelShape shape, Direction facing) { - return forDirectionsWithRotation(shape, facing, Arrays.asList(Iterate.directions), new DefaultRotationValues()); - } - - public static VoxelShaper forAxis(VoxelShape shape, Axis along) { - return forDirectionsWithRotation(shape, axisAsFace(along), - Arrays.asList(Direction.SOUTH, Direction.EAST, Direction.UP), new DefaultRotationValues()); - } - - public VoxelShaper withVerticalShapes(VoxelShape upShape) { - shapes.put(Direction.UP, upShape); - shapes.put(Direction.DOWN, rotatedCopy(upShape, new Vec3(180, 0, 0))); - return this; - } - - public VoxelShaper withShape(VoxelShape shape, Direction facing) { - shapes.put(facing, shape); - return this; - } - - public static Direction axisAsFace(Axis axis) { - return Direction.get(AxisDirection.POSITIVE, axis); - } - - protected static float horizontalAngleFromDirection(Direction direction) { - return (float) ((Math.max(direction.get2DDataValue(), 0) & 3) * 90); - } - - protected static VoxelShaper forDirectionsWithRotation(VoxelShape shape, Direction facing, - Iterable directions, Function rotationValues) { - VoxelShaper voxelShaper = new VoxelShaper(); - for (Direction dir : directions) { - voxelShaper.shapes.put(dir, rotate(shape, facing, dir, rotationValues)); - } - return voxelShaper; - } - - protected static VoxelShape rotate(VoxelShape shape, Direction from, Direction to, - Function usingValues) { - if (from == to) - return shape; - - return rotatedCopy(shape, usingValues.apply(from) - .reverse() - .add(usingValues.apply(to))); - } - - protected static VoxelShape rotatedCopy(VoxelShape shape, Vec3 rotation) { - if (rotation.equals(Vec3.ZERO)) - return shape; - - MutableObject result = new MutableObject<>(Shapes.empty()); - Vec3 center = new Vec3(8, 8, 8); - - shape.forAllBoxes((x1, y1, z1, x2, y2, z2) -> { - Vec3 v1 = new Vec3(x1, y1, z1).scale(16) - .subtract(center); - Vec3 v2 = new Vec3(x2, y2, z2).scale(16) - .subtract(center); - - v1 = VecHelper.rotate(v1, (float) rotation.x, Axis.X); - v1 = VecHelper.rotate(v1, (float) rotation.y, Axis.Y); - v1 = VecHelper.rotate(v1, (float) rotation.z, Axis.Z) - .add(center); - - v2 = VecHelper.rotate(v2, (float) rotation.x, Axis.X); - v2 = VecHelper.rotate(v2, (float) rotation.y, Axis.Y); - v2 = VecHelper.rotate(v2, (float) rotation.z, Axis.Z) - .add(center); - - VoxelShape rotated = blockBox(v1, v2); - result.setValue(Shapes.or(result.getValue(), rotated)); - }); - - return result.getValue(); - } - - protected static VoxelShape blockBox(Vec3 v1, Vec3 v2) { - return Block.box( - Math.min(v1.x, v2.x), - Math.min(v1.y, v2.y), - Math.min(v1.z, v2.z), - Math.max(v1.x, v2.x), - Math.max(v1.y, v2.y), - Math.max(v1.z, v2.z) - ); - } - - protected static class DefaultRotationValues implements Function { - // assume facing up as the default rotation - @Override - public Vec3 apply(Direction direction) { - return new Vec3(direction == Direction.UP ? 0 : (Direction.Plane.VERTICAL.test(direction) ? 180 : 90), - -horizontalAngleFromDirection(direction), 0); - } - } - - protected static class HorizontalRotationValues implements Function { - @Override - public Vec3 apply(Direction direction) { - return new Vec3(0, -horizontalAngleFromDirection(direction), 0); - } - } - -} diff --git a/src/main/java/com/oierbravo/mechanicals_ui/MechanicalsUI.java b/src/main/java/com/oierbravo/mechanicals_ui/MechanicalsUI.java new file mode 100644 index 0000000..1aa17d0 --- /dev/null +++ b/src/main/java/com/oierbravo/mechanicals_ui/MechanicalsUI.java @@ -0,0 +1,25 @@ +package com.oierbravo.mechanicals_ui; + +import com.mojang.logging.LogUtils; +import net.minecraft.resources.ResourceLocation; +import net.neoforged.bus.api.IEventBus; +import net.neoforged.fml.ModContainer; +import net.neoforged.fml.common.Mod; +import org.slf4j.Logger; + +@Mod(MechanicalsUI.MODID) +public class MechanicalsUI { + + public static final String MODID = "mechanicals_ui"; + private static final Logger LOGGER = LogUtils.getLogger(); + + public MechanicalsUI(IEventBus modEventBus, ModContainer modContainer) { + + + } + + public static ResourceLocation asResource(String path) { + return ResourceLocation.fromNamespaceAndPath(MODID, path); + } + +} diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/AbstractSimiScreen.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/AbstractSimiScreen.java.old similarity index 94% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/AbstractSimiScreen.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/AbstractSimiScreen.java.old index 7c88f17..b24ce0d 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/AbstractSimiScreen.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/AbstractSimiScreen.java.old @@ -1,4 +1,4 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.gui; +package com.oierbravo.mechanicals_ui.foundation.gui; /* * Credits: Creators of create * https://github.com/Creators-of-Create/Create @@ -6,8 +6,8 @@ package com.oierbravo.mechanical_lemon_ui.foundation.gui; */ import com.mojang.blaze3d.platform.InputConstants; import com.mojang.blaze3d.vertex.PoseStack; -import com.oierbravo.mechanical_lemon_ui.foundation.gui.widget.AbstractSimiWidget; -import com.oierbravo.mechanical_lemon_ui.foundation.utility.Components; +import com.oierbravo.mechanicals_ui.foundation.gui.widget.AbstractSimiWidget; +import com.oierbravo.mechanicals_ui.foundation.utility.Components; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.EditBox; @@ -16,8 +16,8 @@ import net.minecraft.client.gui.components.events.GuiEventListener; import net.minecraft.client.gui.narration.NarratableEntry; import net.minecraft.client.gui.screens.Screen; import net.minecraft.network.chat.Component; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; import java.util.Collection; import java.util.List; diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/TickableGuiEventListener.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/TickableGuiEventListener.java similarity index 81% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/TickableGuiEventListener.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/TickableGuiEventListener.java index cb5c63e..0296b54 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/TickableGuiEventListener.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/TickableGuiEventListener.java @@ -1,4 +1,4 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.gui; +package com.oierbravo.mechanicals_ui.foundation.gui; /* * Credits: Creators of create * https://github.com/Creators-of-Create/Create diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/menu/AbstractSimiContainerScreen.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/menu/AbstractSimiContainerScreen.java similarity index 80% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/menu/AbstractSimiContainerScreen.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/menu/AbstractSimiContainerScreen.java index 77764f7..a5b5be3 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/menu/AbstractSimiContainerScreen.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/menu/AbstractSimiContainerScreen.java @@ -1,13 +1,15 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.gui.menu; +package com.oierbravo.mechanicals_ui.foundation.gui.menu; /* * Credits: Creators of create * https://github.com/Creators-of-Create/Create * License: MIT */ import com.mojang.blaze3d.platform.InputConstants; -import com.oierbravo.mechanical_lemon_ui.foundation.gui.TickableGuiEventListener; -import com.oierbravo.mechanical_lemon_ui.foundation.gui.widget.AbstractSimiWidget; -import com.oierbravo.mechanical_lemon_ui.register.LibGuiTextures; +import com.oierbravo.mechanicals_ui.register.LibGuiTextures; +import net.createmod.catnip.animation.AnimationTickHolder; +import net.createmod.catnip.gui.TickableGuiEventListener; +import net.createmod.catnip.gui.widget.AbstractSimiWidget; +import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.components.EditBox; @@ -17,22 +19,25 @@ import net.minecraft.client.gui.narration.NarratableEntry; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.ContainerScreen; import net.minecraft.client.renderer.Rect2i; +import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.network.chat.Component; +import net.minecraft.sounds.SoundEvent; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.AbstractContainerMenu; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; +import org.lwjgl.glfw.GLFW; import javax.annotation.ParametersAreNonnullByDefault; import java.util.Collection; import java.util.Collections; import java.util.List; + @OnlyIn(Dist.CLIENT) @ParametersAreNonnullByDefault public abstract class AbstractSimiContainerScreen extends AbstractContainerScreen { - protected int titleXOffset = 2; - protected int titleYOffset = 6; + protected int windowXOffset, windowYOffset; public AbstractSimiContainerScreen(T container, Inventory inv, Component title) { @@ -96,11 +101,15 @@ public abstract class AbstractSimiContainerScreen extends AbstractContainerMenu { @@ -20,7 +20,7 @@ public abstract class MenuBase extends AbstractContainerMenu { public Inventory playerInventory; public T contentHolder; - protected MenuBase(MenuType type, int id, Inventory inv, FriendlyByteBuf extraData) { + protected MenuBase(MenuType type, int id, Inventory inv, RegistryFriendlyByteBuf extraData) { super(type, id); init(inv, createOnClient(extraData)); } @@ -40,7 +40,7 @@ public abstract class MenuBase extends AbstractContainerMenu { } @OnlyIn(Dist.CLIENT) - protected abstract T createOnClient(FriendlyByteBuf extraData); + protected abstract T createOnClient(RegistryFriendlyByteBuf extraData); protected abstract void initAndReadInventory(T contentHolder); @@ -70,5 +70,5 @@ public abstract class MenuBase extends AbstractContainerMenu { return ((IInteractionChecker) contentHolder).canPlayerUse(player); return true; } - } + diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/widget/AbstractSimiWidget.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/widget/AbstractSimiWidget.java.old similarity index 93% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/widget/AbstractSimiWidget.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/widget/AbstractSimiWidget.java.old index 0736622..d9dbda6 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/widget/AbstractSimiWidget.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/widget/AbstractSimiWidget.java.old @@ -1,11 +1,10 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.gui.widget; +package com.oierbravo.mechanicals_ui.foundation.gui.widget; /* * Credits: Creators of create * https://github.com/Creators-of-Create/Create * License: MIT */ -import com.oierbravo.mechanical_lemon_ui.foundation.gui.TickableGuiEventListener; -import com.oierbravo.mechanical_lemon_ui.foundation.utility.Components; +import com.oierbravo.mechanicals_ui.foundation.gui.TickableGuiEventListener; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.client.gui.narration.NarrationElementOutput; diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/widget/EnergyDisplay.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/widget/EnergyDisplay.java similarity index 89% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/widget/EnergyDisplay.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/widget/EnergyDisplay.java index 497a0e6..358518e 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/widget/EnergyDisplay.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/widget/EnergyDisplay.java @@ -1,12 +1,13 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.gui.widget; +package com.oierbravo.mechanicals_ui.foundation.gui.widget; import com.mojang.blaze3d.systems.RenderSystem; -import com.oierbravo.mechanical_lemon_ui.register.LibGuiTextures; +import com.oierbravo.mechanicals_ui.register.LibGuiTextures; +import net.createmod.catnip.gui.widget.AbstractSimiWidget; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.Font; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; -import net.minecraftforge.energy.IEnergyStorage; +import net.neoforged.neoforge.energy.IEnergyStorage; import org.jetbrains.annotations.NotNull; import java.util.List; diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/widget/IconButton.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/widget/IconButton.java similarity index 85% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/widget/IconButton.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/widget/IconButton.java index 5ea9920..10ff5ec 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/widget/IconButton.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/widget/IconButton.java @@ -1,12 +1,13 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.gui.widget; +package com.oierbravo.mechanicals_ui.foundation.gui.widget; /* * Credits: Creators of create * https://github.com/Creators-of-Create/Create * License: MIT */ import com.mojang.blaze3d.systems.RenderSystem; -import com.oierbravo.mechanical_lemon_ui.foundation.utility.ScreenElement; -import com.oierbravo.mechanical_lemon_ui.register.LibGuiTextures; +import com.oierbravo.mechanicals_ui.register.LibGuiTextures; +import net.createmod.catnip.gui.element.ScreenElement; +import net.createmod.catnip.gui.widget.AbstractSimiWidget; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/widget/ProgressArrow.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/widget/ProgressArrow.java similarity index 81% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/widget/ProgressArrow.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/widget/ProgressArrow.java index 1b4eed1..8000ec8 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/widget/ProgressArrow.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/widget/ProgressArrow.java @@ -1,6 +1,7 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.gui.widget; +package com.oierbravo.mechanicals_ui.foundation.gui.widget; -import com.oierbravo.mechanical_lemon_ui.register.LibGuiTextures; +import com.oierbravo.mechanicals_ui.register.LibGuiTextures; +import net.createmod.catnip.gui.widget.AbstractSimiWidget; import net.minecraft.client.gui.GuiGraphics; import org.jetbrains.annotations.NotNull; diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/widget/ToggleIconButton.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/widget/ToggleIconButton.java similarity index 88% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/widget/ToggleIconButton.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/widget/ToggleIconButton.java index 7746be0..f8e3cb8 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/gui/widget/ToggleIconButton.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/gui/widget/ToggleIconButton.java @@ -1,9 +1,9 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.gui.widget; +package com.oierbravo.mechanicals_ui.foundation.gui.widget; import com.mojang.blaze3d.systems.RenderSystem; -import com.oierbravo.mechanical_lemon_ui.foundation.gui.widget.AbstractSimiWidget; -import com.oierbravo.mechanical_lemon_ui.foundation.utility.ScreenElement; -import com.oierbravo.mechanical_lemon_ui.register.LibGuiTextures; +import com.oierbravo.mechanicals_ui.register.LibGuiTextures; +import net.createmod.catnip.gui.element.ScreenElement; +import net.createmod.catnip.gui.widget.AbstractSimiWidget; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/Components.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/Components.java.old similarity index 93% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/Components.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/Components.java.old index 6489365..e1fa134 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/Components.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/Components.java.old @@ -1,4 +1,4 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.utility; +package com.oierbravo.mechanicals_ui.foundation.utility; /* * Credits: Creators of create * https://github.com/Creators-of-Create/Create diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/Couple.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/Couple.java.old similarity index 98% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/Couple.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/Couple.java.old index dfb0e96..e88eb0d 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/Couple.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/Couple.java.old @@ -1,4 +1,4 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.utility; +package com.oierbravo.mechanicals_ui.foundation.utility; /* * Credits: Creators of create * https://github.com/Creators-of-Create/Create diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/FakeItemRenderer.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/FakeItemRenderer.java similarity index 95% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/FakeItemRenderer.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/FakeItemRenderer.java index 41d8c89..4361100 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/FakeItemRenderer.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/FakeItemRenderer.java @@ -1,4 +1,4 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.utility; +package com.oierbravo.mechanicals_ui.foundation.utility; /* * smashingmods * diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/IGuiTextures.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/IGuiTextures.java.old similarity index 79% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/IGuiTextures.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/IGuiTextures.java.old index 29469cb..c8c45aa 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/IGuiTextures.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/IGuiTextures.java.old @@ -1,7 +1,6 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.utility; +package com.oierbravo.mechanicals_ui.foundation.utility; import com.mojang.blaze3d.systems.RenderSystem; -import com.oierbravo.mechanical_lemon_ui.foundation.gui.UIRenderHelper; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.resources.ResourceLocation; /* @@ -9,8 +8,6 @@ import net.minecraft.resources.ResourceLocation; * https://github.com/Creators-of-Create/Create * License: MIT */ -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; public abstract class IGuiTextures { diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/IInteractionChecker.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/IInteractionChecker.java similarity index 78% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/IInteractionChecker.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/IInteractionChecker.java index 15873cd..fc806c4 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/IInteractionChecker.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/IInteractionChecker.java @@ -1,4 +1,4 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.utility; +package com.oierbravo.mechanicals_ui.foundation.utility; /* * Credits: Creators of create * https://github.com/Creators-of-Create/Create diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/Iterate.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/Iterate.java.old similarity index 96% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/Iterate.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/Iterate.java.old index 0b52a65..f4fba0b 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/Iterate.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/Iterate.java.old @@ -1,4 +1,4 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.utility; +package com.oierbravo.mechanicals_ui.foundation.utility; /* * Credits: Creators of create * https://github.com/Creators-of-Create/Create diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/LangNumberFormat.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/LangNumberFormat.java.old similarity index 93% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/LangNumberFormat.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/LangNumberFormat.java.old index 963e1c9..6b2b034 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/LangNumberFormat.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/LangNumberFormat.java.old @@ -1,4 +1,4 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.utility; +package com.oierbravo.mechanicals_ui.foundation.utility; /* * Credits: Creators of create * https://github.com/Creators-of-Create/Create diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/NBTHelper.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/NBTHelper.java.old similarity index 98% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/NBTHelper.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/NBTHelper.java.old index 60fccb7..e309264 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/NBTHelper.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/NBTHelper.java.old @@ -1,4 +1,4 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.utility; +package com.oierbravo.mechanicals_ui.foundation.utility; /* * Credits: Creators of create * https://github.com/Creators-of-Create/Create diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/Pair.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/Pair.java.old similarity index 95% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/Pair.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/Pair.java.old index d62ca97..33f1dc6 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/Pair.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/Pair.java.old @@ -1,4 +1,4 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.utility; +package com.oierbravo.mechanicals_ui.foundation.utility; /* * Credits: Creators of create * https://github.com/Creators-of-Create/Create diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/ShapeBuilder.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/ShapeBuilder.java similarity index 95% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/ShapeBuilder.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/ShapeBuilder.java index c7ebe4c..a7b1716 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/ShapeBuilder.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/ShapeBuilder.java @@ -1,9 +1,10 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.utility; +package com.oierbravo.mechanicals_ui.foundation.utility; /* * Credits: Creators of create * https://github.com/Creators-of-Create/Create * License: MIT */ +import net.createmod.catnip.math.VoxelShaper; import net.minecraft.core.Direction; import net.minecraft.world.level.block.Block; import net.minecraft.world.phys.shapes.BooleanOp; diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/VecHelper.java b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/VecHelper.java.old similarity index 99% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/VecHelper.java rename to src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/VecHelper.java.old index 03bcbed..eeda545 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/foundation/utility/VecHelper.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/foundation/utility/VecHelper.java.old @@ -1,4 +1,4 @@ -package com.oierbravo.mechanical_lemon_ui.foundation.utility; +package com.oierbravo.mechanicals_ui.foundation.utility; /* * Credits: Creators of create * https://github.com/Creators-of-Create/Create diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/register/LibGuiTextures.java b/src/main/java/com/oierbravo/mechanicals_ui/register/LibGuiTextures.java similarity index 72% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/register/LibGuiTextures.java rename to src/main/java/com/oierbravo/mechanicals_ui/register/LibGuiTextures.java index b88998e..9e1c644 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/register/LibGuiTextures.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/register/LibGuiTextures.java @@ -1,16 +1,16 @@ -package com.oierbravo.mechanical_lemon_ui.register; +package com.oierbravo.mechanicals_ui.register; import com.mojang.blaze3d.systems.RenderSystem; -import com.oierbravo.mechanical_lemon_ui.MechanicalLemonUI; -import com.oierbravo.mechanical_lemon_ui.foundation.gui.UIRenderHelper; -import com.oierbravo.mechanical_lemon_ui.foundation.utility.Color; -import com.oierbravo.mechanical_lemon_ui.foundation.utility.ScreenElement; +import com.oierbravo.mechanicals_ui.MechanicalsUI; +import net.createmod.catnip.gui.UIRenderHelper; +import net.createmod.catnip.gui.element.ScreenElement; +import net.createmod.catnip.theme.Color; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.resources.ResourceLocation; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; -public enum LibGuiTextures implements ScreenElement { +public enum LibGuiTextures implements ScreenElement { PLAYER_INVENTORY("player_inventory", 176, 108), @@ -38,11 +38,11 @@ public enum LibGuiTextures implements ScreenElement { } private LibGuiTextures(String location, int startX, int startY, int width, int height) { - this(MechanicalLemonUI.MODID, location, startX, startY, width, height); + this(MechanicalsUI.MODID, location, startX, startY, width, height); } private LibGuiTextures(String namespace, String location, int startX, int startY, int width, int height) { - this.location = new ResourceLocation(namespace, "textures/gui/" + location + ".png"); + this.location = ResourceLocation.fromNamespaceAndPath(namespace, "textures/gui/" + location + ".png"); this.width = width; this.height = height; this.startX = startX; diff --git a/src/main/java/com/oierbravo/mechanical_lemon_ui/register/LibIcons.java b/src/main/java/com/oierbravo/mechanicals_ui/register/LibIcons.java similarity index 84% rename from src/main/java/com/oierbravo/mechanical_lemon_ui/register/LibIcons.java rename to src/main/java/com/oierbravo/mechanicals_ui/register/LibIcons.java index 5f0e8ee..fb54bc5 100644 --- a/src/main/java/com/oierbravo/mechanical_lemon_ui/register/LibIcons.java +++ b/src/main/java/com/oierbravo/mechanicals_ui/register/LibIcons.java @@ -1,22 +1,22 @@ -package com.oierbravo.mechanical_lemon_ui.register; +package com.oierbravo.mechanicals_ui.register; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; -import com.oierbravo.mechanical_lemon_ui.MechanicalLemonUI; -import com.oierbravo.mechanical_lemon_ui.foundation.utility.Color; -import com.oierbravo.mechanical_lemon_ui.foundation.utility.ScreenElement; +import com.oierbravo.mechanicals_ui.MechanicalsUI; +import net.createmod.catnip.gui.element.ScreenElement; +import net.createmod.catnip.theme.Color; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.client.renderer.RenderType; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.phys.Vec3; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.neoforged.api.distmarker.Dist; +import net.neoforged.api.distmarker.OnlyIn; import org.joml.Matrix4f; public class LibIcons implements ScreenElement { - public static final ResourceLocation ICON_ATLAS = MechanicalLemonUI.asResource("textures/gui/icons.png"); + public static final ResourceLocation ICON_ATLAS = MechanicalsUI.asResource("textures/gui/icons.png"); public static final int ICON_ATLAS_SIZE = 256; private static int x = 0; private static int y = -1; @@ -80,6 +80,9 @@ public class LibIcons implements ScreenElement { @OnlyIn(Dist.CLIENT) private void vertex(VertexConsumer builder, Matrix4f matrix, Vec3 vec, Color rgb, float u, float v, int light) { - builder.vertex(matrix, (float)vec.x, (float)vec.y, (float)vec.z).color(rgb.getRed(), rgb.getGreen(), rgb.getBlue(), 255).uv(u, v).uv2(light).endVertex(); + builder.addVertex(matrix, (float) vec.x, (float) vec.y, (float) vec.z) + .setColor(rgb.getRed(), rgb.getGreen(), rgb.getBlue(), 255) + .setUv(u, v) + .setLight(light); } } \ No newline at end of file diff --git a/src/main/resources/META-INF/accesstransformer.cfg b/src/main/resources/META-INF/accesstransformer.cfg new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml deleted file mode 100644 index 3b79691..0000000 --- a/src/main/resources/META-INF/mods.toml +++ /dev/null @@ -1,24 +0,0 @@ -modLoader = "javafml" #mandatory -loaderVersion = "${loader_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions. -license = "${mod_license}" - -[[mods]] #mandatory -modId = "${modid}" #mandatory -version = "${mod_version}" #mandatory -displayName = "${mod_name}" #mandatory -authors = "${author}" #optional -description = '''${mod_description}''' - -[[dependencies."${modid}"]] #optional -modId = "forge" #mandatory -mandatory = true #mandatory -versionRange = "${forge_version_range}" #mandatory -ordering = "NONE" -side = "BOTH"# Here's another dependency - -[[dependencies."${modid}"]] -modId = "minecraft" -mandatory = true -versionRange = "${minecraft_version_range}" -ordering = "NONE" -side = "BOTH" diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/resources/META-INF/neoforge.mods.toml new file mode 100644 index 0000000..f2cbf09 --- /dev/null +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -0,0 +1,27 @@ +modLoader = "javafml" #mandatory +loaderVersion = "[0,)"# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties. +license = "${mod_license}" +[[mods]] #mandatory +modId = "${mod_id}" #mandatory +version = "${mod_version}" #mandatory +displayName = "${mod_name}" #mandatory +#updateJSONURL="https://change.me.example.invalid/updates.json" #optional +#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional +#logoFile="mechanicals_lib.png" #optional +#credits="Thanks for this example mod goes to Java" #optional +authors = "${mod_author}" #optional +description = '''${mod_description}''' + +[[dependencies."${mod_id}"]] +modId="neoforge" +type="required" +versionRange="${neo_version_range}" +ordering="NONE" +side="BOTH" + +[[dependencies."${mod_id}"]] +modId="minecraft" +type="required" +versionRange="${minecraft_version_range}" +ordering="NONE" +side="BOTH" diff --git a/src/main/resources/assets/mechanical_lemon_ui/lang/en_us.json b/src/main/resources/assets/mechanicals_ui/lang/en_us.json similarity index 100% rename from src/main/resources/assets/mechanical_lemon_ui/lang/en_us.json rename to src/main/resources/assets/mechanicals_ui/lang/en_us.json diff --git a/src/main/resources/assets/mechanical_lemon_ui/textures/gui/icons.png b/src/main/resources/assets/mechanicals_ui/textures/gui/icons.png similarity index 100% rename from src/main/resources/assets/mechanical_lemon_ui/textures/gui/icons.png rename to src/main/resources/assets/mechanicals_ui/textures/gui/icons.png diff --git a/src/main/resources/assets/mechanical_lemon_ui/textures/gui/player_inventory.png b/src/main/resources/assets/mechanicals_ui/textures/gui/player_inventory.png similarity index 100% rename from src/main/resources/assets/mechanical_lemon_ui/textures/gui/player_inventory.png rename to src/main/resources/assets/mechanicals_ui/textures/gui/player_inventory.png diff --git a/src/main/resources/assets/mechanical_lemon_ui/textures/gui/widgets.png b/src/main/resources/assets/mechanicals_ui/textures/gui/widgets.png similarity index 100% rename from src/main/resources/assets/mechanical_lemon_ui/textures/gui/widgets.png rename to src/main/resources/assets/mechanicals_ui/textures/gui/widgets.png diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta deleted file mode 100644 index 5a1df0c..0000000 --- a/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack": { - "description": "mechanical_lemon_ui resources", - "pack_format": 15 - } -}