Replace ItemTag API with new API that also expands to Tiles and Entities
By: Bjarne Koll <LynxPlay101@gmail.com>
This commit is contained in:
@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Represents a captured state of a banner.
|
||||
*/
|
||||
public interface Banner extends BlockState {
|
||||
public interface Banner extends TileState {
|
||||
|
||||
/**
|
||||
* Returns the base color for this banner
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents a captured state of a beacon.
|
||||
*/
|
||||
public interface Beacon extends BlockState, Lockable, Nameable {
|
||||
public interface Beacon extends TileState, Lockable, Nameable {
|
||||
|
||||
/**
|
||||
* Returns the list of players within the beacon's range of effect.
|
||||
|
||||
@@ -7,4 +7,4 @@ import org.bukkit.material.Colorable;
|
||||
* @deprecated does not provide useful information beyond the material itself
|
||||
*/
|
||||
@Deprecated
|
||||
public interface Bed extends BlockState, Colorable { }
|
||||
public interface Bed extends TileState, Colorable { }
|
||||
|
||||
@@ -3,4 +3,4 @@ package org.bukkit.block;
|
||||
/**
|
||||
* Represents a captured state of Bell.
|
||||
*/
|
||||
public interface Bell extends BlockState { }
|
||||
public interface Bell extends TileState { }
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents a captured state of a campfire.
|
||||
*/
|
||||
public interface Campfire extends BlockState {
|
||||
public interface Campfire extends TileState {
|
||||
|
||||
/**
|
||||
* @see Inventory#getSize()
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents a captured state of a command block.
|
||||
*/
|
||||
public interface CommandBlock extends BlockState {
|
||||
public interface CommandBlock extends TileState {
|
||||
|
||||
/**
|
||||
* Gets the command that this CommandBlock will run when powered.
|
||||
|
||||
@@ -3,4 +3,4 @@ package org.bukkit.block;
|
||||
/**
|
||||
* Represents a captured state of an on / off comparator.
|
||||
*/
|
||||
public interface Comparator extends BlockState { }
|
||||
public interface Comparator extends TileState { }
|
||||
|
||||
@@ -3,4 +3,4 @@ package org.bukkit.block;
|
||||
/**
|
||||
* Represents a captured state of a conduit.
|
||||
*/
|
||||
public interface Conduit extends BlockState { }
|
||||
public interface Conduit extends TileState { }
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Represents a captured state of a container block.
|
||||
*/
|
||||
public interface Container extends BlockState, BlockInventoryHolder, Lockable, Nameable {
|
||||
public interface Container extends TileState, BlockInventoryHolder, Lockable, Nameable {
|
||||
|
||||
/**
|
||||
* Gets the inventory of the block represented by this block state.
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Represents a captured state of a creature spawner.
|
||||
*/
|
||||
public interface CreatureSpawner extends BlockState {
|
||||
public interface CreatureSpawner extends TileState {
|
||||
|
||||
/**
|
||||
* Get the spawner's creature type.
|
||||
|
||||
@@ -3,4 +3,4 @@ package org.bukkit.block;
|
||||
/**
|
||||
* Represents a captured state of a (possibly inverted) daylight detector.
|
||||
*/
|
||||
public interface DaylightDetector extends BlockState { }
|
||||
public interface DaylightDetector extends TileState { }
|
||||
|
||||
@@ -5,4 +5,4 @@ import org.bukkit.Nameable;
|
||||
/**
|
||||
* Represents a captured state of an enchanting table.
|
||||
*/
|
||||
public interface EnchantingTable extends BlockState, Nameable { }
|
||||
public interface EnchantingTable extends TileState, Nameable { }
|
||||
|
||||
@@ -6,7 +6,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents a captured state of an end gateway.
|
||||
*/
|
||||
public interface EndGateway extends BlockState {
|
||||
public interface EndGateway extends TileState {
|
||||
|
||||
/**
|
||||
* Gets the location that entities are teleported to when
|
||||
|
||||
@@ -3,4 +3,4 @@ package org.bukkit.block;
|
||||
/**
|
||||
* Represents a captured state of an ender chest.
|
||||
*/
|
||||
public interface EnderChest extends BlockState { }
|
||||
public interface EnderChest extends TileState { }
|
||||
|
||||
@@ -3,4 +3,4 @@ package org.bukkit.block;
|
||||
/**
|
||||
* Represents a captured state of a jigsaw.
|
||||
*/
|
||||
public interface Jigsaw extends BlockState { }
|
||||
public interface Jigsaw extends TileState { }
|
||||
|
||||
@@ -8,7 +8,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents a captured state of a jukebox.
|
||||
*/
|
||||
public interface Jukebox extends BlockState {
|
||||
public interface Jukebox extends TileState {
|
||||
|
||||
/**
|
||||
* Gets the record inserted into the jukebox.
|
||||
|
||||
@@ -7,7 +7,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Represents a captured state of a lectern.
|
||||
*/
|
||||
public interface Lectern extends BlockState, BlockInventoryHolder {
|
||||
public interface Lectern extends TileState, BlockInventoryHolder {
|
||||
|
||||
/**
|
||||
* Get the current lectern page.
|
||||
|
||||
@@ -5,7 +5,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
/**
|
||||
* Represents a captured state of either a SignPost or a WallSign.
|
||||
*/
|
||||
public interface Sign extends BlockState {
|
||||
public interface Sign extends TileState {
|
||||
|
||||
/**
|
||||
* Gets all the lines of text currently on this sign.
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
/**
|
||||
* Represents a captured state of a skull block.
|
||||
*/
|
||||
public interface Skull extends BlockState {
|
||||
public interface Skull extends TileState {
|
||||
|
||||
/**
|
||||
* Checks to see if the skull has an owner
|
||||
|
||||
@@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
* Represents a structure block that can save and load blocks from a file. They
|
||||
* can only be used by OPs, and are not obtainable in survival.
|
||||
*/
|
||||
public interface Structure extends BlockState {
|
||||
public interface Structure extends TileState {
|
||||
|
||||
/**
|
||||
* The name of this structure.
|
||||
|
||||
39
paper-api/src/main/java/org/bukkit/block/TileState.java
Normal file
39
paper-api/src/main/java/org/bukkit/block/TileState.java
Normal file
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user