Skip to content

Commit

Permalink
Update to 19w35a
Browse files Browse the repository at this point in the history
  • Loading branch information
liach authored and Runemoro committed Aug 31, 2019
1 parent 8112ebe commit 2bbdab7
Show file tree
Hide file tree
Showing 39 changed files with 792 additions and 595 deletions.
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
maven { url = 'https://maven.fabricmc.net/' }
}
dependencies {
classpath "net.fabricmc:fabric-loom:0.2.0-SNAPSHOT"
classpath "net.fabricmc:fabric-loom:0.2.5-SNAPSHOT"
}
}

Expand All @@ -15,16 +15,16 @@ sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
minecraft "com.mojang:minecraft:19w02a"
mappings "net.fabricmc:yarn:19w02a.20"
modCompile "net.fabricmc:fabric-loader:0.3.2.93"
modCompile "net.fabricmc:fabric:0.1.4.71"
minecraft "com.mojang:minecraft:19w35a"
mappings "net.fabricmc:yarn:19w35a+build.1"
modCompile "net.fabricmc:fabric-loader:0.6.1+build.164"
// modCompile "net.fabricmc.fabric-api:fabric-api:0.3.2+build.217-1.15"
}

def travisBuildNumber = System.getenv("TRAVIS_BUILD_NUMBER")
def versionSuffix = travisBuildNumber != null ? travisBuildNumber : "SNAPSHOT"

version "1.0"
version "1.0.1"
group "org.dimdev.toomanycrashes"
archivesBaseName = "TooManyCrashes"

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
22 changes: 19 additions & 3 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down Expand Up @@ -109,8 +125,8 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
Expand Down
18 changes: 17 additions & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
Expand All @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
Expand Down
64 changes: 64 additions & 0 deletions src/main/java/org/dimdev/toomanycrashes/CrashScreen.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package org.dimdev.toomanycrashes;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.util.SystemUtil;
import net.minecraft.util.crash.CrashReport;
import net.minecraft.util.math.Box;

import java.io.File;

@Environment(EnvType.CLIENT)
public class CrashScreen extends ProblemScreen {

public CrashScreen(CrashReport report) {
super(report);
}

@Override
public void init() {
super.init();
ButtonWidget mainMenuButton = new ButtonWidget(width / 2 - 155, height / 4 + 120 + 12, 150, 20, I18n.translate("gui.toTitle"),
button -> minecraft.openScreen(new TitleScreen()));

if (ModConfig.instance().disableReturnToMainMenu) {
mainMenuButton.active = false;
mainMenuButton.setMessage(I18n.translate("toomanycrashes.gui.disabledByConfig"));
}

addButton(mainMenuButton);
}


@Override
public void render(int mouseX, int mouseY, float partialTicks) { // TODO: localize number of lines
renderBackground();
drawCenteredString(font, I18n.translate("toomanycrashes.crashscreen.title"), width / 2, height / 4 - 40, 0xFFFFFF);

int textColor = 0xD0D0D0;
int x = width / 2 - 155;
int y = height / 4;

drawString(font, I18n.translate("toomanycrashes.crashscreen.summary"), x, y, textColor);
drawString(font, I18n.translate("toomanycrashes.crashscreen.paragraph1.line1"), x, y += 18, textColor);

drawCenteredString(font, getModListString(), width / 2, y += 11, 0xE0E000);

drawString(font, I18n.translate("toomanycrashes.crashscreen.paragraph2.line1"), x, y += 11, textColor);
drawString(font, I18n.translate("toomanycrashes.crashscreen.paragraph2.line2"), x, y += 9, textColor);

drawFileNameString(y);
y += 11;

drawString(font, I18n.translate("toomanycrashes.crashscreen.paragraph3.line1"), x, y += 12, textColor);
drawString(font, I18n.translate("toomanycrashes.crashscreen.paragraph3.line2"), x, y += 9, textColor);
drawString(font, I18n.translate("toomanycrashes.crashscreen.paragraph3.line3"), x, y += 9, textColor);
drawString(font, I18n.translate("toomanycrashes.crashscreen.paragraph3.line4"), x, y + 9, textColor);

super.render(mouseX, mouseY, partialTicks);
}
}
61 changes: 0 additions & 61 deletions src/main/java/org/dimdev/toomanycrashes/CrashScreenGui.java

This file was deleted.

11 changes: 7 additions & 4 deletions src/main/java/org/dimdev/toomanycrashes/CrashUtils.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.dimdev.toomanycrashes;

