Advertisement
Atijaf

OnBlockActivated

Feb 1st, 2016
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. @Override
  2.     public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) {
  3.         if(!worldIn.isRemote){
  4.             playerIn.openGui(EnergyTools.instance, CommonProxy.GUI_TELEPORTER, worldIn, pos.getX(), pos.getY(), pos.getZ());
  5.         }
  6.        
  7.         // I want to send a message to the player when he opens the container. <------------!
  8.         /** Tried it without the !   Am starting to get confused -- Noticed playerIn is instanceof EntityPlayerMP with ! */
  9.         if(!worldIn.isRemote){
  10.             TeleporterTE te = (TeleporterTE) worldIn.getTileEntity(pos);
  11.             if(te != null){
  12.                 PacketDispatcher.sendTo(new SyncTeleporterContents(te.getCurrentEnergy()), (EntityPlayerMP)playerIn);
  13.             }
  14.         }
  15.        
  16.         return true;
  17.            
  18.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement