Skip to content

Commit 7228a94

Browse files
committed
Removed Log4J dependency, 0.3.1
1 parent 7671c52 commit 7228a94

12 files changed

+54
-39
lines changed

build.gradle

+10-3
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ dependencies {
4848

4949
implementation 'net.fabricmc:fabric-loom:1.4-SNAPSHOT'
5050

51-
implementation 'org.apache.logging.log4j:log4j-core:2.19.0'
52-
implementation 'org.apache.logging.log4j:log4j-api:2.19.0'
51+
//implementation 'org.apache.logging.log4j:log4j-core:2.19.0'
52+
//implementation 'org.apache.logging.log4j:log4j-api:2.19.0'
5353

5454
implementation "org.lwjgl.lwjgl:lwjgl_util:${lwjglVersion}"
5555
implementation "org.lwjgl.lwjgl:lwjgl:${lwjglVersion}"
@@ -144,7 +144,14 @@ class BTWJarReplacer implements MinecraftJarProcessor<Spec> {
144144
void processJar(java.nio.file.Path jar, Spec spec, ProcessorContext context) throws IOException {
145145
// Replace the Minecraft jar with the custom one from BTW_dev.
146146
// This is just a straight up file replacement, no remapping or anything.
147-
Files.copy(Paths.get(path, "BTW_dev/BTW_dev.zip"), jar, StandardCopyOption.REPLACE_EXISTING)
147+
if (!Files.exists(Paths.get(path, "build/BTW_dev/BTW_dev.zip"))) {
148+
// Print a warning if the BTW_dev zip doesn't exist.
149+
System.err.println("BTW_dev zip not found, skipping BTWJarReplacer")
150+
} else {
151+
Files.copy(Paths.get(path, "build/BTW_dev/BTW_dev.zip"), jar, StandardCopyOption.REPLACE_EXISTING)
152+
// Add Javadocs
153+
Files.copy(Paths.get(path, "build/BTW_dev/BTW_dev-javadoc.jar"), jar.resolveSibling(jar.getFileName().toString().replace(".jar", "-javadoc.jar")), StandardCopyOption.REPLACE_EXISTING)
154+
}
148155
}
149156

150157
@Override

gradle.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ minecraft_version = 1.6.4
55
yarn_mappings = 1.6.4+build.420
66
loader_version = 0.14.19
77

8-
mod_version = 0.3.0
8+
mod_version = 0.3.1
99
maven_group = net.fabricmc
1010
archives_base_name = neodymium-btw
1111

12-
org.gradle.jvmargs=-Xmx4g
12+
org.gradle.jvmargs=-Xmx4g

install.bat

+17-7
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
set MAPPINGS_VERSION=1.0.3
22
cd "%~dp0"
3-
rd /s /q "./BTW_dev"
3+
rd /s /q "build\BTW_dev"
4+
rd /s /q "build\tmp\BTW_dev"
45
call gradlew.bat --no-daemon downloadAssets
5-
mkdir BTW_dev
6+
mkdir build\BTW_dev
67
mkdir custom_mappings
8+
mkdir build\tmp\BTW_dev
79
tar.exe -xf mavenRepo/btw/community/mappings/%MAPPINGS_VERSION%/mappings-%MAPPINGS_VERSION%.jar -C custom_mappings
8-
java -jar libs/tiny-remapper-0.8.6+local-fat.jar %~f1 "BTW_dev/%~nx1" custom_mappings/mappings/mappings.tiny intermediary named %userprofile%/.gradle/caches/fabric-loom/1.6.4/minecraft-merged-intermediary.jar"
9-
tar.exe -xf %userprofile%/.gradle/caches/fabric-loom/minecraftMaven/net/minecraft/minecraft-merged/1.6.4-btw.community.mappings.1_6_4.%MAPPINGS_VERSION%-v2/minecraft-merged-1.6.4-btw.community.mappings.1_6_4.%MAPPINGS_VERSION%-v2.jar -C BTW_dev
10-
tar.exe -xf "BTW_dev/%~nx1" -C BTW_dev
11-
del BTW_dev\%~nx1
12-
cd BTW_dev
10+
del "%userprofile%\.gradle\caches\fabric-loom\1.6.4\minecraft-merged-intermediary.jar"
11+
java -jar libs/tiny-remapper-0.8.6+local-fat.jar "%userprofile%/.gradle/caches/fabric-loom/1.6.4/minecraft-merged.jar" "%userprofile%/.gradle/caches/fabric-loom/1.6.4/minecraft-merged-intermediary.jar" "%userprofile%/.gradle/caches/fabric-loom/1.6.4/intermediary-v2.tiny" official intermediary
12+
tar.exe -xf "%~f1" -C build/tmp/BTW_dev
13+
java -jar libs/tiny-remapper-0.8.6+local-fat.jar "build/tmp/BTW_dev/BTW-CE-Intermediary.zip" "build/BTW_dev/BTW-CE-Intermediary.zip" custom_mappings/mappings/mappings.tiny intermediary named "%userprofile%/.gradle/caches/fabric-loom/1.6.4/minecraft-merged-intermediary.jar"
14+
tar.exe -xf %userprofile%/.gradle/caches/fabric-loom/minecraftMaven/net/minecraft/minecraft-merged/1.6.4-btw.community.mappings.1_6_4.%MAPPINGS_VERSION%-v2/minecraft-merged-1.6.4-btw.community.mappings.1_6_4.%MAPPINGS_VERSION%-v2.jar -C build/BTW_dev
15+
tar.exe -xf "build/BTW_dev/BTW-CE-Intermediary.zip" -C build/BTW_dev
16+
del build\BTW_dev\BTW-CE-Intermediary.zip
17+
cd build\BTW_dev
1318
tar.exe -a -cf ../BTW_dev.zip *
1419
cd ..
20+
rd /s /q "BTW_dev"
21+
mkdir "BTW_dev"
1522
move BTW_dev.zip BTW_dev\BTW_dev.zip
23+
cd ..
24+
move build\tmp\BTW_dev\BTW-CE-Intermediary-javadoc.jar build\BTW_dev\BTW_dev-javadoc.jar
25+
rd /s /q "build\tmp\BTW_dev"
1626
echo Done!
1727
PAUSE

src/main/java/makamys/neodymium/Compat.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class Compat {
2929

3030
public static void init() {
3131
isGL33Supported = GLContext.getCapabilities().OpenGL33;
32-
if (!MinecraftServer.getIsServer() && !FabricLauncherBase.getLauncher().isDevelopment() && System.getProperty("os.name") != null && System.getProperty("os.name").contains("Windows")) {
32+
if (!MinecraftServer.getIsServer() && !FabricLauncherBase.getLauncher().isDevelopment() && System.getProperty("os.name") != null && System.getProperty("os.name").toLowerCase().contains("windows")) {
3333
boolean found = false;
3434
Minecraft.getMinecraft().getPlayerUsageSnooper().startSnooper();
3535
Map map = ((PlayerUsageSnooperAccessor)Minecraft.getMinecraft().getPlayerUsageSnooper()).getDataMap();
@@ -47,7 +47,7 @@ public static void init() {
4747
}
4848
}
4949
if (!found) {
50-
FabricGuiEntry.displayCriticalError(new RuntimeException("Neodymium requires the JVM argument -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump to be set. Please add it to your JVM arguments."), true);
50+
//FabricGuiEntry.displayCriticalError(new RuntimeException("Neodymium requires the JVM argument -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump to be set. Please add it to your JVM arguments."), true);
5151
}
5252
}
5353
/*if (Loader.isModLoaded("triangulator")) {
@@ -72,7 +72,7 @@ public static void getCompatibilityWarnings(List<Warning> warns, List<Warning> c
7272
criticalWarns.add(new Warning("A shader pack is enabled, this is not supported."));
7373
}
7474
} catch(Exception e) {
75-
LOGGER.warn("Failed to get shader pack name");
75+
LOGGER.log(System.Logger.Level.WARNING, "Failed to get shader pack name");
7676
e.printStackTrace();
7777
}
7878
} catch (ClassNotFoundException e) {
@@ -114,7 +114,7 @@ private static boolean detectedNotEnoughVRAM() {
114114
public static void forceEnableOptiFineDetectionOfFastCraft() {
115115
if(Compat.class.getResource("/fastcraft/Tweaker.class") != null) {
116116
// If OptiFine is present, it's already on the class path at this point, so our virtual jar won't override it.
117-
LOGGER.info("FastCraft is present, applying hack to forcingly enable FastCraft's OptiFine compat");
117+
LOGGER.log(System.Logger.Level.INFO, "FastCraft is present, applying hack to forcingly enable FastCraft's OptiFine compat");
118118
VirtualJar.add(new OptiFineStubVirtualJar());
119119
}
120120
}
@@ -141,7 +141,7 @@ public String getName() {
141141
public InputStream getInputStream(String path) {
142142
if(path.equals("/optifine/OptiFineForgeTweaker.class")) {
143143
// Dummy file to make FastCraft think OptiFine is present.
144-
LOGGER.debug("Returning a dummy /optifine/OptiFineForgeTweaker.class to force FastCraft compat.");
144+
LOGGER.log(System.Logger.Level.DEBUG, "Returning a dummy /optifine/OptiFineForgeTweaker.class to force FastCraft compat.");
145145
return new ByteArrayInputStream(new byte[0]);
146146
} else {
147147
return null;

src/main/java/makamys/neodymium/Constants.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package makamys.neodymium;
22

3-
import org.apache.logging.log4j.LogManager;
4-
import org.apache.logging.log4j.Logger;
53

64
public class Constants {
75

86
public static final String MODID = "neodymium";
9-
public static final String VERSION = "0.3.0";
10-
public static final Logger LOGGER = LogManager.getLogger(MODID);
7+
public static final String VERSION = "0.3.1";
8+
public static final System.Logger LOGGER = System.getLogger(MODID);
119

1210
public static final String PROTOCOL = "neodymiumvirtualjar";
1311

src/main/java/makamys/neodymium/Neodymium.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,10 @@ public static Pair<List<Warning>, List<Warning>> showCompatStatus(boolean status
291291
}
292292

293293
for(Warning warn : warns) {
294-
LOGGER.warn(warn.text);
294+
LOGGER.log(System.Logger.Level.WARNING, warn.text);
295295
}
296296
for(Warning criticalWarn : criticalWarns) {
297-
LOGGER.warn("Critical: " + criticalWarn.text);
297+
LOGGER.log(System.Logger.Level.WARNING, "Critical: " + criticalWarn.text);
298298
}
299299

300300
return new Pair(warns, criticalWarns);

src/main/java/makamys/neodymium/config/Config.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ public void handleConfigProperties(Map<String, String> propertyValues) {
153153
try {
154154
registerWatchService();
155155
} catch(IOException e) {
156-
LOGGER.warn("Failed to register watch service: " + e + " (" + e.getMessage() + "). Changes to the config file will not be reflected");
156+
LOGGER.log(System.Logger.Level.WARNING, "Failed to register watch service: " + e + " (" + e.getMessage() + "). Changes to the config file will not be reflected");
157157
}
158158
}
159159
}*/
@@ -193,7 +193,7 @@ public static void reloadConfig() {
193193
try {
194194
currentValue = field.get(null);
195195
} catch (Exception e) {
196-
LOGGER.error("Failed to get value of field " + field.getName());
196+
LOGGER.log(System.Logger.Level.ERROR, "Failed to get value of field " + field.getName());
197197
e.printStackTrace();
198198
continue;
199199
}
@@ -245,7 +245,7 @@ public static void reloadConfig() {
245245
try {
246246
field.set(null, newValue);
247247
} catch (Exception e) {
248-
LOGGER.error("Failed to set value of field " + field.getName());
248+
LOGGER.log(System.Logger.Level.ERROR, "Failed to set value of field " + field.getName());
249249
e.printStackTrace();
250250
}
251251
}

src/main/java/makamys/neodymium/renderer/ChunkMesh.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public ChunkMesh(WorldRenderer wr, int pass) {
6666
instances++;
6767

6868
if(!quadBuf.getAsList().isEmpty()) {
69-
LOGGER.error("Invalid state: tried to construct a chunk mesh before the previous one has finished constructing!");
69+
LOGGER.log(System.Logger.Level.ERROR, "Invalid state: tried to construct a chunk mesh before the previous one has finished constructing!");
7070
}
7171
}
7272

@@ -119,22 +119,22 @@ private void addTessellatorData(Tessellator t) {
119119
if(!Config.silenceErrors) {
120120
String dimId = wr.worldObj != null && wr.worldObj.provider != null ? "" + wr.worldObj.provider.dimensionId : "UNKNOWN";
121121
if(!errors.isEmpty()) {
122-
LOGGER.error("Errors in chunk ({}, {}, {}) in dimension {}:", x, y, z, dimId);
122+
LOGGER.log(System.Logger.Level.ERROR, "Errors in chunk ({}, {}, {}) in dimension {}:", x, y, z, dimId);
123123
for(String error : errors) {
124-
LOGGER.error("Error: " + error);
124+
LOGGER.log(System.Logger.Level.ERROR, "Error: " + error);
125125
}
126126
for(String warning : warnings) {
127-
LOGGER.error("Warning: " + warning);
127+
LOGGER.log(System.Logger.Level.ERROR, "Warning: " + warning);
128128
}
129-
LOGGER.error("(World renderer pos: ({}, {}, {}), Tessellator pos: ({}, {}, {}), Tessellation count: {}", wr.posX, wr.posY, wr.posZ, ((TessellatorAccessor) t).getXOffset(), ((TessellatorAccessor) t).getYOffset(), ((TessellatorAccessor) t).getZOffset(), tesselatorDataCount);
130-
LOGGER.error("Stack trace:");
129+
LOGGER.log(System.Logger.Level.ERROR, "(World renderer pos: ({}, {}, {}), Tessellator pos: ({}, {}, {}), Tessellation count: {}", wr.posX, wr.posY, wr.posZ, ((TessellatorAccessor) t).getXOffset(), ((TessellatorAccessor) t).getYOffset(), ((TessellatorAccessor) t).getZOffset(), tesselatorDataCount);
130+
LOGGER.log(System.Logger.Level.ERROR, "Stack trace:");
131131
try {
132132
// Generate a stack trace
133133
throw new IllegalArgumentException();
134134
} catch(IllegalArgumentException e) {
135135
e.printStackTrace();
136136
}
137-
LOGGER.error("Skipping chunk due to errors.");
137+
LOGGER.log(System.Logger.Level.ERROR, "Skipping chunk due to errors.");
138138
quadBuf.reset();
139139
} else {
140140
WarningHelper.showDebugMessageOnce(String.format("Warnings in chunk (%d, %d, %d) in dimension %s: %s", x, y, z, dimId, String.join(", ", warnings)));

src/main/java/makamys/neodymium/renderer/GPUMemoryManager.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public void sendMeshToGPU(Mesh mesh) {
113113
ChatUtil.showNeoChatMessage("VRAM keeps getting full! Reverting to vanilla renderer. Try increasing the VRAM buffer size in the config, if possible.", ChatUtil.MessageVerbosity.ERROR, false);
114114
Compat.onNotEnoughVRAM(Config.VRAMSize);
115115
} else {
116-
LOGGER.debug("Reloading renderer because VRAM is full.");
116+
LOGGER.log(System.Logger.Level.DEBUG, "Reloading renderer because VRAM is full.");
117117
// TODO restart renderer with more VRAM allocated when this happens.
118118
}
119119
lastVRAMFullness = t;

src/main/java/makamys/neodymium/util/ChatUtil.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static void showChatMessage(String text) {
2020
if(player != null) {
2121
player.addChatMessage(text);
2222
} else {
23-
LOGGER.info(text);
23+
LOGGER.log(System.Logger.Level.INFO, text);
2424
}
2525
}
2626

src/main/java/makamys/neodymium/util/WarningHelper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class WarningHelper {
1212
public static void showDebugMessageOnce(String warning) {
1313
int hash = warning.hashCode();
1414
if(!shownWarnings.contains(hash)) {
15-
LOGGER.debug(warning);
15+
LOGGER.log(System.Logger.Level.DEBUG, warning);
1616
shownWarnings.add(hash);
1717
}
1818
}

src/main/java/makamys/neodymium/util/virtualjar/VirtualJar.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class VirtualJar {
2727
public static void registerHandler() {
2828
if(registered) return;
2929

30-
LOGGER.debug("Registering URL protocol handler: " + PROTOCOL);
30+
LOGGER.log(System.Logger.Level.DEBUG, "Registering URL protocol handler: " + PROTOCOL);
3131

3232
// We want the Handler to always be loaded by the same class loader.
3333
//Launch.classLoader.addClassLoaderExclusion("makamys." + MODID + ".util.virtualjar.protocol." + PROTOCOL);
@@ -45,7 +45,7 @@ public static void registerHandler() {
4545
public static void add(IVirtualJar jar) {
4646
registerHandler();
4747

48-
LOGGER.trace("Adding virtual jar to class path: " + PROTOCOL + ":" + jar.getName() + ".jar");
48+
LOGGER.log(System.Logger.Level.TRACE, "Adding virtual jar to class path: " + PROTOCOL + ":" + jar.getName() + ".jar");
4949

5050
String urlStr = PROTOCOL + ":" + jar.getName() + ".jar!/";
5151

@@ -58,7 +58,7 @@ public static void add(IVirtualJar jar) {
5858

5959
jars.put(jar.getName(), jar);
6060
} catch(MalformedURLException e) {
61-
LOGGER.fatal("Failed to add virtual jar to class path");
61+
LOGGER.log(System.Logger.Level.ERROR, "Failed to add virtual jar to class path");
6262
e.printStackTrace();
6363
}
6464
}

0 commit comments

Comments
 (0)