mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 17:47:32 +00:00
Made registered animations load at once
This commit is contained in:
1 parent
dd6a27b915
commit
a296a533c9
1 file changed
+15
-5
@@ -1,5 +1,6 @@
|
||||
package noppes.npcs.controllers;
|
||||
|
||||
import kamkeel.npcs.util.Register;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
@@ -28,11 +29,7 @@ import java.nio.file.FileSystems;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
@@ -48,6 +45,8 @@ public class AnimationController implements IAnimationHandler {
|
||||
public static AnimationController Instance = new AnimationController();
|
||||
private int lastUsedID = 0;
|
||||
|
||||
public LinkedHashMap<String, Register.Animations> registeredAnimations = new LinkedHashMap<>();
|
||||
|
||||
public AnimationController() {
|
||||
Instance = this;
|
||||
bootOrder = new HashMap<>();
|
||||
@@ -64,6 +63,7 @@ public class AnimationController implements IAnimationHandler {
|
||||
builtInAnimations = new HashMap<>();
|
||||
LogWriter.info("Loading animations...");
|
||||
loadBuiltInAnimations();
|
||||
loadRegisteredBuiltIns();
|
||||
readAnimationMap();
|
||||
loadAnimations();
|
||||
LogWriter.info("Done loading animations.");
|
||||
@@ -200,6 +200,16 @@ public class AnimationController implements IAnimationHandler {
|
||||
saveAnimationMap();
|
||||
}
|
||||
|
||||
public void addAnimationRegister(String namespace, Register.Animations register) {
|
||||
registeredAnimations.put(namespace, register);
|
||||
}
|
||||
|
||||
private void loadRegisteredBuiltIns() {
|
||||
for (Register.Animations register : registeredAnimations.values()) {
|
||||
register.register();
|
||||
}
|
||||
}
|
||||
|
||||
private File getDir() {
|
||||
return new File(CustomNpcs.getWorldSaveDirectory(), "animations");
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user