diff --git a/src/main/java/com/simibubi/create/Create.java b/src/main/java/com/simibubi/create/Create.java index 8987f1f8e..4b1fa8256 100644 --- a/src/main/java/com/simibubi/create/Create.java +++ b/src/main/java/com/simibubi/create/Create.java @@ -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(); diff --git a/src/main/java/com/simibubi/create/foundation/utility/ShippedResourcePacks.java b/src/main/java/com/simibubi/create/foundation/utility/ShippedResourcePacks.java new file mode 100644 index 000000000..e8db06dfb --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/utility/ShippedResourcePacks.java @@ -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(); + } + } + + } + +} diff --git a/src/main/resources/opt_in/Copper Legacy Pack.zip b/src/main/resources/opt_in/Copper Legacy Pack.zip new file mode 100644 index 000000000..d8b9f62b8 Binary files /dev/null and b/src/main/resources/opt_in/Copper Legacy Pack.zip differ