init
This commit is contained in:
commit
0fe7955f69
21 changed files with 951 additions and 0 deletions
129
.clang-format
Normal file
129
.clang-format
Normal file
|
@ -0,0 +1,129 @@
|
|||
---
|
||||
AccessModifierOffset: 0
|
||||
AlignAfterOpenBracket: BlockIndent
|
||||
AlignArrayOfStructures: None
|
||||
AlignConsecutiveAssignments: None
|
||||
AlignConsecutiveMacros: None
|
||||
AlignConsecutiveBitFields: None
|
||||
AlignConsecutiveDeclarations: None
|
||||
AlignEscapedNewlines: DontAlign
|
||||
AlignOperands: DontAlign
|
||||
AlignTrailingComments: false
|
||||
AllowAllArgumentsOnNextLine: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: Empty
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortEnumsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortIfStatementsOnASingleLine: Never
|
||||
AllowShortLambdasOnASingleLine: All
|
||||
AllowShortLoopsOnASingleLine: false
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: MultiLine
|
||||
AttributeMacros: []
|
||||
BinPackArguments: false
|
||||
BinPackParameters: false
|
||||
BitFieldColonSpacing: After
|
||||
BraceWrapping:
|
||||
AfterCaseLabel: false
|
||||
AfterClass: false
|
||||
AfterControlStatement: Never
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
BeforeLambdaBody: false
|
||||
BeforeWhile: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: false
|
||||
SplitEmptyRecord: false
|
||||
SplitEmptyNamespace: false
|
||||
BreakAfterJavaFieldAnnotations: true
|
||||
#BreakArrays: false
|
||||
BreakBeforeBinaryOperators: All
|
||||
BreakBeforeBraces: Custom
|
||||
BreakBeforeConceptDeclarations: true
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializers: AfterColon
|
||||
BreakInheritanceList: AfterColon
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 90
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: false
|
||||
DeriveLineEnding: false
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false # wtf
|
||||
EmptyLineAfterAccessModifier: Never
|
||||
EmptyLineBeforeAccessModifier: Always
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: false
|
||||
ForEachMacros: ["BOOST_FOREACH"]
|
||||
IfMacros: []
|
||||
IncludeBlocks: Regroup
|
||||
IndentAccessModifiers: false
|
||||
IndentCaseBlocks: false
|
||||
IndentCaseLabels: true
|
||||
IndentExternBlock: Indent
|
||||
IndentGotoLabels: true
|
||||
IndentPPDirectives: BeforeHash
|
||||
#IndentRequiresClause: false
|
||||
IndentWidth: 4
|
||||
IndentWrappedFunctionNames: false
|
||||
#InsertBraces: false
|
||||
InsertTrailingCommas: Wrapped
|
||||
JavaScriptQuotes: Double
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
LambdaBodyIndentation: OuterScope
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: All
|
||||
PackConstructorInitializers: NextLine
|
||||
PointerAlignment: Left
|
||||
QualifierAlignment: Left
|
||||
ReferenceAlignment: Left
|
||||
ReflowComments: true
|
||||
#RemoveSemicolon: true
|
||||
#RequiresClausePosition: OwnLine
|
||||
#RequiresExpressionIndentation: OuterScope
|
||||
SeparateDefinitionBlocks: Always
|
||||
SortIncludes: false
|
||||
SortJavaStaticImport: Before
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: true
|
||||
SpaceAfterLogicalNot: false
|
||||
SpaceAfterTemplateKeyword: false
|
||||
SpaceAroundPointerQualifiers: After
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeCaseColon: false
|
||||
SpaceBeforeCpp11BracedList: false
|
||||
SpaceBeforeCtorInitializerColon: false
|
||||
SpaceBeforeInheritanceColon: false
|
||||
SpaceBeforeParens: ControlStatementsExceptControlMacros
|
||||
SpaceBeforeRangeBasedForLoopColon: true
|
||||
SpaceBeforeSquareBrackets: false
|
||||
SpaceInEmptyBlock: false
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesInAngles: Never
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInConditionalStatement: false
|
||||
SpacesInContainerLiterals: false
|
||||
SpacesInLineCommentPrefix:
|
||||
Minimum: 0
|
||||
Maximum: -1
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: c++20
|
||||
StatementAttributeLikeMacros: []
|
||||
StatementMacros: []
|
||||
TabWidth: 4
|
||||
TypenameMacros: []
|
||||
UseCRLF: false # wtf
|
||||
UseTab: Never
|
||||
WhitespaceSensitiveMacros: ["BOOST_PP_STRINGSIZE"]
|
34
.gitignore
vendored
Normal file
34
.gitignore
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
# gradle
|
||||
|
||||
.gradle/
|
||||
build/
|
||||
out/
|
||||
classes/
|
||||
.factorypath
|
||||
|
||||
# eclipse
|
||||
|
||||
*.launch
|
||||
|
||||
# idea
|
||||
|
||||
.idea/
|
||||
*.iml
|
||||
*.ipr
|
||||
*.iws
|
||||
|
||||
# vscode
|
||||
|
||||
.settings/
|
||||
.vscode/
|
||||
bin/
|
||||
.classpath
|
||||
.project
|
||||
|
||||
# macos
|
||||
|
||||
*.DS_Store
|
||||
|
||||
# fabric
|
||||
|
||||
run/
|
8
LICENSE
Normal file
8
LICENSE
Normal file
|
@ -0,0 +1,8 @@
|
|||
Copyright (C) 2023 Anvilcraft
|
||||
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3.
|
||||
|
||||
The above copyright notice, this permission notice and the word "ALEC" shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>
|
74
build.gradle
Normal file
74
build.gradle
Normal file
|
@ -0,0 +1,74 @@
|
|||
plugins {
|
||||
id "dev.architectury.loom" version "1.1-SNAPSHOT"
|
||||
id "maven-publish"
|
||||
}
|
||||
|
||||
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_17
|
||||
|
||||
archivesBaseName = project.archives_base_name
|
||||
version = project.mod_version
|
||||
group = project.maven_group
|
||||
|
||||
loom {
|
||||
forge {
|
||||
mixinConfigs = [
|
||||
"ntx4core.mixins.json"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
repositories {}
|
||||
|
||||
dependencies {
|
||||
// to change the versions see the gradle.properties file
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||
|
||||
forge "net.minecraftforge:forge:${project.forge_version}"
|
||||
}
|
||||
|
||||
processResources {
|
||||
// this will replace the property "${version}" in your mods.toml
|
||||
// with the version you've defined in your gradle.properties
|
||||
filesMatching("META-INF/mods.toml") {
|
||||
expand "version": project.version
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
options.encoding = "UTF-8"
|
||||
options.release = 17
|
||||
}
|
||||
|
||||
java {
|
||||
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
|
||||
// if it is present.
|
||||
// If you remove this line, sources will not be generated.
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
jar {
|
||||
// add some additional metadata to the jar manifest
|
||||
manifest {
|
||||
attributes([
|
||||
"Specification-Title" : project.mod_id,
|
||||
"Specification-Vendor" : project.mod_author,
|
||||
"Specification-Version" : "1",
|
||||
"Implementation-Title" : project.name,
|
||||
"Implementation-Version" : version,
|
||||
"Implementation-Vendor" : project.mod_author,
|
||||
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
// configure the maven publication
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
|
||||
repositories {}
|
||||
}
|
23
gradle.properties
Normal file
23
gradle.properties
Normal file
|
@ -0,0 +1,23 @@
|
|||
# Done to increase the memory available to gradle.
|
||||
org.gradle.jvmargs=-Xmx1G
|
||||
|
||||
# tell architectury loom that this project is a forge project.
|
||||
# this will enable us to use the "forge" dependency.
|
||||
# using archloom without this is possible and will give you a
|
||||
# "standard" loom installation with some extra features.
|
||||
loom.platform=forge
|
||||
|
||||
# Base properties
|
||||
# minecraft version
|
||||
minecraft_version=1.18.2
|
||||
# forge version, latest version can be found on https://files.minecraftforge.net/
|
||||
forge_version=1.18.2-40.2.1
|
||||
# yarn, latest version can be found on https://fabricmc.net/develop/
|
||||
yarn_mappings=1.18.2+build.4
|
||||
|
||||
# Mod Properties
|
||||
mod_version=1.0.0
|
||||
maven_group=net.anvilcraft.ntx4core
|
||||
archives_base_name=ntx4core
|
||||
mod_id=ntx4core
|
||||
mod_author=LordMZTE
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
234
gradlew
vendored
Executable file
234
gradlew
vendored
Executable file
|
@ -0,0 +1,234 @@
|
|||
#!/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.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# 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/master/subprojects/plugins/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
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# 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"'
|
||||
|
||||
# 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
|
||||
which java >/dev/null 2>&1 || 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
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
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
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# 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" "$@"
|
10
settings.gradle
Normal file
10
settings.gradle
Normal file
|
@ -0,0 +1,10 @@
|
|||
pluginManagement {
|
||||
// when using additional gradle plugins like shadow,
|
||||
// add their repositories to this list!
|
||||
repositories {
|
||||
maven { url "https://maven.fabricmc.net/" }
|
||||
maven { url "https://maven.architectury.dev/" }
|
||||
maven { url "https://files.minecraftforge.net/maven/" }
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
30
src/main/java/net/anvilcraft/ntx4core/Ntx4Core.java
Normal file
30
src/main/java/net/anvilcraft/ntx4core/Ntx4Core.java
Normal file
|
@ -0,0 +1,30 @@
|
|||
package net.anvilcraft.ntx4core;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
|
||||
@Mod("ntx4core")
|
||||
public class Ntx4Core {
|
||||
public static final String MODID = "ntx4core";
|
||||
public static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
public Ntx4Core() {
|
||||
IEventBus modBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
|
||||
modBus.addListener(this::commonSetup);
|
||||
modBus.addListener(this::clientSetup);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(Ntx4CoreShaders.class);
|
||||
}
|
||||
|
||||
private void commonSetup(final FMLCommonSetupEvent event) {}
|
||||
|
||||
private void clientSetup(final FMLClientSetupEvent event) {}
|
||||
}
|
29
src/main/java/net/anvilcraft/ntx4core/Ntx4CoreShaders.java
Normal file
29
src/main/java/net/anvilcraft/ntx4core/Ntx4CoreShaders.java
Normal file
|
@ -0,0 +1,29 @@
|
|||
package net.anvilcraft.ntx4core;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.render.Shader;
|
||||
import net.minecraft.client.render.VertexFormats;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class Ntx4CoreShaders {
|
||||
public static Shader SPLASH;
|
||||
|
||||
// This method is called from SplashOverlayMixin as Forge has no fitting event that
|
||||
// fires early enough (and not too early).
|
||||
public static void registerShaders() {
|
||||
Ntx4Core.LOGGER.info("Registering Shaders");
|
||||
|
||||
try {
|
||||
SPLASH = new Shader(
|
||||
MinecraftClient.getInstance().getResourceManager(),
|
||||
new Identifier(Ntx4Core.MODID, "splash"),
|
||||
VertexFormats.POSITION
|
||||
);
|
||||
} catch (IOException e) {
|
||||
Ntx4Core.LOGGER.error("Error registering shaders", e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,215 @@
|
|||
package net.anvilcraft.ntx4core.mixin.client;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.lwjgl.opengl.GL31;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.anvilcraft.ntx4core.Ntx4Core;
|
||||
import net.anvilcraft.ntx4core.Ntx4CoreShaders;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Overlay;
|
||||
import net.minecraft.client.gui.screen.SplashOverlay;
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.client.render.BufferRenderer;
|
||||
import net.minecraft.client.render.GameRenderer;
|
||||
import net.minecraft.client.render.Tessellator;
|
||||
import net.minecraft.client.render.VertexFormat.DrawMode;
|
||||
import net.minecraft.client.render.VertexFormats;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.resource.ResourceReload;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.math.ColorHelper.Argb;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.client.loading.ClientModLoader;
|
||||
|
||||
@Mixin(SplashOverlay.class)
|
||||
public class SplashOverlayMixin extends Overlay {
|
||||
@Unique
|
||||
private static final Identifier LOGO
|
||||
= new Identifier(Ntx4Core.MODID, "textures/gui/title/splash.png");
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private MinecraftClient client;
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private boolean reloading;
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private ResourceReload reload;
|
||||
|
||||
@Shadow
|
||||
@Final
|
||||
private Consumer<Optional<Throwable>> exceptionHandler;
|
||||
|
||||
@Shadow
|
||||
private float progress;
|
||||
|
||||
@Shadow
|
||||
private long reloadStartTime;
|
||||
|
||||
@Shadow
|
||||
private long reloadCompleteTime;
|
||||
|
||||
@Unique
|
||||
private float time = 0.0f;
|
||||
|
||||
/**
|
||||
* @reason Replaces the vanilla spash screen
|
||||
* @author LordMZTE
|
||||
*/
|
||||
@Overwrite
|
||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||
time += delta;
|
||||
if (Ntx4CoreShaders.SPLASH == null) {
|
||||
Ntx4CoreShaders.registerShaders();
|
||||
}
|
||||
int i = this.client.getWindow().getScaledWidth();
|
||||
int j = this.client.getWindow().getScaledHeight();
|
||||
long k = Util.getMeasuringTimeMs();
|
||||
if (this.reloading && this.reloadStartTime == -1L) {
|
||||
this.reloadStartTime = k;
|
||||
}
|
||||
|
||||
float f = this.reloadCompleteTime > -1L
|
||||
? (float) (k - this.reloadCompleteTime) / 1000.0F
|
||||
: -1.0F;
|
||||
float f1 = this.reloadStartTime > -1L
|
||||
? (float) (k - this.reloadStartTime) / 500.0F
|
||||
: -1.0F;
|
||||
float f2;
|
||||
int l1;
|
||||
GlStateManager._clearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
GlStateManager._clear(GL31.GL_COLOR_BUFFER_BIT, false);
|
||||
if (f >= 1.0F) {
|
||||
if (this.client.currentScreen != null) {
|
||||
this.client.currentScreen.render(matrices, 0, 0, delta);
|
||||
}
|
||||
|
||||
l1 = MathHelper.ceil(
|
||||
(1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F)) * 255.0F
|
||||
);
|
||||
//fill(matrices, 0, 0, i, j, withAlpha(BRAND_ARGB.getAsInt(), l1));
|
||||
f2 = 1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F);
|
||||
} else if (this.reloading) {
|
||||
if (this.client.currentScreen != null && f1 < 1.0F) {
|
||||
this.client.currentScreen.render(matrices, mouseX, mouseY, delta);
|
||||
}
|
||||
|
||||
l1 = MathHelper.ceil(MathHelper.clamp((double) f1, 0.15D, 1.0D) * 255.0D);
|
||||
//fill(matrices, 0, 0, i, j, withAlpha(BRAND_ARGB.getAsInt(), l1));
|
||||
f2 = MathHelper.clamp(f1, 0.0F, 1.0F);
|
||||
} else {
|
||||
f2 = 1.0F;
|
||||
}
|
||||
//RenderSystem.enableBlend();
|
||||
//RenderSystem.blendEquation(32774);
|
||||
//RenderSystem.blendFunc(770, 1);
|
||||
RenderSystem.setShader(() -> Ntx4CoreShaders.SPLASH);
|
||||
Ntx4CoreShaders.SPLASH.getUniform("Time").set(this.time / 20.0f);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, f2);
|
||||
BufferBuilder buf = Tessellator.getInstance().getBuffer();
|
||||
buf.begin(DrawMode.QUADS, VertexFormats.POSITION);
|
||||
buf.vertex(-1.0, -1.0, 0.0).next();
|
||||
buf.vertex(1.0, -1.0, 0.0).next();
|
||||
buf.vertex(1.0, 1.0, 0.0).next();
|
||||
buf.vertex(-1.0, 1.0, 0.0).next();
|
||||
buf.end();
|
||||
BufferRenderer.draw(buf);
|
||||
|
||||
l1 = (int) ((double) this.client.getWindow().getScaledWidth() * 0.5D);
|
||||
int k2 = (int) ((double) this.client.getWindow().getScaledHeight() * 0.5D);
|
||||
double d1 = Math.min(
|
||||
(double) this.client.getWindow().getScaledWidth() * 0.75D,
|
||||
(double) this.client.getWindow().getScaledHeight()
|
||||
)
|
||||
* 0.25D;
|
||||
int i1 = (int) (d1 * 0.5D);
|
||||
double d0 = d1 * 6.0D;
|
||||
int j1 = (int) (d0 * 0.5D);
|
||||
RenderSystem.setShaderTexture(0, LOGO);
|
||||
RenderSystem.setShader(GameRenderer::getPositionTexShader);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, f2);
|
||||
int texWidth = 642;
|
||||
int texHeight = 254;
|
||||
drawTexture(
|
||||
matrices,
|
||||
l1 - j1 / 2,
|
||||
k2 - i1,
|
||||
j1,
|
||||
(int) d1,
|
||||
0.0F,
|
||||
0.0F,
|
||||
texWidth,
|
||||
texHeight,
|
||||
texWidth,
|
||||
texHeight
|
||||
);
|
||||
RenderSystem.defaultBlendFunc();
|
||||
RenderSystem.disableBlend();
|
||||
int k1 = (int) ((double) this.client.getWindow().getScaledHeight() * 0.8325D);
|
||||
float f6 = this.reload.getProgress();
|
||||
this.progress
|
||||
= MathHelper.clamp(this.progress * 0.95F + f6 * 0.050000012F, 0.0F, 1.0F);
|
||||
ClientModLoader.renderProgressText();
|
||||
if (f < 1.0F) {
|
||||
this.renderProgressBar(
|
||||
matrices,
|
||||
i / 2 - j1,
|
||||
k1 - 5,
|
||||
i / 2 + j1,
|
||||
k1 + 5,
|
||||
1.0F - MathHelper.clamp(f, 0.0F, 1.0F)
|
||||
);
|
||||
}
|
||||
|
||||
if (f >= 2.0F) {
|
||||
this.client.setOverlay((Overlay) null);
|
||||
}
|
||||
|
||||
if (this.reloadCompleteTime == -1L && this.reload.isComplete()
|
||||
&& (!this.reloading || f1 >= 2.0F)) {
|
||||
this.reloadCompleteTime = Util.getMeasuringTimeMs();
|
||||
|
||||
try {
|
||||
this.reload.throwException();
|
||||
this.exceptionHandler.accept(Optional.empty());
|
||||
} catch (Throwable var23) {
|
||||
this.exceptionHandler.accept(Optional.of(var23));
|
||||
}
|
||||
|
||||
if (this.client.currentScreen != null) {
|
||||
this.client.currentScreen.init(
|
||||
this.client,
|
||||
this.client.getWindow().getScaledWidth(),
|
||||
this.client.getWindow().getScaledHeight()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void renderProgressBar(
|
||||
MatrixStack matrices, int minX, int minY, int maxX, int maxY, float opacity
|
||||
) {
|
||||
int i = MathHelper.ceil((float) (maxX - minX - 2) * this.progress);
|
||||
int j = Math.round(opacity * 255.0F);
|
||||
int k = Argb.getArgb(j, 116, 119, 236);
|
||||
fill(matrices, minX + 2, minY + 2, minX + i, maxY - 2, Argb.getArgb(j, 203, 166, 247));
|
||||
fill(matrices, minX + 1, minY, maxX - 1, minY + 1, k);
|
||||
fill(matrices, minX + 1, maxY, maxX - 1, maxY - 1, k);
|
||||
fill(matrices, minX, minY, minX + 1, maxY, k);
|
||||
fill(matrices, maxX, minY, maxX - 1, maxY, k);
|
||||
}
|
||||
}
|
2
src/main/resources/META-INF/accesstransformer.cfg
Normal file
2
src/main/resources/META-INF/accesstransformer.cfg
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Make stuff for custom title screen public
|
||||
public-f net.minecraft.client.gui.screens.LoadingOverlay f_96161_ # SplashOverlay.BRAND_ARGB
|
34
src/main/resources/META-INF/mods.toml
Normal file
34
src/main/resources/META-INF/mods.toml
Normal file
|
@ -0,0 +1,34 @@
|
|||
modLoader = "javafml"
|
||||
loaderVersion = "[40,)"
|
||||
license = "AGPL-3.0+ALEC"
|
||||
|
||||
issueTrackerURL = "https://git.tilera.org/Anvilcraft/ntx4core/issues"
|
||||
|
||||
[[mods]]
|
||||
modId = "ntx4core"
|
||||
version = "${version}"
|
||||
displayName = "ntx4core"
|
||||
displayURL = "https://anvilcraft.net/"
|
||||
#credits = ""
|
||||
authors = "LordMZTE, (tilera)"
|
||||
|
||||
description = '''
|
||||
Core for Notex 4.
|
||||
|
||||
Includes recipes and tweaks.
|
||||
'''
|
||||
|
||||
[[dependencies.ntx4core]]
|
||||
modId = "forge"
|
||||
mandatory = true
|
||||
|
||||
versionRange = "[40,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
|
||||
[[dependencies.ntx4core]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
versionRange = "[1.18.2]"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
47
src/main/resources/assets/ntx4core/shaders/core/splash.fsh
Normal file
47
src/main/resources/assets/ntx4core/shaders/core/splash.fsh
Normal file
|
@ -0,0 +1,47 @@
|
|||
#version 150
|
||||
// vim: ft=glsl
|
||||
|
||||
uniform vec4 ColorModulator;
|
||||
uniform vec2 ScreenSize;
|
||||
uniform float Time;
|
||||
|
||||
in vec4 vertexColor;
|
||||
in vec2 fragCoord;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
/* "Quasar" by @kishimisu (2023) - https://www.shadertoy.com/view/msGyzc
|
||||
449 => 443 chars thanks to @Xor
|
||||
|
||||
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
|
||||
*/
|
||||
|
||||
#define r(a) mat2(cos(a + asin(vec4(0,1,-1,0)))),
|
||||
#define X(p) p *= r(round(atan(p.x, p.y) * 4.) / 4.)
|
||||
|
||||
void main() {
|
||||
// offset to the bottom left
|
||||
vec2 F = (fragCoord + .8) * ScreenSize;
|
||||
vec3 p, R = vec3(ScreenSize, 1.);
|
||||
float i, t, d, a, b, T = Time * .5 + .5;
|
||||
|
||||
vec4 O = vec4(0.);
|
||||
|
||||
for(O *= i; i++ < 44.;
|
||||
O += .04 * (1. + cos(a + t*.3 - T*.8 + vec4(0,1,2,0)))
|
||||
/ (1. + abs(d)*30.) )
|
||||
|
||||
p = t * normalize(vec3(F+F-R.xy, R.y)),
|
||||
p.z -= 4.,
|
||||
p.xz *= r(T/4.)
|
||||
p.yz *= r(sin(T/4.)*.5)
|
||||
X(p.zx) a = p.x,
|
||||
X(p.yx)
|
||||
p.x = mod(b = p.x - T, .5) - .25,
|
||||
|
||||
t += d = length(p) - (2. - a - smoothstep(b+2., b, T)*30.)
|
||||
* (cos(T/6.+1.)+1.) / 2e2;
|
||||
|
||||
fragColor = O * ColorModulator;
|
||||
}
|
||||
|
43
src/main/resources/assets/ntx4core/shaders/core/splash.json
Normal file
43
src/main/resources/assets/ntx4core/shaders/core/splash.json
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
"blend": {
|
||||
"func": "add",
|
||||
"srcrgb": "srcalpha",
|
||||
"dstrgb": "1-srcalpha"
|
||||
},
|
||||
"vertex": "ntx4core:splash",
|
||||
"fragment": "ntx4core:splash",
|
||||
"attributes": [
|
||||
"Position"
|
||||
],
|
||||
"samplers": [],
|
||||
"uniforms": [
|
||||
{
|
||||
"name": "ColorModulator",
|
||||
"type": "float",
|
||||
"count": 4,
|
||||
"values": [
|
||||
1.0,
|
||||
1.0,
|
||||
1.0,
|
||||
1.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "ScreenSize",
|
||||
"type": "float",
|
||||
"count": 2,
|
||||
"values": [
|
||||
1.0,
|
||||
1.0
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Time",
|
||||
"type": "float",
|
||||
"count": 1,
|
||||
"values": [
|
||||
0.0
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
14
src/main/resources/assets/ntx4core/shaders/core/splash.vsh
Normal file
14
src/main/resources/assets/ntx4core/shaders/core/splash.vsh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#version 150
|
||||
// vim: ft=glsl
|
||||
|
||||
in vec3 Position;
|
||||
|
||||
out vec4 vertexColor;
|
||||
out vec2 fragCoord;
|
||||
|
||||
void main() {
|
||||
gl_Position = vec4(Position, 1.0);
|
||||
|
||||
fragCoord = Position.xy;
|
||||
vertexColor = gl_Position;
|
||||
}
|
BIN
src/main/resources/assets/ntx4core/textures/gui/title/notex4.png
Normal file
BIN
src/main/resources/assets/ntx4core/textures/gui/title/notex4.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
src/main/resources/assets/ntx4core/textures/gui/title/splash.png
Normal file
BIN
src/main/resources/assets/ntx4core/textures/gui/title/splash.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 62 KiB |
13
src/main/resources/ntx4core.mixins.json
Normal file
13
src/main/resources/ntx4core.mixins.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"required": true,
|
||||
"package": "net.anvilcraft.ntx4core.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"minVersion": "0.8",
|
||||
"mixins": [],
|
||||
"client": [
|
||||
"client.SplashOverlayMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
7
src/main/resources/pack.mcmeta
Normal file
7
src/main/resources/pack.mcmeta
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"pack": {
|
||||
"description": "Resources for ntx4core",
|
||||
"pack_format": 8,
|
||||
"_comment": "pack_format 8 is the current format for Minecraft 1.18.2. Be aware may have changed by the time you use this template!"
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue