mirror of
https://github.com/GTNewHorizons/Angelica.git
synced 2026-11-25 14:44:28 +00:00
Speed up boot (#2190)
This commit is contained in:
1 parent
12fa08ab46
commit
38b1d9a0c3
17 files changed
+937
-23
No files matched your search
@@ -1012,8 +1012,8 @@ public enum Mixins implements IMixins {
|
||||
MCPATCHER_FORGE_CTM_OR_CC(new MixinBuilder("MCP:F Connected Textures or Custom Colors")
|
||||
.setPhase(Phase.EARLY)
|
||||
.setApplyIf(() -> AngelicaConfig.enableMCPatcherForgeFeatures
|
||||
&& MCPatcherForgeConfig.ConnectedTextures.enabled
|
||||
|| MCPatcherForgeConfig.CustomColors.enabled)
|
||||
&& (MCPatcherForgeConfig.ConnectedTextures.enabled
|
||||
|| MCPatcherForgeConfig.CustomColors.enabled))
|
||||
.addClientMixins("mcpatcherforge.ctm_cc.MixinTextureMap")
|
||||
),
|
||||
//End from NotFine
|
||||
|
||||
@@ -56,7 +56,7 @@ public class CITUtils {
|
||||
private static final List<Enchantment> allItemEnchantments = new ArrayList<>();
|
||||
private static final Map<Item, List<ArmorOverride>> armors = new IdentityHashMap<>();
|
||||
|
||||
static boolean useGlint;
|
||||
static boolean useGlint = true;
|
||||
|
||||
private static EnchantmentList armorMatches;
|
||||
private static int armorMatchIndex;
|
||||
|
||||
@@ -353,6 +353,7 @@ public class CTMUtils {
|
||||
}
|
||||
|
||||
private static void setBlankResourceWithoutLock() {
|
||||
if (tileLoader == null) return;
|
||||
RenderBlocksUtils.blankIcon = tileLoader.getIcon(RenderPassAPI.instance.getBlankResource());
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,12 @@ import java.util.Set;
|
||||
|
||||
import net.minecraft.client.resources.IResourcePack;
|
||||
|
||||
import com.gtnewhorizons.angelica.config.AngelicaConfig;
|
||||
import com.prupe.mcpatcher.MCLogger;
|
||||
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.LoaderState;
|
||||
|
||||
abstract public class TexturePackChangeHandler implements Comparable<TexturePackChangeHandler> {
|
||||
|
||||
private static final MCLogger logger = MCLogger.getLogger(MCLogger.Category.TEXTURE_PACK);
|
||||
@@ -18,6 +22,8 @@ abstract public class TexturePackChangeHandler implements Comparable<TexturePack
|
||||
private static boolean initialized;
|
||||
private static long startTime;
|
||||
private static long startMem;
|
||||
private static boolean loaderAvailable;
|
||||
private static int deferredDepth;
|
||||
|
||||
private boolean updateNeeded;
|
||||
|
||||
@@ -50,14 +56,29 @@ abstract public class TexturePackChangeHandler implements Comparable<TexturePack
|
||||
return this.order - that.order;
|
||||
}
|
||||
|
||||
public static boolean isBootDeferred() {
|
||||
if (loaderAvailable) {
|
||||
return false;
|
||||
}
|
||||
if (!AngelicaConfig.enableMCPatcherForgeFeatures || Loader.instance().hasReachedState(LoaderState.AVAILABLE)) {
|
||||
loaderAvailable = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void register(TexturePackChangeHandler handler) {
|
||||
if (handler != null) {
|
||||
try {
|
||||
logger.info("initializing %s...", handler.name);
|
||||
handler.initialize();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.severe("%s initialization failed", handler.name);
|
||||
if (isBootDeferred()) {
|
||||
logger.fine("deferring %s initialization until mod loading completes", handler.name);
|
||||
} else {
|
||||
try {
|
||||
logger.info("initializing %s...", handler.name);
|
||||
handler.initialize();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.severe("%s initialization failed", handler.name);
|
||||
}
|
||||
}
|
||||
handlers.add(handler);
|
||||
logger.fine("registered texture pack handler %s, priority %d", handler.name, handler.order);
|
||||
@@ -81,6 +102,10 @@ abstract public class TexturePackChangeHandler implements Comparable<TexturePack
|
||||
}
|
||||
|
||||
public static void beforeChange1() {
|
||||
if (deferredDepth > 0 || isBootDeferred()) {
|
||||
deferredDepth++;
|
||||
return;
|
||||
}
|
||||
logger.finer("beforeChange1 depth %d", recurseDepth);
|
||||
if (recurseDepth++ > 0) {
|
||||
return;
|
||||
@@ -115,6 +140,10 @@ abstract public class TexturePackChangeHandler implements Comparable<TexturePack
|
||||
}
|
||||
|
||||
public static void afterChange1() {
|
||||
if (deferredDepth > 0) {
|
||||
deferredDepth--;
|
||||
return;
|
||||
}
|
||||
logger.finer("afterChange1 depth %d", recurseDepth - 1);
|
||||
if (--recurseDepth > 0) {
|
||||
return;
|
||||
|
||||
@@ -92,6 +92,9 @@ public class TileLoader {
|
||||
}
|
||||
|
||||
public static void registerIcons(TextureMap textureMap, String mapName, Map<String, TextureAtlasSprite> map) {
|
||||
if (TexturePackChangeHandler.isBootDeferred()) {
|
||||
return;
|
||||
}
|
||||
mapName = mapName.replaceFirst("/$", "");
|
||||
logger.fine("before registerIcons(%s) %d icons", mapName, map.size());
|
||||
if (!changeHandlerCalled) {
|
||||
|
||||
Reference in new issue
Block a user