コード例 #1
0
ファイル: Commode.java プロジェクト: rickyminecraft/Mobiliers
  @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
ファイル: Commode.java プロジェクト: rickyminecraft/Mobiliers
 /** 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);
 }