mirror of
https://github.com/PuzzleMC/Puzzle.git
synced 2025-12-15 11:25:11 +01:00
stonecutter: support NeoForge 1.21.10
This commit is contained in:
@@ -1,17 +1,19 @@
|
||||
package net.puzzlemc.core;
|
||||
|
||||
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
||||
import com.terraformersmc.modmenu.api.ModMenuApi;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.resource.v1.ResourceLoader;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.PackType;
|
||||
import net.puzzlemc.gui.screen.PuzzleOptionsScreen;
|
||||
import net.puzzlemc.splashscreen.PuzzleSplashScreen;
|
||||
|
||||
import static net.puzzlemc.core.PuzzleCore.MOD_ID;
|
||||
|
||||
//? fabric {
|
||||
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
||||
import com.terraformersmc.modmenu.api.ModMenuApi;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.resource.v1.ResourceLoader;
|
||||
import net.minecraft.server.packs.PackType;
|
||||
|
||||
public class PuzzleClient implements ClientModInitializer, ModMenuApi {
|
||||
|
||||
@Override
|
||||
@@ -30,19 +32,27 @@ public class PuzzleClient implements ClientModInitializer, ModMenuApi {
|
||||
//?}
|
||||
|
||||
//? neoforge {
|
||||
// @Mod(value = MOD_ID, dist = Dist.CLIENT)
|
||||
// public class PuzzleClient {
|
||||
// public PuzzleClient() {
|
||||
// PuzzleCore.initModules();
|
||||
// ModList.get().getModContainerById(MOD_ID).orElseThrow().registerExtensionPoint(IConfigScreenFactory.class, (client, parent) -> new PuzzleOptionsScreen(parent));
|
||||
// }
|
||||
//
|
||||
// @EventBusSubscriber(modid = MOD_ID, value = Dist.CLIENT)
|
||||
// public static class MidnightLibBusEvents {
|
||||
// @SubscribeEvent
|
||||
// public static void onResourceReload(AddClientReloadListenersEvent event) {
|
||||
// event.addListener(ResourceLocation.of(MOD_ID, "splash_screen"), PuzzleSplashScreen.ReloadListener.INSTANCE);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//?}
|
||||
/*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.AddClientReloadListenersEvent;
|
||||
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
|
||||
|
||||
@Mod(value = MOD_ID, dist = Dist.CLIENT)
|
||||
public class PuzzleClient {
|
||||
public PuzzleClient() {
|
||||
PuzzleCore.initModules();
|
||||
ModList.get().getModContainerById(MOD_ID).orElseThrow().registerExtensionPoint(IConfigScreenFactory.class, (client, parent) -> new PuzzleOptionsScreen(parent));
|
||||
}
|
||||
|
||||
@EventBusSubscriber(modid = MOD_ID, value = Dist.CLIENT)
|
||||
public static class MidnightLibBusEvents {
|
||||
@SubscribeEvent
|
||||
public static void onResourceReload(AddClientReloadListenersEvent event) {
|
||||
event.addListener(ResourceLocation.fromNamespaceAndPath(MOD_ID, "splash_screen"), PuzzleSplashScreen.ReloadListener.INSTANCE);
|
||||
}
|
||||
}
|
||||
}
|
||||
*///?}
|
||||
@@ -11,9 +11,11 @@ import static net.puzzlemc.gui.PuzzleGui.YES;
|
||||
|
||||
public class LBGCompat {
|
||||
public static void init() {
|
||||
//? fabric {
|
||||
LBGConfig lbgConfig = LambdaBetterGrass.get().config;
|
||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Component.literal("\uD83C\uDF31 LambdaBetterGrass")));
|
||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Component.translatable("lambdabettergrass.option.mode"), (button) -> button.setMessage(lbgConfig.getMode().getTranslatedText()), (button) -> lbgConfig.setMode(lbgConfig.getMode().next())));
|
||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Component.translatable("lambdabettergrass.option.better_snow"), (button) -> button.setMessage(lbgConfig.hasBetterLayer() ? YES : NO), (button) -> lbgConfig.setBetterLayer(!lbgConfig.hasBetterLayer())));
|
||||
//?}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import static net.puzzlemc.gui.PuzzleGui.YES;
|
||||
|
||||
public class LDLCompat {
|
||||
public static void init() {
|
||||
//? fabric {
|
||||
DynamicLightsConfig ldlConfig = LambDynLights.get().config;
|
||||
|
||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Component.literal("\uD83D\uDCA1 LambDynamicLights")));
|
||||
@@ -19,5 +20,6 @@ public class LDLCompat {
|
||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Component.empty().append("DynLights: ").append(Component.translatable("entity.minecraft.creeper")), (button) -> button.setMessage(ldlConfig.getCreeperLightingMode().getTranslatedText()), (button) -> ldlConfig.setCreeperLightingMode(ldlConfig.getCreeperLightingMode().next())));
|
||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Component.empty().append("DynLights: ").append(Component.translatable("block.minecraft.tnt")), (button) -> button.setMessage(ldlConfig.getTntLightingMode().getTranslatedText()), (button) -> ldlConfig.setTntLightingMode(ldlConfig.getTntLightingMode().next())));
|
||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Component.empty().append("DynLights: ").append(Component.translatable("lambdynlights.option.light_sources.water_sensitive_check")), (button) -> button.setMessage(ldlConfig.getWaterSensitiveCheck().get() ? YES : NO), (button) -> ldlConfig.getWaterSensitiveCheck().set(!ldlConfig.getWaterSensitiveCheck().get())));
|
||||
//?}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,8 +46,10 @@ public abstract class MixinOptionsScreen extends Screen {
|
||||
@Unique
|
||||
public void puzzle$setButtonPos() {
|
||||
int i = 0;
|
||||
if (PlatformFunctions.isModLoaded("lod")) i = i + 358;
|
||||
if (MidnightLibConfig.config_screen_list.equals(MidnightLibConfig.ConfigButton.FALSE)) i = i - 25;
|
||||
if (PlatformFunctions.isModLoaded("lod")) {
|
||||
i = i + 358;
|
||||
if (MidnightLibConfig.config_screen_list.equals(MidnightLibConfig.ConfigButton.FALSE)) i = i - 25;
|
||||
}
|
||||
puzzle$button.setPosition(this.width / 2 - 178 + i, layout.getY() + layout.getFooterHeight() - 4);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
package net.puzzlemc.splashscreen.mixin;
|
||||
|
||||
//? neoforge || forge {
|
||||
//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();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//?}
|
||||
/*import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.LoadingOverlay;
|
||||
import net.minecraft.server.packs.resources.ReloadInstance;
|
||||
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 LoadingOverlay {
|
||||
public MixinNeoForgeLoadingOverlay(Minecraft arg, ReloadInstance arg2, Consumer<Optional<Throwable>> consumer, boolean bl) {
|
||||
super(arg, arg2, consumer, bl);
|
||||
}
|
||||
|
||||
@Inject(method = "render", at = @At("HEAD"), cancellable = true) // Replaces the NeoForge loading screen in later stages with the (customized) vanilla version
|
||||
private void redirectNeoForgeLoading(GuiGraphics context, int mouseX, int mouseY, float tickDelta, CallbackInfo ci) {
|
||||
if (PuzzleConfig.resourcepackSplashScreen && PuzzleConfig.hasCustomSplashScreen) {
|
||||
super.render(context, mouseX, mouseY, tickDelta);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
*///?}
|
||||
|
||||
Reference in New Issue
Block a user