Experimental multipart parallelizations
This commit is contained in:
parent
8e99cac6a7
commit
ccc3959328
|
|
@ -24,6 +24,7 @@ public class ModernFixEarlyConfig {
|
|||
this.addMixinRule("perf.boost_worker_count", true);
|
||||
this.addMixinRule("perf.skip_first_datapack_reload", true);
|
||||
this.addMixinRule("perf.parallelize_model_loading", true);
|
||||
this.addMixinRule("perf.parallelize_model_loading.multipart", false);
|
||||
this.addMixinRule("perf.trim_model_caches", true);
|
||||
this.addMixinRule("bugfix.concurrency", true);
|
||||
this.addMixinRule("bugfix.edge_chunk_not_saved", true);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
package org.embeddedt.modernfix.mixin.bugfix.buggy_tooltip_handlers;public class ForgeEventFactoryMixin {
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package org.embeddedt.modernfix.mixin.perf.parallelize_model_loading.multipart;
|
||||
|
||||
import net.minecraft.client.renderer.model.multipart.Multipart;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Mixin(Multipart.class)
|
||||
public class MultipartMixin {
|
||||
@Redirect(method = "getMaterials", at = @At(value = "INVOKE", target = "Ljava/util/List;stream()Ljava/util/stream/Stream;", ordinal = 0))
|
||||
private Stream makeStreamParallel(List instance) {
|
||||
return instance.parallelStream();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package org.embeddedt.modernfix.mixin.perf.parallelize_model_loading.multipart;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.client.renderer.model.IUnbakedModel;
|
||||
import net.minecraft.client.renderer.model.RenderMaterial;
|
||||
import net.minecraft.client.renderer.model.Variant;
|
||||
import net.minecraft.client.renderer.model.VariantList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Mixin(VariantList.class)
|
||||
public abstract class VariantListMixin {
|
||||
@Shadow public abstract List<Variant> getVariants();
|
||||
|
||||
/**
|
||||
* @author embeddedt
|
||||
* @reason Parallelize calls to getMaterials
|
||||
*/
|
||||
@Overwrite
|
||||
public Collection<RenderMaterial> getMaterials(Function<ResourceLocation, IUnbakedModel> pModelGetter, Set<Pair<String, String>> pMissingTextureErrors) {
|
||||
List<IUnbakedModel> models = this.getVariants().stream().map(Variant::getModelLocation).distinct().map(pModelGetter).collect(Collectors.toList());
|
||||
return models.parallelStream().flatMap(model -> model.getMaterials(pModelGetter, pMissingTextureErrors).stream()).collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +33,8 @@
|
|||
"bugfix.concurrency.MinecraftMixin",
|
||||
"perf.parallelize_model_loading.ModelBakeryMixin",
|
||||
"perf.parallelize_model_loading.OBJLoaderMixin",
|
||||
"perf.parallelize_model_loading.multipart.MultipartMixin",
|
||||
"perf.parallelize_model_loading.multipart.VariantListMixin",
|
||||
"perf.trim_model_caches.ModelManagerMixin",
|
||||
"perf.async_jei.IngredientListElementFactoryMixin",
|
||||
"perf.async_jei.ClientLifecycleHandlerMixin",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user