Package net.minecraftforge.liquids

Examples of net.minecraftforge.liquids.LiquidStack


  {
    if(!Loader.isModLoaded("Forestry"))
    {
      return;
    }
    LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("milk", new LiquidStack(
        MineFactoryReloadedCore.milkLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(Item.bucketMilk), new ItemStack(Item.bucketEmpty)));
    LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("sludge", new LiquidStack(
        MineFactoryReloadedCore.sludgeLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.sludgeBucketItem),
        new ItemStack(Item.bucketEmpty)));
    LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("sewage", new LiquidStack(
        MineFactoryReloadedCore.sewageLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.sewageBucketItem),
        new ItemStack(Item.bucketEmpty)));
    LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("mobEssence", new LiquidStack(
        MineFactoryReloadedCore.essenceLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.mobEssenceBucketItem),
        new ItemStack(Item.bucketEmpty)));
    LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("biofuel", new LiquidStack(
        MineFactoryReloadedCore.biofuelLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.bioFuelBucketItem),
        new ItemStack(Item.bucketEmpty)));
    LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("meat", new LiquidStack(
        MineFactoryReloadedCore.meatLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.meatBucketItem),
        new ItemStack(Item.bucketEmpty)));
    LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("pinkslime", new LiquidStack(
        MineFactoryReloadedCore.pinkSlimeLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.pinkSlimeBucketItem),
        new ItemStack(Item.bucketEmpty)));
    LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("chocolatemilk", new LiquidStack(
        MineFactoryReloadedCore.chocolateMilkLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(
        MineFactoryReloadedCore.chocolateMilkBucketItem), new ItemStack(Item.bucketEmpty)));
    LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("mushroomsoup", new LiquidStack(
        MineFactoryReloadedCore.mushroomSoupLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(
        MineFactoryReloadedCore.mushroomSoupBucketItem), new ItemStack(Item.bucketEmpty)));
   
    LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("mushroomsoup", new LiquidStack(
        MineFactoryReloadedCore.mushroomSoupLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(Item.bowlSoup),
        new ItemStack(Item.bowlEmpty)));
  }
View Full Code Here


  {
    if(!Loader.isModLoaded("Forestry"))
    {
      return;
    }
    LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("milk", new LiquidStack(
        MineFactoryReloadedCore.milkLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(Item.bucketMilk), new ItemStack(Item.bucketEmpty)));
    LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("sludge", new LiquidStack(
        MineFactoryReloadedCore.sludgeLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.sludgeBucketItem),
        new ItemStack(Item.bucketEmpty)));
    LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("sewage", new LiquidStack(
        MineFactoryReloadedCore.sewageLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.sewageBucketItem),
        new ItemStack(Item.bucketEmpty)));
    LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("mobEssence", new LiquidStack(
        MineFactoryReloadedCore.essenceLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.mobEssenceBucketItem),
        new ItemStack(Item.bucketEmpty)));
    LiquidContainerRegistry.registerLiquid(new LiquidContainerData(LiquidDictionary.getOrCreateLiquid("biofuel", new LiquidStack(
        MineFactoryReloadedCore.biofuelLiquid, LiquidContainerRegistry.BUCKET_VOLUME)), new ItemStack(MineFactoryReloadedCore.bioFuelBucketItem),
        new ItemStack(Item.bucketEmpty)));
   
    MineFactoryReloadedCore.proxy.onPostTextureStitch(null);
    ForestryUtils.setTreeRoot();
View Full Code Here

        {
          for(ItemStack s : drops)
          {
            if(LiquidContainerRegistry.isLiquid(s))
            {
              _tank.fill(new LiquidStack(s.itemID, LiquidContainerRegistry.BUCKET_VOLUME, s.getItemDamage()), true);
              didDrop = true;
              continue;
            }
           
            doDrop(s);
View Full Code Here

    {
      if(_inventory[i] != null)
      {
        if(LiquidContainerRegistry.isFilledContainer(_inventory[i]))
        {
          LiquidStack l = LiquidContainerRegistry.getLiquidForFilledItem(_inventory[i]);
          for(ItemResourceTracker t : requiredItems)
          {
            if(t.id == l.itemID && t.meta == l.itemMeta)
            {
              t.required += 1000;
              continue inv;
            }
          }
          requiredItems.add(new ItemResourceTracker(l.itemID, l.itemMeta, 1000));
        }
        else
        {
          for(ItemResourceTracker t : requiredItems)
          {
            if(t.id == _inventory[i].itemID && t.meta == _inventory[i].getItemDamage())
            {
              t.required++;
              continue inv;
            }
          }
          requiredItems.add(new ItemResourceTracker(_inventory[i].itemID, _inventory[i].getItemDamage(), 1));
        }
      }
    }
   
    for(int i = 11; i < 29; i++)
    {
      if(_inventory[i] != null)
      {
        for(ItemResourceTracker t : requiredItems)
        {
          if(t.id == _inventory[i].itemID && (t.meta == _inventory[i].getItemDamage() || _inventory[i].getItem().isDamageable()))
          {
            if(!_inventory[i].getItem().hasContainerItem())
            {
              t.found += _inventory[i].stackSize;
            }
            else
            {
              t.found += 1;
            }
            break;
          }
        }
      }
    }
    for(int i = 0; i < _tanks.length; i++)
    {
      LiquidStack l = _tanks[i].getLiquid();
      if(l == null || l.amount == 0)
      {
        continue;
      }
      for(ItemResourceTracker t : requiredItems)
      {
        if(t.id == l.itemID && t.meta == l.itemMeta)
        {
          t.found += l.amount;
          break;
        }
      }
    }
   
    for(ItemResourceTracker t : requiredItems)
    {
      if(t.found < t.required)
      {
        _resourcesChangedSinceLastFailedCraft = false;
        return;
      }
    }
   
    for(int i = 11; i < 29; i++)
    {
      if(_inventory[i] != null)
      {
        for(ItemResourceTracker t : requiredItems)
        {
          if(t.id == _inventory[i].itemID && (t.meta == _inventory[i].getItemDamage() || _inventory[i].getItem().isDamageable()))
          {
            int use;
            if(_inventory[i].getItem().hasContainerItem())
            {
              use = 1;
              ItemStack container = _inventory[i].getItem().getContainerItemStack(_inventory[i]);
              if(container.isItemStackDamageable() && container.getItemDamage() > container.getMaxDamage())
              {
                _inventory[i] = null;
              }
              else
              {
                _inventory[i] = container;
              }
            }
            else
            {
              use = Math.min(t.required, _inventory[i].stackSize);
              _inventory[i].stackSize -= use;
            }
            t.required -= use;
           
            if(_inventory[i] != null && _inventory[i].stackSize == 0)
            {
              _inventory[i] = null;
            }
           
            if(t.required == 0)
            {
              requiredItems.remove(t);
            }
            break;
          }
        }
      }
    }
    for(int i = 0; i < _tanks.length; i++)
    {
      LiquidStack l = _tanks[i].getLiquid();
      if(l == null || l.amount == 0)
      {
        continue;
      }
      for(ItemResourceTracker t : requiredItems)
View Full Code Here

    {
      NBTTagCompound nbttagcompound1 = (NBTTagCompound)nbttaglist.tagAt(i);
      int j = nbttagcompound1.getByte("Tank") & 0xff;
      if(j >= 0 && j < _tanks.length)
      {
        LiquidStack l = LiquidStack.loadLiquidStackFromNBT(nbttagcompound1);
        if(l != null && l.asItemStack().getItem() != null && LiquidContainerRegistry.isLiquid(l.asItemStack()))
        {
          _tanks[j].setLiquid(l);
        }
      }
    }
View Full Code Here

      if(_tanks[i].getLiquid() != null)
      {
        NBTTagCompound nbttagcompound1 = new NBTTagCompound();
        nbttagcompound1.setByte("Tank", (byte)i);
       
        LiquidStack l = _tanks[i].getLiquid();
        l.writeToNBT(nbttagcompound1);
        tanks.appendTag(nbttagcompound1);
      }
    }
   
    nbttagcompound.setTag("Tanks", tanks);
View Full Code Here

      {
        TileEntity te = BlockPosition.getAdjacentTileEntity(this, _outputDirections[i]);
        int amountForThisRoute = startingAmount * routes[i] / totalWeight(routes);
        if(te instanceof ITankContainer && amountForThisRoute > 0)
        {
          amountRemaining -= ((ITankContainer)te).fill(_outputDirections[i].getOpposite()new LiquidStack(resource.itemID, amountForThisRoute, resource.itemMeta), doFill);
          if(amountRemaining <= 0)
          {
            break;
          }
        }
      }
    }
   
    if(0 < amountRemaining && amountRemaining < totalWeight(routes))
    {
      int outdir = weightedRandomSide(routes);
      TileEntity te = BlockPosition.getAdjacentTileEntity(this, _outputDirections[outdir]);
      if(te instanceof ITankContainer)
      {
        amountRemaining -= ((ITankContainer)te).fill(_outputDirections[outdir].getOpposite()new LiquidStack(resource.itemID, amountRemaining, resource.itemMeta), doFill);
      }
    }
   
    return amountRemaining;
  }
View Full Code Here

    ILiquidTank tank = getTank();
   
    int tankAmount = nbttagcompound.getInteger("tankAmount");
    if (tank != null && nbttagcompound.hasKey("tankFluidName"))
    {
      LiquidStack fluid = LiquidDictionary.getLiquid(nbttagcompound.getString("tankFluidName"), tankAmount);
      if (fluid != null)
      {
        if(fluid.amount > tank.getCapacity())
        {
          fluid.amount = tank.getCapacity();
        }
       
        ((LiquidTank)tank).setLiquid(fluid);
       
        foundLiquid = true;
      }
    }
    if (!foundLiquid)
    {
      int tankItemId = nbttagcompound.getInteger("tankItemId");
      int tankItemMeta = nbttagcompound.getInteger("tankItemMeta");
     
      if(tank != null && Item.itemsList[tankItemId] != null && LiquidContainerRegistry.isLiquid(new ItemStack(tankItemId, 1, tankItemMeta)))
      {
        ((LiquidTank)tank).setLiquid(new LiquidStack(tankItemId, tankAmount, tankItemMeta));
       
        if(tank.getLiquid() != null && tank.getLiquid().amount > tank.getCapacity())
        {
          tank.getLiquid().amount = tank.getCapacity();
        }
View Full Code Here

        nbttaglist.appendTag(nbttagcompound1);
      }
    }
    if(getTank() != null && getTank().getLiquid() != null)
    {
      LiquidStack fluid = getTank().getLiquid();
      nbttagcompound.setInteger("tankAmount", fluid.amount);
      String name = LiquidDictionary.findLiquidName(fluid);
      if (name != null)
      {
        nbttagcompound.setString("tankFluidName", name);
View Full Code Here

   * @return  True if liquid was transferred to the tank.
   */
  public static boolean manuallyFillTank(ITankContainerBucketable itcb, EntityPlayer entityplayer)
  {
    ItemStack ci = entityplayer.inventory.getCurrentItem();
    LiquidStack liquid = LiquidContainerRegistry.getLiquidForFilledItem(ci);
    if(liquid != null)
    {
      if(itcb.fill(ForgeDirection.UNKNOWN, liquid, false) == liquid.amount)
      {
        itcb.fill(ForgeDirection.UNKNOWN, liquid, true);
View Full Code Here

TOP

Related Classes of net.minecraftforge.liquids.LiquidStack

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.