Search in sources :

Example 1 with ActiveCITs

use of shcm.shsupercm.fabric.citresewn.ActiveCITs in project CITResewn by SHsuperCM.

the class ModelLoaderMixin method initCITs.

@Inject(method = "addModel", at = @At("TAIL"))
public void initCITs(ModelIdentifier eventModelId, CallbackInfo ci) {
    if (eventModelId != ModelLoader.MISSING_ID)
        return;
    if (CITResewn.INSTANCE.activeCITs != null) {
        info("Clearing active CITs..");
        CITResewn.INSTANCE.activeCITs.dispose();
        CITResewn.INSTANCE.activeCITs = null;
    }
    if (!CITResewnConfig.INSTANCE().enabled)
        return;
    info("Parsing CITs...");
    List<CITPack> parsedPacks = CITParser.parseCITs(resourceManager.streamResourcePacks().collect(Collectors.toCollection(ArrayList::new)));
    List<CIT> parsed = parsedPacks.stream().flatMap(pack -> pack.cits.stream()).collect(Collectors.toCollection(ArrayList::new));
    if (parsed.size() > 0) {
        info("Activating CITs...");
        CITResewn.INSTANCE.activeCITs = new ActiveCITs(parsedPacks, parsed);
    } else
        info("No cit packs found.");
}
Also used : ActiveCITs(shcm.shsupercm.fabric.citresewn.ActiveCITs) CITParser(shcm.shsupercm.fabric.citresewn.pack.CITParser) Inject(org.spongepowered.asm.mixin.injection.Inject) CITResewn(shcm.shsupercm.fabric.citresewn.CITResewn) Collection(java.util.Collection) ModelLoader(net.minecraft.client.render.model.ModelLoader) ResourceManager(net.minecraft.resource.ResourceManager) Final(org.spongepowered.asm.mixin.Final) Collectors(java.util.stream.Collectors) CITResewnConfig(shcm.shsupercm.fabric.citresewn.config.CITResewnConfig) ArrayList(java.util.ArrayList) CallbackInfo(org.spongepowered.asm.mixin.injection.callback.CallbackInfo) List(java.util.List) ModelIdentifier(net.minecraft.client.util.ModelIdentifier) Mixin(org.spongepowered.asm.mixin.Mixin) CITPack(shcm.shsupercm.fabric.citresewn.pack.CITPack) CIT(shcm.shsupercm.fabric.citresewn.pack.cits.CIT) Shadow(org.spongepowered.asm.mixin.Shadow) At(org.spongepowered.asm.mixin.injection.At) CITResewn.info(shcm.shsupercm.fabric.citresewn.CITResewn.info) ActiveCITs(shcm.shsupercm.fabric.citresewn.ActiveCITs) ArrayList(java.util.ArrayList) CITPack(shcm.shsupercm.fabric.citresewn.pack.CITPack) CIT(shcm.shsupercm.fabric.citresewn.pack.cits.CIT) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

ArrayList (java.util.ArrayList)1 Collection (java.util.Collection)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 ModelLoader (net.minecraft.client.render.model.ModelLoader)1 ModelIdentifier (net.minecraft.client.util.ModelIdentifier)1 ResourceManager (net.minecraft.resource.ResourceManager)1 Final (org.spongepowered.asm.mixin.Final)1 Mixin (org.spongepowered.asm.mixin.Mixin)1 Shadow (org.spongepowered.asm.mixin.Shadow)1 At (org.spongepowered.asm.mixin.injection.At)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1 CallbackInfo (org.spongepowered.asm.mixin.injection.callback.CallbackInfo)1 ActiveCITs (shcm.shsupercm.fabric.citresewn.ActiveCITs)1 CITResewn (shcm.shsupercm.fabric.citresewn.CITResewn)1 CITResewn.info (shcm.shsupercm.fabric.citresewn.CITResewn.info)1 CITResewnConfig (shcm.shsupercm.fabric.citresewn.config.CITResewnConfig)1 CITPack (shcm.shsupercm.fabric.citresewn.pack.CITPack)1 CITParser (shcm.shsupercm.fabric.citresewn.pack.CITParser)1 CIT (shcm.shsupercm.fabric.citresewn.pack.cits.CIT)1