Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package bone008.<censored>.shared.util.nbt;
- import java.util.List;
- public interface Compound {
- /**
- * Checks if this compound has the given key set.
- *
- * @param name the name of the key
- * @return true if the key exists, otherwise false
- */
- public boolean hasKey(String name);
- /**
- * Removes a key and its value from this compound.
- *
- * @param name the name of the key
- */
- public void remove(String name);
- /**
- * Sets a key in this compound to a value. The name of the compound is used as the name of the key.
- *
- * @param value the value to set
- */
- public void setCompound(Compound value);
- /**
- * Returns the value of a key in this compound.<br>
- * If the key is not set, a default value is returned (in this case an empty compound).<br>
- * If the key has an incompatible data type, a {@link NBTException} is thrown.
- *
- * @param name the name of the key
- * @return the associated value, or a default value
- * @throws NBTException if the key has an invalid data type
- */
- public Compound getCompound(String name) throws NBTException;
- /**
- * Sets a key in this compound to a value.
- *
- * @param name the name of the key
- * @param value the value to set
- */
- public void setByte(String name, byte value);
- /**
- * Returns the value of a key in this compound.<br>
- * If the key is not set, a default value is returned.<br>
- * If the key has an incompatible data type, a {@link NBTException} is thrown.
- *
- * @param name the name of the key
- * @return the associated value, or a default value
- * @throws NBTException if the key has an invalid data type
- */
- public byte getByte(String name) throws NBTException;
- /**
- * Sets a key in this compound to a value.
- *
- * @param name the name of the key
- * @param value the value to set
- */
- public void setShort(String name, short value);
- /**
- * Returns the value of a key in this compound.<br>
- * If the key is not set, a default value is returned.<br>
- * If the key has an incompatible data type, a {@link NBTException} is thrown.
- *
- * @param name the name of the key
- * @return the associated value, or a default value
- * @throws NBTException if the key has an invalid data type
- */
- public short getShort(String name) throws NBTException;
- /**
- * Sets a key in this compound to a value.
- *
- * @param name the name of the key
- * @param value the value to set
- */
- public void setInt(String name, int value);
- /**
- * Returns the value of a key in this compound.<br>
- * If the key is not set, a default value is returned.<br>
- * If the key has an incompatible data type, a {@link NBTException} is thrown.
- *
- * @param name the name of the key
- * @return the associated value, or a default value
- * @throws NBTException if the key has an invalid data type
- */
- public int getInt(String name) throws NBTException;
- /**
- * Sets a key in this compound to a value.
- *
- * @param name the name of the key
- * @param value the value to set
- */
- public void setLong(String name, long value);
- /**
- * Returns the value of a key in this compound.<br>
- * If the key is not set, a default value is returned.<br>
- * If the key has an incompatible data type, a {@link NBTException} is thrown.
- *
- * @param name the name of the key
- * @return the associated value, or a default value
- * @throws NBTException if the key has an invalid data type
- */
- public long getLong(String name) throws NBTException;
- /**
- * Sets a key in this compound to a value.
- *
- * @param name the name of the key
- * @param value the value to set
- */
- public void setFloat(String name, float value);
- /**
- * Returns the value of a key in this compound.<br>
- * If the key is not set, a default value is returned.<br>
- * If the key has an incompatible data type, a {@link NBTException} is thrown.
- *
- * @param name the name of the key
- * @return the associated value, or a default value
- * @throws NBTException if the key has an invalid data type
- */
- public float getFloat(String name) throws NBTException;
- /**
- * Sets a key in this compound to a value.
- *
- * @param name the name of the key
- * @param value the value to set
- */
- public void setDouble(String name, double value);
- /**
- * Returns the value of a key in this compound.<br>
- * If the key is not set, a default value is returned.<br>
- * If the key has an incompatible data type, a {@link NBTException} is thrown.
- *
- * @param name the name of the key
- * @return the associated value, or a default value
- * @throws NBTException if the key has an invalid data type
- */
- public double getDouble(String name) throws NBTException;
- /**
- * Sets a key in this compound to a value.
- *
- * @param name the name of the key
- * @param value the value to set
- */
- public void setString(String name, String value);
- /**
- * Returns the value of a key in this compound.<br>
- * If the key is not set, a default value is returned.<br>
- * If the key has an incompatible data type, a {@link NBTException} is thrown.
- *
- * @param name the name of the key
- * @return the associated value, or a default value
- * @throws NBTException if the key has an invalid data type
- */
- public String getString(String name) throws NBTException;
- /**
- * Sets a key in this compound to a value.
- *
- * @param name the name of the key
- * @param value the value to set
- */
- public void setByteArray(String name, byte[] value);
- /**
- * Returns the value of a key in this compound.<br>
- * If the key is not set, a default value is returned (in this case an array with length 0).<br>
- * If the key has an incompatible data type, a {@link NBTException} is thrown.
- *
- * @param name the name of the key
- * @return the associated value, or a default value
- * @throws NBTException if the key has an invalid data type
- */
- public byte[] getByteArray(String name) throws NBTException;
- /**
- * Sets a key in this compound to a value.
- *
- * @param name the name of the key
- * @param value the value to set
- */
- public void setIntArray(String name, int[] value);
- /**
- * Returns the value of a key in this compound.<br>
- * If the key is not set, a default value is returned (in this case an array with length 0).<br>
- * If the key has an incompatible data type, a {@link NBTException} is thrown.
- *
- * @param name the name of the key
- * @return the associated value, or a default value
- * @throws NBTException if the key has an invalid data type
- */
- public int[] getIntArray(String name) throws NBTException;
- /**
- * Sets a key in this component to a list value.<br>
- * The list can contain any supported data type, including byte and int arrays, compounds and other lists, but all entries must have the same type.
- *
- * @param name the name of the key
- * @param value the value to set
- */
- public <T> void setList(String name, List<T> value);
- /**
- * Returns the value of a key in this compound as a list. A parameter indicating the content type of the list must be given.
- *
- * @param name the name of the key
- * @param entryType the type of entries that are expected in this list
- * @return the associated value, or an empty list if not set
- * @throws NBTException if the key is not a list, or the list's type does not match the expected <tt>entryType</tt>
- */
- public <T> List<T> getList(String name, Class<T> entryType) throws NBTException;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement