Skip to content

Commit 21319f8

Browse files
committed
Minor DependencyHelper improvements.
1 parent 09aa39d commit 21319f8

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

loader/src/main/java/com/fox2code/foxloader/loader/ModLoader.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,12 @@
3737
import com.fox2code.foxloader.loader.packet.LoaderNetworkManager;
3838
import com.fox2code.foxloader.network.SidedMetadataAPI;
3939
import com.fox2code.foxloader.selection.PlayerSelectionProvider;
40-
import com.fox2code.foxloader.registry.CommandRegistry;
4140
import com.fox2code.foxloader.registry.GameRegistry;
4241
import com.fox2code.foxloader.updater.UpdateManager;
4342
import net.minecraft.client.Minecraft;
4443
import net.minecraft.client.gui.*;
4544
import net.minecraft.client.player.EntityPlayerSP;
4645
import net.minecraft.common.CoreConstants;
47-
import net.minecraft.common.command.Command;
48-
import net.minecraft.common.command.ICommandListener;
4946
import net.minecraft.common.networking.NetworkManager;
5047
import net.minecraft.common.util.i18n.StringTranslate;
5148
import net.minecraft.server.MinecraftServer;

patching/src/main/java/com/fox2code/foxloader/dependencies/DependencyHelper.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ private static boolean checkHashOrDeleteEx(File file, Dependency dependency, boo
391391
}
392392
if (!dependency.sha256Sum.equals(hashString)) {
393393
boolean deleteSuccessful = keepFile || file.delete();
394+
if (!deleteSuccessful) {
395+
file.deleteOnExit();
396+
}
394397
if (errorOut) {
395398
throw new RuntimeException("Remote dependency " + dependency.name + " checksum mismatch " +
396399
"(got: " + hashString + ", expected: " + dependency.sha256Sum + ")", cause);
@@ -431,7 +434,7 @@ static void addToClassPath(final File library) {
431434
inst.appendToSystemClassLoaderSearch(new JarFile(library));
432435
} catch (final IOException e) {
433436
System.err.println("Failed to add jar to ClassPath");
434-
e.printStackTrace();
437+
DependencyImpl.CURRENT_IMPL.printStackTrace(e);
435438
System.exit(1);
436439
}
437440
}

patching/src/main/java/com/fox2code/foxloader/patching/game/LootPatch.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
/*
2+
* MIT License
3+
*
4+
* Copyright (c) 2023-2025 Fox2Code
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
124
package com.fox2code.foxloader.patching.game;
225

326
import com.fox2code.foxloader.patching.TransformerUtils;

0 commit comments

Comments
 (0)