mirror of
https://github.com/PuzzleMC/Puzzle.git
synced 2025-12-16 20:05:09 +01:00
Puzzle 2.0.0 - Multiplatform & Cleaner code
- Removed intrusive branding (previously visible on Title screen and F3 menu) - De-modularized: Previously, Puzzle was split into multiple modules which complicated the development process and was just unnecessary - Experimental NeoForge support - Many small improvements - puzzle-splashscreen: Improved background image blending - puzzle-splashscreen: Added support for custom blend functions for full OptiFine parity
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
package net.puzzlemc.neoforge;
|
||||
|
||||
import net.neoforged.api.distmarker.Dist;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.ModList;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.neoforge.client.event.RegisterClientReloadListenersEvent;
|
||||
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
|
||||
import net.puzzlemc.core.PuzzleCore;
|
||||
import net.puzzlemc.gui.screen.PuzzleOptionsScreen;
|
||||
import net.puzzlemc.splashscreen.PuzzleSplashScreen;
|
||||
|
||||
import static net.puzzlemc.core.PuzzleCore.MOD_ID;
|
||||
|
||||
@Mod(value = MOD_ID, dist = Dist.CLIENT)
|
||||
public class PuzzleNeoForge {
|
||||
public PuzzleNeoForge() {
|
||||
PuzzleCore.initModules();
|
||||
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)
|
||||
public static class MidnightLibBusEvents {
|
||||
@SubscribeEvent
|
||||
public static void onResourceReload(RegisterClientReloadListenersEvent event) {
|
||||
event.registerReloadListener(PuzzleSplashScreen.ReloadListener.INSTANCE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package net.puzzlemc.neoforge.mixin.splashscreen;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.SplashOverlay;
|
||||
import net.minecraft.resource.ResourceReload;
|
||||
import net.neoforged.neoforge.client.loading.NeoForgeLoadingOverlay;
|
||||
import net.puzzlemc.core.config.PuzzleConfig;
|
||||
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.CallbackInfo;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mixin(NeoForgeLoadingOverlay.class)
|
||||
public class MixinNeoForgeLoadingOverlay extends SplashOverlay {
|
||||
public MixinNeoForgeLoadingOverlay(MinecraftClient client, ResourceReload monitor, Consumer<Optional<Throwable>> exceptionHandler, boolean reloading) {
|
||||
super(client, monitor, exceptionHandler, reloading);
|
||||
}
|
||||
|
||||
@Inject(method = "render", at = @At("HEAD"), cancellable = true) // Replaces the NeoForge loading screen in later stages with the (customized) vanilla version
|
||||
private void redirectNeoForgeLoading(DrawContext context, int mouseX, int mouseY, float tickDelta, CallbackInfo ci) {
|
||||
if (PuzzleConfig.resourcepackSplashScreen && PuzzleConfig.hasCustomSplashScreen) {
|
||||
super.render(context, mouseX, mouseY, tickDelta);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
37
neoforge/src/main/resources/META-INF/neoforge.mods.toml
Normal file
37
neoforge/src/main/resources/META-INF/neoforge.mods.toml
Normal file
@@ -0,0 +1,37 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "[2,)"
|
||||
#issueTrackerURL = ""
|
||||
license = "MIT License"
|
||||
|
||||
[[mods]]
|
||||
modId = "puzzle"
|
||||
version = "${version}"
|
||||
displayName = "Puzzle"
|
||||
logoFile = "puzzle.png"
|
||||
authors = "PuzzleMC, Motschen"
|
||||
description = '''
|
||||
Improved resourcepack capabilities.
|
||||
'''
|
||||
|
||||
[[mixins]]
|
||||
config = "puzzle-gui.mixins.json"
|
||||
[[mixins]]
|
||||
config = "puzzle-models.mixins.json"
|
||||
[[mixins]]
|
||||
config = "puzzle-splashscreen.mixins.json"
|
||||
[[mixins]]
|
||||
config = "puzzle-splashscreen_neoforge.mixins.json"
|
||||
|
||||
[[dependencies.puzzle]]
|
||||
modId = "neoforge"
|
||||
mandatory = true
|
||||
versionRange = "[21.0,)"
|
||||
ordering = "NONE"
|
||||
side = "CLIENT"
|
||||
|
||||
[[dependencies.puzzle]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
versionRange = "[1.21,)"
|
||||
ordering = "NONE"
|
||||
side = "CLIENT"
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "net.puzzlemc.neoforge.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"client": [
|
||||
"splashscreen.MixinNeoForgeLoadingOverlay"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
BIN
neoforge/src/main/resources/puzzle.png
Normal file
BIN
neoforge/src/main/resources/puzzle.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Reference in New Issue
Block a user