ModernFix

ModernFix

2M Downloads

Add modid to mixin method names

ChiefArug opened this issue ยท 1 comments

commented

Can you please add your modid to the names of all methods you add via mixin so that it is easy to tell the source of a mixin from a stacktrace, instead of needing to search the entirety of github or all mod jars in the mods folder for the source of a mixin.

Something like this:

    @Inject(method = "getChunk", at = @At("HEAD"), cancellable = true)
    private void modernfix$bailIfServerDead(int chunkX, int chunkZ, ChunkStatus requiredStatus, boolean load, CallbackInfoReturnable<ChunkAccess> cir) {
        /* ... */
    }

Example stacktrace where this would be useful:

    at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerChunkCache.handler$zec000$bailIfServerDead(ServerChunkCache.java:1596)
        ~ cut to shorten ~
    at TRANSFORMER/[email protected]/net.minecraft.world.level.biome.BiomeManager.m_204214_(BiomeManager.java:79)
    at TRANSFORMER/[email protected]/com.momosoftworks.coldsweat.api.temperature.modifier.BiomeTempModifier.calculate(BiomeTempModifier.java:52)
    at TRANSFORMER/[email protected]/com.momosoftworks.coldsweat.api.temperature.modifier.TempModifier.update(TempModifier.java:60)
    at TRANSFORMER/[email protected]/com.momosoftworks.coldsweat.api.util.Temperature.apply(Temperature.java:114)
    at TRANSFORMER/[email protected]/com.momosoftworks.coldsweat.api.util.Temperature.apply(Temperature.java:130)
    at TRANSFORMER/[email protected]/com.momosoftworks.coldsweat.api.util.Temperature.getTemperatureAt(Temperature.java:138)
    at TRANSFORMER/[email protected]/net.minecraft.world.entity.item.ItemEntity.mdb608ee$lambda$tickFood$0$0(ItemEntity.java:1034)
    at TRANSFORMER/[email protected]/net.minecraftforge.common.util.LazyOptional.ifPresent(LazyOptional.java:150)
    at TRANSFORMER/[email protected]/net.minecraft.world.entity.item.ItemEntity.handler$bfl000$tickFood(ItemEntity.java:1033)
    at TRANSFORMER/[email protected]/net.minecraft.world.entity.item.ItemEntity.m_8119_(ItemEntity.java:98)
    at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerLevel.track(ServerLevel.java:6240)
    at TRANSFORMER/[email protected]/net.minecraft.server.level.ServerLevel.redirect$dko000$onTickNonPassenger(ServerLevel.java:6256)
        ~ cut to shorten ~
    at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:244)
    at java.base/java.lang.Thread.run(Thread.java:833)

There are three mixins in here, all from different mods (your one is near the top). Because they don't have modids in them its impossible to tell which mods they are from without a decompiler or hoping the mod is on github and its not too generic a method name.

commented

I'm not planning to do this; it just makes the codebase harder to read because every method is now (redundantly) prefixed with modernfix$ when it's already clear to the developer that they have the ModernFix project open.

Ideally, this should be done by the Mixin library itself at runtime, like Fabric already does. That approach brings all the support benefits with none of the dev-time downsides.