From 6b648d14edc660419d52bd1977567ef81bd6af96 Mon Sep 17 00:00:00 2001 From: Xephi Date: Thu, 21 Mar 2013 13:44:20 +0100 Subject: Add Dropper BlockState. Adds BUKKIT-3750 --- src/main/java/org/bukkit/Material.java | 3 ++- src/main/java/org/bukkit/block/Dropper.java | 25 ++++++++++++++++++++++ .../org/bukkit/event/inventory/InventoryType.java | 4 ++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/bukkit/block/Dropper.java (limited to 'src/main/java/org') diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java index 9488dfda..b2d13ec7 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java @@ -16,6 +16,7 @@ import org.bukkit.material.Command; import org.bukkit.material.Crops; import org.bukkit.material.DetectorRail; import org.bukkit.material.Diode; +import org.bukkit.material.DirectionalContainer; import org.bukkit.material.Dispenser; import org.bukkit.material.Door; import org.bukkit.material.Dye; @@ -220,7 +221,7 @@ public enum Material { QUARTZ_BLOCK(155), QUARTZ_STAIRS(156, Stairs.class), ACTIVATOR_RAIL(157), - DROPPER(158), + DROPPER(158, DirectionalContainer.class), // ----- Item Separator ----- IRON_SPADE(256, 1, 250), IRON_PICKAXE(257, 1, 250), diff --git a/src/main/java/org/bukkit/block/Dropper.java b/src/main/java/org/bukkit/block/Dropper.java new file mode 100644 index 00000000..3cf73ab4 --- /dev/null +++ b/src/main/java/org/bukkit/block/Dropper.java @@ -0,0 +1,25 @@ +package org.bukkit.block; + +import org.bukkit.inventory.InventoryHolder; + +/** + * Represents a dropper. + */ +public interface Dropper extends BlockState, InventoryHolder { + /** + * Tries to drop a randomly selected item from the Dropper's inventory, + * following the normal behavior of a Dropper. + *

+ * Normal behavior of a Dropper is as follows: + *

+ * If the block that the Dropper is facing is an InventoryHolder or + * ContainerBlock 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. + *

+ * If the block that the Dropper is facing is not an InventoryHolder or + * ContainerBlock, the randomly selected ItemStack is dropped on + * the ground in the form of an {@link org.bukkit.entity.Item Item}. + */ + public void drop(); +} diff --git a/src/main/java/org/bukkit/event/inventory/InventoryType.java b/src/main/java/org/bukkit/event/inventory/InventoryType.java index 7820a36a..87edc427 100644 --- a/src/main/java/org/bukkit/event/inventory/InventoryType.java +++ b/src/main/java/org/bukkit/event/inventory/InventoryType.java @@ -9,6 +9,10 @@ public enum InventoryType { * A dispenser inventory, with 9 slots of type CONTAINER. */ DISPENSER(9,"Dispenser"), + /** + * A dropper inventory, with 9 slots of type CONTAINER. + */ + DROPPER(9, "Dropper"), /** * A furnace inventory, with a RESULT slot, a CRAFTING slot, and a FUEL slot. */ -- cgit v1.2.3