parent
44113d2536
commit
653a477060
|
|
@ -1,5 +1,6 @@
|
||||||
package org.embeddedt.modernfix.common.mixin.perf.attribute_supplier_dedup;
|
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.Attribute;
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
|
import net.minecraft.world.entity.ai.attributes.AttributeInstance;
|
||||||
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
|
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
|
||||||
|
|
@ -22,11 +23,11 @@ public class AttributeSupplierMixin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author embeddedt
|
* @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
|
* care about insertion order in this context
|
||||||
*/
|
*/
|
||||||
@Inject(method = "<init>", at = @At("RETURN"))
|
@Inject(method = "<init>", at = @At("RETURN"))
|
||||||
private void useCompactJavaMap(Map<Attribute, AttributeInstance> instances, CallbackInfo ci) {
|
private void useCompactJavaMap(Map<Attribute, AttributeInstance> instances, CallbackInfo ci) {
|
||||||
this.instances = Map.copyOf(this.instances);
|
this.instances = new Object2ObjectOpenHashMap<>(this.instances);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user