stonecutter: support MC 1.21.5

This commit is contained in:
Martin Prokoph
2025-11-04 23:07:54 +01:00
parent fc4db5f749
commit cb2989488c
3 changed files with 21 additions and 6 deletions

View File

@@ -98,7 +98,11 @@ public class MidnightLib {
if (PlatformFunctions.isClientEnv()) this.onInitializeClient();
}
//? if >= 1.21.6 {
@EventBusSubscriber(modid = "midnightlib", value = Dist.CLIENT)
//?} else {
/^@EventBusSubscriber(modid = "midnightlib", bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
^///?}
public static class MidnightLibBusEvents {
@SubscribeEvent
public static void onPostInit(FMLClientSetupEvent event) {

View File

@@ -6,8 +6,13 @@ import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.components.ContainerObjectSelectionList;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.renderer.RenderPipelines;
import net.minecraft.network.chat.Component;
//? if >= 1.21.6 {
import net.minecraft.client.renderer.RenderPipelines;
//?} else {
/*import net.minecraft.client.renderer.RenderType;
*///?}
public class MidnightConfigListWidget extends ContainerObjectSelectionList<ButtonEntry> {
public boolean renderHeaderSeparator = true;
@@ -26,7 +31,13 @@ public class MidnightConfigListWidget extends ContainerObjectSelectionList<Butto
if (renderHeaderSeparator)
super.renderListSeparators(context);
else
context.blit(RenderPipelines.GUI_TEXTURED, this.minecraft.level == null ? Screen.FOOTER_SEPARATOR : Screen.INWORLD_FOOTER_SEPARATOR, this.getX(), this.getBottom(), 0, 0, this.getWidth(), 2, 32, 2);
context.blit(
//? if >= 1.21.6 {
RenderPipelines.GUI_TEXTURED
//?} else {
/*RenderType::guiTextured
*///?}
, this.minecraft.level == null ? Screen.FOOTER_SEPARATOR : Screen.INWORLD_FOOTER_SEPARATOR, this.getX(), this.getBottom(), 0, 0, this.getWidth(), 2, 32, 2);
}
public void addButton(List<AbstractWidget> buttons, Component text, EntryInfo info) {

View File

@@ -43,10 +43,10 @@ public class PlatformFunctions {
}
public static boolean isClientEnv() {
//? if >= 1.21.9 {
/^return FMLEnvironment.getDist().isClient();
^///?} else {
return FMLEnvironment.dist.isClient();
//?}
return FMLEnvironment.getDist().isClient();
//?} else {
/^return FMLEnvironment.dist.isClient();
^///?}
}
public static boolean isModLoaded(String modid) {
return ModList.get().isLoaded(modid);