Allow COW in StaticTagHelper
Seems that some mods bind tags at runtime. This is a hack but it should fix the persistent CME I get when launching ATM6
This commit is contained in:
parent
c7f2d41695
commit
aa963f4d1a
|
|
@ -0,0 +1,28 @@
|
|||
package org.embeddedt.modernfix.mixin.bugfix.concurrency;
|
||||
|
||||
import net.minecraft.tags.StaticTagHelper;
|
||||
import net.minecraft.tags.TagCollection;
|
||||
import net.minecraft.tags.TagContainer;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Mutable;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.function.Function;
|
||||
|
||||
@Mixin(StaticTagHelper.class)
|
||||
public class StaticTagHelperMixin<T> {
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Shadow @Mutable
|
||||
@Final private List wrappers;
|
||||
|
||||
@Inject(method = "<init>", at = @At("RETURN"))
|
||||
private void useCOWArrayList(Function<TagContainer, TagCollection<T>> function, CallbackInfo ci) {
|
||||
this.wrappers = new CopyOnWriteArrayList<>();
|
||||
}
|
||||
}
|
||||
|
|
@ -55,6 +55,7 @@
|
|||
"perf.skip_first_datapack_reload.MinecraftMixin",
|
||||
"bugfix.concurrency.RenderTypeMixin",
|
||||
"bugfix.concurrency.MinecraftMixin",
|
||||
"bugfix.concurrency.StaticTagHelperMixin",
|
||||
"perf.parallelize_model_loading.ModelBakeryMixin",
|
||||
"perf.parallelize_model_loading.OBJLoaderMixin",
|
||||
"perf.parallelize_model_loading.multipart.MultipartMixin",
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user