本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}