Skip to content

Commit

Permalink
change: Update for 1.20.5
Browse files Browse the repository at this point in the history
  • Loading branch information
FlashyReese committed Apr 23, 2024
1 parent 530e674 commit ac4e7c4
Show file tree
Hide file tree
Showing 48 changed files with 1,237 additions and 666 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ jobs:
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v2
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
java-version: 21
check-latest: true
- name: Build with Gradle
run: ./gradlew build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v2
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
java-version: 21
check-latest: true
- name: Upload assets to releases
run: ./gradlew build publishAllPublicationsToFlashyReeseReleasesRepository
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/self-hosted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v2
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
java-version: 21
check-latest: true
- name: Build with Gradle
run: ./gradlew build
Expand Down
15 changes: 6 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {

plugins {
id 'signing'
id 'fabric-loom' version '1.5-SNAPSHOT'
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
id 'io.github.juuxel.loom-quiltflower' version '1.10.0'
}
Expand All @@ -22,8 +22,8 @@ crowdintranslate.crowdinProjectName = 'sodium-extra'
crowdintranslate.minecraftProjectName = 'sodium-extra'
crowdintranslate.verbose = false

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21

archivesBaseName = project.archives_base_name
version = "${project.mod_version}${getVersionType(project.version_type, project.revision)}+mc${project.minecraft_version}-${getVersionMetadata()}"
Expand Down Expand Up @@ -58,8 +58,8 @@ dependencies {
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

modImplementation "me.jellysquid.mods:sodium-fabric:0.5.6-snapshot+mc1.20.3-build.1"
//modImplementation "maven.modrinth:sodium:${project.sodium_version}"
//modImplementation "me.jellysquid.mods:sodium-fabric:0.5.6+git.d2b4c1f"
modImplementation "maven.modrinth:sodium:${project.sodium_version}"
/*modImplementation("me.flashyreese.mods:reeses-sodium-options:${project.reeses_sodium_options}") {
exclude group: "net.coderbot.iris_mc1_19", module: "iris"
}*/
Expand All @@ -71,9 +71,6 @@ dependencies {
// Currently using altrisi/CaffeineConfig until it is officially available through CaffeineMC's maven repository
// Todo: Use https://github.com/CaffeineMC/mixin-config when available
include(modImplementation("net.caffeinemc:CaffeineConfig:1.3.0+1.17"))
include(modImplementation("de.guntram.mcmod:crowdin-translate:${project.crowdin_translate}"))

//modRuntimeOnly "maven.modrinth:lazydfu:0.1.3"
}

processResources {
Expand All @@ -90,7 +87,7 @@ build {

tasks.withType(JavaCompile).configureEach {
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
it.options.release = 17
it.options.release = 21
}

java {
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.6
minecraft_version=1.20.5
yarn_mappings=1.20.5+build.1
loader_version=0.15.10

# Mod Properties
version_type=release
Expand All @@ -14,7 +14,7 @@ org.gradle.jvmargs=-Xmx1G
archives_base_name=sodium-extra

# Dependencies
reeses_sodium_options=1.5.1+mc1.20-build.74
sodium_version=mc1.20.3-0.5.5
fabric_version=0.95.1+1.20.4
reeses_sodium_options=1.7.3+mc1.20.5-build.74
sodium_version=mc1.20.5-0.5.8
fabric_version=0.97.5+1.20.5
crowdin_translate=1.4+1.19.3
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion gradlew
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ 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='-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"'
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,
Expand Down
2 changes: 1 addition & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ set APP_HOME=%DIRNAME%
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=-Dfile.encoding=UTF-8 "-Xmx64m" "-Xms64m"
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package me.flashyreese.mods.sodiumextra.client;

import de.guntram.mcmod.crowdintranslate.CrowdinTranslate;
import me.flashyreese.mods.sodiumextra.client.gui.SodiumExtraHud;
import me.flashyreese.mods.sodiumextra.client.gui.SodiumExtraGameOptions;
import net.caffeinemc.caffeineconfig.CaffeineConfig;
Expand Down Expand Up @@ -56,6 +55,7 @@ public static CaffeineConfig mixinConfig() {
.addMixinOption("optimizations.fast_weather", false)
.addMixinOption("particle", true)
.addMixinOption("prevent_shaders", true)
.addMixinOption("profiler", true)
.addMixinOption("reduce_resolution_on_mac", true)
.addMixinOption("render", true)
.addMixinOption("render.block", true)
Expand Down Expand Up @@ -92,13 +92,6 @@ private static SodiumExtraGameOptions loadConfig() {

@Override
public void onInitializeClient() {
if (SodiumExtraClientMod.options().superSecretSettings.fetchSodiumExtraCrowdinTranslations) {
CrowdinTranslate.downloadTranslations(SodiumExtraClientMod.options().superSecretSettings.sodiumExtraCrowdinProjectIdentifier, "sodium-extra");
}
if (SodiumExtraClientMod.options().superSecretSettings.fetchSodiumCrowdinTranslations) {
CrowdinTranslate.downloadTranslations(SodiumExtraClientMod.options().superSecretSettings.sodiumCrowdinProjectIdentifier, "sodium");
}

getClientTickHandler().onClientInitialize();
SodiumExtraHud sodiumExtraHud = new SodiumExtraHud();
HudRenderCallback.EVENT.register(sodiumExtraHud);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ private static Text translatableTooltip(Identifier identifier, String category)

Text translatable = Text.translatable(key);
if (!Texts.hasTranslation(translatable)) {
System.out.println(key);
translatable = Text.translatable(
"sodium-extra.option.".concat(category).concat(".tooltips"),
translatableName(identifier, category)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public class SodiumExtraGameOptions {
public final DetailSettings detailSettings = new DetailSettings();
public final RenderSettings renderSettings = new RenderSettings();
public final ExtraSettings extraSettings = new ExtraSettings();
public final SuperSecretSettings superSecretSettings = new SuperSecretSettings();
private File file;

public static SodiumExtraGameOptions load(File file) {
Expand Down Expand Up @@ -264,18 +263,4 @@ public ExtraSettings() {
this.steadyDebugHudRefreshInterval = 1;
}
}

public static class SuperSecretSettings {
public boolean fetchSodiumExtraCrowdinTranslations;
public String sodiumExtraCrowdinProjectIdentifier;
public boolean fetchSodiumCrowdinTranslations;
public String sodiumCrowdinProjectIdentifier;

public SuperSecretSettings() {
this.fetchSodiumExtraCrowdinTranslations = false;
this.sodiumExtraCrowdinProjectIdentifier = "sodium-extra";
this.fetchSodiumCrowdinTranslations = false;
this.sodiumCrowdinProjectIdentifier = "sodium-fabric";
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package me.flashyreese.mods.sodiumextra.mixin.particle;

import it.unimi.dsi.fastutil.ints.IntList;
import me.flashyreese.mods.sodiumextra.client.SodiumExtraClientMod;
import net.minecraft.client.particle.FireworksSparkParticle;
import net.minecraft.client.particle.Particle;
Expand All @@ -17,7 +18,7 @@ public class MixinFireworkParticle {
private final Identifier fireworkIdentifier = new Identifier("minecraft", "firework");

@Inject(method = "addExplosionParticle", at = @At(value = "HEAD"), cancellable = true)
public void addExplosionParticle(double x, double y, double z, double velocityX, double velocityY, double velocityZ, int[] colors, int[] fadeColors, boolean trail, boolean flicker, CallbackInfo ci) {
public void addExplosionParticle(double x, double y, double z, double velocityX, double velocityY, double velocityZ, IntList colors, IntList targetColors, boolean trail, boolean flicker, CallbackInfo ci) {
if (!SodiumExtraClientMod.options().particleSettings.otherMap.getOrDefault(this.fireworkIdentifier, true) || !SodiumExtraClientMod.options().particleSettings.particles) {
ci.cancel();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package me.flashyreese.mods.sodiumextra.mixin.profiler;

import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.WeakHashMap;

@Mixin(BlockEntityRenderDispatcher.class)
public class MixinBlockEntityRenderDispatcher {
@Unique
private static final WeakHashMap<Class<?>, String> names = new WeakHashMap<>();

@Inject(at = @At("HEAD"), method = "render(Lnet/minecraft/client/render/block/entity/BlockEntityRenderer;Lnet/minecraft/block/entity/BlockEntity;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;)V")
private static <T extends BlockEntity> void onRender(BlockEntityRenderer<T> renderer, T blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, CallbackInfo info) {
World world = blockEntity.getWorld();
if (world != null) {
String name = names.computeIfAbsent(renderer.getClass(), Class::getSimpleName);
if (!name.isEmpty()) {
world.getProfiler().push(name);
}
}
}

@Inject(at = @At("TAIL"), method = "render(Lnet/minecraft/client/render/block/entity/BlockEntityRenderer;Lnet/minecraft/block/entity/BlockEntity;FLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;)V")
private static <T extends BlockEntity> void afterRender(BlockEntityRenderer<T> renderer, T blockEntity, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, CallbackInfo info) {
World world = blockEntity.getWorld();
if (world != null) {
String name = names.computeIfAbsent(renderer.getClass(), Class::getSimpleName);
if (!name.isEmpty()) {
world.getProfiler().pop();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package me.flashyreese.mods.sodiumextra.mixin.profiler;

import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.EntityRenderDispatcher;
import net.minecraft.client.render.entity.EntityRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

import java.util.WeakHashMap;

@Mixin(EntityRenderDispatcher.class)
public abstract class MixinEntityRenderDispatcher {
@Shadow
public abstract <T extends Entity> EntityRenderer<? super T> getRenderer(T entity);

private static final WeakHashMap<Class<?>, String> names = new WeakHashMap<>();

@Inject(at = @At("HEAD"), method = "render")
private <E extends Entity> void onRender(E entity, double x, double y, double z, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
World world = entity.getWorld();
if (world != null) {
String name = names.computeIfAbsent(this.getRenderer(entity).getClass(), Class::getSimpleName);
if (!name.isEmpty()) {
world.getProfiler().push(name);
}
}
}

@Inject(at = @At("TAIL"), method = "render")
private <E extends Entity> void afterRender(E entity, double x, double y, double z, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
World world = entity.getWorld();
if (world != null) {
String name = names.computeIfAbsent(this.getRenderer(entity).getClass(), Class::getSimpleName);
if (!name.isEmpty()) {
world.getProfiler().pop();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ private void onRender(T entity, float f, float g, MatrixStack matrixStack, Verte
if (entity instanceof ArmorStandEntity && !SodiumExtraClientMod.options().renderSettings.armorStand) {
ci.cancel();
if (this.hasLabel(entity)) {
this.renderLabelIfPresent(entity, entity.getDisplayName(), matrixStack, vertexConsumerProvider, i);
this.renderLabelIfPresent(entity, entity.getDisplayName(), matrixStack, vertexConsumerProvider, i, g);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
@Mixin(WorldRenderer.class)
public class MixinWorldRenderer {
@Redirect(
method = "renderSky(Lnet/minecraft/client/util/math/MatrixStack;Lorg/joml/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V",
method = "renderSky(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gl/VertexBuffer;draw(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;Lnet/minecraft/client/gl/ShaderProgram;)V",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
@Mixin(WorldRenderer.class)
public class MixinWorldRenderer {
@Redirect(
method = "renderSky(Lnet/minecraft/client/util/math/MatrixStack;Lorg/joml/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V",
method = "renderSky(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/world/ClientWorld;method_23787(F)F"
target = "Lnet/minecraft/client/world/ClientWorld;getStarBrightness(F)F"
)
)
public float redirectGetStarBrightness(ClientWorld instance, float f) {
if (SodiumExtraClientMod.options().detailSettings.stars) {
return instance.method_23787(f);
return instance.getStarBrightness(f);
} else {
return 0.0f;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class MixinWorldRenderer {
private static Identifier MOON_PHASES;

@Redirect(
method = "renderSky(Lnet/minecraft/client/util/math/MatrixStack;Lorg/joml/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V",
method = "renderSky(Lorg/joml/Matrix4f;Lorg/joml/Matrix4f;FLnet/minecraft/client/render/Camera;ZLjava/lang/Runnable;)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/render/DimensionEffects;getFogColorOverride(FF)[F"
Expand Down
Loading

0 comments on commit ac4e7c4

Please sign in to comment.