mirror of
https://github.com/PuzzleMC/Puzzle.git
synced 2025-12-16 03:45:10 +01:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
caee4c801a | ||
|
|
97117ea46a | ||
|
|
ee274fcefd | ||
|
|
74de5ba33c | ||
|
|
7caadedcf1 | ||
|
|
16f5c08011 | ||
|
|
eac8b24617 | ||
|
|
c930b778b6 | ||
|
|
b73c28d48d |
@@ -3,7 +3,7 @@ import groovy.json.JsonOutput
|
|||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "architectury-plugin" version "3.4-SNAPSHOT"
|
id "architectury-plugin" version "3.4-SNAPSHOT"
|
||||||
id "dev.architectury.loom" version "1.7-SNAPSHOT" apply false
|
id "dev.architectury.loom" version "1.11-SNAPSHOT" apply false
|
||||||
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
|
id "me.shedaniel.unified-publishing" version "0.1.+" apply false
|
||||||
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,10 +21,9 @@ public class PuzzleGui {
|
|||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
MidnightLib.hiddenMods.add("puzzle");
|
MidnightLib.hiddenMods.add("puzzle");
|
||||||
MinecraftClient client = MinecraftClient.getInstance();
|
|
||||||
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.of("\uD83E\uDDE9 Puzzle")));
|
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.of("\uD83E\uDDE9 Puzzle")));
|
||||||
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.translatable("puzzle.midnightconfig.title"), (button) -> button.setMessage(Text.of("OPEN")), (button) -> {
|
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.translatable("puzzle.midnightconfig.title"), (button) -> button.setMessage(Text.of("OPEN")), (button) -> {
|
||||||
client.setScreen(PuzzleConfig.getScreen(client.currentScreen, "puzzle"));
|
MinecraftClient.getInstance().setScreen(PuzzleConfig.getScreen(MinecraftClient.getInstance().currentScreen, "puzzle"));
|
||||||
}));
|
}));
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("\uD83E\uDDE9 Puzzle")));
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("\uD83E\uDDE9 Puzzle")));
|
||||||
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("puzzle.option.resourcepack_splash_screen"), (button) -> button.setMessage(PuzzleConfig.resourcepackSplashScreen ? YES : NO), (button) -> {
|
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("puzzle.option.resourcepack_splash_screen"), (button) -> button.setMessage(PuzzleConfig.resourcepackSplashScreen ? YES : NO), (button) -> {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.puzzlemc.gui.compat;
|
package net.puzzlemc.gui.compat;
|
||||||
|
|
||||||
|
import com.mojang.text2speech.OperatingSystem;
|
||||||
import link.infra.borderlessmining.config.ConfigHandler;
|
import link.infra.borderlessmining.config.ConfigHandler;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
@@ -17,7 +18,7 @@ public class BorderlessMiningCompat {
|
|||||||
bmConfig.setEnabledPending(!bmConfig.isEnabledOrPending());
|
bmConfig.setEnabledPending(!bmConfig.isEnabledOrPending());
|
||||||
bmConfig.save();
|
bmConfig.save();
|
||||||
}));
|
}));
|
||||||
if (MinecraftClient.IS_SYSTEM_MAC) {
|
if (OperatingSystem.get() == OperatingSystem.MAC_OS) {
|
||||||
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.translatable("config.borderlessmining.general.enabledmac"), (button) -> button.setMessage(bmConfig.enableMacOS ? YES : NO), (button) -> {
|
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.translatable("config.borderlessmining.general.enabledmac"), (button) -> button.setMessage(bmConfig.enableMacOS ? YES : NO), (button) -> {
|
||||||
bmConfig.enableMacOS = !bmConfig.enableMacOS;
|
bmConfig.enableMacOS = !bmConfig.enableMacOS;
|
||||||
bmConfig.setEnabledPending(bmConfig.isEnabled());
|
bmConfig.setEnabledPending(bmConfig.isEnabled());
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import net.minecraft.client.gui.tab.GridScreenTab;
|
|||||||
import net.minecraft.client.gui.tab.Tab;
|
import net.minecraft.client.gui.tab.Tab;
|
||||||
import net.minecraft.client.gui.tab.TabManager;
|
import net.minecraft.client.gui.tab.TabManager;
|
||||||
import net.minecraft.client.gui.widget.TabNavigationWidget;
|
import net.minecraft.client.gui.widget.TabNavigationWidget;
|
||||||
|
import net.minecraft.client.input.KeyInput;
|
||||||
import net.minecraft.screen.ScreenTexts;
|
import net.minecraft.screen.ScreenTexts;
|
||||||
import net.minecraft.text.Text;
|
import net.minecraft.text.Text;
|
||||||
import net.puzzlemc.gui.PuzzleApi;
|
import net.puzzlemc.gui.PuzzleApi;
|
||||||
@@ -75,9 +76,8 @@ public class PuzzleOptionsScreen extends Screen {
|
|||||||
list.addAll(options);
|
list.addAll(options);
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
|
public boolean keyPressed(KeyInput input) {
|
||||||
if (this.tabNavigation.trySwitchTabsWithKey(keyCode)) return true;
|
return this.tabNavigation.keyPressed(input) || super.keyPressed(input);
|
||||||
return super.keyPressed(keyCode, scanCode, modifiers);
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package net.puzzlemc.gui.screen.widget;
|
package net.puzzlemc.gui.screen.widget;
|
||||||
|
|
||||||
|
import eu.midnightdust.lib.config.ButtonEntry;
|
||||||
|
import eu.midnightdust.lib.config.EntryInfo;
|
||||||
import eu.midnightdust.lib.config.MidnightConfig;
|
import eu.midnightdust.lib.config.MidnightConfig;
|
||||||
|
import eu.midnightdust.lib.config.MidnightConfigListWidget;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
@@ -19,8 +22,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static net.puzzlemc.core.PuzzleCore.LOGGER;
|
import static net.puzzlemc.core.PuzzleCore.LOGGER;
|
||||||
|
|
||||||
@Environment(EnvType.CLIENT)
|
public class PuzzleOptionListWidget extends MidnightConfigListWidget {
|
||||||
public class PuzzleOptionListWidget extends MidnightConfig.MidnightConfigListWidget {
|
|
||||||
TextRenderer textRenderer;
|
TextRenderer textRenderer;
|
||||||
|
|
||||||
public PuzzleOptionListWidget(MinecraftClient minecraftClient, int i, int j, int k, int l) {
|
public PuzzleOptionListWidget(MinecraftClient minecraftClient, int i, int j, int k, int l) {
|
||||||
@@ -51,20 +53,21 @@ public class PuzzleOptionListWidget extends MidnightConfig.MidnightConfigListWid
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void addButton(List<ClickableWidget> buttons, Text text) {
|
public void addButton(List<ClickableWidget> buttons, Text text) {
|
||||||
MidnightConfig.EntryInfo info = new MidnightConfig.EntryInfo(null, "puzzle");
|
EntryInfo info = new EntryInfo(null, "puzzle");
|
||||||
if (buttons.isEmpty()) info.comment = new MidnightConfig.Comment(){
|
if (buttons.isEmpty()) info.comment = new MidnightConfig.Comment(){
|
||||||
public Class<? extends Annotation> annotationType() {return null;}
|
public Class<? extends Annotation> annotationType() {return null;}
|
||||||
public boolean centered() {return true;}
|
public boolean centered() {return true;}
|
||||||
public String category() {return "";}
|
public String category() {return "";}
|
||||||
public String name() {return "";}
|
public String name() {return "";}
|
||||||
|
public String url() {return "";}
|
||||||
public String requiredMod() {return "";}
|
public String requiredMod() {return "";}
|
||||||
};
|
};
|
||||||
var entry = new MidnightConfig.ButtonEntry(buttons, text, info);
|
var entry = new ButtonEntry(buttons, text, info);
|
||||||
this.addEntry(entry);
|
this.addEntry(entry);
|
||||||
}
|
}
|
||||||
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
|
public void renderWidget(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||||
super.renderWidget(context, mouseX, mouseY, delta);
|
super.renderWidget(context, mouseX, mouseY, delta);
|
||||||
MidnightConfig.ButtonEntry e = this.getHoveredEntry();
|
ButtonEntry e = this.getHoveredEntry();
|
||||||
if (client.currentScreen instanceof PuzzleOptionsScreen page && e != null && !e.buttons.isEmpty() &&
|
if (client.currentScreen instanceof PuzzleOptionsScreen page && e != null && !e.buttons.isEmpty() &&
|
||||||
e.text.getContent() instanceof TranslatableTextContent content) {
|
e.text.getContent() instanceof TranslatableTextContent content) {
|
||||||
ClickableWidget button = e.buttons.getFirst();
|
ClickableWidget button = e.buttons.getFirst();
|
||||||
@@ -91,7 +94,7 @@ public class PuzzleOptionListWidget extends MidnightConfig.MidnightConfigListWid
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MidnightConfig.ButtonEntry getHoveredEntry() {
|
public ButtonEntry getHoveredEntry() {
|
||||||
return super.getHoveredEntry();
|
return super.getHoveredEntry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
package net.puzzlemc.splashscreen;
|
package net.puzzlemc.splashscreen;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.pipeline.BlendFunction;
|
||||||
|
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||||
|
import com.mojang.blaze3d.platform.DepthTestFunction;
|
||||||
|
import com.mojang.blaze3d.platform.DestFactor;
|
||||||
|
import com.mojang.blaze3d.platform.SourceFactor;
|
||||||
import eu.midnightdust.lib.util.MidnightColorUtil;
|
import eu.midnightdust.lib.util.MidnightColorUtil;
|
||||||
import eu.midnightdust.lib.util.PlatformFunctions;
|
import eu.midnightdust.lib.util.PlatformFunctions;
|
||||||
import net.minecraft.client.texture.NativeImageBackedTexture;
|
import net.minecraft.client.texture.NativeImageBackedTexture;
|
||||||
@@ -12,6 +17,7 @@ import net.minecraft.client.resource.metadata.TextureResourceMetadata;
|
|||||||
import net.minecraft.client.texture.NativeImage;
|
import net.minecraft.client.texture.NativeImage;
|
||||||
import net.minecraft.client.texture.ResourceTexture;
|
import net.minecraft.client.texture.ResourceTexture;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.puzzlemc.splashscreen.mixin.RenderPipelinesAccessor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@@ -33,8 +39,9 @@ public class PuzzleSplashScreen {
|
|||||||
public static File CONFIG_PATH = new File(String.valueOf(PlatformFunctions.getConfigDirectory().resolve(".puzzle_cache")));
|
public static File CONFIG_PATH = new File(String.valueOf(PlatformFunctions.getConfigDirectory().resolve(".puzzle_cache")));
|
||||||
public static Path LOGO_TEXTURE = Paths.get(CONFIG_PATH + "/mojangstudios.png");
|
public static Path LOGO_TEXTURE = Paths.get(CONFIG_PATH + "/mojangstudios.png");
|
||||||
public static Path BACKGROUND_TEXTURE = Paths.get(CONFIG_PATH + "/splash_background.png");
|
public static Path BACKGROUND_TEXTURE = Paths.get(CONFIG_PATH + "/splash_background.png");
|
||||||
private static final MinecraftClient client = MinecraftClient.getInstance();
|
private static MinecraftClient client = MinecraftClient.getInstance();
|
||||||
private static boolean keepBackground = false;
|
private static boolean keepBackground = false;
|
||||||
|
private static RenderPipeline CUSTOM_LOGO_PIPELINE;
|
||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
if (!CONFIG_PATH.exists()) { // Run when config directory is nonexistent //
|
if (!CONFIG_PATH.exists()) { // Run when config directory is nonexistent //
|
||||||
@@ -45,8 +52,38 @@ public class PuzzleSplashScreen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
buildRenderLayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static RenderPipeline getCustomLogoRenderPipeline() {
|
||||||
|
return CUSTOM_LOGO_PIPELINE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void buildRenderLayer() {
|
||||||
|
if (PuzzleConfig.resourcepackSplashScreen) {
|
||||||
|
BlendFunction blendFunction = new BlendFunction(SourceFactor.SRC_ALPHA, DestFactor.ONE);
|
||||||
|
if (PuzzleConfig.disableBlend) blendFunction = null;
|
||||||
|
else if (PuzzleConfig.customBlendFunction.size() == 4) {
|
||||||
|
try {
|
||||||
|
blendFunction = new BlendFunction(
|
||||||
|
SourceFactor.valueOf(PuzzleConfig.customBlendFunction.get(0)),
|
||||||
|
DestFactor.valueOf(PuzzleConfig.customBlendFunction.get(1)),
|
||||||
|
SourceFactor.valueOf(PuzzleConfig.customBlendFunction.get(2)),
|
||||||
|
DestFactor.valueOf(PuzzleConfig.customBlendFunction.get(3)));
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error("Incorrect blend function defined in color.properties: {}{}", PuzzleConfig.customBlendFunction, e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var CUSTOM_LOGO_PIPELINE_BUILDER = RenderPipeline.builder(RenderPipelinesAccessor.getPOSITION_TEX_COLOR_SNIPPET())
|
||||||
|
.withLocation("pipeline/mojang_logo_puzzle")
|
||||||
|
.withDepthTestFunction(DepthTestFunction.NO_DEPTH_TEST)
|
||||||
|
.withDepthWrite(false);
|
||||||
|
CUSTOM_LOGO_PIPELINE_BUILDER = blendFunction != null ? CUSTOM_LOGO_PIPELINE_BUILDER.withBlend(blendFunction) : CUSTOM_LOGO_PIPELINE_BUILDER.withoutBlend();
|
||||||
|
|
||||||
|
CUSTOM_LOGO_PIPELINE = CUSTOM_LOGO_PIPELINE_BUILDER.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class ReloadListener implements SynchronousResourceReloader {
|
public static class ReloadListener implements SynchronousResourceReloader {
|
||||||
public static final ReloadListener INSTANCE = new ReloadListener();
|
public static final ReloadListener INSTANCE = new ReloadListener();
|
||||||
@@ -55,6 +92,7 @@ public class PuzzleSplashScreen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reload(ResourceManager manager) {
|
public void reload(ResourceManager manager) {
|
||||||
|
client = MinecraftClient.getInstance();
|
||||||
if (PuzzleConfig.resourcepackSplashScreen) {
|
if (PuzzleConfig.resourcepackSplashScreen) {
|
||||||
PuzzleSplashScreen.resetColors();
|
PuzzleSplashScreen.resetColors();
|
||||||
client.getTextureManager().registerTexture(LOGO, new LogoTexture(LOGO));
|
client.getTextureManager().registerTexture(LOGO, new LogoTexture(LOGO));
|
||||||
@@ -107,7 +145,7 @@ public class PuzzleSplashScreen {
|
|||||||
try (InputStream stream = resource.getInputStream()) {
|
try (InputStream stream = resource.getInputStream()) {
|
||||||
Files.copy(stream, BACKGROUND_TEXTURE, StandardCopyOption.REPLACE_EXISTING);
|
Files.copy(stream, BACKGROUND_TEXTURE, StandardCopyOption.REPLACE_EXISTING);
|
||||||
InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.BACKGROUND_TEXTURE));
|
InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.BACKGROUND_TEXTURE));
|
||||||
client.getTextureManager().registerTexture(BACKGROUND, new NativeImageBackedTexture(NativeImage.read(input)));
|
client.getTextureManager().registerTexture(BACKGROUND, new NativeImageBackedTexture(() -> "splash_screen_background", NativeImage.read(input)));
|
||||||
keepBackground = true;
|
keepBackground = true;
|
||||||
PuzzleConfig.hasCustomSplashScreen = true;
|
PuzzleConfig.hasCustomSplashScreen = true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -121,6 +159,7 @@ public class PuzzleSplashScreen {
|
|||||||
}
|
}
|
||||||
keepBackground = false;
|
keepBackground = false;
|
||||||
PuzzleConfig.write(MOD_ID);
|
PuzzleConfig.write(MOD_ID);
|
||||||
|
buildRenderLayer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
package net.puzzlemc.splashscreen.mixin;
|
package net.puzzlemc.splashscreen.mixin;
|
||||||
|
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
|
||||||
|
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gl.RenderPipelines;
|
||||||
import net.minecraft.client.gui.DrawContext;
|
import net.minecraft.client.gui.DrawContext;
|
||||||
import net.minecraft.client.gui.screen.Overlay;
|
import net.minecraft.client.gui.screen.Overlay;
|
||||||
import net.minecraft.client.gui.screen.SplashOverlay;
|
import net.minecraft.client.gui.screen.SplashOverlay;
|
||||||
import net.minecraft.client.render.*;
|
|
||||||
import net.minecraft.client.texture.NativeImage;
|
import net.minecraft.client.texture.NativeImage;
|
||||||
import net.minecraft.client.texture.NativeImageBackedTexture;
|
import net.minecraft.client.texture.NativeImageBackedTexture;
|
||||||
import net.minecraft.client.texture.TextureManager;
|
import net.minecraft.client.texture.TextureManager;
|
||||||
@@ -28,7 +29,6 @@ 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)
|
||||||
@@ -52,7 +52,7 @@ public abstract class MixinSplashScreen extends Overlay {
|
|||||||
if (PuzzleSplashScreen.BACKGROUND_TEXTURE.toFile().exists()) {
|
if (PuzzleSplashScreen.BACKGROUND_TEXTURE.toFile().exists()) {
|
||||||
try {
|
try {
|
||||||
InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.BACKGROUND_TEXTURE));
|
InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.BACKGROUND_TEXTURE));
|
||||||
textureManager.registerTexture(BACKGROUND, new NativeImageBackedTexture(NativeImage.read(input)));
|
textureManager.registerTexture(BACKGROUND, new NativeImageBackedTexture(() -> "splash_screen_background", NativeImage.read(input)));
|
||||||
} catch (IOException ignored) {}
|
} catch (IOException ignored) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,23 +62,14 @@ public abstract class MixinSplashScreen extends Overlay {
|
|||||||
private int puzzle$modifyBackground(IntSupplier instance) { // Set the Progress Bar Frame Color to our configured value //
|
private int puzzle$modifyBackground(IntSupplier instance) { // Set the Progress Bar Frame Color to our configured value //
|
||||||
return (!PuzzleConfig.resourcepackSplashScreen || PuzzleConfig.progressBarBackgroundColor == 15675965) ? instance.getAsInt() : PuzzleConfig.backgroundColor | 255 << 24;
|
return (!PuzzleConfig.resourcepackSplashScreen || PuzzleConfig.progressBarBackgroundColor == 15675965) ? instance.getAsInt() : PuzzleConfig.backgroundColor | 255 << 24;
|
||||||
}
|
}
|
||||||
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/ColorHelper;getWhite(F)I", shift = At.Shift.AFTER))
|
|
||||||
private void puzzle$betterBlend(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
@WrapOperation(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/DrawContext;drawTexture(Lcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/util/Identifier;IIFFIIIIIII)V"))
|
||||||
if (PuzzleConfig.resourcepackSplashScreen) {
|
private void puzzle$modifyRenderLayer(DrawContext instance, RenderPipeline pipeline, Identifier sprite, int x, int y, float u, float v, int width, int height, int regionWidth, int regionHeight, int textureWidth, int textureHeight, int color, Operation<Void> original) {
|
||||||
if (PuzzleConfig.disableBlend) RenderSystem.disableBlend();
|
if (PuzzleConfig.resourcepackSplashScreen)
|
||||||
else if (PuzzleConfig.customBlendFunction.size() == 4) {
|
instance.drawTexture(PuzzleSplashScreen.getCustomLogoRenderPipeline(), sprite, x, y, u, v, width, height, regionWidth, regionHeight, textureWidth, textureHeight, color);
|
||||||
try {
|
else instance.drawTexture(pipeline, sprite, x, y, u, v, width, height, textureWidth, textureHeight, color);
|
||||||
RenderSystem.blendFuncSeparate(
|
|
||||||
GlStateManager.SrcFactor.valueOf(PuzzleConfig.customBlendFunction.get(0)),
|
|
||||||
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))
|
||||||
private void puzzle$renderSplashBackground(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
private void puzzle$renderSplashBackground(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
|
||||||
if (Files.exists(PuzzleSplashScreen.BACKGROUND_TEXTURE) && PuzzleConfig.resourcepackSplashScreen) {
|
if (Files.exists(PuzzleSplashScreen.BACKGROUND_TEXTURE) && PuzzleConfig.resourcepackSplashScreen) {
|
||||||
@@ -91,23 +82,16 @@ public abstract class MixinSplashScreen extends Overlay {
|
|||||||
if (f >= 1.0F) s = 1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F);
|
if (f >= 1.0F) s = 1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F);
|
||||||
else if (reloading) s = MathHelper.clamp(g, 0.0F, 1.0F);
|
else if (reloading) s = MathHelper.clamp(g, 0.0F, 1.0F);
|
||||||
else s = 1.0F;
|
else s = 1.0F;
|
||||||
RenderSystem.enableBlend();
|
context.drawTexture(RenderPipelines.GUI_TEXTURED, BACKGROUND, 0, 0, 0, 0, width, height, width, height, ColorHelper.getWhite(s));
|
||||||
RenderSystem.blendEquation(32774);
|
|
||||||
RenderSystem.defaultBlendFunc();
|
|
||||||
context.getMatrices().translate(0, 0, 1f);
|
|
||||||
context.drawTexture(RenderLayer::getGuiTextured, BACKGROUND, 0, 0, 0, 0, width, height, width, height, ColorHelper.getWhite(s));
|
|
||||||
RenderSystem.defaultBlendFunc();
|
|
||||||
RenderSystem.disableBlend();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "renderProgressBar", at = @At("HEAD"))
|
@Inject(method = "renderProgressBar", at = @At("HEAD"))
|
||||||
private void puzzle$addProgressBarBackground(DrawContext context, int minX, int minY, int maxX, int maxY, float opacity, CallbackInfo ci) {
|
private void puzzle$addProgressBarBackground(DrawContext context, int minX, int minY, int maxX, int maxY, float opacity, CallbackInfo ci) {
|
||||||
context.getMatrices().translate(0, 0, 1f);
|
|
||||||
if (!PuzzleConfig.resourcepackSplashScreen || PuzzleConfig.progressBarBackgroundColor == 15675965) return;
|
if (!PuzzleConfig.resourcepackSplashScreen || PuzzleConfig.progressBarBackgroundColor == 15675965) return;
|
||||||
long l = Util.getMeasuringTimeMs();
|
long l = Util.getMeasuringTimeMs();
|
||||||
float f = this.reloadCompleteTime > -1L ? (float)(l - this.reloadCompleteTime) / 1000.0F : -1.0F;
|
float f = this.reloadCompleteTime > -1L ? (float)(l - this.reloadCompleteTime) / 1000.0F : -1.0F;
|
||||||
int m = MathHelper.ceil((1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F)) * 255.0F);
|
int m = MathHelper.ceil((1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F)) * 255.0F);
|
||||||
RenderSystem.disableBlend();
|
|
||||||
context.fill(minX, minY, maxX, maxY, withAlpha(PuzzleConfig.progressBarBackgroundColor, m));
|
context.fill(minX, minY, maxX, maxY, withAlpha(PuzzleConfig.progressBarBackgroundColor, m));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package net.puzzlemc.splashscreen.mixin;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||||
|
import net.minecraft.client.gl.RenderPipelines;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
|
@Mixin(RenderPipelines.class)
|
||||||
|
public interface RenderPipelinesAccessor {
|
||||||
|
@Accessor
|
||||||
|
static RenderPipeline.Snippet getPOSITION_TEX_COLOR_SNIPPET() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"puzzle.text.update_available":"Uma atualização está disponível!",
|
"puzzle.text.update_available":"Uma atualização está disponível!",
|
||||||
"puzzle.screen.title":"Puzzle Definições",
|
"puzzle.screen.title":"Configurações do Puzzle",
|
||||||
"puzzle.page.graphics":"Gráficas",
|
"puzzle.page.graphics":"Gráficas",
|
||||||
"puzzle.page.resources":"Recursos",
|
"puzzle.page.resources":"Recursos",
|
||||||
"puzzle.page.performance":"Desempenho",
|
"puzzle.page.performance":"Desempenho",
|
||||||
@@ -8,16 +8,19 @@
|
|||||||
"puzzle.option.check_for_updates":"Verifique se há atualizações",
|
"puzzle.option.check_for_updates":"Verifique se há atualizações",
|
||||||
"puzzle.option.check_for_updates.tooltip":"Ativa o verificador de atualização integrado do Puzzle",
|
"puzzle.option.check_for_updates.tooltip":"Ativa o verificador de atualização integrado do Puzzle",
|
||||||
"puzzle.option.show_version_info":"Mostrar informações da versão do Puzzle",
|
"puzzle.option.show_version_info":"Mostrar informações da versão do Puzzle",
|
||||||
"puzzle.option.show_version_info.tooltip":"Mostrar informações sobre o atual\nVersão do Puzzle e status de atualização em\na tela de título e o menu F3",
|
"puzzle.option.show_version_info.tooltip":"Mostrar informações sobre o atual\nversão do Puzzle e status de atualização em\n Tela de Título e o Menu F3",
|
||||||
"puzzle.option.resourcepack_splash_screen":"Use a tela inicial do pacote de recursos",
|
"puzzle.option.resourcepack_splash_screen":"Use a tela inicial do pacote de recursos",
|
||||||
"puzzle.option.resourcepack_splash_screen.tooltip":"Permite que os pacotes de recursos mudem a aparência\ndo carregamento do Minecraft/splash\ntela usando o formato OptiFine",
|
"puzzle.option.resourcepack_splash_screen.tooltip":"Permite que os pacotes de recursos mudem a aparência\ndo carregamento do Minecraft/splash\ntela usando o formato OptiFine",
|
||||||
"puzzle.option.better_splash_screen_blend":"Melhor combinação do logotipo da tela inicial",
|
"puzzle.option.better_splash_screen_blend":"Melhor combinação do logotipo da tela inicial",
|
||||||
"puzzle.option.better_splash_screen_blend.tooltip":"Muda o tipo de mistura usado\npelo logotipo na tela inicial\npara trabalhar melhor com logotipos coloridos personalizados",
|
"puzzle.option.better_splash_screen_blend.tooltip":"Muda o tipo de mistura usado\npelo logotipo na tela inicial\npara trabalhar melhor com logotipos coloridos personalizados",
|
||||||
"puzzle.option.unlimited_model_rotations":"Rotações de modelo ilimitadas",
|
"puzzle.option.unlimited_model_rotations":"Rotações de Modelo Ilimitadas",
|
||||||
"puzzle.option.unlimited_model_rotations.tooltip":"Desbloqueia rotação total de 360° em modelos de itens/blocos personalizados",
|
"puzzle.option.unlimited_model_rotations.tooltip":"Desbloqueia rotação total de 360° em modelos de itens/blocos personalizados",
|
||||||
"puzzle.option.bigger_custom_models":"Modelos personalizados maiores",
|
"puzzle.option.bigger_custom_models":"Modelos Personalizados Maiores",
|
||||||
"puzzle.option.bigger_custom_models.tooltip":"Aumenta o limite de\ntamanhos de modelo de bloco/item personalizados\nde 3x3x3 a 5x5x5",
|
"puzzle.option.bigger_custom_models.tooltip":"Aumenta o limite de\ntamanhos de modelo de bloco/item personalizados\nde 3x3x3 a 5x5x5",
|
||||||
"puzzle.midnightconfig.title":"Configuração avançada do Puzzle",
|
"puzzle.midnightconfig.title":"Configuração Avançada do Puzzle",
|
||||||
|
"puzzle.midnightconfig.category.gui":"GUI",
|
||||||
|
"puzzle.midnightconfig.category.features":"Recursos",
|
||||||
|
"puzzle.midnightconfig.category.internal":"Interno",
|
||||||
"puzzle.midnightconfig.tooltip":"Opções apenas para usuários avançados",
|
"puzzle.midnightconfig.tooltip":"Opções apenas para usuários avançados",
|
||||||
|
|
||||||
"cullleaves.puzzle.option.enabled": "Abate de Folhas",
|
"cullleaves.puzzle.option.enabled": "Abate de Folhas",
|
||||||
@@ -34,6 +37,6 @@
|
|||||||
"config.dynamicfps.run_gc_on_unfocus.tooltip": "Execute um coletor de lixo enquanto\nMinecraft não está focado em\nliberar um pouco de RAM",
|
"config.dynamicfps.run_gc_on_unfocus.tooltip": "Execute um coletor de lixo enquanto\nMinecraft não está focado em\nliberar um pouco de RAM",
|
||||||
"config.dynamicfps.unfocused_volume.tooltip": "O volume que o jogo deve reproduzir\nsom enquanto desfocado\n(ou seja, outra janela é selecionada)",
|
"config.dynamicfps.unfocused_volume.tooltip": "O volume que o jogo deve reproduzir\nsom enquanto desfocado\n(ou seja, outra janela é selecionada)",
|
||||||
"config.dynamicfps.hidden_volume.tooltip": "O volume que o jogo deve reproduzir\nsom em enquanto não visível\n(ou seja, minimizado, coberto por outras janelas\nem em outra área de trabalho virtual)",
|
"config.dynamicfps.hidden_volume.tooltip": "O volume que o jogo deve reproduzir\nsom em enquanto não visível\n(ou seja, minimizado, coberto por outras janelas\nem em outra área de trabalho virtual)",
|
||||||
"entity_texture_features.puzzle.emissive_type.brighter": "§eMais brilhante",
|
"entity_texture_features.puzzle.emissive_type.brighter": "§eMais Brilhante",
|
||||||
"entity_texture_features.puzzle.emissive_type.default": "§6Padrão"
|
"entity_texture_features.puzzle.emissive_type.default": "§6Padrão"
|
||||||
}
|
}
|
||||||
@@ -1,2 +1,7 @@
|
|||||||
accessWidener v1 named
|
accessWidener v1 named
|
||||||
accessible class net/minecraft/client/render/model/json/ModelElement$Deserializer
|
accessible class net/minecraft/client/render/model/json/ModelElement$Deserializer
|
||||||
|
accessible method net/minecraft/client/render/RenderLayer of (Ljava/lang/String;ILcom/mojang/blaze3d/pipeline/RenderPipeline;Lnet/minecraft/client/render/RenderLayer$MultiPhaseParameters;)Lnet/minecraft/client/render/RenderLayer$MultiPhase;
|
||||||
|
accessible class net/minecraft/client/render/RenderLayer$MultiPhaseParameters
|
||||||
|
accessible class net/minecraft/client/render/RenderPhase$Texture
|
||||||
|
accessible method net/minecraft/client/render/RenderLayer$MultiPhaseParameters$Builder texture (Lnet/minecraft/client/render/RenderPhase$TextureBase;)Lnet/minecraft/client/render/RenderLayer$MultiPhaseParameters$Builder;
|
||||||
|
accessible method net/minecraft/client/render/RenderLayer$MultiPhaseParameters$Builder build (Z)Lnet/minecraft/client/render/RenderLayer$MultiPhaseParameters;
|
||||||
@@ -3,7 +3,8 @@
|
|||||||
"package": "net.puzzlemc.splashscreen.mixin",
|
"package": "net.puzzlemc.splashscreen.mixin",
|
||||||
"compatibilityLevel": "JAVA_17",
|
"compatibilityLevel": "JAVA_17",
|
||||||
"client": [
|
"client": [
|
||||||
"MixinSplashScreen"
|
"MixinSplashScreen",
|
||||||
|
"RenderPipelinesAccessor"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ dependencies {
|
|||||||
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
|
modApi "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
|
||||||
modImplementation include ("maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric")
|
modImplementation include ("maven.modrinth:midnightlib:${rootProject.midnightlib_version}-fabric")
|
||||||
|
|
||||||
modImplementation ("com.terraformersmc:modmenu:${project.modmenu_version}") {
|
modCompileOnlyApi ("com.terraformersmc:modmenu:${project.modmenu_version}") {
|
||||||
exclude(group: "net.fabricmc.fabric-api")
|
exclude(group: "net.fabricmc.fabric-api")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
# Done to increase the memory available to gradle.
|
# Done to increase the memory available to gradle.
|
||||||
org.gradle.jvmargs=-Xmx2G
|
org.gradle.jvmargs=-Xmx2G
|
||||||
|
|
||||||
minecraft_version=1.21.4
|
minecraft_version=1.21.9
|
||||||
supported_versions=
|
supported_versions=
|
||||||
yarn_mappings=1.21.4+build.1
|
yarn_mappings=1.21.9+build.1
|
||||||
enabled_platforms=fabric,neoforge
|
enabled_platforms=fabric,neoforge
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 2.0.5
|
mod_version = 2.1.2
|
||||||
maven_group = net.puzzlemc
|
maven_group = net.puzzlemc
|
||||||
archives_base_name = puzzle
|
archives_base_name = puzzle
|
||||||
release_type=release
|
release_type=release
|
||||||
@@ -15,15 +15,15 @@ curseforge_id=563977
|
|||||||
modrinth_id=3IuO68q1
|
modrinth_id=3IuO68q1
|
||||||
|
|
||||||
# Modloaders
|
# Modloaders
|
||||||
fabric_loader_version=0.16.9
|
fabric_loader_version=0.17.2
|
||||||
fabric_api_version=0.110.5+1.21.4
|
fabric_api_version=0.133.14+1.21.9
|
||||||
|
|
||||||
neoforge_version=21.4.9-beta
|
neoforge_version=21.9.3-beta
|
||||||
yarn_mappings_patch_neoforge_version = 1.21+build.4
|
yarn_mappings_patch_neoforge_version = 1.21+build.4
|
||||||
|
|
||||||
# Libraries
|
# Libraries
|
||||||
midnightlib_version = 1.7.0+1.21.4
|
midnightlib_version = 1.8.1+1.21.9
|
||||||
modmenu_version = 13.0.0-beta.1
|
modmenu_version = 15.0.0-beta.1
|
||||||
|
|
||||||
# Mod Integrations
|
# Mod Integrations
|
||||||
cull_leaves_version = 3.0.2-fabric
|
cull_leaves_version = 3.0.2-fabric
|
||||||
@@ -39,8 +39,8 @@ toml4j_version = 0.7.2
|
|||||||
cit_resewn_version = 1.1.3+1.20
|
cit_resewn_version = 1.1.3+1.20
|
||||||
complete_config_version = 2.3.0
|
complete_config_version = 2.3.0
|
||||||
spruceui_version=5.0.0+1.20
|
spruceui_version=5.0.0+1.20
|
||||||
emf_version=2.2.3
|
emf_version=2.4.1
|
||||||
etf_version=6.2.2
|
etf_version=6.2.10
|
||||||
exordium_version=1.2.1-1.20.2
|
exordium_version=1.2.1-1.20.2
|
||||||
# Required for LBG
|
# Required for LBG
|
||||||
quilt_loader_version=0.19.0-beta.18
|
quilt_loader_version=0.19.0-beta.18
|
||||||
|
|||||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
package net.puzzlemc.neoforge;
|
package net.puzzlemc.neoforge;
|
||||||
|
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
import net.neoforged.api.distmarker.Dist;
|
import net.neoforged.api.distmarker.Dist;
|
||||||
import net.neoforged.bus.api.SubscribeEvent;
|
import net.neoforged.bus.api.SubscribeEvent;
|
||||||
import net.neoforged.fml.ModList;
|
import net.neoforged.fml.ModList;
|
||||||
import net.neoforged.fml.common.EventBusSubscriber;
|
import net.neoforged.fml.common.EventBusSubscriber;
|
||||||
import net.neoforged.fml.common.Mod;
|
import net.neoforged.fml.common.Mod;
|
||||||
import net.neoforged.neoforge.client.event.RegisterClientReloadListenersEvent;
|
import net.neoforged.neoforge.client.event.AddClientReloadListenersEvent;
|
||||||
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
|
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
|
||||||
import net.puzzlemc.core.PuzzleCore;
|
import net.puzzlemc.core.PuzzleCore;
|
||||||
import net.puzzlemc.gui.screen.PuzzleOptionsScreen;
|
import net.puzzlemc.gui.screen.PuzzleOptionsScreen;
|
||||||
@@ -20,11 +21,11 @@ public class PuzzleNeoForge {
|
|||||||
ModList.get().getModContainerById(MOD_ID).orElseThrow().registerExtensionPoint(IConfigScreenFactory.class, (client, parent) -> new PuzzleOptionsScreen(parent));
|
ModList.get().getModContainerById(MOD_ID).orElseThrow().registerExtensionPoint(IConfigScreenFactory.class, (client, parent) -> new PuzzleOptionsScreen(parent));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusSubscriber(modid = MOD_ID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
|
@EventBusSubscriber(modid = MOD_ID, value = Dist.CLIENT)
|
||||||
public static class MidnightLibBusEvents {
|
public static class MidnightLibBusEvents {
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onResourceReload(RegisterClientReloadListenersEvent event) {
|
public static void onResourceReload(AddClientReloadListenersEvent event) {
|
||||||
event.registerReloadListener(PuzzleSplashScreen.ReloadListener.INSTANCE);
|
event.addListener(Identifier.of(MOD_ID, "splash_screen"), PuzzleSplashScreen.ReloadListener.INSTANCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user