Replace ItemTag API with new API that also expands to Tiles and Entities

By: Bjarne Koll <LynxPlay101@gmail.com>
This commit is contained in:
Bukkit/Spigot
2019-04-25 14:24:05 +10:00
parent 3209bcbf56
commit ddfd4b10c4
30 changed files with 416 additions and 22 deletions
@@ -0,0 +1,39 @@
package org.bukkit.block;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.persistence.PersistentDataHolder;
import org.jetbrains.annotations.NotNull;
/**
* Represents a block state that also hosts a tile entity at the given location.
*
* This interface alone is merely a marker that does not provide any data.
*
* Data about the tile entities is provided by the respective interface for each
* tile entity type.
*
* After modifying the data provided by a TileState, {@link #update()} needs to
* be called to store the data.
*/
public interface TileState extends BlockState, PersistentDataHolder {
/**
* Returns a custom tag container capable of storing tags on the object.
*
* Note that the tags stored on this container are all stored under their
* own custom namespace therefore modifying default tags using this
* {@link PersistentDataHolder} is impossible.
* <p>
* This {@link PersistentDataHolder} is only linked to the snapshot instance
* stored by the {@link BlockState}.
*
* When storing changes on the {@link PersistentDataHolder}, the updated
* content will only be applied to the actual tile entity after one of the
* {@link #update()} methods is called.
*
* @return the custom tag container
*/
@NotNull
@Override
PersistentDataContainer getPersistentDataContainer();
}