aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util/GTPlayedSound.java
blob: 0b527136b3429ae8ebf615104da970084b1dd530 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package gregtech.api.util;

import net.minecraft.util.ResourceLocation;

public class GTPlayedSound {

    public final String mSoundName;
    public final int mX, mY, mZ;

    public GTPlayedSound(ResourceLocation aSoundResourceLocation, double aX, double aY, double aZ) {
        mSoundName = aSoundResourceLocation.toString();
        mX = (int) aX;
        mY = (int) aY;
        mZ = (int) aZ;
    }

    @Override
    public boolean equals(Object aObject) {
        if (aObject instanceof GTPlayedSound) {
            return ((GTPlayedSound) aObject).mX == mX && ((GTPlayedSound) aObject).mY == mY
                && ((GTPlayedSound) aObject).mZ == mZ
                && ((GTPlayedSound) aObject).mSoundName.equals(mSoundName);
        }
        return false;
    }

    @Override
    public int hashCode() {
        return mX + mY + mZ + mSoundName.hashCode();
    }
}