gt22

Untitled

Jul 25th, 2016
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.96 KB | None | 0 0
  1. @Override
  2.     public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int idk, float what, float these, float are)
  3.     {
  4.         TEAltar tileEntity = (TEAltar) world.getTileEntity(x, y, z);
  5.  
  6.         if (tileEntity == null || player.isSneaking())
  7.         {
  8.             return false;
  9.         }
  10.  
  11.         ItemStack playerItem = player.getCurrentEquippedItem();
  12.  
  13.         if (playerItem != null)
  14.         {
  15.             if (playerItem.getItem().equals(ModItems.divinationSigil))
  16.             {
  17.                 if (player.worldObj.isRemote)
  18.                 {
  19.                     world.markBlockForUpdate(x, y, z);
  20.                 } else
  21.                 {
  22.                     tileEntity.sendChatInfoToPlayer(player);
  23.                 }
  24.  
  25.                 return true;
  26.             } else if (playerItem.getItem().equals(ModItems.itemSeerSigil))
  27.             {
  28.                 if (player.worldObj.isRemote)
  29.                 {
  30.                     world.markBlockForUpdate(x, y, z);
  31.                 } else
  32.                 {
  33.                     tileEntity.sendMoreChatInfoToPlayer(player);
  34.                 }
  35.  
  36.                 return true;
  37.             }else if(playerItem.getItem() instanceof IAltarManipulator)
  38.             {
  39.                 return false;
  40.             }
  41.             else if (playerItem.getItem().equals(ModItems.sigilOfHolding))
  42.             {
  43.                 ItemStack item = SigilOfHolding.getCurrentSigil(playerItem);
  44.  
  45.                 if (item != null && item.getItem().equals(ModItems.divinationSigil))
  46.                 {
  47.                     if (player.worldObj.isRemote)
  48.                     {
  49.                         world.markBlockForUpdate(x, y, z);
  50.                     } else
  51.                     {
  52.                         tileEntity.sendChatInfoToPlayer(player);
  53.                     }
  54.  
  55.                     return true;
  56.                 } else if (item != null && item.getItem().equals(ModItems.itemSeerSigil))
  57.                 {
  58.                     if (player.worldObj.isRemote)
  59.                     {
  60.                         world.markBlockForUpdate(x, y, z);
  61.                     } else
  62.                     {
  63.                         tileEntity.sendMoreChatInfoToPlayer(player);
  64.                     }
  65.  
  66.                     return true;
  67.                 }
  68.             }
  69.         }
  70.  
  71.         if (tileEntity.getStackInSlot(0) == null && playerItem != null)
  72.         {
  73.             ItemStack newItem = playerItem.copy();
  74.             newItem.stackSize = 1;
  75.             --playerItem.stackSize;
  76.             tileEntity.setInventorySlotContents(0, newItem);
  77.             tileEntity.startCycle();
  78.         } else if (tileEntity.getStackInSlot(0) != null && playerItem == null)
  79.         {
  80.             player.inventory.addItemStackToInventory(tileEntity.getStackInSlot(0));
  81.             tileEntity.setInventorySlotContents(0, null);
  82.             tileEntity.setActive();
  83.         }
  84.         world.markBlockForUpdate(x, y, z);
  85.         return true;
  86.     }
Advertisement
Add Comment
Please, Sign In to add comment