mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 20:45:10 +01:00
Backwards Coppertability
- Added the option to ship opt-in resource packs
This commit is contained in:
parent
38b656b501
commit
55b13bf421
@ -31,6 +31,7 @@ import com.simibubi.create.foundation.data.recipe.ProcessingRecipeGen;
|
||||
import com.simibubi.create.foundation.data.recipe.SequencedAssemblyRecipeGen;
|
||||
import com.simibubi.create.foundation.data.recipe.StandardRecipeGen;
|
||||
import com.simibubi.create.foundation.networking.AllPackets;
|
||||
import com.simibubi.create.foundation.utility.ShippedResourcePacks;
|
||||
import com.simibubi.create.foundation.worldgen.AllWorldFeatures;
|
||||
import com.tterrag.registrate.util.NonNullLazyValue;
|
||||
|
||||
@ -131,6 +132,7 @@ public class Create {
|
||||
BuiltinPotatoProjectileTypes.register();
|
||||
|
||||
CHUNK_UTIL.init();
|
||||
ShippedResourcePacks.extractFiles("Copper Legacy Pack");
|
||||
|
||||
event.enqueueWork(() -> {
|
||||
AllTriggers.register();
|
||||
|
@ -0,0 +1,33 @@
|
||||
package com.simibubi.create.foundation.utility;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.FileAlreadyExistsException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
|
||||
public class ShippedResourcePacks {
|
||||
|
||||
public static void extractFiles(String... packs) {
|
||||
FilesHelper.createFolderIfMissing("resourcepacks");
|
||||
|
||||
for (String name : packs) {
|
||||
InputStream folderInJar = ShippedResourcePacks.class.getResourceAsStream("/opt_in/" + name + ".zip");
|
||||
|
||||
try {
|
||||
Files.copy(folderInJar, Paths.get("resourcepacks/" + name + ".zip"));
|
||||
} catch (FileAlreadyExistsException e) {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try {
|
||||
folderInJar.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
BIN
src/main/resources/opt_in/Copper Legacy Pack.zip
Normal file
BIN
src/main/resources/opt_in/Copper Legacy Pack.zip
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user