/*
 * Decompiled with CFR 0.152.
 */
package com.evilco.mc.nbt.tag;

import com.evilco.mc.nbt.stream.NbtInputStream;
import com.evilco.mc.nbt.stream.NbtOutputStream;
import com.evilco.mc.nbt.tag.AbstractTag;
import com.evilco.mc.nbt.tag.TagType;
import java.io.IOException;
import javax.annotation.Nonnull;

public class TagInteger
extends AbstractTag {
    protected int value;

    public TagInteger(@Nonnull String name, int value) {
        super(name);
        this.setValue(value);
    }

    public TagInteger(@Nonnull NbtInputStream inputStream, boolean anonymous) throws IOException {
        super(inputStream, anonymous);
        this.setValue(inputStream.readInt());
    }

    @Override
    public byte getTagID() {
        return TagType.INTEGER.typeID;
    }

    public int getValue() {
        return this.value;
    }

    public void setValue(int i) {
        this.value = i;
    }

    @Override
    public void write(NbtOutputStream outputStream, boolean anonymous) throws IOException {
        super.write(outputStream, anonymous);
        outputStream.writeInt(this.value);
    }
}
