예제 #1
0
  @Override
  /**
   * Gets the hardness of block at the given coordinates in the given world, relative to the ability
   * of the given EntityPlayer.
   */
  public float getPlayerRelativeBlockHardness(
      EntityPlayer entityPlayer, World world, int x, int y, int z) {
    TEBase TE = getTileEntityStrict(world, x, y, z);

    if (Safe.isOpen(TE)
        || !PlayerPermissions.canPlayerEdit(TE, TE.xCoord, TE.yCoord, TE.zCoord, entityPlayer)) {
      return -1; // Unbreakable
    } else {
      return super.getPlayerRelativeBlockHardness(entityPlayer, world, x, y, z);
    }
  }
예제 #2
0
 /** Returns whether player is allowed to activate this block. */
 @Override
 protected boolean canPlayerActivate(TEBase TE, EntityPlayer entityPlayer) {
   return PlayerPermissions.canPlayerEdit(TE, TE.xCoord, TE.yCoord, TE.zCoord, entityPlayer)
       || !Safe.isLocked(TE);
 }