mirror of
https://github.com/GTNewHorizons/bdlib.git
synced 2026-11-13 16:54:11 +00:00
Added extractor (for scala pattern matching) for ItemStack
This commit is contained in:
1 parent
971fd94532
commit
8891cfff06
1 file changed
+23
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (c) bdew, 2013 - 2014
|
||||
* https://github.com/bdew/bdlib
|
||||
*
|
||||
* This mod is distributed under the terms of the Minecraft Mod Public
|
||||
* License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* https://raw.github.com/bdew/bdlib/master/MMPL-1.0.txt
|
||||
*/
|
||||
|
||||
package net.bdew.lib.items
|
||||
|
||||
import net.minecraft.item.{Item, ItemStack}
|
||||
|
||||
/**
|
||||
* Allows matching Items in ItemStacks in scala pattern matches
|
||||
*/
|
||||
object IStack {
|
||||
def unapply(x: ItemStack): Option[Item] =
|
||||
if (x == null || x.getItem == null)
|
||||
None
|
||||
else
|
||||
Some(x.getItem)
|
||||
}
|
||||
Reference in new issue
Block a user