feat: Update to Minecraft 26.2 (rc 2)
This commit is contained in:
+7
-1
@@ -12,6 +12,7 @@ import de.siphalor.tweed5.core.api.entry.ConfigEntry;
|
||||
import de.siphalor.tweed5.core.api.extension.TweedExtensionSetupContext;
|
||||
import de.siphalor.tweed5.patchwork.api.PatchworkPartAccess;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -67,7 +68,12 @@ public class TweedCoatBridgeExtensionImpl implements TweedCoatBridgeExtension {
|
||||
} else {
|
||||
title = translatableComponent(params.translationKeyPrefix() + ".title");
|
||||
}
|
||||
ConfigScreen configScreen = new ConfigScreen(minecraft.screen, title, Collections.singletonList(contentWidget));
|
||||
//# if MC_VERSION_NUMBER >= 260200
|
||||
Screen parent = minecraft.gui.screen();
|
||||
//# else
|
||||
//- Screen parent = minecraft.screen;
|
||||
//# end
|
||||
ConfigScreen configScreen = new ConfigScreen(parent, title, Collections.singletonList(contentWidget));
|
||||
if (params.saveHandler() != null) {
|
||||
configScreen.setOnSave(() -> params.saveHandler().accept(value));
|
||||
}
|
||||
|
||||
+7
-2
@@ -38,7 +38,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.Value;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
//- import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.locale.Language;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.Identifier;
|
||||
//- import net.minecraft.resources.ResourceLocation;
|
||||
@@ -592,7 +593,11 @@ public class TweedCoatMappersImpl {
|
||||
);
|
||||
|
||||
String descriptionKey = translationKey + ".description";
|
||||
if (I18n.exists(descriptionKey)) {
|
||||
//# if MC_VERSION_NUMBER >= 260200
|
||||
if (Language.getInstance().has(descriptionKey)) {
|
||||
//# else
|
||||
//- if (I18n.exists(descriptionKey)) {
|
||||
//# end
|
||||
categoryWidget.addEntry(new ConfigListTextEntry(
|
||||
translatableComponent(descriptionKey).withStyle(ChatFormatting.GRAY)
|
||||
));
|
||||
|
||||
+10
-2
@@ -83,7 +83,11 @@ public class TweedCoatBridgeTestMod implements ClientModInitializer {
|
||||
|
||||
@Override
|
||||
public boolean onPressedPriority() {
|
||||
if (!(Minecraft.getInstance().screen instanceof TitleScreen)) {
|
||||
//# if MC_VERSION_NUMBER >= 260200
|
||||
if (!(Minecraft.getInstance().gui.screen() instanceof TitleScreen)) {
|
||||
//# else
|
||||
//- if (!(Minecraft.getInstance().screen instanceof TitleScreen)) {
|
||||
//# end
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -101,7 +105,11 @@ public class TweedCoatBridgeTestMod implements ClientModInitializer {
|
||||
})
|
||||
.build()
|
||||
);
|
||||
Minecraft.getInstance().setScreen(configScreen);
|
||||
//# if MC_VERSION_NUMBER >= 260200
|
||||
Minecraft.getInstance().gui.setScreen(configScreen);
|
||||
//# else
|
||||
//- Minecraft.getInstance().setScreen(configScreen);
|
||||
//# end
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user