Skip to content

Commit

Permalink
new: Update to 24w14a
Browse files Browse the repository at this point in the history
  • Loading branch information
FlashyReese committed Apr 5, 2024
1 parent be9326a commit 571ddb1
Show file tree
Hide file tree
Showing 18 changed files with 143 additions and 90 deletions.
46 changes: 43 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.3-SNAPSHOT'
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
id 'io.github.juuxel.loom-quiltflower' version '1.10.0'
}
Expand All @@ -23,6 +23,16 @@ repositories {
includeGroup "maven.modrinth"
}
}
maven {
url "https://maven.flashyreese.me/releases"
}
maven {
url "https://maven.flashyreese.me/snapshots"
}
maven {
name 'TerraformersMC'
url 'https://maven.terraformersmc.com'
}
mavenCentral()
}

Expand All @@ -35,7 +45,7 @@ dependencies {

compileOnly "com.google.code.findbugs:jsr305:3.0.2"

modRuntimeOnly "maven.modrinth:lazydfu:0.1.3"
//modRuntimeOnly "maven.modrinth:lazydfu:0.1.3"
//modRuntimeOnly "maven.modrinth:lithium:mc1.20.1-0.11.2"
//modRuntimeOnly "maven.modrinth:sodium:mc1.20.1-0.5.2"

Expand All @@ -58,7 +68,7 @@ test {
}

tasks.withType(JavaCompile).configureEach {
it.options.release.set 17
it.options.release.set 21
}

java {
Expand All @@ -71,4 +81,34 @@ jar {

runClient {
classpath(sourceSets.testmod.runtimeClasspath)
}

// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}

// select the repositories you want to publish to
repositories {
// uncomment to publish to the local maven
maven {
name = "FlashyReeseReleases"
url = "https://maven.flashyreese.me/releases"
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
maven {
name = "FlashyReeseSnapshots"
url = "https://maven.flashyreese.me/snapshots"
credentials {
username = System.getenv("MAVEN_USERNAME")
password = System.getenv("MAVEN_PASSWORD")
}
}
}
}
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.1
loader_version=0.14.22
minecraft_version=24w14a
yarn_mappings=24w14a+build.5
loader_version=0.15.9
# Mod Properties
mod_version=0.7.3
mod_version=0.7.7
maven_group=io.github.amerebagatelle
archives_base_name=fabricskyboxes
# Dependencies
fabric_version=0.89.0+1.20.2
fabric_version=0.96.14+1.20.5
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
35 changes: 22 additions & 13 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# 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
# https://github.com/gradle/gradle/blob/HEAD/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/.
Expand All @@ -80,13 +80,11 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
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"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -133,22 +131,29 @@ 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.
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
Expand Down Expand Up @@ -193,11 +198,15 @@ if "$cygwin" || "$msys" ; then
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.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ 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%

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public static Skybox parseSkyboxJson(Identifier id, JsonObjectWrapper objectWrap
Metadata metadata;

try {
metadata = Metadata.CODEC.decode(JsonOps.INSTANCE, objectWrapper.getFocusedObject()).getOrThrow(false, System.err::println).getFirst();
metadata = Metadata.CODEC.decode(JsonOps.INSTANCE, objectWrapper.getFocusedObject()).getOrThrow(IllegalStateException::new).getFirst();
} catch (RuntimeException e) {
FabricSkyBoxesClient.getLogger().warn("Skipping invalid skybox " + id.toString(), e);
FabricSkyBoxesClient.getLogger().warn(objectWrapper.toString());
Expand All @@ -62,7 +62,7 @@ public static Skybox parseSkyboxJson(Identifier id, JsonObjectWrapper objectWrap
//noinspection ConstantConditions
type.getDeserializer().getDeserializer().accept(objectWrapper, skybox);
} else {
skybox = type.getCodec(metadata.getSchemaVersion()).decode(JsonOps.INSTANCE, objectWrapper.getFocusedObject()).getOrThrow(false, System.err::println).getFirst();
skybox = type.getCodec(metadata.getSchemaVersion()).decode(JsonOps.INSTANCE, objectWrapper.getFocusedObject()).getOrThrow(IllegalStateException::new).getFirst();
}
return skybox;
}
Expand Down Expand Up @@ -125,10 +125,10 @@ public void clearSkyboxes() {
}

@Internal
public void renderSkyboxes(WorldRendererAccess worldRendererAccess, MatrixStack matrices, Matrix4f matrix4f, float tickDelta, Camera camera, boolean thickFog) {
public void renderSkyboxes(WorldRendererAccess worldRendererAccess, MatrixStack matrixStack, Matrix4f projectionMatrix, float tickDelta, Camera camera, boolean thickFog, Runnable fogCallback) {
this.activeSkyboxes.forEach(skybox -> {
this.currentSkybox = skybox;
skybox.render(worldRendererAccess, matrices, matrix4f, tickDelta, camera, thickFog);
skybox.render(worldRendererAccess, matrixStack, projectionMatrix, tickDelta, camera, thickFog, fogCallback);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ default int getPriority() {
* This will be process if {@link Skybox#isActive()}
*
* @param worldRendererAccess Access to the worldRenderer as skyboxes often require it.
* @param matrices The current MatrixStack.
* @param tickDelta The current tick delta.
* @param camera The player camera.
* @param thickFog Is using thick fog.
* @param fogCallback The fogCallback to run.
*/
void render(WorldRendererAccess worldRendererAccess, MatrixStack matrices, Matrix4f matrix4f, float tickDelta, Camera camera, boolean thickFog);

void render(WorldRendererAccess worldRendererAccess, MatrixStack matrixStack, Matrix4f projectionMatrix, float tickDelta, Camera camera, boolean thickFog, Runnable fogCallback);

/**
* The main thread for a skybox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(WorldRenderer.class)
@Mixin(value = WorldRenderer.class, priority = 900)
public abstract class SkyboxRenderMixin {

@Shadow
Expand All @@ -22,15 +22,16 @@ public abstract class SkyboxRenderMixin {
/**
* Contains the logic for when skyboxes should be rendered.
*/
@Inject(method = "renderSky(Lnet/minecraft/client/util/math/MatrixStack;Lorg/joml/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V", at = @At("HEAD"), cancellable = true)
private void renderCustomSkyboxes(MatrixStack matrices, Matrix4f matrix4f, float tickDelta, Camera camera, boolean bl, Runnable runnable, CallbackInfo ci) {
@Inject(method = "renderSky(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V", at = @At("HEAD"), cancellable = true)
private void renderCustomSkyboxes(Matrix4f matrix4f, Matrix4f projectionMatrix, float tickDelta, Camera camera, boolean thickFog, Runnable fogCallback, CallbackInfo ci) {
SkyboxManager skyboxManager = SkyboxManager.getInstance();
if (skyboxManager.isEnabled() && !skyboxManager.getActiveSkyboxes().isEmpty()) {
runnable.run();
CameraSubmersionType cameraSubmersionType = camera.getSubmersionType();
boolean renderSky = !FabricSkyBoxesClient.config().generalSettings.keepVanillaBehaviour || (!bl && cameraSubmersionType != CameraSubmersionType.POWDER_SNOW && cameraSubmersionType != CameraSubmersionType.LAVA && cameraSubmersionType != CameraSubmersionType.WATER && !this.hasBlindnessOrDarkness(camera));
boolean renderSky = !FabricSkyBoxesClient.config().generalSettings.keepVanillaBehaviour || (!thickFog && cameraSubmersionType != CameraSubmersionType.POWDER_SNOW && cameraSubmersionType != CameraSubmersionType.LAVA && cameraSubmersionType != CameraSubmersionType.WATER && !this.hasBlindnessOrDarkness(camera));
if (renderSky) {
skyboxManager.renderSkyboxes((WorldRendererAccess) this, matrices, matrix4f, tickDelta, camera, bl);
MatrixStack matrixStack = new MatrixStack();
matrixStack.multiplyPositionMatrix(matrix4f);
skyboxManager.renderSkyboxes((WorldRendererAccess) this, matrixStack, projectionMatrix, tickDelta, camera, thickFog, fogCallback);
}
ci.cancel();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ protected boolean checkEffects() {

} else {
if (camera.getFocusedEntity() instanceof LivingEntity livingEntity) {
return this.conditions.getEffects().stream().noneMatch(identifier -> client.world.getRegistryManager().get(RegistryKeys.STATUS_EFFECT).get(identifier) != null && livingEntity.hasStatusEffect(client.world.getRegistryManager().get(RegistryKeys.STATUS_EFFECT).get(identifier)));
return this.conditions.getEffects().stream().noneMatch(identifier -> client.world.getRegistryManager().get(RegistryKeys.STATUS_EFFECT).get(identifier) != null && livingEntity.hasStatusEffect(client.world.getRegistryManager().get(RegistryKeys.STATUS_EFFECT).getEntry(client.world.getRegistryManager().get(RegistryKeys.STATUS_EFFECT).get(identifier))));
}
}
return true;
Expand Down Expand Up @@ -230,7 +230,7 @@ protected boolean checkWeather() {

public abstract SkyboxType<? extends Skybox> getType();

public void renderDecorations(WorldRendererAccess worldRendererAccess, MatrixStack matrices, Matrix4f matrix4f, float tickDelta, BufferBuilder bufferBuilder, float alpha) {
public void renderDecorations(WorldRendererAccess worldRendererAccess, MatrixStack matrixStack, Matrix4f projectionMatrix, float tickDelta, BufferBuilder bufferBuilder, float alpha, Runnable fogCallback) {
RenderSystem.enableBlend();
Vector3f rotationStatic = this.decorations.getRotation().getStatic();
Vector3f rotationAxis = this.decorations.getRotation().getAxis();
Expand All @@ -239,38 +239,38 @@ public void renderDecorations(WorldRendererAccess worldRendererAccess, MatrixSta

// Custom Blender
this.decorations.getBlend().applyBlendFunc(alpha);
matrices.push();
matrixStack.push();

// axis rotation
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(rotationAxis.x()));
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotationAxis.y()));
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(rotationAxis.z()));
matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(rotationAxis.x()));
matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotationAxis.y()));
matrixStack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(rotationAxis.z()));

// Vanilla rotation
//matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-90.0F));
//matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-90.0F));
// Iris Compat
//matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(IrisCompat.getSunPathRotation()));
//matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(world.getSkyAngle(tickDelta) * 360.0F * this.decorations.getRotation().getRotationSpeed()));
//matrixStack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(IrisCompat.getSunPathRotation()));
//matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(world.getSkyAngle(tickDelta) * 360.0F * this.decorations.getRotation().getRotationSpeed()));

// Custom rotation
double timeRotationX = Utils.calculateRotation(this.decorations.getRotation().getRotationSpeedX(), this.decorations.getRotation().getTimeShift().x(), this.decorations.getRotation().getSkyboxRotation(), world);
double timeRotationY = Utils.calculateRotation(this.decorations.getRotation().getRotationSpeedY(), this.decorations.getRotation().getTimeShift().y(), this.decorations.getRotation().getSkyboxRotation(), world);
double timeRotationZ = Utils.calculateRotation(this.decorations.getRotation().getRotationSpeedZ(), this.decorations.getRotation().getTimeShift().z(), this.decorations.getRotation().getSkyboxRotation(), world);
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees((float) timeRotationX));
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees((float) timeRotationY));
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees((float) timeRotationZ));
matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees((float) timeRotationX));
matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees((float) timeRotationY));
matrixStack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees((float) timeRotationZ));

// axis rotation
matrices.multiply(RotationAxis.NEGATIVE_Z.rotationDegrees(rotationAxis.z()));
matrices.multiply(RotationAxis.NEGATIVE_Y.rotationDegrees(rotationAxis.y()));
matrices.multiply(RotationAxis.NEGATIVE_X.rotationDegrees(rotationAxis.x()));
matrixStack.multiply(RotationAxis.NEGATIVE_Z.rotationDegrees(rotationAxis.z()));
matrixStack.multiply(RotationAxis.NEGATIVE_Y.rotationDegrees(rotationAxis.y()));
matrixStack.multiply(RotationAxis.NEGATIVE_X.rotationDegrees(rotationAxis.x()));

// static rotation
matrices.multiply(RotationAxis.POSITIVE_X.rotationDegrees(rotationStatic.x()));
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotationStatic.y()));
matrices.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(rotationStatic.z()));
matrixStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(rotationStatic.x()));
matrixStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotationStatic.y()));
matrixStack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(rotationStatic.z()));

