commit 3d86cc99654d9462a3033490b79bae1efe5de317 Author: Jika Date: Fri Sep 26 09:07:05 2025 +0200 Initial commit diff --git a/.factorypath b/.factorypath new file mode 100644 index 0000000..3ef43a8 --- /dev/null +++ b/.factorypath @@ -0,0 +1,4 @@ + + + + diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dfe0770 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Auto detect text files and perform LF normalization +* text=auto diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2f5d04d --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +# gradle + +.gradle/ +build/ +out/ +classes/ + +# eclipse + +*.launch + +# idea + +.idea/ +*.iml +*.ipr +*.iws + +# vscode + +.settings/ +.vscode/ +bin/ +.classpath +.project + +# macos + +*.DS_Store + +run/ +run-data/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..22e812e --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Kinetic Bridge + +Kinetic Bridge is a GregTech CEu addon that turns dynamo hatches into Create/Greate-friendly kinetic outputs. The first milestone introduces a tiered "Kinetic Output Hatch" that exports Create stress at a fixed 256 RPM while scaling stress capacity with the GregTech voltage tier, letting turbines spin Create contraptions without any Forge Energy detours. diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..842fc73 --- /dev/null +++ b/build.gradle @@ -0,0 +1,184 @@ +buildscript { + repositories { + maven { url = 'https://repo.spongepowered.org/repository/maven-public/' } + mavenCentral() + } + dependencies { + classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT' + } +} + +plugins { + id 'eclipse' + id "idea" + id "maven-publish" + id 'net.minecraftforge.gradle' version '[6.0,6.2)' + id 'org.parchmentmc.librarian.forgegradle' version '1.+' + id 'com.diffplug.spotless' version '7.0.2' + id 'org.spongepowered.mixin' version '0.7+' +} + +def generatedResources = file("src/generated") + +sourceSets { + main { + resources.srcDir generatedResources + } +} + +repositories { + mavenLocal() + mavenCentral() + maven { + name = "ModMaven" + url = "https://modmaven.dev" + } + maven { + url = "https://api.modrinth.com/maven" + } + maven { + name = 'GTCEu Maven' + url = 'https://maven.gtceu.com' + content { + includeGroup 'com.gregtechceu.gtceu' + } + } + maven { + name = 'GeckoLib' + url = 'https://dl.cloudsmith.io/public/geckolib3/geckolib/maven/' + content { + includeGroupByRegex("software\\.bernie.*") + includeGroup('com.eliotlash.mclib') + } + } + maven { + name = 'Create' + url = 'https://maven.createmod.net' + content { + includeGroup 'com.simibubi.create' + includeGroup 'dev.engine-room.flywheel' + includeGroup 'net.createmod.ponder' + } + } + maven { + name = 'FirstDarkDev' + url = 'https://maven.firstdarkdev.xyz/snapshots' + } + maven { + name = 'Create DevOS' + url = 'https://mvn.devos.one/snapshots/' + } + maven { + name = "Registrate" + url = "https://maven.tterrag.com/" + } + maven { + name = "CurseMaven" + url = "https://cursemaven.com/" + content { + includeGroup "curse.maven" + } + } + maven { + name = "TerraformersMC" + url = "https://maven.terraformersmc.com/releases/" + } + maven { + url = "https://maven.parchmentmc.org" + } + maven { + url = "https://maven.neoforged.net/releases" + } +} + +version = mod_version +group = maven_group +base { archivesName = archives_base_name } +java { sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17 } +sourceSets.main.resources { srcDir 'src/generated/resources' } + +minecraft { + mappings channel: mapping_channel, version: mapping_version + copyIdeResources = true + runs { + configureEach { + workingDirectory project.file('run') + property 'forge.logging.markers', 'REGISTRIES' + property 'forge.logging.console.level', 'debug' + mods { "${mod_id}" { source sourceSets.main } } + property 'mixin.env.remapRefMap', 'true' + property 'mixin.env.refMapRemappingFile', "${buildDir}/createSrgToMcp/output.srg" + } + client { property 'forge.enabledGameTestNamespaces', mod_id } + server { property 'forge.enabledGameTestNamespaces', mod_id; args '--nogui' } + data { + // example of overriding the workingDirectory set in configureEach above + workingDirectory project.file('run-data') + + // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. + args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') + } + } +} + + +apply plugin: 'org.spongepowered.mixin' +apply from: "$rootDir/gradle/scripts/spotless.gradle" + +dependencies { + minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" + + // Mixin + annotationProcessor "org.spongepowered:mixin:${mixin_processor_version}:processor" + testAnnotationProcessor "org.spongepowered:mixin:${mixin_processor_version}:processor" + + // GregTech and dependencies + implementation fg.deobf("com.gregtechceu.gtceu:gtceu-${minecraft_version}:${gtm_version}") { transitive = false } + implementation fg.deobf("com.lowdragmc.ldlib:ldlib-forge-${minecraft_version}:${ldlib_version}") { transitive = false } + compileOnly fg.deobf("com.tterrag.registrate:Registrate:${registrate_version}") + // runtimeOnly fg.deobf("dev.toma.configuration:configuration-forge-${minecraft_version}:${configuration_version}") + + // Create / Flywheel / Greate + implementation fg.deobf("com.simibubi.create:create-${minecraft_version}:${create_version}:slim") { transitive = false } + implementation fg.deobf("dev.engine-room.flywheel:flywheel-forge-${minecraft_version}:${flywheel_version}") { transitive = false } + implementation fg.deobf("net.createmod.ponder:Ponder-Forge-${minecraft_version}:${ponder_version}") { transitive = false } + + // lombok + compileOnly 'org.projectlombok:lombok:1.18.24' + annotationProcessor 'org.projectlombok:lombok:1.18.24' +} + +mixin { + add sourceSets.main, "${mod_id}.refmap.json" + config "${mod_id}.mixins.json" +} + +tasks.named('processResources', ProcessResources).configure { + var properties = [ + "mod_license": mod_license, + "mod_id": mod_id, + "version": version, + "mod_name": mod_name, + "mod_url": mod_url, + "mod_author": mod_author, + "forge_version": forge_version.split("\\.")[0], // only specify major version of forge + "minecraft_version": minecraft_version, + "gtceu_version": gtm_version, + "create_version": create_version, + ] + inputs.properties(properties) + + filesMatching("META-INF/mods.toml") { + expand properties + [project: project] + } +} + +tasks.named('jar', Jar).configure { finalizedBy 'reobfJar' } +tasks.withType(JavaCompile).configureEach { + // 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 + // If Javadoc is generated, this must be specified in that task too. + options.encoding = "UTF-8" + options.release.set(17) +} diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..55c1abd --- /dev/null +++ b/gradle.properties @@ -0,0 +1,36 @@ +# Done to increase the memory available to gradle. +org.gradle.jvmargs=-Xmx1G + + +# Base properties + # minecraft version + minecraft_version=1.20.1 + # forge version, latest version can be found on https://files.minecraftforge.net/ + forge_version=47.3.5 + mapping_channel=parchment + mapping_version=2023.09.03-1.20.1 + +# Mod Properties + mod_version=0.0.1 + maven_group=com.imbgt.kineticbridge + archives_base_name=kineticbridge + mod_id=kineticbridge + mod_name=Kinetic Bridge + mod_url=https://git.jika.li/Jika/kineticbridge + mod_author=Jika + mod_license=LGPL-3.0-or-later + +# Dependencies +mixin_processor_version=0.8.5 +mixinextras_version=0.5.0 + + gtm_version=7.1.2 + ldlib_version=1.0.40.b + registrate_version=MC1.20-1.3.11 + configuration_version=2.2.0 + jei_version=15.20.0.105 + emi_version = 1.1.13+1.20.1 + create_version=6.0.6-141 + flywheel_version=1.0.4 + greate_version=0.0.51 + ponder_version=1.0.80 diff --git a/gradle/scripts/spotless.gradle b/gradle/scripts/spotless.gradle new file mode 100644 index 0000000..622ca29 --- /dev/null +++ b/gradle/scripts/spotless.gradle @@ -0,0 +1,26 @@ +// Spotless auto-formatter +// See https://github.com/diffplug/spotless/tree/main/plugin-gradle +// Can be locally toggled via spotless:off/spotless:on comments +spotless { + encoding 'UTF-8' + + format 'misc', { + target '.gitignore' + + trimTrailingWhitespace() + indentWithSpaces(4) + endWithNewline() + } + java { + target 'src/main/java/**/*.java', 'src/test/java/**/*.java' + + def orderFile = file("$rootDir/spotless/spotless.importorder") + def formatFile = file("$rootDir/spotless/spotless.eclipseformat.xml") + + toggleOffOn() + importOrderFile(orderFile) + removeUnusedImports('cleanthat-javaparser-unnecessaryimport') + endWithNewline() + eclipse('4.31').configFile(formatFile) + } +} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..a4b76b9 Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..9355b41 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..f5feea6 --- /dev/null +++ b/gradlew @@ -0,0 +1,252 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..9d21a21 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..2dd1f6d --- /dev/null +++ b/settings.gradle @@ -0,0 +1,16 @@ +pluginManagement { + repositories { + gradlePluginPortal() + maven { + name = 'MinecraftForge' + url = 'https://maven.minecraftforge.net/' + } + maven { url = 'https://maven.parchmentmc.org' } + } +} + +plugins { + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' +} + +rootProject.name = "gt-kinetic-hatches" diff --git a/spotless/spotless.eclipseformat.xml b/spotless/spotless.eclipseformat.xml new file mode 100644 index 0000000..8db01de --- /dev/null +++ b/spotless/spotless.eclipseformat.xml @@ -0,0 +1,400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spotless/spotless.importorder b/spotless/spotless.importorder new file mode 100644 index 0000000..096b1cc --- /dev/null +++ b/spotless/spotless.importorder @@ -0,0 +1,8 @@ +0=com.example +1=com.gregtechceu +2=com.lowdragmc +3=net +4= +5=java +6=javax +7=\# \ No newline at end of file diff --git a/src/main/java/com/imbgt/kineticbridge/KineticBridge.java b/src/main/java/com/imbgt/kineticbridge/KineticBridge.java new file mode 100644 index 0000000..2f7b003 --- /dev/null +++ b/src/main/java/com/imbgt/kineticbridge/KineticBridge.java @@ -0,0 +1,37 @@ +package com.imbgt.kineticbridge; + +import com.gregtechceu.gtceu.api.GTCEuAPI; +import com.gregtechceu.gtceu.api.machine.MachineDefinition; +import com.gregtechceu.gtceu.api.registry.registrate.GTRegistrate; + +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; + +import com.mojang.logging.LogUtils; +import org.slf4j.Logger; + +@Mod(KineticBridge.MOD_ID) +public class KineticBridge { + + public static final String MOD_ID = "kineticbridge"; + public static final Logger LOGGER = LogUtils.getLogger(); + public static final GTRegistrate REGISTRATE = GTRegistrate.create(MOD_ID); + + public KineticBridge() { + IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus(); + + REGISTRATE.registerRegistrate(); + + modBus.addGenericListener(MachineDefinition.class, this::registerMachines); + } + + private void registerMachines(GTCEuAPI.RegisterEvent event) { + KineticBridgeMachines.init(); + } + + public static ResourceLocation id(String path) { + return new ResourceLocation(MOD_ID, path); + } +} diff --git a/src/main/java/com/imbgt/kineticbridge/KineticBridgeMachines.java b/src/main/java/com/imbgt/kineticbridge/KineticBridgeMachines.java new file mode 100644 index 0000000..d97a92e --- /dev/null +++ b/src/main/java/com/imbgt/kineticbridge/KineticBridgeMachines.java @@ -0,0 +1,62 @@ +package com.imbgt.kineticbridge; + +import com.gregtechceu.gtceu.api.GTValues; +import com.gregtechceu.gtceu.api.data.RotationState; +import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; +import com.gregtechceu.gtceu.api.machine.MachineDefinition; +import com.gregtechceu.gtceu.api.machine.MetaMachine; +import com.gregtechceu.gtceu.api.machine.multiblock.PartAbility; +import com.gregtechceu.gtceu.api.registry.registrate.MachineBuilder; +import com.gregtechceu.gtceu.common.machine.multiblock.part.EnergyHatchPartMachine; +import com.gregtechceu.gtceu.utils.FormattingUtil; + +import net.minecraft.network.chat.Component; + +import com.imbgt.kineticbridge.machine.KineticOutputHatchPartMachine; + +import java.util.Locale; +import java.util.function.BiFunction; + +public final class KineticBridgeMachines { + + private KineticBridgeMachines() {} + + public static final MachineDefinition[] KINETIC_OUTPUT_HATCH = registerTieredMachines( + "kinetic_output_hatch", + (holder, tier) -> new KineticOutputHatchPartMachine(holder, tier, 2), + (tier, builder) -> builder + .langValue(GTValues.VNF[tier] + " Kinetic Output Hatch") + .rotationState(RotationState.ALL) + .abilities(PartAbility.OUTPUT_ENERGY) + .tooltips( + Component.translatable("gtceu.universal.tooltip.voltage_out", + FormattingUtil.formatNumbers(GTValues.V[tier]), GTValues.VNF[tier]), + Component.translatable("gtceu.universal.tooltip.amperage_out", 2), + Component.translatable("gtceu.universal.tooltip.energy_storage_capacity", + FormattingUtil + .formatNumbers(EnergyHatchPartMachine.getHatchEnergyCapacity(tier, 2))), + Component.translatable("gtceu.machine.energy_hatch.output.tooltip")) + .overlayTieredHullModel("energy_output_hatch") + .register(), + GTValues.ALL_TIERS); + + private static MachineDefinition[] registerTieredMachines( + String name, + BiFunction factory, + BiFunction, MachineDefinition> builder, + int... tiers) { + MachineDefinition[] definitions = new MachineDefinition[GTValues.TIER_COUNT]; + for (int tier : tiers) { + var register = KineticBridge.REGISTRATE.machine( + GTValues.VN[tier].toLowerCase(Locale.ROOT) + "_" + name, + holder -> factory.apply(holder, tier)) + .tier(tier); + definitions[tier] = builder.apply(tier, register); + } + return definitions; + } + + public static void init() { + // Ensure the class is loaded so static initialisers run. + } +} diff --git a/src/main/java/com/imbgt/kineticbridge/machine/KineticOutputHatchPartMachine.java b/src/main/java/com/imbgt/kineticbridge/machine/KineticOutputHatchPartMachine.java new file mode 100644 index 0000000..fa0258b --- /dev/null +++ b/src/main/java/com/imbgt/kineticbridge/machine/KineticOutputHatchPartMachine.java @@ -0,0 +1,12 @@ +package com.imbgt.kineticbridge.machine; + +import com.gregtechceu.gtceu.api.capability.recipe.IO; +import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity; +import com.gregtechceu.gtceu.common.machine.multiblock.part.EnergyHatchPartMachine; + +public class KineticOutputHatchPartMachine extends EnergyHatchPartMachine { + + public KineticOutputHatchPartMachine(IMachineBlockEntity holder, int tier, int amperage) { + super(holder, tier, IO.OUT, amperage); + } +} diff --git a/src/main/resources/META-INF/mods.toml b/src/main/resources/META-INF/mods.toml new file mode 100644 index 0000000..66e4147 --- /dev/null +++ b/src/main/resources/META-INF/mods.toml @@ -0,0 +1,48 @@ +modLoader = "javafml" +loaderVersion = "[47,)" +license = "${mod_license}" + +# This is a URL to e.g. your GitHub or CurseForge issues page. +# It will appear in any crash reports this mod is directly involved in. +# issueTrackerURL="https://github.com/invalid/pleasechangeme/issues" #optional +# A list of mods - how many allowed here is determined by the individual mod loader + +[[mods]] + modId = "${mod_id}" + version = "${version}" + displayName = "${mod_name}" + displayURL = "${mod_url}" + # This will be displayed as your mod's logo in the Mods panel. + # logoFile="icon.png" #optional + # Some more fluff displayed in the Mods panel. Feel free to issue your special thanks here! + # credits="Thanks to Mojang for making this great game" #optional + # Some more fluff displayed in the Mods panel. Plug your stuff here! + authors="${mod_author}" + description = ''' +Kinetic Bridge supplies kinetic-aware GregTech hatches and infrastructure so turbines can drive Create and Greate rotational networks without FE. +''' + + [[dependencies.${mod_id}]] + modId = "forge" + mandatory = true + versionRange = "[${forge_version},)" + ordering = "NONE" + side = "BOTH" + [[dependencies.${mod_id}]] + modId = "minecraft" + mandatory = true + versionRange = "[${minecraft_version},)" + ordering = "NONE" + side = "BOTH" + [[dependencies.${mod_id}]] + modId = "gtceu" + mandatory = true + versionRange = "[${gtceu_version},)" + ordering = "AFTER" + side = "BOTH" + [[dependencies.${mod_id}]] + modId = "create" + mandatory = true + versionRange = "[${create_version},)" + ordering = "AFTER" + side = "BOTH" diff --git a/src/main/resources/kineticbridge.mixins.json b/src/main/resources/kineticbridge.mixins.json new file mode 100644 index 0000000..23b967e --- /dev/null +++ b/src/main/resources/kineticbridge.mixins.json @@ -0,0 +1,13 @@ +{ + "required": true, + "package": "com.imbgt.kineticbridge.mixin", + "compatibilityLevel": "JAVA_17", + "minVersion": "0.8", + "mixins": [ + ], + "client": [ + ], + "injectors": { + "defaultRequire": 1 + } +} diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..1e43790 --- /dev/null +++ b/src/main/resources/pack.mcmeta @@ -0,0 +1,7 @@ +{ + "pack": { + "description": "Resources for Kinetic Bridge", + "pack_format": 15, + "_comment": "pack_format 15 is the current format for Minecraft 1.20.1. Be aware may have changed by the time you use this template!" + } +}