Code shown uses Forges Mojang Mappings which should be now all Mojang Mappings.
Stat.class
private static <T> String locationToKey(@Nullable ResourceLocation p_12866_) {
return p_12866_.toString().replace(':', '.');
}
There is a bug in this code.
I actually managed to run into the case where the input was null with a custom registered stat.
Would be nice if this is fixed in 1.19.1 since datapacks can easily run into this bug too.
Crashlog:
java.lang.NullPointerException: Cannot invoke "net.minecraft.resources.ResourceLocation.toString()" because "p_12866_" is null
at net.minecraft.stats.Stat.m_12865_(Stat.java:29) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:mixin,re:classloading}
at net.minecraft.stats.Stat.m_12862_(Stat.java:23) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:mixin,re:classloading}
at net.minecraft.stats.Stat.<init>(Stat.java:16) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:mixin,re:classloading}
at net.minecraft.stats.StatType.m_12894_(StatType.java:27) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:classloading,re:mixin}
at java.util.Map.computeIfAbsent(Map.java:1054) ~[?:?] {re:mixin}
at net.minecraft.stats.StatType.m_12899_(StatType.java:27) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:classloading,re:mixin}
at net.minecraft.stats.StatType.m_12902_(StatType.java:40) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:classloading,re:mixin}
at ic2.core.platform.advancements.StatTrigger$Instance.test(StatTrigger.java:98) ~[IC2Classic-1.19-Beta-1.0.8.jar%23130!/:1.19-Beta-1.0.8] {re:classloading}
at ic2.core.platform.advancements.StatTrigger$Listeners.trigger(StatTrigger.java:150) ~[IC2Classic-1.19-Beta-1.0.8.jar%23130!/:1.19-Beta-1.0.8] {re:classloading}
at ic2.core.platform.advancements.StatTrigger.onTrigger(StatTrigger.java:74) ~[IC2Classic-1.19-Beta-1.0.8.jar%23130!/:1.19-Beta-1.0.8] {re:mixin,re:classloading}
at net.minecraft.server.level.ServerPlayer.handler$zcl000$statCallback(ServerPlayer.java:1703) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:ic2.mixins.json:server.StatMixin,pl:mixin:A}
at net.minecraft.server.level.ServerPlayer.m_6278_(ServerPlayer.java:1049) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:mixin,pl:accesstransformer:B,re:computing_frames,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:ic2.mixins.json:server.StatMixin,pl:mixin:A}
at net.minecraft.world.entity.player.Player.m_36246_(Player.java:1380) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:mixin,pl:accesstransformer:B,xf:fml:ic2:betterarmorcalculations,re:computing_frames,pl:accesstransformer:B,xf:fml:ic2:betterarmorcalculations,re:classloading,pl:accesstransformer:B,xf:fml:ic2:betterarmorcalculations,pl:mixin:APP:ic2.mixins.json:server.PlayerMixin,pl:mixin:A}
at net.minecraft.world.entity.player.Player.m_36220_(Player.java:1372) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:mixin,pl:accesstransformer:B,xf:fml:ic2:betterarmorcalculations,re:computing_frames,pl:accesstransformer:B,xf:fml:ic2:betterarmorcalculations,re:classloading,pl:accesstransformer:B,xf:fml:ic2:betterarmorcalculations,pl:mixin:APP:ic2.mixins.json:server.PlayerMixin,pl:mixin:A}
at ic2.core.entity.misc.MiningLaserEntity.m_8119_(MiningLaserEntity.java:189) ~[IC2Classic-1.19-Beta-1.0.8.jar%23130!/:1.19-Beta-1.0.8] {re:classloading}
at ic2.core.entity.misc.TrackingMiningLaserEntity.m_8119_(TrackingMiningLaserEntity.java:60) ~[IC2Classic-1.19-Beta-1.0.8.jar%23130!/:1.19-Beta-1.0.8] {re:classloading}
at net.minecraft.server.level.ServerLevel.m_8647_(ServerLevel.java:657) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:supplementaries.mixins.json:ServerLevelMixin,pl:mixin:A}
at net.minecraft.world.level.Level.m_46653_(Level.java:457) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B}
at net.minecraft.server.level.ServerLevel.m_184063_(ServerLevel.java:322) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:supplementaries.mixins.json:ServerLevelMixin,pl:mixin:A}
at net.minecraft.world.level.entity.EntityTickList.m_156910_(EntityTickList.java:54) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:classloading}
at net.minecraft.server.level.ServerLevel.m_8793_(ServerLevel.java:302) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:APP:supplementaries.mixins.json:ServerLevelMixin,pl:mixin:A}
at net.minecraft.server.MinecraftServer.m_5703_(MinecraftServer.java:866) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:A}
at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:806) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:A}
at net.minecraft.client.server.IntegratedServer.m_5705_(IntegratedServer.java:84) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:classloading,pl:runtimedistcleaner:A}
at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:654) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:A}
at net.minecraft.server.MinecraftServer.m_177918_(MinecraftServer.java:245) ~[client-1.19-20220607.102129-srg.jar%23139!/:?] {re:mixin,pl:accesstransformer:B,re:classloading,pl:accesstransformer:B,pl:mixin:A}
at java.lang.Thread.run(Thread.java:833) ~[?:?] {}
Comments 15
Edit this might be confusing for anyone watching from the outside.
The Crash is my bug yes, but the code snipped (from mojang) is missleading to say the least.
The function says it supports null inputs but if you do that the game will crash. And that is mojangs bug, not mine.
since datapacks can easily run into this
How? Unless a bug has actual gameplay impact in vanilla, Mojang resolves reports as invalid (they've done so several times before).
> How? Unless a bug has actual gameplay impact in vanilla, Mojang resolves reports as invalid (they've done so several times before).
How this was triggered was by Using a custom Advancement tester that was using a ID to detect the current value of the stat that should be tracked.
And just that test was causing a crash even so the stats were properly registered. To be more specific it is the stat that command blocks can register on their own.
And since you can easily create custom stats with command blocks or DataPacks you can easily run into that if anything fails, because this is only an issue since 1.19, older versions were fine.
Thats why datapacks can easily run into it because it is a feature datapacks can use.
Also their Development tools should yell at them to fix such things. (Because they are programmed to yell at such things)
This is one of the most common ways bugs are created in a game...
And since you can easily create custom stats with command blocks or DataPacks you can easily run into that if anything fails
This is literally the first time I'm hearing any of this. Mind attaching commands/a data pack so this report can actually be tested?
Funny thing is, that stance is one of the reasons why mojangs code quality is at the level it is at.
But yeah I managed to register a custom stat and successfully create it, and then managed to (without anything i wrote) to make it be deleted and then create a crash because a Stat that wasn't registered anymore couldn't be recreated because the one function that could recreated it would crash if the function received a null from it, but not because the function was supposed to be crashing, nah it was supposed to handle the case but horrible mojang code => yeah this is normal xD
Also @Dhranios do you see the bug in the code provided?
if not then you clearly need to get glasses
Funny, especially since it's a new policy and tickets have only been getting invalidated with that as reason since this year...
And yes I do, but I do not go over that. No need to try and insult me. (For all you know, I could absolutely hate programming and not know how to read it, making you attack me for no reason.)
Eh, not really a insult or even a attempt, just a hint that your input is as wanted as that comment.
And the code quality dropped massively since 1.18 (When i noticed it) so that explains it really well thank you!
Marking incomplete because this bug does not include repro steps or Vanilla gameplay impact.
To be clear, I think you may have a valid bug–but it is important that you frame the bug from the lens of it having gameplay impact. Your comments above are more than that it would take it to reframe this bug as "This statistic is not being tracked correctly" or "Players will not be able to create [this kind of custom statistic]" or such.
⚠️ Please do not mark Unreleased Versions as affected. You don't have access to them yet.
-- I am a bot. This action was performed automatically! If you think it was incorrect, please notify us on Discord or Reddit