Matrix4f matrix4f2 = matrices.peek().getPositionMatrix();
Matrix4f matrix4f2 = matrixStack.peek().getPositionMatrix();
RenderSystem.setShader(GameRenderer::getPositionTexProgram);
// Sun
if (this.decorations.isSunEnabled()) {
Expand Down Expand Up @@ -302,16 +302,17 @@ public void renderDecorations(WorldRendererAccess worldRendererAccess, MatrixSta
// Stars
if (this.decorations.isStarsEnabled()) {
float i = 1.0F - world.getRainGradient(tickDelta);
float brightness = world.method_23787(tickDelta) * i;
float brightness = world.getStarBrightness(tickDelta) * i;
if (brightness > 0.0F) {
RenderSystem.setShaderColor(brightness, brightness, brightness, brightness);
BackgroundRenderer.clearFog();
worldRendererAccess.getStarsBuffer().bind();
worldRendererAccess.getStarsBuffer().draw(matrices.peek().getPositionMatrix(), matrix4f, GameRenderer.getPositionProgram());
worldRendererAccess.getStarsBuffer().draw(matrixStack.peek().getPositionMatrix(), projectionMatrix, GameRenderer.getPositionProgram());
VertexBuffer.unbind();
fogCallback.run();
}
}
matrices.pop();
matrixStack.pop();

RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.disableBlend();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public SkyboxType<? extends Skybox> getType() {
}

@Override
public void render(WorldRendererAccess worldRendererAccess, MatrixStack matrices, Matrix4f projectionMatrix, float tickDelta, Camera camera, boolean thickFog) {
public void render(WorldRendererAccess worldRendererAccess, MatrixStack matrices, Matrix4f projectionMatrix, float tickDelta, Camera camera, boolean thickFog, Runnable fogCallback) {
MinecraftClient client = MinecraftClient.getInstance();
assert client.world != null;

Expand Down Expand Up @@ -74,7 +74,7 @@ public void render(WorldRendererAccess worldRendererAccess, MatrixStack matrices
}
BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());

this.renderDecorations(worldRendererAccess, matrices, projectionMatrix, tickDelta, bufferBuilder, this.alpha);
this.renderDecorations(worldRendererAccess, matrices, projectionMatrix, tickDelta, bufferBuilder, this.alpha, fogCallback);

RenderSystem.depthMask(true);
RenderSystem.disableBlend();
Expand Down
Loading

0 comments on commit 571ddb1

Please sign in to comment.