Skip to content
This repository was archived by the owner on Aug 10, 2025. It is now read-only.
This repository was archived by the owner on Aug 10, 2025. It is now read-only.

Compound, List, and Array Tags give false-positives when using == #31

@Fisch37

Description

@Fisch37

When comparing compound tags the bar for equality is set extremely low. Two compound objects are equal if they have the same type (guaranteed) and their names are the same.

This is because the CompoundTag class does not override the Tag.Equals method leading to this bizarre behaviour. A very simple check is this:

using SharpNBT.SNBT;
Console.WriteLine(StringNbt.Parse("{value:385}") == StringNbt.Parse("{data:[1,2,3,4]}"));

This will pass even though the two compounds aren't remotely the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions