public ItemStack dispenseStack(IBlockSource blockSource, ItemStack itemstack) {
    EnumFacing facing = EnumFacing.func_82600_a(blockSource.func_82620_h());
    World world = blockSource.getWorld();
    int targetX = blockSource.getXInt() + facing.func_82601_c();
    int targetY = blockSource.getYInt();
    int targetZ = blockSource.getZInt() + facing.func_82599_e();

    TileEntity te = world.getBlockTileEntity(targetX, targetY, targetZ);
    if (te != null && te instanceof ITankContainer) {
      return fillOrEmptyContainer((ITankContainer) te, itemstack, facing);
    }
    if (world.isAirBlock(targetX, targetY, targetZ)) {
      TileEntity tileabove = world.getBlockTileEntity(targetX, targetY + 1, targetZ);
      TileEntity tilebelow = world.getBlockTileEntity(targetX, targetY - 1, targetZ);
      if (tileabove != null && LiquidContainerRegistry.isEmptyContainer(itemstack)) {
        return fillContainer((ITankContainer) tileabove, itemstack, EnumFacing.UP);
      }
      if (tilebelow != null && LiquidContainerRegistry.isFilledContainer(itemstack)) {
        return emptyContainer((ITankContainer) tilebelow, itemstack, EnumFacing.DOWN);
      }
    }
    System.out.println("Not matched");

    return null;
  }
 protected void spawnDispenseParticles(IBlockSource blockSource) {
   EnumFacing facing = EnumFacing.func_82600_a(blockSource.func_82620_h());
   blockSource
       .getWorld()
       .playAuxSFX(
           2000,
           blockSource.getXInt(),
           blockSource.getYInt(),
           blockSource.getZInt(),
           facing.func_82601_c() + 1 + (facing.func_82599_e() + 1) * 3);
 }
示例#3
0
 public static EnumFacing func_100009_j_(int p_100009_0_) {
   return EnumFacing.func_82600_a(p_100009_0_ & 7);
 }