Adjustments for 1.8.

This commit is contained in:
Florian Nücke 2015-04-03 18:23:05 +02:00
parent 9e2371c7d7
commit e8a73e8e9c
3 changed files with 9 additions and 9 deletions

View File

@ -16,11 +16,11 @@ class Chamelium(val parent: Delegator) extends Delegate {
stack stack
} }
override def getItemUseAction(stack: ItemStack): EnumAction = EnumAction.eat override def getItemUseAction(stack: ItemStack): EnumAction = EnumAction.EAT
override def getMaxItemUseDuration(stack: ItemStack): Int = 32 override def getMaxItemUseDuration(stack: ItemStack): Int = 32
override def onEaten(stack: ItemStack, world: World, player: EntityPlayer): ItemStack = { override def onItemUseFinish(stack: ItemStack, world: World, player: EntityPlayer): ItemStack = {
if (!world.isRemote) { if (!world.isRemote) {
player.addPotionEffect(new PotionEffect(Potion.invisibility.id, 100, 0)) player.addPotionEffect(new PotionEffect(Potion.invisibility.id, 100, 0))
player.addPotionEffect(new PotionEffect(Potion.blindness.id, 200, 0)) player.addPotionEffect(new PotionEffect(Potion.blindness.id, 200, 0))

View File

@ -53,11 +53,11 @@ trait Delegate {
stack stack
} }
def getItemUseAction(stack: ItemStack): EnumAction = EnumAction.none def getItemUseAction(stack: ItemStack): EnumAction = EnumAction.NONE
def getMaxItemUseDuration(stack: ItemStack) = 0 def getMaxItemUseDuration(stack: ItemStack) = 0
def onEaten(stack: ItemStack, world: World, player: EntityPlayer): ItemStack = stack def onItemUseFinish(stack: ItemStack, world: World, player: EntityPlayer): ItemStack = stack
def onPlayerStoppedUsing(stack: ItemStack, player: EntityPlayer, duration: Int) {} def onPlayerStoppedUsing(stack: ItemStack, player: EntityPlayer, duration: Int) {}

View File

@ -126,14 +126,14 @@ class Delegator extends Item {
// ----------------------------------------------------------------------- // // ----------------------------------------------------------------------- //
override def onEaten(stack: ItemStack, world: World, player: EntityPlayer): ItemStack = override def onItemUseFinish(stack: ItemStack, world: World, player: EntityPlayer): ItemStack =
subItem(stack) match { Delegator.subItem(stack) match {
case Some(subItem) => subItem.onEaten(stack, world, player) case Some(subItem) => subItem.onItemUseFinish(stack, world, player)
case _ => super.onEaten(stack, world, player) case _ => super.onItemUseFinish(stack, world, player)
} }
override def getItemUseAction(stack: ItemStack): EnumAction = override def getItemUseAction(stack: ItemStack): EnumAction =
subItem(stack) match { Delegator.subItem(stack) match {
case Some(subItem) => subItem.getItemUseAction(stack) case Some(subItem) => subItem.getItemUseAction(stack)
case _ => super.getItemUseAction(stack) case _ => super.getItemUseAction(stack)
} }