Improvements to BlockStates

* Update Javadoc of block state classes to better match implementation behaviour.
* Add Container interface which provides access to the snapshot inventory.

By: Lukas Hennig <lukas@wirsindwir.de>
This commit is contained in:
Bukkit/Spigot
2017-08-05 14:35:40 +10:00
parent 5727987ab3
commit 2ab655238c
25 changed files with 186 additions and 82 deletions

View File

@@ -0,0 +1,36 @@
package org.bukkit.block;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
/**
* Represents a captured state of a container block.
*/
public interface Container extends BlockState, InventoryHolder, Lockable {
/**
* Gets the inventory of the block represented by this block state.
* <p>
* If the block was changed to a different type in the meantime, the
* returned inventory might no longer be valid.
* <p>
* If this block state is not placed this will return the captured inventory
* snapshot instead.
*
* @return the inventory
*/
@Override
Inventory getInventory();
/**
* Gets the captured inventory snapshot of this container.
* <p>
* The returned inventory is not linked to any block. Any modifications to
* the returned inventory will not be applied to the block represented by
* this block state up until {@link #update(boolean, boolean)} has been
* called.
*
* @return the captured inventory snapshot
*/
Inventory getSnapshotInventory();
}