Backwards Coppertability
- Added the option to ship opt-in resource packs
This commit is contained in:
parent
38b656b501
commit
55b13bf421
3 changed files with 35 additions and 0 deletions
|
@ -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.SequencedAssemblyRecipeGen;
|
||||||
import com.simibubi.create.foundation.data.recipe.StandardRecipeGen;
|
import com.simibubi.create.foundation.data.recipe.StandardRecipeGen;
|
||||||
import com.simibubi.create.foundation.networking.AllPackets;
|
import com.simibubi.create.foundation.networking.AllPackets;
|
||||||
|
import com.simibubi.create.foundation.utility.ShippedResourcePacks;
|
||||||
import com.simibubi.create.foundation.worldgen.AllWorldFeatures;
|
import com.simibubi.create.foundation.worldgen.AllWorldFeatures;
|
||||||
import com.tterrag.registrate.util.NonNullLazyValue;
|
import com.tterrag.registrate.util.NonNullLazyValue;
|
||||||
|
|
||||||
|
@ -131,6 +132,7 @@ public class Create {
|
||||||
BuiltinPotatoProjectileTypes.register();
|
BuiltinPotatoProjectileTypes.register();
|
||||||
|
|
||||||
CHUNK_UTIL.init();
|
CHUNK_UTIL.init();
|
||||||
|
ShippedResourcePacks.extractFiles("Copper Legacy Pack");
|
||||||
|
|
||||||
event.enqueueWork(() -> {
|
event.enqueueWork(() -> {
|
||||||
AllTriggers.register();
|
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 a new issue