From 653a477060f4a26a9e7442c5bf583160eea09060 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Tue, 5 May 2026 20:23:06 -0400 Subject: [PATCH] Fix crash when mods use null attributes Fixes #658 --- .../attribute_supplier_dedup/AttributeSupplierMixin.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/embeddedt/modernfix/common/mixin/perf/attribute_supplier_dedup/AttributeSupplierMixin.java b/src/main/java/org/embeddedt/modernfix/common/mixin/perf/attribute_supplier_dedup/AttributeSupplierMixin.java index 5ffc3489..d4d0901b 100644 --- a/src/main/java/org/embeddedt/modernfix/common/mixin/perf/attribute_supplier_dedup/AttributeSupplierMixin.java +++ b/src/main/java/org/embeddedt/modernfix/common/mixin/perf/attribute_supplier_dedup/AttributeSupplierMixin.java @@ -1,5 +1,6 @@ package org.embeddedt.modernfix.common.mixin.perf.attribute_supplier_dedup; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; import net.minecraft.world.entity.ai.attributes.Attribute; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; @@ -22,11 +23,11 @@ public class AttributeSupplierMixin { /** * @author embeddedt - * @reason Java 9's Map.of() implementation is significantly more compact than ImmutableMap, and we do not + * @reason more compact than ImmutableMap due to less wrapper objects, and we do not * care about insertion order in this context */ @Inject(method = "", at = @At("RETURN")) private void useCompactJavaMap(Map instances, CallbackInfo ci) { - this.instances = Map.copyOf(this.instances); + this.instances = new Object2ObjectOpenHashMap<>(this.instances); } } \ No newline at end of file