initial commit

This commit is contained in:
Halbear
2026-08-05 14:14:27 +01:00
parent d05a905396
commit 008c91cff3
46 changed files with 2138 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
# Disable autocrlf on generated files, they always generate with LF
# Add any extra files or paths here to make git stop saying they
# are changed when only line endings change.
src/generated/**/.cache/* text eol=lf
src/generated/**/*.json text eol=lf
+42
View File
@@ -0,0 +1,42 @@
### Gradle ###
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/**/build/
### IntelliJ IDEA ###
.idea/
*.iws
*.iml
*.ipr
out/
!**/src/**/out/
.run/
### Eclipse ###
.apt_generated
.classpath
.eclipse/
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/**/bin/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store
### Minecraft Modding ###
run/
!**/src/**/run/
**/src/generated/**/.cache/
repo/
!**/src/**/repo/
/console.txt
/Assets/
+24
View File
@@ -0,0 +1,24 @@
MIT License
Copyright (c) 2023 NeoForged project
This license applies to the template files as supplied by github.com/NeoForged/MDK
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+186
View File
@@ -0,0 +1,186 @@
plugins {
id 'java-library'
id 'maven-publish'
id 'net.neoforged.moddev' version '2.0.142'
id 'idea'
}
tasks.named('wrapper', Wrapper).configure {
// Define wrapper values here so as to not have to always do so when updating gradlew.properties.
// Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with
// documentation attached on cursor hover of gradle classes and methods. However, this comes with increased
// file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards.
// (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`)
distributionType = Wrapper.DistributionType.BIN
}
version = mod_version
group = mod_group_id
sourceSets.main.resources {
// Include resources generated by data generators.
srcDir('src/generated/resources')
// Exclude common development only resources from finalized outputs
exclude("**/*.bbmodel") // BlockBench project files
exclude("src/generated/**/.cache") // datagen cache files
}
repositories {
// Add here additional repositories if required by some of the dependencies below.
}
base {
archivesName = mod_id
}
// Mojang ships Java 25 to end users in 26.1, so mods should target Java 25.
java.toolchain.languageVersion = JavaLanguageVersion.of(25)
neoForge {
// Specify the version of NeoForge to use.
version = project.neo_version
// This line is optional. Access Transformers are automatically detected
// accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')
// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
client()
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}
server {
server()
programArgument '--nogui'
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}
// 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 {
type = "gameTestServer"
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
}
data {
clientData()
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
// gameDirectory = project.file('run-data')
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
}
// applies to all the run configs above
configureEach {
// 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.
systemProperty 'forge.logging.markers', 'REGISTRIES'
// 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
logLevel = org.slf4j.event.Level.DEBUG
}
}
mods {
// define mod <-> source bindings
// these are used to tell the game which sources are for which mod
// multi mod projects should define one per mod
"${mod_id}" {
sourceSet(sourceSets.main)
}
}
}
// Sets up a dependency configuration called 'localRuntime'.
// This configuration should be used instead of 'runtimeOnly' to declare
// a dependency that will be present for runtime testing but that is
// "optional", meaning it will not be pulled by dependents of this mod.
configurations {
runtimeClasspath.extendsFrom localRuntime
}
dependencies {
// Example optional mod dependency with JEI
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
// compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}"
// compileOnly "mezz.jei:jei-${mc_version}-neoforge-api:${jei_version}"
// We add the full version to localRuntime, not runtimeOnly, so that we do not publish a dependency on it
// localRuntime "mezz.jei:jei-${mc_version}-neoforge:${jei_version}"
// Example mod dependency using a mod jar from ./libs with a flat dir repository
// This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar
// The group id is ignored when searching -- in this case, it is "blank"
// implementation "blank:coolmod-${mc_version}:${coolmod_version}"
// Example mod dependency using a file as dependency
// implementation files("libs/coolmod-${mc_version}-${coolmod_version}.jar")
// Example project dependency using a sister or child project:
// implementation project(":myproject")
// For more info:
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
}
// 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.
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
var replaceProperties = [
minecraft_version : minecraft_version,
minecraft_version_range: minecraft_version_range,
neo_version : neo_version,
mod_id : mod_id,
mod_name : mod_name,
mod_license : mod_license,
mod_version : mod_version,
]
inputs.properties replaceProperties
expand replaceProperties
from "src/main/templates"
into "build/generated/sources/modMetadata"
}
// Include the output of "generateModMetadata" as an input directory for the build
// this works with both building through Gradle and the IDE.
sourceSets.main.resources.srcDir generateModMetadata
// To avoid having to run "generateModMetadata" manually, make it run on every project reload
neoForge.ideSyncTask generateModMetadata
// Example configuration to allow publishing using the maven-publish plugin
publishing {
publications {
register('mavenJava', MavenPublication) {
from components.java
}
}
repositories {
maven {
url "file://${project.projectDir}/repo"
}
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
idea {
module {
downloadSources = true
downloadJavadoc = true
}
}
+33
View File
@@ -0,0 +1,33 @@
# Sets default memory used for gradle commands. Can be overridden by user or command line properties.
org.gradle.jvmargs=-Xmx1G
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=true
# Environment Properties
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
# The Minecraft version must agree with the Neo version to get a valid artifact
minecraft_version=26.1
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[26.1]
# The Neo version must agree with the Minecraft version to get a valid artifact
neo_version=26.1.0.19-beta
## Mod Properties
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
# Must match the String constant located in the main mod class annotated with @Mod.
mod_id=hals_skybox_mod
# The human-readable display name for the mod.
mod_name=Hal's Skybox Mod
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=All Rights Reserved
# The mod version. See https://semver.org/
mod_version=0.0.3
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
mod_group_id=net.halbear.skyboxmod
Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Vendored
+248
View File
@@ -0,0 +1,248 @@
#!/bin/sh
#
# Copyright © 2015 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\n' "$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
# 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" )
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, 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" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# 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" "$@"
Vendored
+93
View File
@@ -0,0 +1,93 @@
@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
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
: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
+9
View File
@@ -0,0 +1,9 @@
pluginManagement {
repositories {
gradlePluginPortal()
}
}
plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '1.0.0'
}
@@ -0,0 +1,423 @@
package net.halbear.skyboxmod;
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.mojang.blaze3d.platform.NativeImage;
import com.mojang.serialization.Codec;
import net.halbear.skyboxmod.rendering.screen.ConfigScreen;
import net.halbear.skyboxmod.rendering.screen.SelectionScreen;
import net.halbear.skyboxmod.rendering.skybox.DistantSkyObject;
import net.halbear.skyboxmod.rendering.skybox.SkyBoxRendering;
import net.minecraft.client.Minecraft;
import net.minecraft.client.OptionInstance;
import net.minecraft.client.renderer.texture.AbstractTexture;
import net.minecraft.client.renderer.texture.DynamicTexture;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.Identifier;
import net.minecraft.server.packs.resources.Resource;
import net.minecraft.util.Util;
import net.neoforged.fml.loading.FMLPaths;
import net.neoforged.neoforge.common.ModConfigSpec;
import javax.naming.spi.DirectoryManager;
import static net.minecraft.client.Options.genericValueLabel;
// An example config class. This is not required, but it's a good idea to have one to keep your config organized.
// Demonstrates how to use Neo's config APIs
public class Config {
private final OptionInstance<Integer> CloudCount;
private final OptionInstance<Double> MinCloudSpeed;
private final OptionInstance<Double> MaxCloudSpeed;
private final OptionInstance<Integer> MaxVerticalAngle;
private final OptionInstance<Integer> MinVerticalAngle;
private final OptionInstance<Double> MaxScale;
private final OptionInstance<Double> MinScale;
private final OptionInstance<Boolean> OpenCloudImageButton;
private final OptionInstance<Boolean> OpenCloudSprites;
private final OptionInstance<Boolean> RenderCustomSun;
private final OptionInstance<Boolean> RenderCustomMoon;
private final OptionInstance<Boolean> RenderCustomSkybox;
private final OptionInstance<Boolean> RenderCustomClouds;
private final OptionInstance<Boolean> RenderSunTranslucent;
private final OptionInstance<Boolean> RenderMoonTranslucent;
private final OptionInstance<Double> SunScale;
private final OptionInstance<Double> MoonScale;
public static String ResourcePath = "N/A";
public static final String ResourceFolderName = "HalsSkyboxMod_Resources";
public static final String CloudsFolderName = "Skybox_Clouds";
public static Path ResourceLocation;
public OptionInstance<Integer> CloudCount(){return CloudCount;}
public OptionInstance<Boolean> OpenCloudSprites(){return OpenCloudSprites;}
public OptionInstance<Integer> MaxVerticalAngle(){return MaxVerticalAngle;}
public OptionInstance<Integer> MinVerticalAngle(){return MinVerticalAngle;}
public OptionInstance<Double> MinCloudSpeed(){return MinCloudSpeed;}
public OptionInstance<Double> MaxCloudSpeed(){return MaxCloudSpeed;}
public OptionInstance<Double> MaxScale(){return MaxScale;}
public OptionInstance<Double> MinScale(){return MinScale;}
public OptionInstance<Double> SunScale(){return SunScale;}
public OptionInstance<Double> MoonScale(){return MoonScale;}
public OptionInstance<Boolean> OpenCloudImageButton(){return OpenCloudImageButton;}
public OptionInstance<Boolean> RenderCustomSun(){return RenderCustomSun;}
public OptionInstance<Boolean> RenderCustomMoon(){return RenderCustomMoon;}
public OptionInstance<Boolean> RenderCustomSkybox(){return RenderCustomSkybox;}
public OptionInstance<Boolean> RenderCustomClouds(){return RenderCustomClouds;}
public OptionInstance<Boolean> RenderSunTranslucent(){return RenderSunTranslucent;}
public OptionInstance<Boolean> RenderMoonTranslucent(){return RenderMoonTranslucent;}
public static Config Instance;
public Config(){
CloudCount = new OptionInstance<Integer>("hals_skybox_config.cloud_object_count", OptionInstance.noTooltip(), (caption, value) -> Component.literal(caption.getString() + ": " + value), (new OptionInstance.IntRange(0, 1024)).xmap((value) -> value, (value) -> value, true), Codec.intRange(0, 1024), CLOUD_COUNT.getAsInt(), (value) -> {
CLOUD_COUNT.set(value);
CLOUD_COUNT.save();
DistantSkyObject.RegenerateClouds();
});
MaxVerticalAngle = new OptionInstance<Integer>("hals_skybox_config.max_cloud_vertical_angle", OptionInstance.noTooltip(), (caption, value) -> Component.literal(""+ value), (new OptionInstance.IntRange(-180, 180)).xmap((value) -> value, (value) -> value, true), Codec.intRange(-180, 180), MAX_CLOUD_VERTICALE_ANGLE.getAsInt(), (value) -> {
MAX_CLOUD_VERTICALE_ANGLE.set(value);
MAX_CLOUD_VERTICALE_ANGLE.save();
DistantSkyObject.RegenerateClouds();
});
MinVerticalAngle = new OptionInstance<Integer>("hals_skybox_config.min_cloud_vertical_angle", OptionInstance.noTooltip(), (caption, value) -> Component.literal(caption.getString() + ": " + value), (new OptionInstance.IntRange(-180, 180)).xmap((value) -> value, (value) -> value, true), Codec.intRange(-180, 180), MIN_CLOUD_VERTICAL_ANGLE.getAsInt(), (value) -> {
MIN_CLOUD_VERTICAL_ANGLE.set(value);
MIN_CLOUD_VERTICAL_ANGLE.save();
DistantSkyObject.RegenerateClouds();
});
RenderCustomSun = new OptionInstance<Boolean>("hals_skybox_config.render_sun", OptionInstance.noTooltip(), (caption, value) -> Component.literal(""+ value), ( OptionInstance.BOOLEAN_VALUES), RENDER_SUN.getAsBoolean(), (value) -> {
RENDER_SUN.set(value);
RENDER_SUN.save();
});
RenderCustomMoon = new OptionInstance<Boolean>("hals_skybox_config.render_moon", OptionInstance.noTooltip(), (caption, value) -> Component.literal(""+ value), ( OptionInstance.BOOLEAN_VALUES), RENDER_MOON.getAsBoolean(), (value) -> {
RENDER_MOON.set(value);
RENDER_MOON.save();
});
RenderCustomSkybox = new OptionInstance<Boolean>("hals_skybox_config.render_skybox", OptionInstance.noTooltip(), (caption, value) -> Component.literal(""+ value), ( OptionInstance.BOOLEAN_VALUES), RENDER_SKYBOX.getAsBoolean(), (value) -> {
RENDER_SKYBOX.set(value);
RENDER_SKYBOX.save();
});
RenderCustomClouds = new OptionInstance<Boolean>("hals_skybox_config.render_clouds", OptionInstance.noTooltip(), (caption, value) -> Component.literal(""+ value), ( OptionInstance.BOOLEAN_VALUES), RENDER_CLOUDS.getAsBoolean(), (value) -> {
RENDER_CLOUDS.set(value);
RENDER_CLOUDS.save();
});
RenderSunTranslucent = new OptionInstance<Boolean>("hals_skybox_config.render_sun_translucent", OptionInstance.noTooltip(), (caption, value) -> Component.literal(""+ value), ( OptionInstance.BOOLEAN_VALUES), RENDER_SUN_TRANSLUCENCY.getAsBoolean(), (value) -> {
RENDER_SUN_TRANSLUCENCY.set(value);
RENDER_SUN_TRANSLUCENCY.save();
});
RenderMoonTranslucent = new OptionInstance<Boolean>("hals_skybox_config.render_moon_translucent", OptionInstance.noTooltip(), (caption, value) -> Component.literal(""+ value), ( OptionInstance.BOOLEAN_VALUES), RENDER_MOON_TRANSLUCENCY.getAsBoolean(), (value) -> {
RENDER_MOON_TRANSLUCENCY.set(value);
RENDER_MOON_TRANSLUCENCY.save();
});
OpenCloudSprites = new OptionInstance<Boolean>("hals_skybox_config.open_cloud_sprites", OptionInstance.noTooltip(), (caption, value) -> {return Component.literal("");},
OptionInstance.BOOLEAN_VALUES, false, (value) -> {
Path ResourcesDir = FMLPaths.GAMEDIR.get().resolve(ResourceFolderName);
Path Clouds = ResourcesDir.resolve(CloudsFolderName);
net.minecraft.client.Minecraft.getInstance().setScreen(
new SelectionScreen(Minecraft.getInstance().screen,Clouds.toFile())
);
});
MoonScale = new OptionInstance<Double>("hals_skybox_config.moon_scale", OptionInstance.noTooltip(), (caption, value) -> {
double realFloatValue = 1.0 + (value * (99));
return Component.literal(caption.getString() + ": " + String.format("%.2f", realFloatValue));
}, OptionInstance.UnitDouble.INSTANCE, (MOON_SCALE.getAsDouble() - 1.0)/99.0, (value) -> {
double realFloatValue = 1.0 + (value * (99));
MOON_SCALE.set((realFloatValue));
MOON_SCALE.save();
});
SunScale = new OptionInstance<Double>("hals_skybox_config.sun_scale", OptionInstance.noTooltip(), (caption, value) -> {
double realFloatValue = 1.0 + (value * (99));
return Component.literal(caption.getString() + ": " + String.format("%.2f", realFloatValue));
}, OptionInstance.UnitDouble.INSTANCE, (SUN_SCALE.getAsDouble() - 1.0)/99.0, (value) -> {
double realFloatValue = 1.0 + (value * (99));
SUN_SCALE.set((realFloatValue));
SUN_SCALE.save();
DistantSkyObject.RegenerateClouds();
});
MinScale = new OptionInstance<Double>("hals_skybox_config.min_cloud_scale", OptionInstance.noTooltip(), (caption, value) -> {
double realFloatValue = 1.0 + (value * (99));
return Component.literal(caption.getString() + ": " + String.format("%.2f", realFloatValue));
}, OptionInstance.UnitDouble.INSTANCE, (MIN_CLOUD_SCALE.getAsDouble() - 1.0)/99.0, (value) -> {
double realFloatValue = 1.0 + (value * (99));
MIN_CLOUD_SCALE.set((realFloatValue));
MIN_CLOUD_SCALE.save();
DistantSkyObject.RegenerateClouds();
});
MaxScale = new OptionInstance<Double>("hals_skybox_config.max_cloud_scale", OptionInstance.noTooltip(), (caption, value) -> {
double realFloatValue = 1.0 + (value * (99));
return Component.literal(caption.getString() + ": " + String.format("%.2f", realFloatValue));
}, OptionInstance.UnitDouble.INSTANCE, (MAX_CLOUD_SCALE.getAsDouble() - 1.0)/99.0, (value) -> {
double realFloatValue = 1.0 + (value * (99));
MAX_CLOUD_SCALE.set((realFloatValue));
MAX_CLOUD_SCALE.save();
DistantSkyObject.RegenerateClouds();
});
MinCloudSpeed = new OptionInstance<Double>("hals_skybox_config.min_cloud_speed", OptionInstance.noTooltip(), (caption, value) -> {
double realFloatValue = -1.0 + (value * (2));
return Component.literal(caption.getString() + ": " + String.format("%.2f", realFloatValue));
}, OptionInstance.UnitDouble.INSTANCE, (MIN_CLOUD_SPEED.getAsDouble() + 1.0)/2.0, (value) -> {
double realFloatValue = -1.0 + (value * (2));
MIN_CLOUD_SPEED.set((realFloatValue));
MIN_CLOUD_SPEED.save();
DistantSkyObject.RegenerateClouds();
});
MaxCloudSpeed = new OptionInstance<Double>("hals_skybox_config.max_cloud_speed", OptionInstance.noTooltip(), (caption, value) -> {
double realFloatValue = -1.0 + (value * (2));
return Component.literal(caption.getString() + ": " + String.format("%.2f", realFloatValue));
}, OptionInstance.UnitDouble.INSTANCE, (MAX_CLOUD_SPEED.getAsDouble() + 1.0)/2.0, (value) -> {
double realFloatValue = -1.0 + (value * (2));
MAX_CLOUD_SPEED.set((realFloatValue));
MAX_CLOUD_SPEED.save();
DistantSkyObject.RegenerateClouds();
});
Instance = this;
OpenCloudImageButton = new OptionInstance<Boolean>("hals_skybox_config.open_cloud_images_location", OptionInstance.noTooltip(), (caption, value) -> {return Component.literal("");},
OptionInstance.BOOLEAN_VALUES, false, (value) -> {
Path ResourcesDir = FMLPaths.GAMEDIR.get().resolve(ResourceFolderName);
Path Clouds = ResourcesDir.resolve(CloudsFolderName);
if(!Files.isDirectory(Clouds)) {
try {
Files.createDirectories(Clouds);
} catch (Exception e) {
SkyboxMod.LOGGER.error("Failed to create Clouds directory", e);
return;
}
}
Util.getPlatform().openFile(Clouds.toFile());
});
if(RESOURCE_LOCATION.get() == ResourceLocations.GAME_DIR){
Path ResourcesDir = FMLPaths.GAMEDIR.get().resolve(ResourceFolderName);
if(!Files.isDirectory(ResourcesDir)){
try {
Files.createDirectories(ResourcesDir);
SkyboxMod.LOGGER.info("Successfully created folder: {}", ResourcesDir);
} catch (IOException e) {
SkyboxMod.LOGGER.error("Failed to create ResourcesDir directory", e);
RESOURCE_LOCATION.set(ResourceLocations.IDENTIFIERS);
return;
}
}
ResourceLocation = ResourcesDir;
Path Clouds = ResourcesDir.resolve(CloudsFolderName);
if(!Files.isDirectory(Clouds)){
try {
Files.createDirectories(Clouds);
SkyboxMod.LOGGER.info("Successfully created folder: {}", ResourcesDir);
Identifier[] clouds = new Identifier[EmbeddedCloudTextures.length];
for(int i = 0; i < EmbeddedCloudTextures.length; i++){
clouds[i] = Identifier.parse(EmbeddedCloudTextures[i]);
Optional<Resource> resource = Minecraft.getInstance().getResourceManager().getResource(clouds[i]);
if (resource.isPresent()) {
Path targetFile = Clouds.resolve(clouds[i].getPath().replace("/", "_"));
try (InputStream stream = resource.get().open()) {
//if(Files.notExists(targetFile))Files.createFile(targetFile);
Files.copy(stream, targetFile, StandardCopyOption.REPLACE_EXISTING);
System.out.println("Successfully saved asset to: " + targetFile.toAbsolutePath());
} catch (IOException e) {
SkyboxMod.LOGGER.error("Failed to something or other: ",e);
RESOURCE_LOCATION.set(ResourceLocations.IDENTIFIERS);
return;
}
}
}
} catch (IOException e) {
SkyboxMod.LOGGER.error("Failed to create Clouds directory", e);
RESOURCE_LOCATION.set(ResourceLocations.IDENTIFIERS);
return;
}
}
}
}
public List<Identifier> GetAndLoadAllCloudFiles(){
Path ResourcesDir = FMLPaths.GAMEDIR.get().resolve(ResourceFolderName);
Path Clouds = ResourcesDir.resolve(CloudsFolderName);
List<Identifier> CloudFiles = new ArrayList<>();
try (Stream<Path> stream = Files.walk(Clouds)) {
List<Path> files = stream
.filter(Files::isRegularFile)
.collect(Collectors.toList());
files.forEach(cloudfile->{
if(cloudfile.endsWith(".png")) {
File texture = cloudfile.toFile();
Identifier loadedTexture = registerExternalTexture(texture);
CloudFiles.add(loadedTexture);
}
});
} catch (IOException e) {
e.printStackTrace();
}
return CloudFiles;
}
public List<Identifier> GetAllClouds(){
List<? extends String> paths = CLOUD_PATHS.get();
List<Identifier> loadedAssets = new ArrayList<>();
if(RESOURCE_LOCATION.get() == ResourceLocations.GAME_DIR){
Path ResourcesDir = FMLPaths.GAMEDIR.get().resolve(ResourceFolderName);
Path Clouds = ResourcesDir.resolve(CloudsFolderName);
paths.forEach((path)->{
File texture = Clouds.resolve(path.replace('/','_')).toFile();
Identifier loadedTexture = registerExternalTexture(texture);
loadedAssets.add(loadedTexture);
});
} else{
paths.forEach(path->{
loadedAssets.add(Identifier.parse(path));
});
}
return loadedAssets;
}
public static int loadedTexture = 0;
public static Map<File, Identifier> LoadedTextureMap = new LinkedHashMap<>();
public static Identifier registerExternalTexture(File imageFile) {
if(LoadedTextureMap.containsKey( imageFile)) return LoadedTextureMap.get(imageFile);
Identifier location = Identifier.fromNamespaceAndPath(SkyboxMod.MODID, "external_textures/loaded_texture_" + loadedTexture);
try (InputStream stream = new FileInputStream(imageFile)) {
NativeImage nativeImage = NativeImage.read(stream);
DynamicTexture dynamicTexture = new DynamicTexture(()->"loaded_texture_" + loadedTexture,nativeImage);
loadedTexture++;
Minecraft.getInstance().getTextureManager().register(location, dynamicTexture);
LoadedTextureMap.put(imageFile, location);
return location;
} catch (IOException e) {
SkyboxMod.LOGGER.error("Failed to load texture: ",e);
return Identifier.fromNamespaceAndPath(SkyboxMod.MODID, "textures/no_texture.png");
}
}
public File getAssetAsFile(Identifier location) throws IOException {
var resourceManager = Minecraft.getInstance().getResourceManager();
var resource = resourceManager.getResource(location)
.orElseThrow(() -> new FileNotFoundException("Asset not found: " + location));
try (InputStream stream = resource.open()) {
File tempFile = File.createTempFile("asset_", "_" + location.getPath().replace("/", "_"));
tempFile.deleteOnExit();
Files.copy(stream, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
return tempFile;
}
}
private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder();
public static final ModConfigSpec.IntValue CLOUD_COUNT = BUILDER
.comment("how many clouds to render in the sky")
.defineInRange("cloud_count", 128, 0, 1024);
public static final ModConfigSpec.DoubleValue MIN_CLOUD_SPEED = BUILDER
.comment("the slowest cloud")
.defineInRange("min_cloud_speed", 0.05, -1f, 1f);
public static final ModConfigSpec.DoubleValue MAX_CLOUD_SPEED = BUILDER
.comment("the fastest cloud")
.defineInRange("max_cloud_speed", 0.15, -1f, 1f);
public static final ModConfigSpec.DoubleValue MIN_CLOUD_SCALE = BUILDER
.comment("how small (in blocks) the clouds can render")
.defineInRange("min_cloud_scale", 2, 1f, 100f);
public static final ModConfigSpec.DoubleValue MAX_CLOUD_SCALE = BUILDER
.comment("how large (in blocks) the clouds can render")
.defineInRange("max_cloud_scale", 14, 1f, 100f);
public static final ModConfigSpec.DoubleValue SUN_SCALE = BUILDER
.comment("how large (in blocks) the sun can render")
.defineInRange("sun_scale", 22.5, 1f, 100f);
public static final ModConfigSpec.DoubleValue MOON_SCALE = BUILDER
.comment("how large (in blocks) the moon can render")
.defineInRange("moon_scale", 22.5, 1f, 100f);
public static final ModConfigSpec.IntValue MIN_CLOUD_VERTICAL_ANGLE = BUILDER
.comment("how Low in the sky it can render")
.defineInRange("min_cloud_vert_angle", -130, -180, 180);
public static final ModConfigSpec.IntValue MAX_CLOUD_VERTICALE_ANGLE = BUILDER
.comment("how high in the sky it can render")
.defineInRange("max_cloud_vert_angle", -70, -180, 180);
public static final ModConfigSpec.BooleanValue RENDER_SUN = BUILDER
.comment("render custom sun texture and pipeline")
.define("render_custom_sun", true);
public static final ModConfigSpec.BooleanValue RENDER_SUN_TRANSLUCENCY = BUILDER
.comment("render custom sun as a translucent object, this makes it have absolute colour with working transparency")
.define("render_custom_sun_pipeline", false);
public static final ModConfigSpec.BooleanValue RENDER_MOON = BUILDER
.comment("render custom moon texture and pipeline")
.define("render_custom_moon", true);
public static final ModConfigSpec.BooleanValue RENDER_MOON_TRANSLUCENCY = BUILDER
.comment("render custom moon as a translucent object, this makes it have absolute colour with working transparency")
.define("render_custom_moon_pipeline", true);
public static final ModConfigSpec.BooleanValue RENDER_SKYBOX = BUILDER
.comment("render custom Skybox")
.define("render_custom_skybox", true);
public static final ModConfigSpec.BooleanValue RENDER_CLOUDS = BUILDER
.comment("render custom cloud textures and pipeline")
.define("render_custom_clouds", true);
public enum ResourceLocations{
GAME_DIR,
IDENTIFIERS,
}
public static final ModConfigSpec.EnumValue<ResourceLocations> RESOURCE_LOCATION = BUILDER
.comment("where the asset folders are located")
.defineEnum("resource_location", ResourceLocations.GAME_DIR);
public static final ModConfigSpec.ConfigValue<List<? extends String>> CLOUD_PATHS = BUILDER
.comment("A list of items to log on common setup.")
.defineListAllowEmpty("cloud_paths", List.of("textures/cloud2.png","textures/cloud3.png","textures/smallcloud1.png","textures/smallcloud2.png","textures/smallcloud3.png"), () -> "", Config::ValidateCloudPath);
private static final String[] EmbeddedCloudTextures = new String[]{"hals_skybox_mod:textures/cloud2.png","hals_skybox_mod:textures/cloud3.png","hals_skybox_mod:textures/smallcloud1.png","hals_skybox_mod:textures/smallcloud2.png","hals_skybox_mod:textures/smallcloud3.png"};
static final ModConfigSpec SPEC = BUILDER.build();
private static boolean ValidateCloudPath(final Object obj) {
return obj instanceof String itemName && Identifier.isValidPath(itemName);
}
public static final ModConfigSpec.ConfigValue<List<? extends String>> ITEM_STRINGS = BUILDER
.comment("A list of items to log on common setup.")
.defineListAllowEmpty("items", List.of("minecraft:iron_ingot"), () -> "", Config::validateItemName);
private static boolean validateItemName(final Object obj) {
return obj instanceof String itemName && BuiltInRegistries.ITEM.containsKey(Identifier.parse(itemName));
}
}
@@ -0,0 +1,69 @@
package net.halbear.skyboxmod;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent;
import net.neoforged.neoforge.network.handling.IPayloadHandler;
import net.neoforged.neoforge.network.registration.PayloadRegistrar;
import org.slf4j.Logger;
import com.mojang.logging.LogUtils;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.level.block.Blocks;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.config.ModConfig;
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.BuildCreativeModeTabContentsEvent;
import net.neoforged.neoforge.event.server.ServerStartingEvent;
import java.util.HashMap;
import java.util.Map;
import static net.halbear.skyboxmod.rendering.skybox.DistantSkyObject.RegenerateClouds;
@Mod(value = SkyboxMod.MODID, dist = Dist.CLIENT)
public class SkyboxMod {
public static final String MODID = "hals_skybox_mod";
public static final Logger LOGGER = LogUtils.getLogger();
public SkyboxMod(IEventBus modEventBus, ModContainer modContainer) {
// Register the commonSetup method for modloading
modEventBus.addListener(this::commonSetup);
NeoForge.EVENT_BUS.register(this);
modEventBus.addListener(this::addCreative);
modContainer.registerConfig(ModConfig.Type.COMMON, Config.SPEC);
}
private void commonSetup(FMLCommonSetupEvent event) {
// Some common setup code
LOGGER.info("HELLO FROM COMMON SETUP");
new Config();
}
// Add the example block item to the building blocks tab
private void addCreative(BuildCreativeModeTabContentsEvent event) {
}
// You can use SubscribeEvent and let the Event Bus discover methods to call
@SubscribeEvent
public void onServerStarting(ServerStartingEvent event) {
// Do something when the server starts
LOGGER.info("HELLO from server starting");
}
}
@@ -0,0 +1,31 @@
package net.halbear.skyboxmod;
import net.minecraft.client.Minecraft;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.event.lifecycle.FMLClientSetupEvent;
import net.neoforged.neoforge.client.gui.ConfigurationScreen;
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
// This class will not load on dedicated servers. Accessing client side code from here is safe.
@Mod(value = SkyboxMod.MODID, dist = Dist.CLIENT)
// You can use EventBusSubscriber to automatically register all static methods in the class annotated with @SubscribeEvent
@EventBusSubscriber(modid = SkyboxMod.MODID, value = Dist.CLIENT)
public class SkyboxModClient {
public SkyboxModClient(ModContainer container) {
// Allows NeoForge to create a config screen for this mod's configs.
// The config screen is accessed by going to the Mods screen > clicking on your mod > clicking on config.
// Do not forget to add translations for your config options to the en_us.json file.
container.registerExtensionPoint(IConfigScreenFactory.class, ConfigurationScreen::new);
}
@SubscribeEvent
static void onClientSetup(FMLClientSetupEvent event) {
// Some client setup code
SkyboxMod.LOGGER.info("HELLO FROM CLIENT SETUP");
SkyboxMod.LOGGER.info("MINECRAFT NAME >> {}", Minecraft.getInstance().getUser().getName());
}
}
@@ -0,0 +1,53 @@
package net.halbear.skyboxmod.rendering.screen;
import net.halbear.skyboxmod.Config;
import net.halbear.skyboxmod.SkyboxMod;
import net.minecraft.client.OptionInstance;
import net.minecraft.client.Options;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.options.OptionsSubScreen;
import net.minecraft.network.chat.Component;
public class ConfigScreen extends OptionsSubScreen {
private final Screen lastScreen;
private static OptionInstance<?>[] CloudOptions(Options options) {
return new OptionInstance[]{Config.Instance.MinCloudSpeed(),Config.Instance.MaxCloudSpeed(), Config.Instance.MinScale(),Config.Instance.MaxScale(), Config.Instance.MinVerticalAngle(),Config.Instance.MaxVerticalAngle()};
}
private static OptionInstance<?>[] CelestialOptions(Options options) {
return new OptionInstance[]{Config.Instance.SunScale(),Config.Instance.MoonScale()};
}
private static OptionInstance<?>[] GeneralOptions(Options options) {
return new OptionInstance[]{Config.Instance.RenderCustomSun(),Config.Instance.RenderCustomMoon(),Config.Instance.RenderCustomSkybox(),Config.Instance.RenderCustomClouds()};
}
public ConfigScreen(Screen lastScreen,Options options) {
SkyboxMod.LOGGER.debug("screen!");
super(lastScreen,options,Component.literal("Skybox Configuration"));
this.lastScreen = lastScreen;
}
@Override
protected void addOptions() {
this.list.addHeader(Component.translatable("hals_skybox_config.general_header"));
this.list.addSmall(GeneralOptions(this.options));
this.list.addHeader(Component.translatable("hals_skybox_config.celestial_header"));
this.list.addSmall(CelestialOptions(this.options));
this.list.addBig(Config.Instance.RenderSunTranslucent());
this.list.addBig(Config.Instance.RenderMoonTranslucent());
this.list.addHeader(Component.translatable("hals_skybox_config.cloud_header"));
this.list.addBig(Config.Instance.CloudCount());
this.list.addSmall(CloudOptions(this.options));
this.list.addBig(Config.Instance.OpenCloudSprites());
this.list.addBig(Config.Instance.OpenCloudImageButton());
}
@Override
public void onClose() {
this.minecraft.setScreen(this.lastScreen);
}
}
@@ -0,0 +1,169 @@
package net.halbear.skyboxmod.rendering.screen;
import net.halbear.skyboxmod.SkyboxMod;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphicsExtractor;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.ObjectSelectionList;
import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.packs.TransferableSelectionList;
import net.minecraft.client.input.MouseButtonEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.Identifier;
import net.minecraft.util.Util;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.neoforged.neoforge.client.event.ContainerScreenEvent;
import net.neoforged.neoforge.client.event.ScreenEvent;
import net.neoforged.neoforge.common.NeoForge;
import org.jspecify.annotations.NonNull;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class SelectionScreen extends Screen {
private final Screen lastScreen;
private final File targetDirectory;
private final List<String> availableItems = new ArrayList<>(List.of("Test1", "Test2", "Test3", "Test4"));
private final List<String> selectedItems = new ArrayList<>(List.of("Test5"));
private SelectionPanelList leftList;
private SelectionPanelList rightList;
public SelectionScreen(Screen lastScreen, File targetDirectory) {
super(Component.literal("Select Custom Options"));
this.lastScreen = lastScreen;
this.targetDirectory = targetDirectory;
}
@Override
protected void init() {
super.init();
int listWidth = 170;
int listHeight = this.height - 80;
this.leftList = new SelectionPanelList(this.minecraft, listWidth, listHeight,40,24 );
this.leftList.setX(this.width / 2 - 180);
this.rightList = new SelectionPanelList(this.minecraft, listWidth, listHeight,40,24);
this.rightList.setX(this.width / 2 + 10);
refreshListData();
this.addRenderableWidget(this.leftList);
this.addRenderableWidget(this.rightList);
this.addRenderableWidget(Button.builder(
Component.literal("Done"),
button -> this.onClose()
).bounds(this.width / 2 - 75, this.height - 32, 150, 20).build());
}
private void refreshListData() {
this.leftList.clearEntries();
this.rightList.clearEntries();
for (String item : availableItems) {
this.leftList.AddEntry(new TextRowEntry(item, true,this));
}
for (String item : selectedItems) {
this.rightList.AddEntry(new TextRowEntry(item, false,this));
}
}
@Override
public void extractBackground(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick) {
super.extractBackground(guiGraphics, mouseX, mouseY, partialTick);
}
@Override
public void extractRenderState(GuiGraphicsExtractor guiGraphicsExtractor, int mouseX, int mouseY, float partialTick){
super.extractRenderState(guiGraphicsExtractor,mouseX,mouseY,partialTick);
guiGraphicsExtractor.pose().pushMatrix();
guiGraphicsExtractor.text(this.font, this.title, this.width / 2 - this.font.width(this.title)/2, 8, 0xFFFFFF,false);
guiGraphicsExtractor.text(this.font, "Drag and drop sprites inside...", this.width / 2 - this.font.width("Drag and drop sprites inside...")/2, 20, 0x808080,false);
guiGraphicsExtractor.pose().popMatrix();
// NeoForge.EVENT_BUS.post(new ScreenEvent.Render.Post(this,guiGraphicsExtractor, mouseX, mouseY,partialTick));
SkyboxMod.LOGGER.debug("\n this font: " + this.font + "\n this width:" + this.width + "\n this Title: " + this.title + "\n this title width: " + this.font.width(this.title));
}
@Override
public void onClose() {
this.minecraft.setScreen(this.lastScreen);
}
private class SelectionPanelList extends ObjectSelectionList<TextRowEntry> {
public SelectionPanelList(Minecraft minecraft, int width, int height, int y, int itemHeight) {
super(minecraft, width, height, y, itemHeight);
}
public void AddEntry(TextRowEntry entry){
this.addEntry(entry);
}
public void ClearChildren(){
this.clearEntries();
}
}
private class TextRowEntry extends ObjectSelectionList.Entry<TextRowEntry> {
private final String textValue;
private final Button transferButton;
private final SelectionScreen Parent;
public TextRowEntry(String value, boolean isAvailableSide, SelectionScreen Parent) {
this.Parent = Parent;
this.textValue = value;
String buttonSymbol = isAvailableSide ? "" : "";
this.transferButton = Button.builder(Component.literal(buttonSymbol), button -> {
if (isAvailableSide) {
availableItems.remove(textValue);
selectedItems.add(textValue);
} else {
selectedItems.remove(textValue);
availableItems.add(textValue);
}
refreshListData();
}).bounds(0, 0, 20, 20).build();
}
@Override
public void extractContent(@NonNull GuiGraphicsExtractor graphics, int mouseX, int mouseY, boolean isHovered, float partialTick) {
int left = this.getX();
int top = this.getY();
int rowWidth = this.getWidth();
int rowHeight = this.getHeight();
graphics.pose().pushMatrix();
graphics.pose().translate((float)left, (float)top);
this.transferButton.extractRenderState(graphics, mouseX, mouseY, partialTick);
SkyboxMod.LOGGER.debug("\n this font: " + Parent.getFont() + "\n this rowWidth:" + rowWidth + "\n this Text: " + this.textValue + "\n this Position: " + left +"_"+top);
graphics.blit( Identifier.fromNamespaceAndPath(SkyboxMod.MODID, "textures/no_texture.png"),0, 0,0 + 20, 0 + 20,0,1,0,1);
graphics.text(Parent.getFont(), this.textValue, 0 + 4, 0 + 6, 0xFFFFFF, true);
graphics.pose().popMatrix();
}
@Override
public boolean mouseClicked(MouseButtonEvent event, boolean doubleclicked) {
if (this.transferButton.mouseClicked(event, doubleclicked)) {
return true;
}
return super.mouseClicked(event, doubleclicked);
}
@Override
public Component getNarration() {
return Component.literal(this.textValue);
}
}
}
@@ -0,0 +1,238 @@
package net.halbear.skyboxmod.rendering.skybox;
import com.mojang.blaze3d.buffers.GpuBuffer;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.*;
import net.halbear.skyboxmod.Config;
import net.halbear.skyboxmod.SkyboxMod;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.AbstractTexture;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import org.joml.Vector3f;
import org.joml.Vector4f;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static net.halbear.skyboxmod.rendering.skybox.SkyBoxRendering.*;
public class DistantSkyObject {
public static Map<Double, GpuBuffer> SkyObjectMeshMap = new HashMap<>();
public static Map<String, DistantSkyObject> SkyObjectRegistry = new HashMap<>();
public static Map<ResourceKey, List<String>> ObjectsMappedToDimension = new HashMap<>();
public static float DayAlpha = 1.0f;
public static float NightAlpha = 0.0f;
public static void RegenerateClouds(){
SkyObjectRegistry.clear();
ObjectsMappedToDimension.clear();
TextureManager textureManager = Minecraft.getInstance().getTextureManager();
Identifier[] clouds = Config.Instance.GetAllClouds().toArray(new Identifier[0]);
double[] aspectRatios = new double[clouds.length];
for(int i = 0; i < clouds.length; i++){
SkyboxMod.LOGGER.debug(clouds[i].getPath());
AbstractTexture texture = textureManager.getTexture(clouds[i]);
int width = texture.getTexture().getWidth(0);
int height = texture.getTexture().getHeight(0);
if(width != 0 && height != 0) {
aspectRatios[i] = (double)width/(double)height;
}
}
for(int i = 0; i < Config.CLOUD_COUNT.getAsInt(); i++){
int Index = (int)Math.min(clouds.length * Math.random(), clouds.length - 1);
String name = "Cloud"+ i;
double MinSpeed = Config.MIN_CLOUD_SPEED.getAsDouble();
double MaxSpeed = Config.MAX_CLOUD_SPEED.getAsDouble();
float Speed = (float)(MinSpeed + (MaxSpeed - MinSpeed) *Math.random());
DistantSkyObject.Action TickUpdateAction = new DistantSkyObject.Action() {
@Override
public void execute() {
DistantSkyObject object = DistantSkyObject.SkyObjectRegistry.get(name);
object.AddHorizontalDegrees(Speed);
float DayAlpha = DistantSkyObject.DayAlpha;
float NightAlpha = DistantSkyObject.NightAlpha;
object.GetColourModifiers().set(0.75 + (DayAlpha * 0.25f) - (NightAlpha * 0.65f),0.35 + (DayAlpha * 0.65f) - (NightAlpha * 0.25f),0.25 + (DayAlpha * 0.75f) - (NightAlpha * 0.1f),1);
}
};
double MinCloudScale = Config.MIN_CLOUD_SCALE.getAsDouble();
double MaxCloudScale = Config.MAX_CLOUD_SCALE.getAsDouble();
float Scale = (float)(MinCloudScale + (Math.random() * (MaxCloudScale - MinCloudScale)));
double MinCloudAngle = (double)Config.MIN_CLOUD_VERTICAL_ANGLE.getAsInt();
double MaxCloudAngle = (double)Config.MAX_CLOUD_VERTICALE_ANGLE.getAsInt();
new DistantSkyObject(name, clouds[Index], aspectRatios[Index],
(float)Math.toRadians(360*Math.random()),(float)Math.toRadians(MinCloudAngle + ((MaxCloudAngle - MinCloudAngle) * Math.random())),
new Vector3f(0,100,0),new Vector3f(-Scale,-1,Scale),new Vector4f(1,1,1,1))
.AddToDimension(OVERWORLD)
.OverrideTickFunction(TickUpdateAction)
.Cloud();
}
}
public static void TickUpdate(ResourceKey Dimension){
Minecraft minecraft = Minecraft.getInstance();
long time = minecraft.level != null ? minecraft.level.getOverworldClockTime() % 24000 : 0;
DayAlpha = getDayAlpha(time);
NightAlpha = getNightAlpha(time);
List<DistantSkyObject> objects = GetAllObjectsInDimenstion(Dimension);
for(int i = 0; i < objects.size(); i++){
objects.get(i).TickUpdate();
}
}
public static List<DistantSkyObject> GetAllObjectsInDimenstion(ResourceKey Dimension){
List<String> Keys = ObjectsMappedToDimension.get(Dimension);
if(Keys == null || Keys.isEmpty()) return new ArrayList<DistantSkyObject>();
List<DistantSkyObject> objectsInDimentsion = new ArrayList<>();
for(int i = 0; i < Keys.size(); i++){
if(SkyObjectRegistry.containsKey(Keys.get(i)))objectsInDimentsion.add(SkyObjectRegistry.get(Keys.get(i)));
}
return objectsInDimentsion;
}
@FunctionalInterface
public interface Action {
void execute();
}
private static GpuBuffer CreateMeshBuffer(double AspectRatio, float MeshScale, String ObjectName) {
VertexFormat format = DefaultVertexFormat.POSITION_TEX;
float Multipler = (float)AspectRatio;
try (ByteBufferBuilder byteBufferBuilder = ByteBufferBuilder.exactlySized(4 * format.getVertexSize())) {
BufferBuilder bufferBuilder = new BufferBuilder(byteBufferBuilder, VertexFormat.Mode.QUADS, format);
bufferBuilder.addVertex( MeshScale * Multipler, 0.0F, MeshScale).setUv(0.0F, 0.0F);
bufferBuilder.addVertex( -MeshScale * Multipler, 0.0F, MeshScale).setUv(1.0F, 0.0F);
bufferBuilder.addVertex( -MeshScale * Multipler, 0.0F, -MeshScale).setUv( 1.0F, 1.0F);
bufferBuilder.addVertex( MeshScale * Multipler, 0.0F, -MeshScale).setUv( 0.0F, 1.0F);
try (MeshData mesh = bufferBuilder.buildOrThrow()) {
return RenderSystem.getDevice().createBuffer(() -> "Age of the Gods " + ObjectName +" Pass", 32, mesh.vertexBuffer());
}
}
}
public enum ObjectType{
Cloud,
SkyObject
}
private Identifier textureID;
private double aspectRatio;
private float HAngle;
private float VAngle;
private final String Name;
private float NextHAngleAddition = 0;
private float NextVAngleAddition = 0;
private float PartialHAngle = HAngle;
private float PartialVAngle = VAngle;
private final Vector3f Translate;
private final Vector3f Scale;
private final Vector4f ColourModifiers;
private ObjectType type;
private Action ExecuteOnTick = new Action() {
@Override
public void execute() {
}
};
public DistantSkyObject Cloud(){
this.type = ObjectType.Cloud;
return this;
}
public DistantSkyObject SkyObject(){
this.type = ObjectType.SkyObject;
return this;
}
public DistantSkyObject AddToDimension(ResourceKey Dimension){
if(!ObjectsMappedToDimension.containsKey(Dimension)){
ObjectsMappedToDimension.put(Dimension, new ArrayList<String>());
}
ObjectsMappedToDimension.get(Dimension).add(Name);
return this;
}
public DistantSkyObject RemoveFromDimension(ResourceKey Dimension){
if(ObjectsMappedToDimension.containsKey(Dimension)){
ObjectsMappedToDimension.get(Dimension).remove(Name);
}
return this;
}
public DistantSkyObject TickUpdate(){
HAngle += NextHAngleAddition;
NextHAngleAddition = 0;
VAngle += NextVAngleAddition;
NextVAngleAddition = 0;
ExecuteOnTick.execute();
return this;
}
public DistantSkyObject PartialTick(double PartialTick){
PartialHAngle = HAngle + (NextHAngleAddition * Math.clamp((float) PartialTick, 0, 1));
PartialVAngle = VAngle + (NextVAngleAddition * Math.clamp((float) PartialTick, 0, 1));
return this;
}
public DistantSkyObject OverrideTickFunction(Action newAction){
ExecuteOnTick = newAction;
return this;
}
public DistantSkyObject GenerateBufferIfNonExistant(){
if(!SkyObjectMeshMap.containsKey(aspectRatio)){
GpuBuffer newMeshBuffer = CreateMeshBuffer(aspectRatio, 1f, Name);
SkyObjectMeshMap.put(aspectRatio, newMeshBuffer);
}
return this;
}
public GpuBuffer GetMeshBuffer(){
GenerateBufferIfNonExistant();
return SkyObjectMeshMap.get(aspectRatio);
}
public DistantSkyObject(String Name, Identifier TextureID, double AspectRatio, float HorizontalAngleRad, float VerticalAngleRad, Vector3f Translate, Vector3f Scale, Vector4f ColourModifiers){
this.Name = Name;
if(!SkyObjectRegistry.containsKey(Name)) SkyObjectRegistry.put(Name, this);
this.Translate = Translate;
this.Scale = Scale;
this.ColourModifiers = ColourModifiers;
this.textureID = TextureID;
this.aspectRatio = AspectRatio;
this.HAngle = HorizontalAngleRad;
this.VAngle = VerticalAngleRad;
PartialHAngle = HAngle;
PartialVAngle = VAngle;
}
public void AddVerticalDegrees(float degrees){
float Angle = GetVerticalAngleDegrees();
Angle = (Angle + degrees) % 360;
VAngle = (float)Math.toRadians(Angle);
}
public void AddHorizontalDegrees(float degrees){
float Angle = GetHorizontalAngleDegrees();
Angle = (Angle + degrees) % 360;
HAngle = (float)Math.toRadians(Angle);
}
public Vector4f GetColourModifiers(){return ColourModifiers;}
public Vector3f GetScale(){return Scale;}
public Vector3f GetTranslate(){return Translate;}
public String GetName(){return Name;}
public double GetAspectRatio(){return aspectRatio;}
public Identifier GetTextureID(){return textureID;}
public float GetHorizontalAngleDegrees(){return (float)Math.toDegrees(HAngle);}
public float GetHorizontalAngle(){return PartialHAngle;}
public float GetRawHorizontalAngle(){return HAngle;}
public float GetVerticalAngleDegrees(){return (float)Math.toDegrees(VAngle);}
public float GetVerticalAngle(){return PartialVAngle;}
public float GetRawVerticalAngle(){return VAngle;}
}
@@ -0,0 +1,249 @@
package net.halbear.skyboxmod.rendering.skybox;
import com.mojang.blaze3d.buffers.GpuBuffer;
import com.mojang.blaze3d.buffers.GpuBufferSlice;
import com.mojang.blaze3d.pipeline.RenderPipeline;
import com.mojang.blaze3d.systems.RenderPass;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.textures.GpuTextureView;
import com.mojang.blaze3d.vertex.*;
import com.mojang.math.Axis;
import net.halbear.skyboxmod.Config;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderPipelines;
import net.minecraft.client.renderer.state.level.SkyRenderState;
import net.minecraft.client.renderer.texture.AbstractTexture;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.client.event.RenderLevelStageEvent;
import org.joml.Matrix4f;
import org.joml.Matrix4fStack;
import org.joml.Vector3f;
import org.joml.Vector4f;
import java.util.List;
import java.util.OptionalDouble;
import java.util.OptionalInt;
import static net.halbear.skyboxmod.rendering.skybox.DistantSkyObject.RegenerateClouds;
@EventBusSubscriber(Dist.CLIENT)
public class SkyBoxRendering {
public static RenderPipeline CUSTOM_SKYBOX_PIPELINE;
public static boolean CloudsRegistered = false;
private static GpuBuffer sunBuffer;
private static GpuBuffer moonBuffer;
private static GpuBuffer skyboxBuffer;
public static final ResourceKey OVERWORLD = ResourceKey.create(Registries.DIMENSION, Identifier.parse("minecraft:overworld"));
public static final Identifier OVERWORLD_DAY_SKYBOX = Identifier.parse("hals_skybox_mod:textures/skybox/skyboxcubemapday.png");
public static final Identifier OVERWORLD_DUSK_SKYBOX = Identifier.parse("hals_skybox_mod:textures/skybox/cubemaptransitionskybox.png");
public static final Identifier OVERWORLD_NIGHT_SKYBOX = Identifier.parse("hals_skybox_mod:textures/skybox/cubemapnightskybox.png");
public static final Identifier OVERWORLD_SUN = Identifier.parse("hals_skybox_mod:textures/suntexture.png");
public static final Identifier OVERWORLD_MOON = Identifier.parse("hals_skybox_mod:textures/moontexture.png");
private static void initBuffers() {
if (sunBuffer == null)
sunBuffer = buildCelestialBuffer(1.0f, "Sun");
if (moonBuffer == null)
moonBuffer = buildCelestialBuffer(1.0f, "Moon");
if (skyboxBuffer == null)
skyboxBuffer = buildSkyboxBuffer();
}
@SubscribeEvent
public static void renderSky(RenderLevelStageEvent.AfterSky event) {
if(!CloudsRegistered){
DistantSkyObject.RegenerateClouds();
CloudsRegistered = true;
}
Minecraft minecraft = Minecraft.getInstance();
if (minecraft.player == null)
return;
if (minecraft.player.level().dimension() == OVERWORLD) {
if(Config.RENDER_SKYBOX.getAsBoolean()) {
renderCustomSkybox(event, OVERWORLD_DAY_SKYBOX, OVERWORLD_NIGHT_SKYBOX, OVERWORLD_DUSK_SKYBOX);
}
if(Config.RENDER_SUN.getAsBoolean())renderCustomSun(event, OVERWORLD_SUN);
if(Config.RENDER_MOON.getAsBoolean())renderCustomMoon(event, OVERWORLD_MOON);
}
List<DistantSkyObject> SkyObjects = DistantSkyObject.GetAllObjectsInDimenstion(minecraft.player.level().dimension());
if(!SkyObjects.isEmpty() && Config.RENDER_CLOUDS.getAsBoolean()){
for (DistantSkyObject object : SkyObjects) {
object.PartialTick(minecraft.getDeltaTracker().getGameTimeDeltaPartialTick(false));
render2DObjectInSkybox(event, object.GetTextureID(), object.GetName(),object.GetHorizontalAngle(),object.GetVerticalAngle(),object.GetTranslate(),object.GetScale(),object.GetColourModifiers(),object.GetMeshBuffer(), CUSTOM_SKYBOX_PIPELINE);
}
}
}
private static void addSkyboxFace(BufferBuilder bufferBuilder, float x1, float y1, float z1, float u1, float v1, float x2, float y2, float z2, float u2, float v2, float x3, float y3, float z3, float u3, float v3, float x4, float y4, float z4,
float u4, float v4, int colour) {
bufferBuilder.addVertex(x1, y1, z1).setUv(u1, v1).setColor(colour);
bufferBuilder.addVertex(x2, y2, z2).setUv(u2, v2).setColor(colour);
bufferBuilder.addVertex(x3, y3, z3).setUv(u3, v3).setColor(colour);
bufferBuilder.addVertex(x4, y4, z4).setUv(u4, v4).setColor(colour);
}
public static void render2DObjectInSkybox(RenderLevelStageEvent.AfterSky event, Identifier textureId, String Name, float HorizontalRotationRad, float VerticalRotationRad, Vector3f Translate, Vector3f Scale, Vector4f colourModulator, GpuBuffer meshBuffer, RenderPipeline pipeline) {
initBuffers();
Minecraft minecraft = Minecraft.getInstance();
PoseStack poseStack = event.getPoseStack();
SkyRenderState state = event.getLevelRenderState().skyRenderState;
poseStack.pushPose();
poseStack.mulPose(Axis.YP.rotation(HorizontalRotationRad));
poseStack.mulPose(Axis.XP.rotation(VerticalRotationRad));
Matrix4fStack modelViewStack = RenderSystem.getModelViewStack();
modelViewStack.pushMatrix();
modelViewStack.mul(poseStack.last().pose());
modelViewStack.translate(Translate);
modelViewStack.scale(Scale);
GpuBufferSlice dynamicTransforms = RenderSystem.getDynamicUniforms().writeTransform(modelViewStack, colourModulator, new Vector3f(), new Matrix4f());
GpuTextureView colour = minecraft.getMainRenderTarget().getColorTextureView();
GpuTextureView depth = minecraft.getMainRenderTarget().getDepthTextureView();
GpuBuffer indexBuffer = RenderSystem.getSequentialBuffer(VertexFormat.Mode.QUADS).getBuffer(6);
AbstractTexture texture = minecraft.getTextureManager().getTexture(textureId);
try (RenderPass renderPass = RenderSystem.getDevice().createCommandEncoder().createRenderPass(() -> "Age of the Gods Skybox Object [" + Name + "]", colour, OptionalInt.empty(), depth, OptionalDouble.empty())) {
renderPass.setPipeline(pipeline);
RenderSystem.bindDefaultUniforms(renderPass);
renderPass.setUniform("DynamicTransforms", dynamicTransforms);
renderPass.bindTexture("Sampler0", texture.getTextureView(), texture.getSampler());
renderPass.setVertexBuffer(0, meshBuffer);
renderPass.setIndexBuffer(indexBuffer, RenderSystem.getSequentialBuffer(VertexFormat.Mode.QUADS).type());
renderPass.drawIndexed(0, 0, 6, 1);
}
modelViewStack.popMatrix();
poseStack.popPose();
}
public static void renderCustomSun(RenderLevelStageEvent.AfterSky event, Identifier textureId) {
initBuffers();
SkyRenderState state = event.getLevelRenderState().skyRenderState;
RenderPipeline pipeline = Config.RENDER_SUN_TRANSLUCENCY.getAsBoolean() ? CUSTOM_SKYBOX_PIPELINE : RenderPipelines.CELESTIAL;
render2DObjectInSkybox(event, textureId, "Sun",(float)Math.toRadians(-90F),state.sunAngle,new Vector3f(0,100.0f,0),new Vector3f((float)Config.SUN_SCALE.getAsDouble(),-1.0F,(float)Config.SUN_SCALE.getAsDouble()),new Vector4f(1f,1f,1f,state.rainBrightness), sunBuffer,pipeline);
}
public static void renderCustomMoon(RenderLevelStageEvent.AfterSky event, Identifier textureId) {
initBuffers();
SkyRenderState state = event.getLevelRenderState().skyRenderState;
Minecraft minecraft = Minecraft.getInstance();
long time = minecraft.level != null ? minecraft.level.getOverworldClockTime() % 24000 : 0;
float DayAlpha = DistantSkyObject.DayAlpha;
float NightAlpha = DistantSkyObject.NightAlpha;
RenderPipeline pipeline = Config.RENDER_MOON_TRANSLUCENCY.getAsBoolean() ? CUSTOM_SKYBOX_PIPELINE : RenderPipelines.CELESTIAL;
render2DObjectInSkybox(event, textureId, "Moon",(float)Math.toRadians(-90F),state.moonAngle,new Vector3f(0,100.0f,0),new Vector3f((float)Config.MOON_SCALE.getAsDouble(),-1.0F,(float)Config.MOON_SCALE.getAsDouble()),new Vector4f((float) (0.75 + (DayAlpha * 0.25f) + (NightAlpha * 0.25f)), (float) (0.35 + (DayAlpha * 0.65f) + (NightAlpha * 0.65f)), (float) (0.25 + (DayAlpha * 0.75f) + (NightAlpha * 0.75f)),1), moonBuffer,pipeline);//RenderPipelines.CELESTIAL);
}
public static float getNightAlpha(long dayTime) {
long time = dayTime % 24000;
if (time >= 13000) {
if (time < 15000) return (float) (time-13000) / 2000.0F;
if (time > 22000) return 1.0F - ((float)(time - 22000) / 2000.0F);
return 1.0F;
}
return 0.0F;
}
public static float getDayAlpha(long dayTime) {
long time = dayTime % 24000;
if (time >= 0 && time < 13000) {
if (time < 2000) return (float) time / 2000.0F;
if (time > 11000) return 1.0F - ((float)(time - 11000) / 2000.0F);
return 1.0F;
}
return 0.0F;
}
public static void renderCustomSkybox(RenderLevelStageEvent.AfterSky event, Identifier daytextureId, Identifier nighttextureid, Identifier dusktextureid) {
initBuffers();
Minecraft minecraft = Minecraft.getInstance();
long time = minecraft.level != null ? minecraft.level.getOverworldClockTime() % 24000 : 0;
float dayAlpha = getDayAlpha(time);
float nightAlpha = getNightAlpha(time);
PoseStack poseStack = event.getPoseStack();
Matrix4fStack modelViewStack = RenderSystem.getModelViewStack();
modelViewStack.pushMatrix();
modelViewStack.mul(poseStack.last().pose());
GpuTextureView colour = minecraft.getMainRenderTarget().getColorTextureView();
GpuTextureView depth = minecraft.getMainRenderTarget().getDepthTextureView();
GpuBuffer indexBuffer = RenderSystem.getSequentialBuffer(VertexFormat.Mode.QUADS).getBuffer(36);
GpuBufferSlice dynamicTransforms = RenderSystem.getDynamicUniforms().writeTransform(modelViewStack, new Vector4f(1.0F, 1.0F, 1.0F, 1.0F), new Vector3f(), new Matrix4f());
AbstractTexture texture = minecraft.getTextureManager().getTexture(dusktextureid);
try (RenderPass renderPass = RenderSystem.getDevice().createCommandEncoder().createRenderPass(() -> "Age of the Gods Dusk Skybox", colour, OptionalInt.empty(), depth, OptionalDouble.empty())) {
renderPass.setPipeline(RenderPipelines.END_SKY);
RenderSystem.bindDefaultUniforms(renderPass);
renderPass.setUniform("DynamicTransforms", dynamicTransforms);
renderPass.bindTexture("Sampler0", texture.getTextureView(), texture.getSampler());
renderPass.setVertexBuffer(0, skyboxBuffer);
renderPass.setIndexBuffer(indexBuffer, RenderSystem.getSequentialBuffer(VertexFormat.Mode.QUADS).type());
renderPass.drawIndexed(0, 0, 36, 1);
}
dynamicTransforms = RenderSystem.getDynamicUniforms().writeTransform(modelViewStack, new Vector4f(1.0F, 1.0F, 1.0F, dayAlpha), new Vector3f(), new Matrix4f());
texture = minecraft.getTextureManager().getTexture(daytextureId);
try (RenderPass renderPass = RenderSystem.getDevice().createCommandEncoder().createRenderPass(() -> "Age of the Gods Day Skybox", colour, OptionalInt.empty(), depth, OptionalDouble.empty())) {
renderPass.setPipeline(RenderPipelines.END_SKY);
RenderSystem.bindDefaultUniforms(renderPass);
renderPass.setUniform("DynamicTransforms", dynamicTransforms);
renderPass.bindTexture("Sampler0", texture.getTextureView(), texture.getSampler());
renderPass.setVertexBuffer(0, skyboxBuffer);
renderPass.setIndexBuffer(indexBuffer, RenderSystem.getSequentialBuffer(VertexFormat.Mode.QUADS).type());
renderPass.drawIndexed(0, 0, 36, 1);
}
dynamicTransforms = RenderSystem.getDynamicUniforms().writeTransform(modelViewStack, new Vector4f(1.0F, 1.0F, 1.0F, nightAlpha), new Vector3f(), new Matrix4f());
texture = minecraft.getTextureManager().getTexture(nighttextureid);
try (RenderPass renderPass = RenderSystem.getDevice().createCommandEncoder().createRenderPass(() -> "Age of the Gods Night Skybox", colour, OptionalInt.empty(), depth, OptionalDouble.empty())) {
renderPass.setPipeline(RenderPipelines.END_SKY);
RenderSystem.bindDefaultUniforms(renderPass);
renderPass.setUniform("DynamicTransforms", dynamicTransforms);
renderPass.bindTexture("Sampler0", texture.getTextureView(), texture.getSampler());
renderPass.setVertexBuffer(0, skyboxBuffer);
renderPass.setIndexBuffer(indexBuffer, RenderSystem.getSequentialBuffer(VertexFormat.Mode.QUADS).type());
renderPass.drawIndexed(0, 0, 36, 1);
}
modelViewStack.popMatrix();
}
public static float MoonScale = 0.75f;
public static float SunScale = 0.75f;
private static GpuBuffer buildCelestialBuffer(float CelestialScale, String CelestialObjectName) {
VertexFormat format = DefaultVertexFormat.POSITION_TEX;
try (ByteBufferBuilder byteBufferBuilder = ByteBufferBuilder.exactlySized(4 * format.getVertexSize())) {
BufferBuilder bufferBuilder = new BufferBuilder(byteBufferBuilder, VertexFormat.Mode.QUADS, format);
bufferBuilder.addVertex( -CelestialScale, 0.0F, -CelestialScale).setUv(0.0F, 0.0F);
bufferBuilder.addVertex( CelestialScale, 0.0F, -CelestialScale).setUv(1.0F, 0.0F);
bufferBuilder.addVertex( CelestialScale, 0.0F, CelestialScale).setUv( 1.0F, 1.0F);
bufferBuilder.addVertex( -CelestialScale, 0.0F, CelestialScale).setUv( 0.0F, 1.0F);
try (MeshData mesh = bufferBuilder.buildOrThrow()) {
return RenderSystem.getDevice().createBuffer(() -> "Age of the Gods " + CelestialObjectName +" Pass", 32, mesh.vertexBuffer());
}
}
}
private static GpuBuffer buildSkyboxBuffer() {
VertexFormat format = DefaultVertexFormat.POSITION_TEX_COLOR;
try (ByteBufferBuilder byteBufferBuilder = ByteBufferBuilder.exactlySized(24 * format.getVertexSize())) {
BufferBuilder bufferBuilder = new BufferBuilder(byteBufferBuilder, VertexFormat.Mode.QUADS, format);
float distance = 100.0F;
float size = 100.0F;
int colour = 0xFFFFFFFF;
addSkyboxFace(bufferBuilder, -size, distance, -size, 1.0F / 4.0F, 1.0F / 3.0F, size, distance, -size, 2.0F / 4.0F, 1.0F / 3.0F, size, distance, size, 2.0F / 4.0F, 0.0F, -size, distance, size, 1.0F / 4.0F, 0.0F, colour);
addSkyboxFace(bufferBuilder, -size, -distance, -size, 1.0F / 4.0F, 2.0F / 3.0F, -size, -distance, size, 1.0F / 4.0F, 3.0F / 3.0F, size, -distance, size, 2.0F / 4.0F, 3.0F / 3.0F, size, -distance, -size, 2.0F / 4.0F, 2.0F / 3.0F, colour);
addSkyboxFace(bufferBuilder, -distance, -size, size, 0.0F, 2.0F / 3.0F, -distance, -size, -size, 1.0F / 4.0F, 2.0F / 3.0F, -distance, size, -size, 1.0F / 4.0F, 1.0F / 3.0F, -distance, size, size, 0.0F, 1.0F / 3.0F, colour);
addSkyboxFace(bufferBuilder, -size, -size, -distance, 1.0F / 4.0F, 2.0F / 3.0F, size, -size, -distance, 2.0F / 4.0F, 2.0F / 3.0F, size, size, -distance, 2.0F / 4.0F, 1.0F / 3.0F, -size, size, -distance, 1.0F / 4.0F, 1.0F / 3.0F, colour);
addSkyboxFace(bufferBuilder, distance, -size, -size, 2.0F / 4.0F, 2.0F / 3.0F, distance, -size, size, 3.0F / 4.0F, 2.0F / 3.0F, distance, size, size, 3.0F / 4.0F, 1.0F / 3.0F, distance, size, -size, 2.0F / 4.0F, 1.0F / 3.0F, colour);
addSkyboxFace(bufferBuilder, size, -size, distance, 3.0F / 4.0F, 2.0F / 3.0F, -size, -size, distance, 4.0F / 4.0F, 2.0F / 3.0F, -size, size, distance, 4.0F / 4.0F, 1.0F / 3.0F, size, size, distance, 3.0F / 4.0F, 1.0F / 3.0F, colour);
try (MeshData meshData = bufferBuilder.buildOrThrow()) {
return RenderSystem.getDevice().createBuffer(() -> "Age of the Gods Skybox", 40, meshData.vertexBuffer());
}
}
}
}
@@ -0,0 +1,95 @@
package net.halbear.skyboxmod.utility;
import net.halbear.skyboxmod.SkyboxMod;
import net.halbear.skyboxmod.rendering.screen.ConfigScreen;
import net.halbear.skyboxmod.rendering.skybox.DistantSkyObject;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphicsExtractor;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.screens.options.OptionsScreen;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.contents.TranslatableContents;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.client.event.ClientTickEvent;
import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent;
import net.neoforged.neoforge.client.event.ScreenEvent;
import java.util.function.Supplier;
@EventBusSubscriber(modid = SkyboxMod.MODID, value = Dist.CLIENT)
public class ClientEventHandler {
@SubscribeEvent
public static void onClientTick(ClientTickEvent.Pre event) {
Minecraft mc = Minecraft.getInstance();
if (mc.level != null && mc.player != null) {
DistantSkyObject.TickUpdate(mc.level.dimension());
}
}
private static boolean isSkinCustomizationButton(Component component) {
if (component.getContents() instanceof TranslatableContents translatable) {
return "options.skinCustomisation".equals(translatable.getKey());
}
return component.getString().contains("Skin Customization");
}
@SubscribeEvent
public static void onScreenInit(ScreenEvent.Init.Post event) {
if (event.getScreen() instanceof OptionsScreen pauseScreen) {
for (var listener : event.getListenersList()) {
if (listener instanceof AbstractWidget widget) {
Component message = widget.getMessage();
SkyboxMod.LOGGER.debug(message.getString());
if (isSkinCustomizationButton(message)) {
int targetX = widget.getX();
int targetY = widget.getY();
int targetWidth = widget.getWidth();
int targetHeight = widget.getHeight();
SkyboxMod.LOGGER.debug("New Button Tiiime");
int myButtonX = targetX;
int myButtonY = targetY - targetHeight - 4;
Button customMenuButton= new Button(
myButtonX, myButtonY, widget.getWidth(), widget.getHeight(),
Component.translatable("hals_skybox_mod.gui.optionsbutton"),
button -> {
SkyboxMod.LOGGER.debug("Cliiick!");
net.minecraft.client.Minecraft.getInstance().setScreen(
new ConfigScreen(pauseScreen,pauseScreen.getMinecraft().options)
);
}, new Button.CreateNarration() {
@Override
public MutableComponent createNarrationMessage(Supplier<MutableComponent> supplier) {
return Component.translatable("hals_skybox_mod.gui.optionsbutton");
}
}
) {
@Override
protected void extractContents(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick) {
this.setX(widget.getX());
this.setY(widget.getY() - widget.getHeight() - 4);
this.setWidth(targetWidth);
this.setHeight(targetHeight);
this.extractDefaultSprite(guiGraphics);
this.extractDefaultLabel(guiGraphics.textRendererForWidget(this, GuiGraphicsExtractor.HoveredTextEffects.NONE));
// SkyboxMod.LOGGER.debug("Resize: xy:" + widget.getX() + "_" + widget.getY() + " wh:" + targetWidth + "x" + targetHeight);
}
};
event.getScreen().renderables.add(customMenuButton);
event.addListener(customMenuButton);
break;
}
}
}
}
}
}
@@ -0,0 +1,34 @@
package net.halbear.skyboxmod.utility;
import com.mojang.blaze3d.pipeline.BlendFunction;
import com.mojang.blaze3d.pipeline.ColorTargetState;
import com.mojang.blaze3d.pipeline.RenderPipeline;
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
import com.mojang.blaze3d.vertex.VertexFormat;
import net.halbear.skyboxmod.SkyboxMod;
import net.halbear.skyboxmod.rendering.skybox.SkyBoxRendering;
import net.minecraft.resources.Identifier;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.neoforge.client.event.RegisterRenderPipelinesEvent;
import static net.minecraft.client.renderer.RenderPipelines.MATRICES_PROJECTION_SNIPPET;
@EventBusSubscriber(modid = SkyboxMod.MODID, value = Dist.CLIENT)
public class ModEventHandler {
@SubscribeEvent
public static void onRegisterPipelines(RegisterRenderPipelinesEvent event) {
SkyBoxRendering.CUSTOM_SKYBOX_PIPELINE = RenderPipeline.builder(new RenderPipeline.Snippet[]{MATRICES_PROJECTION_SNIPPET})
.withLocation(Identifier.fromNamespaceAndPath(SkyboxMod.MODID, "pipeline/custom_skybox"))
.withVertexShader(Identifier.withDefaultNamespace("core/position_tex"))
.withFragmentShader(Identifier.withDefaultNamespace("core/position_tex"))
.withSampler("Sampler0")
.withCull(false)
.withColorTargetState(new ColorTargetState(BlendFunction.TRANSLUCENT)).withVertexFormat(DefaultVertexFormat.POSITION_TEX, VertexFormat.Mode.QUADS).build();
event.registerPipeline(SkyBoxRendering.CUSTOM_SKYBOX_PIPELINE);
System.out.println("Hal's Skybox Mod pipeline Registered");
}
}
@@ -0,0 +1,37 @@
{
"hals_skybox_mod.configuration.title": "Hal's Skybox Configs",
"hals_skybox_mod.configuration.section.ageofthegods.common.toml": "Hal's Skybox Configs",
"hals_skybox_mod.configuration.section.ageofthegods.common.toml.title": "Hal's Skybox Configs",
"hals_skybox_mod.configuration.items": "Item List",
"hals_skybox_mod.configuration.logDirtBlock": "Log Dirt Block",
"hals_skybox_mod.configuration.magicNumberIntroduction": "Magic Number Text",
"hals_skybox_mod.configuration.magicNumber": "Magic Number",
"hals_skybox_mod.gui.optionsbutton": "Skybox Configuration",
"hals_skybox_config.cloud_object_count.max": "Capped at 1024",
"hals_skybox_config.cloud_object_count": "Skybox Cloud Object Count",
"hals_skybox_config.cloud_min_speed.max": "1°/tick",
"hals_skybox_config.cloud_max_speed.max": "1°/tick",
"hals_skybox_config.cloud_min_speed": "Minimum Cloud Speed",
"hals_skybox_config.cloud_max_speed": "Maximum Cloud Speed",
"hals_skybox_config.cloud_header": "Cloud Configuration",
"hals_skybox_config.min_cloud_speed": "Min Speed",
"hals_skybox_config.max_cloud_speed": "Max Speed",
"hals_skybox_config.max_cloud_vertical_angle": "Max Angle",
"hals_skybox_config.min_cloud_vertical_angle": "Min Angle",
"hals_skybox_config.min_cloud_scale": "Min Scale",
"hals_skybox_config.max_cloud_scale": "Max Scale",
"hals_skybox_config.open_cloud_images_location": "Open cloud image folder",
"hals_skybox_config.celestial_header": "Celestial Configuration",
"hals_skybox_config.general_header": "General Settings",
"hals_skybox_config.moon_scale": "Moon Scale",
"hals_skybox_config.sun_scale": "Sun Scale",
"hals_skybox_config.render_sun": "Render Sun",
"hals_skybox_config.render_moon": "Render Moon",
"hals_skybox_config.render_skybox": "Render Skybox",
"hals_skybox_config.render_clouds": "Render Clouds",
"hals_skybox_config.render_sun_translucent": "Render Sun as Translucent",
"hals_skybox_config.render_moon_translucent": "Render Moon as Translucent",
"hals_skybox_config.open_cloud_sprites": "Select Cloud Sprites"
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 195 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 179 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 326 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1000 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

+7
View File
@@ -0,0 +1,7 @@
{
"pack": {
"min_format": 100.0,
"max_format": 101.1,
"description": ""
}
}
@@ -0,0 +1,86 @@
# This is an example neoforge.mods.toml file. It contains the data relating to the loading mods.
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
# The overall format is standard TOML format, v0.5.0.
# Note that there are a couple of TOML lists in this file.
# Find more information on toml format here: https://github.com/toml-lang/toml
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
license="${mod_license}"
# A URL to refer people to when problems occur with this mod
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
# A list of mods - how many allowed here is determined by the individual mod loader
[[mods]] #mandatory
# The modid of the mod
modId="${mod_id}" #mandatory
# The version number of the mod
version="${mod_version}" #mandatory
# A display name for the mod
displayName="${mod_name}" #mandatory
# A URL to query for updates for this mod. See the JSON update specification https://docs.neoforged.net/docs/misc/updatechecker/
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
# A URL for the "homepage" for this mod, displayed in the mod UI
displayURL="https://halbear.net/" #optional
# A file name (in the root of the mod JAR) containing a logo for display
logoFile="moon_texture.png" #optional
client_side_only=true
# The authors of the mod, displayed in the mod UI (optional)
authors="Halbear1"
# The description text for the mod (multi line!) (#mandatory)
description='''
A customisable Skybox Mod
'''
# The [[mixins]] block allows you to declare your mixin config to FML so that it gets loaded.
# The [[accessTransformers]] block allows you to declare where your AT file is.
# If this block is omitted, a fallback attempt will be made to load an AT from META-INF/accesstransformer.cfg
#[[accessTransformers]]
#file="META-INF/accesstransformer.cfg"
# The coremods config file path is not configurable and is always loaded from META-INF/coremods.json
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
[[dependencies.${mod_id}]] #optional
# the modid of the dependency
modId="neoforge" #mandatory
# The type of the dependency. Can be one of "required", "optional", "incompatible" or "discouraged" (case insensitive).
# 'required' requires the mod to exist, 'optional' does not
# 'incompatible' will prevent the game from loading when the mod exists, and 'discouraged' will show a warning
type="required" #mandatory
# Optional field describing why the dependency is required or why it is incompatible
# reason="..."
# The version range of the dependency
versionRange="[${neo_version},)" #mandatory
# An ordering relationship for the dependency.
# BEFORE - This mod is loaded BEFORE the dependency
# AFTER - This mod is loaded AFTER the dependency
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
side="BOTH"
# Here's another dependency
[[dependencies.${mod_id}]]
modId="minecraft"
type="required"
# This version range declares a minimum of the current minecraft version up to but not including the next major version
versionRange="${minecraft_version_range}"
ordering="NONE"
side="BOTH"
# Features are specific properties of the game environment, that you may want to declare you require. This example declares
# that your mod requires GL version 3.2 or higher. Other features will be added. They are side aware so declaring this won't
# stop your mod loading on the server for example.
#[features.${mod_id}]
#openGLVersion="[3.2,)"