Skip to content

Commit 94d2c6c

Browse files
committed
A few fixes
- Fix client-side crash - Make the mod loadable in a dev environment - Fix error spam with newest mixin
1 parent 539b205 commit 94d2c6c

4 files changed

Lines changed: 14 additions & 11 deletions

File tree

src/main/java/org/dimdev/vanillafix/VanillaFixLoadingPlugin.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,10 @@
2222
import java.util.Map;
2323

2424
@IFMLLoadingPlugin.MCVersion(ForgeVersion.mcVersion)
25-
@IFMLLoadingPlugin.SortingIndex(-10000)
26-
@IFMLLoadingPlugin.TransformerExclusions("org.dimdev.vanillafix.")
25+
@IFMLLoadingPlugin.SortingIndex(-100000)
2726
public class VanillaFixLoadingPlugin implements IFMLLoadingPlugin {
2827
private static final Logger log = LogManager.getLogger();
29-
private static final String MCP_VERSION = "20180601-1.12"; // TODO: Use version for current Minecraft version!
28+
private static final String MCP_VERSION = "20180618-1.12"; // TODO: Use version for current Minecraft version!
3029
private static boolean initialized = false;
3130

3231
public static LoadingConfig config;

src/main/java/org/dimdev/vanillafix/crashes/CrashUtils.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ public static void crash(CrashReport report) {
1919

2020
public static void warn(CrashReport report) {
2121
if (isClient()) {
22-
// TODO: what if there's several exceptions in a row?
2322
outputReport(report);
24-
Minecraft.getMinecraft().addScheduledTask(() -> Minecraft.getMinecraft().displayGuiScreen(new GuiWarningScreen(report, Minecraft.getMinecraft().currentScreen)));
25-
} else {
23+
// Don't inline showWarningScreen, that will cause Java to load the GuiScreen
24+
// class on servers, because of the lambda!
25+
((IPatchedMinecraft) Minecraft.getMinecraft()).showWarningScreen(report);
26+
} else {
2627
log.fatal(report.getDescription(), report.getCrashCause());
2728
}
2829
}

src/main/java/org/dimdev/vanillafix/crashes/IPatchedMinecraft.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44

55
public interface IPatchedMinecraft {
66
boolean shouldCrashIntegratedServerNextTick();
7+
void showWarningScreen(CrashReport report);
78
void makeErrorNotification(CrashReport report);
89
}

src/main/java/org/dimdev/vanillafix/crashes/mixins/client/MixinMinecraft.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,6 @@ private long checkForF3C(Minecraft mc) {
381381
return -1;
382382
}
383383

384-
private void breakRendering() {
385-
getTextureManager().bindTexture(Gui.OPTIONS_BACKGROUND);
386-
}
387-
388384
/** @reason Disables the vanilla F3 + C logic. */
389385
@Redirect(method = "runTickKeyboard", at = @At(value = "INVOKE", target = "Lorg/lwjgl/input/Keyboard;isKeyDown(I)Z", ordinal = 0))
390386
private boolean isKeyDownF3(int key) {
@@ -416,8 +412,14 @@ private void checkForCtrlI(CallbackInfo ci) {
416412
ProblemToast lastToast = getToastGui().getToast(ProblemToast.class, IToast.NO_TOKEN);
417413
if (lastToast != null) {
418414
lastToast.hide = true;
419-
displayGuiScreen(new GuiWarningScreen(lastToast.report, Minecraft.getMinecraft().currentScreen));
415+
displayGuiScreen(new GuiWarningScreen(lastToast.report, currentScreen));
420416
}
421417
}
422418
}
419+
420+
@Override
421+
public void showWarningScreen(CrashReport report) {
422+
// TODO: runGuiLoop instead, to prevent errors from happening while the warning screen is open?
423+
addScheduledTask(() -> displayGuiScreen(new GuiWarningScreen(report, currentScreen)));
424+
}
423425
}

0 commit comments

Comments
 (0)