Skip to content

Commit

Permalink
Update to 1.21.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dima-dencep committed Oct 22, 2024
1 parent 5bd6d61 commit e19ec61
Show file tree
Hide file tree
Showing 15 changed files with 196 additions and 143 deletions.
13 changes: 6 additions & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
steps:

- name: Checkout sources
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
Expand All @@ -31,11 +31,12 @@ jobs:

- name: Build Changelog
id: build_changelog
uses: metcalfc/changelog-generator@v4.2.0
uses: metcalfc/changelog-generator@v4.3.1
if: env.previous_tag
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
mytoken: ${{ secrets.GITHUB_TOKEN }}
base-ref: ${{ env.previous_tag }}
fetch: false

- name: Read value from Properties-file
id: read_property
Expand Down Expand Up @@ -75,7 +76,6 @@ jobs:
game-version-filter: none
game-versions: |
${{ steps.read_property.outputs.minecraft_version }}
1.21
java: |
21
Expand Down Expand Up @@ -105,7 +105,6 @@ jobs:
game-version-filter: none
game-versions: |
${{ steps.read_property.outputs.minecraft_version }}
1.21
dependencies: |
cloth-config
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "io.github.goooler.shadow" version "8.1.8" apply false
id "com.gradleup.shadow" version "8.3.3" apply false
id "architectury-plugin" version "3.4-SNAPSHOT"
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
id "net.neoforged.licenser" version "0.7.+" apply false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,13 @@ private static int replaceAlpha(int color, int alpha) {
method = "render",
at = @At(
value = "INVOKE",
target = "Lcom/mojang/blaze3d/platform/GlStateManager;_clear(IZ)V",
target = "Lcom/mojang/blaze3d/platform/GlStateManager;_clear(I)V",
remap = false
)
)
public void rrls$_clear(int mask, boolean getError, Operation<Void> original) {
public void rrls$_clear(int i, Operation<Void> original) {
if (!rrls$getState().isRendering()) {
original.call(mask, getError);
original.call(i);
}
}

Expand All @@ -194,7 +194,7 @@ private static int replaceAlpha(int color, int alpha) {
method = "drawProgressBar",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/util/FastColor$ARGB32;color(IIII)I"
target = "Lnet/minecraft/util/ARGB;color(IIII)I"
)
)
public int rrls$rainbowProgress(int alpha, int red, int green, int blue, Operation<Integer> original) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public abstract class MinecraftClientMixin {
@Inject(
method = "<init>",
at = @At(
value = "TAIL"
value = "INVOKE",
target = "Lnet/minecraft/client/quickplay/QuickPlayLog;of(Ljava/lang/String;)Lnet/minecraft/client/quickplay/QuickPlayLog;",
shift = At.Shift.AFTER
)
)
public void rrls$init(GameConfig gameConfig, CallbackInfo ci, @Local(ordinal = 0) Minecraft.GameLoadCookie gameLoadCookie) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright 2023 - 2024 dima_dencep.
*
* Licensed under the Open Software License, Version 3.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://spdx.org/licenses/OSL-3.0.txt
*/

package org.redlance.dima_dencep.mods.rrls.mixins.workaround;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Cancellable;
import net.minecraft.client.renderer.CompiledShaderProgram;
import net.minecraft.client.renderer.ShaderManager;
import net.minecraft.client.renderer.ShaderProgram;
import org.redlance.dima_dencep.mods.rrls.ConfigExpectPlatform;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(ShaderManager.CompilationCache.class)
public class CompilationCacheMixin {
@WrapOperation(
method = "getOrCompileProgram",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/ShaderManager$CompilationCache;compileProgram(Lnet/minecraft/client/renderer/ShaderProgram;)Lnet/minecraft/client/renderer/CompiledShaderProgram;"
)
)
private CompiledShaderProgram rrls$supressMissingCache(ShaderManager.CompilationCache instance, ShaderProgram shaderProgram, Operation<CompiledShaderProgram> original, @Cancellable CallbackInfoReturnable<?> cir) {
CompiledShaderProgram compiledShaderProgram = original.call(instance, shaderProgram);

if (compiledShaderProgram == null && ConfigExpectPlatform.hideType().forceClose()) {
cir.setReturnValue(null);
}

return compiledShaderProgram;
}

@Inject(
method = {
"loadPostChain",
"compileProgram"
},
at = @At(
value = "NEW",
target = "(Ljava/lang/String;)Lnet/minecraft/client/renderer/ShaderManager$CompilationException;"
),
cancellable = true
)
private void rrls$supressMissingCache(CallbackInfoReturnable<?> cir) {
if (ConfigExpectPlatform.hideType().forceClose()) {
cir.setReturnValue(null);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.state.EntityRenderState;
import net.minecraft.world.entity.Entity;
import org.redlance.dima_dencep.mods.rrls.ConfigExpectPlatform;
import org.redlance.dima_dencep.mods.rrls.Rrls;
Expand All @@ -32,13 +33,13 @@ public class EntityRenderDispatcherMixin {
private static final Minecraft RRLS$MINECRAFT = Minecraft.getInstance();

@WrapOperation(
method = "render",
method = "render(Lnet/minecraft/world/entity/Entity;DDDFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/renderer/entity/EntityRenderDispatcher;getRenderer(Lnet/minecraft/world/entity/Entity;)Lnet/minecraft/client/renderer/entity/EntityRenderer;"
)
)
public <T extends Entity> EntityRenderer<? super T> rrls$workaroundEntityCrash(EntityRenderDispatcher instance, T entityrenderer, Operation<EntityRenderer<? super T>> original) {
public <E extends Entity> EntityRenderer<? super E, ?> rrls$workaroundEntityCrash(EntityRenderDispatcher instance, E entityrenderer, Operation<EntityRenderer<? super E, ?>> original) {
try {
return original.call(instance, entityrenderer);
} catch (Throwable th) {
Expand All @@ -51,14 +52,14 @@ public class EntityRenderDispatcherMixin {
}

@Inject(
method = "render",
method = "render(Lnet/minecraft/world/entity/Entity;DDDFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;ILnet/minecraft/client/renderer/entity/EntityRenderer;)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/CrashReport;forThrowable(Ljava/lang/Throwable;Ljava/lang/String;)Lnet/minecraft/CrashReport;"
),
cancellable = true
)
public <E extends Entity> void rrls$workaroundEntityCrash(E entity, double x, double y, double z, float rotationYaw, float partialTicks, PoseStack poseStack, MultiBufferSource buffer, int packedLight, CallbackInfo ci) {
public <E extends Entity, S extends EntityRenderState> void rrls$workaroundEntityCrash(E entity, double d, double e, double f, float g, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, EntityRenderer<? super E, S> entityRenderer, CallbackInfo ci) {
if (ConfigExpectPlatform.hideType().forceClose() && RRLS$MINECRAFT.level == null) {
Rrls.LOGGER.warn("Preverting entity ({}) crash.", entity);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,22 @@
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.GuiSpriteManager;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.metadata.gui.GuiSpriteScaling;
import net.minecraft.resources.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;

import java.util.function.Function;

@Mixin(GuiGraphics.class)
public abstract class GuiGraphicsMixin {
@WrapOperation(
method = "*",
method = {
"blitSprite(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIIII)V",
"blitSprite(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIIIIIII)V"
},
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiSpriteManager;getSprite(Lnet/minecraft/resources/ResourceLocation;)Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;"
Expand All @@ -38,30 +44,35 @@ public abstract class GuiGraphicsMixin {
}

@WrapOperation(
method = "*",
method = {
"blitSprite(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIIII)V",
"blitSprite(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIIIIIII)V"
},
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiSpriteManager;getSpriteScaling(Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;)Lnet/minecraft/client/resources/metadata/gui/GuiSpriteScaling;"
)
)
public GuiSpriteScaling rrls$fixSpriteCrash(GuiSpriteManager instance, TextureAtlasSprite sprite, Operation<GuiSpriteScaling> original) {
if (sprite == null)
if (sprite == null) {
return null;
}

return original.call(instance, sprite);
}

@WrapOperation(
method = "blitSprite(Lnet/minecraft/resources/ResourceLocation;IIIIIIIII)V",
method = "blitSprite(Ljava/util/function/Function;Lnet/minecraft/resources/ResourceLocation;IIIIIIII)V",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;IIIII)V"
target = "Lnet/minecraft/client/gui/GuiGraphics;blitSprite(Ljava/util/function/Function;Lnet/minecraft/client/renderer/texture/TextureAtlasSprite;IIII)V"
)
)
public void rrls$fixSpriteCrash(GuiGraphics instance, TextureAtlasSprite sprite, int x, int y, int z, int width, int height, Operation<Void> original) {
if (sprite == null)
public void rrls$fixSpriteCrash(GuiGraphics instance, Function<ResourceLocation, RenderType> function, TextureAtlasSprite arg, int i, int j, int k, int l, Operation<Void> original) {
if (arg == null) {
return;
}

original.call(instance, sprite, x, y, z, width, height);
original.call(instance, function, arg, i, j, k, l);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiSpriteManager;
import net.minecraft.client.gui.font.FontManager;
import net.minecraft.client.renderer.ShaderManager;
import net.minecraft.client.resources.SplashManager;
import net.minecraft.client.resources.language.LanguageManager;
import net.minecraft.server.packs.PackResources;
Expand All @@ -25,7 +26,6 @@
import net.minecraft.server.packs.resources.ReloadInstance;
import net.minecraft.server.packs.resources.ReloadableResourceManager;
import net.minecraft.util.Unit;
import net.minecraft.util.profiling.InactiveProfiler;
import org.redlance.dima_dencep.mods.rrls.ConfigExpectPlatform;
import org.redlance.dima_dencep.mods.rrls.Rrls;
import org.spongepowered.asm.mixin.Mixin;
Expand Down Expand Up @@ -90,6 +90,12 @@ public class ReloadableResourceManagerMixin {
) {
rrls$reloadListener(spriteManager, RRLS$MINECRAFT, (unused, throwable) -> {});
}

if (listener instanceof ShaderManager shaderManager &&
shaderManager.compilationCache.configs == ShaderManager.Configs.EMPTY
) {
rrls$reloadListener(shaderManager, RRLS$MINECRAFT, (unused, throwable) -> {});
}
}

@Inject(
Expand Down Expand Up @@ -121,8 +127,7 @@ public class ReloadableResourceManagerMixin {
Rrls.LOGGER.info("Quick reload listener '{}'", listener.getName());

listener.reload(
CompletableFuture::completedFuture, (ReloadableResourceManager) (Object) this, InactiveProfiler.INSTANCE,
InactiveProfiler.INSTANCE, Util.backgroundExecutor(), gameExecutor
CompletableFuture::completedFuture, (ReloadableResourceManager) (Object) this, Util.backgroundExecutor(), gameExecutor
).whenCompleteAsync(action, Util.backgroundExecutor());

} catch (Throwable th) {
Expand Down

This file was deleted.

Loading

0 comments on commit e19ec61

Please sign in to comment.