mirror of
https://github.com/PuzzleMC/Puzzle.git
synced 2025-12-15 11:25:11 +01:00
Handle incorrectly defined blend functions
- Now logs a warning instead of crashing
This commit is contained in:
@@ -26,6 +26,7 @@ import java.io.InputStream;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.util.function.IntSupplier;
|
import java.util.function.IntSupplier;
|
||||||
|
|
||||||
|
import static net.puzzlemc.core.PuzzleCore.LOGGER;
|
||||||
import static net.puzzlemc.splashscreen.PuzzleSplashScreen.BACKGROUND;
|
import static net.puzzlemc.splashscreen.PuzzleSplashScreen.BACKGROUND;
|
||||||
|
|
||||||
@Mixin(value = SplashOverlay.class, priority = 2000)
|
@Mixin(value = SplashOverlay.class, priority = 2000)
|
||||||
@@ -63,11 +64,17 @@ public abstract class MixinSplashScreen extends Overlay {
|
|||||||
private void puzzle$betterBlend(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
private void puzzle$betterBlend(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||||
if (PuzzleConfig.resourcepackSplashScreen) {
|
if (PuzzleConfig.resourcepackSplashScreen) {
|
||||||
if (PuzzleConfig.disableBlend) RenderSystem.disableBlend();
|
if (PuzzleConfig.disableBlend) RenderSystem.disableBlend();
|
||||||
else if (PuzzleConfig.customBlendFunction.size() == 4) RenderSystem.blendFuncSeparate(
|
else if (PuzzleConfig.customBlendFunction.size() == 4) {
|
||||||
GlStateManager.SrcFactor.valueOf(PuzzleConfig.customBlendFunction.get(0)),
|
try {
|
||||||
GlStateManager.DstFactor.valueOf(PuzzleConfig.customBlendFunction.get(1)),
|
RenderSystem.blendFuncSeparate(
|
||||||
GlStateManager.SrcFactor.valueOf(PuzzleConfig.customBlendFunction.get(2)),
|
GlStateManager.SrcFactor.valueOf(PuzzleConfig.customBlendFunction.get(0)),
|
||||||
GlStateManager.DstFactor.valueOf(PuzzleConfig.customBlendFunction.get(3)));
|
GlStateManager.DstFactor.valueOf(PuzzleConfig.customBlendFunction.get(1)),
|
||||||
|
GlStateManager.SrcFactor.valueOf(PuzzleConfig.customBlendFunction.get(2)),
|
||||||
|
GlStateManager.DstFactor.valueOf(PuzzleConfig.customBlendFunction.get(3)));
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error("Incorrect blend function defined in color.properties: {}{}", PuzzleConfig.customBlendFunction, e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;getScaledWindowWidth()I", ordinal = 2))
|
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;getScaledWindowWidth()I", ordinal = 2))
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ yarn_mappings=1.21+build.2
|
|||||||
enabled_platforms=fabric,neoforge
|
enabled_platforms=fabric,neoforge
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 2.0.0
|
mod_version = 2.0.1
|
||||||
maven_group = net.puzzlemc
|
maven_group = net.puzzlemc
|
||||||
archives_base_name = puzzle
|
archives_base_name = puzzle
|
||||||
release_type=release
|
release_type=release
|
||||||
|
|||||||
Reference in New Issue
Block a user