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

@@ -1,27 +1,31 @@
package org.bukkit.block;
import org.bukkit.Nameable;
import org.bukkit.inventory.InventoryHolder;
/**
* Represents a dropper.
* Represents a captured state of a dropper.
*/
public interface Dropper extends BlockState, InventoryHolder, Lockable, Nameable {
public interface Dropper extends Container, Nameable {
/**
* Tries to drop a randomly selected item from the Dropper's inventory,
* following the normal behavior of a Dropper.
* Tries to drop a randomly selected item from the dropper's inventory,
* following the normal behavior of a dropper.
* <p>
* Normal behavior of a Dropper is as follows:
* Normal behavior of a dropper is as follows:
* <p>
* If the block that the Dropper is facing is an InventoryHolder,
* If the block that the dropper is facing is an InventoryHolder,
* the randomly selected ItemStack is placed within that
* Inventory in the first slot that's available, starting with 0 and
* counting up. If the inventory is full, nothing happens.
* <p>
* If the block that the Dropper is facing is not an InventoryHolder,
* If the block that the dropper is facing is not an InventoryHolder,
* the randomly selected ItemStack is dropped on
* the ground in the form of an {@link org.bukkit.entity.Item Item}.
* <p>
* If the block represented by this state is no longer a dropper, this will
* do nothing.
*
* @throws IllegalStateException if this block state is not placed
*/
public void drop();
}