Just to be 100% sure this gets processed correctly.

The blockstate DOES current store the metadata of the block, but I'd
rather stick with using the Block every time to be absolutely certain
that things are handled correctly.
This commit is contained in:
GJ 2013-03-10 14:53:51 -04:00
parent df67bd6720
commit 2cef6700c7

View File

@ -132,14 +132,15 @@ public class InventoryListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onFurnaceExtractEvent(FurnaceExtractEvent event) { public void onFurnaceExtractEvent(FurnaceExtractEvent event) {
BlockState furnaceState = event.getBlock().getState(); Block furnaceBlock = event.getBlock();
BlockState furnaceState = furnaceBlock.getState();
if (furnaceState instanceof Furnace) { if (furnaceState instanceof Furnace) {
ItemStack result = ((Furnace) furnaceState).getInventory().getResult(); ItemStack result = ((Furnace) furnaceState).getInventory().getResult();
if (furnaceState.hasMetadata(mcMMO.furnaceMetadataKey) && result != null && ItemUtils.isSmelted(result)) { if (furnaceBlock.hasMetadata(mcMMO.furnaceMetadataKey) && result != null && ItemUtils.isSmelted(result)) {
// We can make this assumption because we (should) be the only ones using this exact metadata // We can make this assumption because we (should) be the only ones using this exact metadata
Player player = plugin.getServer().getPlayer(furnaceState.getMetadata(mcMMO.furnaceMetadataKey).get(0).asString()); Player player = plugin.getServer().getPlayer(furnaceBlock.getMetadata(mcMMO.furnaceMetadataKey).get(0).asString());
SmeltingManager smeltingManager = UserManager.getPlayer(player).getSmeltingManager(); SmeltingManager smeltingManager = UserManager.getPlayer(player).getSmeltingManager();