24w04a
This commit is contained in:
parent
e9bfd965cd
commit
8658784906
|
|
@ -1,37 +0,0 @@
|
|||
package org.embeddedt.modernfix.common.mixin.perf.mojang_registry_size;
|
||||
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectList;
|
||||
import net.minecraft.core.MappedRegistry;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(MappedRegistry.class)
|
||||
public class MappedRegistryMixin {
|
||||
/**
|
||||
* Avoid copying the ID list to a slightly larger one every time an entry is added to the registry.
|
||||
* The original behavior causes O(n) time complexity for registration.
|
||||
*/
|
||||
@Redirect(
|
||||
method = "registerMapping(ILnet/minecraft/resources/ResourceKey;Ljava/lang/Object;Lcom/mojang/serialization/Lifecycle;)Lnet/minecraft/core/Holder$Reference;",
|
||||
at = @At(value = "INVOKE", target = "Lit/unimi/dsi/fastutil/objects/ObjectList;size(I)V", remap = false),
|
||||
require = 0
|
||||
)
|
||||
private void setSizeSmart(ObjectList<?> list, int size) {
|
||||
if(list instanceof ObjectArrayList && size > list.size()) {
|
||||
int requestedSize = size;
|
||||
/* choose next power of two, or this value if it is a power of two */
|
||||
int p2Size = Integer.highestOneBit(size);
|
||||
if(p2Size != size)
|
||||
size = p2Size << 1;
|
||||
// grow backing array to power-of-two size, this will return instantly in most cases
|
||||
((ObjectArrayList<?>)list).ensureCapacity(size);
|
||||
// write null entries to fill size, to match the behavior of list.size(int)
|
||||
while(list.size() < requestedSize)
|
||||
list.add(null);
|
||||
} else {
|
||||
list.size(size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -96,7 +96,7 @@ public class DummyServerConfiguration implements WorldData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean getAllowCommands() {
|
||||
public boolean isAllowCommands() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package org.embeddedt.modernfix.fabric.mixin.core;
|
||||
|
||||
import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl;
|
||||
import net.minecraft.client.multiplayer.ClientConfigurationPacketListenerImpl;
|
||||
import org.embeddedt.modernfix.ModernFixClientFabric;
|
||||
import org.embeddedt.modernfix.annotation.ClientOnlyMixin;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
|
@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(ClientCommonPacketListenerImpl.class)
|
||||
@Mixin(ClientConfigurationPacketListenerImpl.class)
|
||||
@ClientOnlyMixin
|
||||
public class ClientCommonPacketListenerImplMixin {
|
||||
@Inject(method = "handleUpdateTags", at = @At("RETURN"))
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ junit_version=5.10.0-M1
|
|||
mixinextras_version=0.3.2
|
||||
|
||||
mod_id=modernfix
|
||||
minecraft_version=24w03a
|
||||
minecraft_version=24w04a
|
||||
enabled_platforms=fabric
|
||||
forge_version=20.4.70-beta
|
||||
# parchment_version=2023.07.09
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user