mojira.dev
MC-260378

Code: ListTag.getLongArray does not work

Getting a long array from the `ListTag` does not work as intended. A LongArrayTag has the id 12. The method getLongArray checks if the id of the tag is 11, which will never happen. So the result will be a new empty long array, unless the tag actually has the id 11 (which will cause a cast exception).

Source in net.minecraft.nbt.ListTag: 

public long[] getLongArray(int p_177992_) {
      if (p_177992_ >= 0 && p_177992_ < this.list.size()) {
         Tag tag = this.list.get(p_177992_);
         if (tag.getId() == 11) {
            return ((LongArrayTag)tag).getAsLongArray();
         }
      }

      return new long[0];
   }

I doubt this can be reproduced using the game itself. It should be an issue fix as well, just replace 11 with 12. Hope this is the right place to report an issue like this.

Comments 7

Does this bug have any impact on gameplay? If it doesn't, unfortunately Mojang will not accept it.

I do know long arrays are used in the chunk format's saved block data, but whether this method is used on it, I do not know.

This method is never used, so it does not impact gameplay at all. But that is only for the moment, it is quite likely it will be used at some point in the future. It is definitely something which should be fixed, to save some headaches for future versions.

In that case this is invalid per having no impact.

When it gets used, a new report may be created.

Folks, there are precedence for Mojang fixing code that is not reproducible at all in vanilla or are impossible to trigger in vanilla. Example: MC-194811

I made that bug report I linked above because while it affected modded, Mojang should’ve been aware of it in case Mojang tries to remove or rename a structure type in the future. I essentially helped saved some headache for Mojang by bringing up a potential issue when they make future changes even though it was impossible to replicate back then in 1.16.5 vanilla (no custom structure types is able to be made by datapack)

So I’m not sure I agree that a bug report has to have gameplay impact unless you count modded gameplay being impacted.

Mojang has resolved several issues as invalid for having no gameplay impact. This has no impact on gameplay, as such this is getting the same resolution. This is not a choice moderators made, it is a choice Mojang made.

This is feedback, not a bug report.

Matthias H.

(Unassigned)

Plausible

(Unassigned)

1.19.3

Retrieved