Skip to content

Commit

Permalink
3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
natanfudge committed Apr 9, 2021
1 parent 845869b commit 41f05d7
Show file tree
Hide file tree
Showing 13 changed files with 103 additions and 26 deletions.
8 changes: 6 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
plugins {
id "architectury-plugin" version "2.0.64"
id "forgified-fabric-loom" version "0.6.53" apply false
id "architectury-plugin"
id "forgified-fabric-loom" apply false
id 'maven-publish'
id 'com.matthewprenger.cursegradle'
}
Expand All @@ -19,6 +19,10 @@ subprojects {
}

ext.total_version = "$mod_version+$minecraft_version"

dependencies {
minecraft "com.mojang:minecraft:${rootProject.minecraft_version}"
}
}

allprojects {
Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

## 3.2.0
- Added a new option `forceCrashScreen` that will prevent cases in which the game closes with no crash log. Instead, the game will crash normally.
### 3.1.9
- Fixed additional crash stack traces appearing when debugModIdentification is false.
### 3.1.8
Expand Down
1 change: 1 addition & 0 deletions common/src/main/java/fudge/notenoughcrashes/ModConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public enum CrashLogUploadType {
public boolean disableReturnToMainMenu = false;
public boolean deobfuscateStackTrace = true;
public boolean debugModIdentification = false;
public boolean forceCrashScreen = false;

public static ModConfig instance() {
if (instance != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import fudge.notenoughcrashes.platform.NecPlatform;
import fudge.notenoughcrashes.test.TestBlock;
import fudge.notenoughcrashes.utils.SystemExitBlock;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.security.Permission;


public class NotEnoughCrashes {
Expand All @@ -23,14 +25,14 @@ public class NotEnoughCrashes {
public static final boolean FILTER_ENTRYPOINT_CATCHER = true;



public static final boolean ENABLE_ENTRYPOINT_CATCHING = !NecPlatform.instance().isDevelopmentEnvironment() || DEBUG_ENTRYPOINT;

public static void ensureDirectoryExists() throws IOException {
Files.createDirectories(DIRECTORY);
}

public static void initialize() {
if (ModConfig.instance().forceCrashScreen) SystemExitBlock.forbidSystemExitCall();
ModConfig.instance();

if (DEBUG_GAMELOOP) TestBlock.init();
Expand All @@ -39,5 +41,4 @@ public static void initialize() {
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ public TestBlock() {

@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
// System.exit(0);
try {

throw new RuntimeException("something NPED!", new NullPointerException("THIS NPED!"));
} catch (Throwable e) {
e.addSuppressed(new NullPointerException("SUPRESSED!"));
throw e;
}

// return null;
}

public static void init() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package fudge.notenoughcrashes.utils;

import java.security.Permission;

public class SystemExitBlock {

public static void forbidSystemExitCall() {
final SecurityManager securityManager = new SecurityManager() {
public void checkPermission( Permission permission ) {
if( permission.getName().startsWith("exitVM") ) {
throw new SystemExitBlockedException("An attempt was made to forcefully close the game with no stack trace (see stack trace)." +
" Not Enough Crashes made the game simply crash instead since the forceCrashScreen option is enabled.") ;
}
}
} ;
System.setSecurityManager( securityManager ) ;
}

private static void enableSystemExitCall() {
System.setSecurityManager( null ) ;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package fudge.notenoughcrashes.utils;

class SystemExitBlockedException extends SecurityException {
public SystemExitBlockedException(String s) {
super(s);
}
}

37 changes: 26 additions & 11 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@ plugins {
}

configurations {
shadow
shadowCommon
}

architectury {
platformSetupLoomIde()
fabric()
}

dependencies {
minecraft("com.mojang:minecraft:${rootProject.minecraft_version}")
// minecraft("com.mojang:minecraft:${rootProject.minecraft_version}")
mappings("net.fabricmc:yarn:${rootProject.yarn_mappings}:v2")
modCompile("net.fabricmc:fabric-loader:${rootProject.loader_version}")
modCompile("net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_version}")
// modCompile("net.fabricmc:fabric-loader:${rootProject.loader_version}")
modApi ("net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_version}")
// Remove the next line if you don't want to depend on the API
// modCompile("me.shedaniel:architectury:${rootProject.architectury_version}:fabric")

compileOnly(project(path: ":common")) {
implementation(project(path: ":common")) {
transitive = false
}
runtimeOnly(project(path: ":common", configuration: "transformDevelopmentFabric")) {
developmentFabric(project(path: ":common")) {
transitive = false
}
shadow(project(path: ":common", configuration: "transformProductionFabric")) {
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) {
transitive = false
}
}
Expand All @@ -39,16 +40,30 @@ processResources {
}

shadowJar {
configurations = [project.configurations.shadow]
classifier "shadow"
configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
}

remapJar {
dependsOn(shadowJar)
input.set(shadowJar.archivePath)
input.set shadowJar.archiveFile
dependsOn shadowJar
classifier "fabric"
}

jar {
classifier "dev"
}

java {
withSourcesJar()
}

sourcesJar {
def commonSources = project(":common").remapSourcesJar
dependsOn commonSources
from zipTree(commonSources.output)
}

curseforge {
apiKey = project.hasProperty("curseforge_api_key") ? project.curseforge_api_key : ""
project {
Expand Down
31 changes: 23 additions & 8 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ plugins {
}

configurations {
shadow
shadowCommon
}

architectury {
platformSetupLoomIde()
forge()
}

loom {
Expand All @@ -18,7 +19,7 @@ loom {
}

dependencies {
minecraft("com.mojang:minecraft:${rootProject.minecraft_version}")
// minecraft("com.mojang:minecraft:${rootProject.minecraft_version}")
mappings("net.fabricmc:yarn:${rootProject.yarn_mappings}:v2")
forge("net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}")
// modRuntime(files("testmods/modid-1.0.jar"))
Expand All @@ -28,10 +29,10 @@ dependencies {
compileOnly(project(path: ":common")) {
transitive = false
}
runtimeOnly(project(path: ":common", configuration: "transformDevelopmentForge")) {
developmentForge(project(path: ":common")) {
transitive = false
}
shadow(project(path: ":common", configuration: "transformProductionForge")) {
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) {
transitive = false
}
}
Expand All @@ -47,13 +48,13 @@ processResources {
shadowJar {
exclude "fabric.mod.json"

configurations = [project.configurations.shadow]
classifier "shadow"
configurations = [project.configurations.shadowCommon]
classifier "dev-shadow"
}

remapJar {
dependsOn(shadowJar)
input.set(shadowJar.archivePath)
input.set shadowJar.archiveFile
dependsOn shadowJar
classifier "forge"
}
jar {
Expand All @@ -64,6 +65,20 @@ jar {
}
}

jar {
classifier "dev"
}

java {
withSourcesJar()
}

sourcesJar {
def commonSources = project(":common").remapSourcesJar
dependsOn commonSources
from zipTree(commonSources.output)
}

curseforge {
apiKey = project.hasProperty("curseforge_api_key") ? project.curseforge_api_key : ""
project {
Expand Down
6 changes: 4 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ org.gradle.jvmargs=-Xmx2048M


archives_base_name=notenoughcrashes
mod_version=3.1.8
mod_version=3.2.0
maven_group=fudge.notenoughcrashes

architectury_version=1.4.91
architectury_version=1.8.131
architectury_plugin_version=3.0-SNAPSHOT
forgeloom_version=0.6-SNAPSHOT


forge_version=36.0.1
Expand Down
Empty file added logs/debug.log
Empty file.
Empty file added logs/latest.log
Empty file.
4 changes: 3 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ pluginManagement {
repositories {
jcenter()
maven { url "https://maven.fabricmc.net/" }
maven { url "https://dl.bintray.com/shedaniel/cloth" }
maven { url "https://maven.shedaniel.me/"}
maven { url "https://files.minecraftforge.net/maven/" }
gradlePluginPortal()
}

plugins {
id 'com.matthewprenger.cursegradle' version cursegradle_version
id "architectury-plugin" version architectury_plugin_version
id "forgified-fabric-loom" version forgeloom_version
}
}

Expand Down

0 comments on commit 41f05d7

Please sign in to comment.