Advertisement
Guest User

Untitled

a guest
Sep 13th, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.81 KB | None | 0 0
  1. override def onItemUse(is: ItemStack, player: EntityPlayer, world: World, x: Int, y: Int, z: Int, side: Int, hitX: Float, hitY: Float, hitZ: Float): Boolean =
  2.     {
  3.         // client side, needs to return false to proceed to server
  4.         if (world.isRemote)
  5.         {
  6.             return false
  7.         }
  8.  
  9.         // server side, do calculation here
  10.         else {
  11.             val compound: NBTTagCompound = is.getTagCompound
  12.             if (compound != null)
  13.             {
  14.                 val te = world.getTileEntity(x,y,z)
  15.                 if (te.isInstanceOf[TileEntityPylon])
  16.                 {
  17.                     val pylon = te.asInstanceOf[TileEntityPylon]
  18.  
  19.                     val teRed = pylon.red
  20.                     val teGreen = pylon.green
  21.                     val teBlue = pylon.blue
  22.  
  23.                     compound.setInteger("colorRed", teRed)
  24.                     compound.setInteger("colorGreen", teGreen)
  25.                     compound.setInteger("colorBlue", teBlue)
  26.                 }
  27.             }
  28.  
  29.             return true
  30.         }
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement