當前位置: 首頁>>代碼示例>>Java>>正文


Java FluidTank.fill方法代碼示例

本文整理匯總了Java中net.minecraftforge.fluids.FluidTank.fill方法的典型用法代碼示例。如果您正苦於以下問題:Java FluidTank.fill方法的具體用法?Java FluidTank.fill怎麽用?Java FluidTank.fill使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraftforge.fluids.FluidTank的用法示例。


在下文中一共展示了FluidTank.fill方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fillWithGCFuel

import net.minecraftforge.fluids.FluidTank; //導入方法依賴的package包/類
/**
 *  Fill Galacticraft entities (e.g. rockets, buggies) with Galacticraft fuel.
 *  For legacy reasons, accepts either "fuel" or "fuelgc".
 *  Auto-converts either one to the same type of fuel as is already contained.
 *    
 * @param tank    The tank
 * @param liquid   A FluidStack being the fuel offered
 * @param doFill   True if this is not a simulation / tank capacity test
 * @return         The amount filled
 */
public static int fillWithGCFuel(FluidTank tank, FluidStack liquid, boolean doFill)
{
	if (liquid != null && testFuel(FluidRegistry.getFluidName(liquid)))
	{
		final FluidStack liquidInTank = tank.getFluid();
		
		//If the tank is empty, fill it with the current type of GC fuel
		if (liquidInTank == null)
		{
			return tank.fill(new FluidStack(GalacticraftCore.fluidFuel, liquid.amount), doFill);
		}
		
		//If the tank already contains something, fill it with more of the same 
		if (liquidInTank.amount + liquid.amount <= tank.getCapacity())
		{
			return tank.fill(new FluidStack(liquidInTank, liquid.amount), doFill);
		}
	}
	
	return 0;
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:32,代碼來源:FluidUtil.java

示例2: fill

import net.minecraftforge.fluids.FluidTank; //導入方法依賴的package包/類
@Override
public int fill(FluidStack resource, boolean doFill) {
  if (ItemStackTools.getStackSize(container) != 1) {
    return 0;
  }
  FluidTank tank = loadTank(container);
  if(tank == null)return 0;
  
  boolean infi = container.getMetadata() == TankType.CREATIVE.getMeta();
  if(infi){
	  FluidStack resourceCreative = resource.copy();
	  resourceCreative.amount = tank.getCapacity();
	  tank.fill(resourceCreative, doFill);
   saveTank(container, tank);
   return 1;
  }
  
  int ret = tank.fill(resource, doFill);
  saveTank(container, tank);
  return ret;
}
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:22,代碼來源:ItemBlockTank.java

示例3: fill

import net.minecraftforge.fluids.FluidTank; //導入方法依賴的package包/類
public int fill(final ForgeDirection from, final FluidStack resource, final boolean doFill) {
    int c = 0;
    for (final FluidTank tank : this.getTanks()) {
        c += tank.fill(resource, doFill);
    }
    return c;
}
 
開發者ID:sameer,項目名稱:ExtraUtilities,代碼行數:8,代碼來源:TileEntityGenerator.java

示例4: WidgetFluidStack

import net.minecraftforge.fluids.FluidTank; //導入方法依賴的package包/類
public WidgetFluidStack(int id, int x, int y, FluidStack stack) {
    super(id, x, y);
    tank = new FluidTank(stack.amount);
    tank.fill(stack, true);
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:6,代碼來源:WidgetFluidStack.java

示例5: WidgetFluidStack

import net.minecraftforge.fluids.FluidTank; //導入方法依賴的package包/類
public WidgetFluidStack(int id, int x, int y, FluidStack stack){
    super(id, x, y);
    tank = new FluidTank(stack.amount);
    tank.fill(stack, true);
}
 
開發者ID:MineMaarten,項目名稱:Signals,代碼行數:6,代碼來源:WidgetFluidStack.java


注:本文中的net.minecraftforge.fluids.FluidTank.fill方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。