import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
import net.minecraft.util.crash.CrashReport;
import org.apache.logging.log4j.LogManager;
Expand All @@ -10,6 +11,7 @@
import java.util.Date;

public final class CrashUtils {

private static final Logger LOGGER = LogManager.getLogger("TMC");
private static boolean isClient;

Expand All @@ -26,10 +28,10 @@ public static void outputReport(CrashReport report) {
if (report.getFile() == null) {
String reportName = "crash-";
reportName += new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss").format(new Date());
reportName += MinecraftClient.getInstance().isMainThread() ? "-client" : "-server";
reportName += isClient && MinecraftClient.getInstance().isOnThread() ? "-client" : "-server";
reportName += ".txt";

File reportsDir = isClient ? new File(MinecraftClient.getInstance().runDirectory, "crash-reports") : new File("crash-reports");
File reportsDir = new File(FabricLoader.getInstance().getGameDirectory(), "crash-reports");
File reportFile = new File(reportsDir, reportName);

report.writeToFile(reportFile);
Expand All @@ -38,7 +40,8 @@ public static void outputReport(CrashReport report) {
LOGGER.fatal("Failed saving report", e);
}

LOGGER.fatal("Minecraft ran into a problem! " + (report.getFile() != null ? "Report saved to: " + report.getFile() : "Crash report could not be saved.") + "\n" +
report.asString());
LOGGER.fatal("Minecraft ran into a problem! " + (report.getFile() != null ? "Report saved to: " + report.getFile() :
"Crash report could not be saved.") + "\n" +
report.asString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@
import java.util.List;

public class DeobfuscatingRewritePolicy implements RewritePolicy {
@Override
public LogEvent rewrite(LogEvent source) {
if (source.getThrown() != null) StacktraceDeobfuscator.deobfuscateThrowable(source.getThrown());
return source;
}

/** Modifies the log4j config to add the policy **/
public static void install() {
Expand All @@ -43,4 +38,12 @@ public static void install() {
// Add the new appender
loggerConfig.addAppender(rewriteAppender, null, null);
}

@Override
public LogEvent rewrite(LogEvent source) {
if (source.getThrown() != null) {
StacktraceDeobfuscator.deobfuscateThrowable(source.getThrown());
}
return source;
}
}
52 changes: 52 additions & 0 deletions src/main/java/org/dimdev/toomanycrashes/InitErrorScreen.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package org.dimdev.toomanycrashes;

import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.resource.language.I18n;
import net.minecraft.util.crash.CrashReport;

@Environment(EnvType.CLIENT)
public class InitErrorScreen extends ProblemScreen {

public InitErrorScreen(CrashReport report) {
super(report);
}

@Override
public void init() {
super.init();
AbstractButtonWidget getLinkButton = buttons.get(0);
getLinkButton.x = width / 2 - 155;
getLinkButton.y = height / 4 + 120 + 12;
getLinkButton.setWidth(310);
}

@Override
public void render(int mouseX, int mouseY, float partialTicks) { // TODO: localize number of lines
renderBackground();
drawCenteredString(font, I18n.translate("toomanycrashes.initerrorscreen.title"), width / 2, height / 4 - 40, 0xFFFFFF);

int textColor = 0xD0D0D0;
int x = width / 2 - 155;
int y = height / 4;

drawString(font, I18n.translate("toomanycrashes.initerrorscreen.summary"), x, y, textColor);
drawString(font, I18n.translate("toomanycrashes.crashscreen.paragraph1.line1"), x, y += 18, textColor);

drawCenteredString(font, getModListString(), width / 2, y += 11, 0xE0E000);

drawString(font, I18n.translate("toomanycrashes.crashscreen.paragraph2.line1"), x, y += 11, textColor);
drawString(font, I18n.translate("toomanycrashes.crashscreen.paragraph2.line2"), x, y += 9, textColor);

drawFileNameString(y);
y += 11;

drawString(font, I18n.translate("toomanycrashes.initerrorscreen.paragraph3.line1"), x, y += 12, textColor);
drawString(font, I18n.translate("toomanycrashes.initerrorscreen.paragraph3.line2"), x, y += 9, textColor);
drawString(font, I18n.translate("toomanycrashes.initerrorscreen.paragraph3.line3"), x, y += 9, textColor);
drawString(font, I18n.translate("toomanycrashes.initerrorscreen.paragraph3.line4"), x, y + 9, textColor);

super.render(mouseX, mouseY, partialTicks);
}
}
Loading

0 comments on commit 2bbdab7

Please sign in to comment.