コード例 #1
0
ファイル: BlockHopper.java プロジェクト: Miner239/TFCraft
  /** Called upon block activation (right click on the block.) */
  @Override
  public boolean onBlockActivated(
      World world,
      int x,
      int y,
      int z,
      EntityPlayer player,
      int side,
      float hitX,
      float hitY,
      float hitZ) {
    TEHopper te = getHopperTE(world, x, y, z);
    if (world.isRemote) {
      if (te != null && te.pressBlock != null && player.isSneaking()) {
        te.pressBlock = null;
        te.pressCooldown = 0;
      }
      return true;
    } else {
      if (te != null && te.pressCooldown == 0) {
        player.openGui(TerraFirmaCraft.instance, 49, world, x, y, z);
      } else if (te != null && te.pressBlock != null && player.isSneaking()) {
        TFC_Core.giveItemToPlayer(te.pressBlock, player);
        te.pressBlock = null;
        te.pressCooldown = 0;
      }

      return true;
    }
  }