Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package at.codezilla
- /**
- Created by Democre on 5/3/13
- */
- package object scamod {
- //string constants replacing Pahimar's reference class idea
- final val MOD_ID = "ScaMod"
- final val MOD_NAME = "Scala Mod"
- final val VERSION = "0.0.1"
- //import and shortening some names just cause I can
- import cpw.mods.fml.common.event._
- type FMLPreInitEvent = FMLPreInitializationEvent
- type FMLInitEvent = FMLInitializationEvent
- type FMLPostInitEvent = FMLPostInitializationEvent
- //implicit Block to ItemStack and Item to ItemStack
- import net.minecraft.block.Block
- import net.minecraft.item.Item
- import net.minecraft.item.ItemStack
- implicit def block2ItemStack(value: Block) = new ItemStack(value)
- implicit def blockAndQuantity2ItemStack(value: (Block, Int)) = new ItemStack(value._1, value._2)
- implicit def blockAndQuantityAndDamage2ItemStack(value: (Block, Int, Int)) = new ItemStack(value._1, value._2, value._3)
- implicit def item2ItemStack(value: Item) = new ItemStack(value)
- implicit def itemAndQuantity2ItemStack(value: (Item, Int)) = new ItemStack(value._1, value._2)
- implicit def itemAndQuantityAndDamage2ItemStack(value: (Item, Int, Int)) = new ItemStack(value._1, value._2, value._3)
- //ItemStack factory to exercise the implicits
- object IS {
- def apply (value: ItemStack) = value
- def apply (obj: Block, quantity: Int) = IS((obj, quantity))
- def apply (obj: Block, quantity: Int, dam: Int) = IS((obj, quantity, dam))
- def apply (obj: Item, quantity: Int) = IS((obj, quantity))
- def apply (obj: Item, quantity: Int, dam: Int) = IS((obj, quantity, dam))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment