예제 #1
0
  @Override
  public boolean onBlockActivated(
      World world,
      int x,
      int y,
      int z,
      EntityPlayer entityplayer,
      int par6,
      float par7,
      float par8,
      float par9) {
    if (!canBlockStay(world, x, y, z)) {
      world.setBlockToAir(x, y, z);
      world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(this, 1)));
    } else if ((TEBloomery) world.getTileEntity(x, y, z) != null) {
      TEBloomery te = (TEBloomery) world.getTileEntity(x, y, z);
      ItemStack is = entityplayer.getCurrentEquippedItem();

      if (is != null
          && (is.getItem() == TFCItems.FireStarter || is.getItem() == TFCItems.FlintSteel)) {
        if (te.canLight()) entityplayer.getCurrentEquippedItem().damageItem(1, entityplayer);
      } else {
        world.playAuxSFXAtEntity(entityplayer, 1003, x, y, z, 0);
        if (isOpen(world.getBlockMetadata(x, y, z)))
          world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) - 8, 3);
        else world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) + 8, 3);
      }
    }
    return true;
  }
예제 #2
0
  private boolean tryFlip(World world, int x, int y, int z) {
    TEBloomery te = (TEBloomery) world.getTileEntity(x, y, z);
    te.swapFlipped();
    if (!canBlockStay(world, x, y, z)) return false;

    return true;
  }