本文整理汇总了Java中net.minecraftforge.fluids.FluidTank.getFluidAmount方法的典型用法代码示例。如果您正苦于以下问题:Java FluidTank.getFluidAmount方法的具体用法?Java FluidTank.getFluidAmount怎么用?Java FluidTank.getFluidAmount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.fluids.FluidTank
的用法示例。
在下文中一共展示了FluidTank.getFluidAmount方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import net.minecraftforge.fluids.FluidTank; //导入方法依赖的package包/类
@Override
public void render(TileEntityKeroseneLamp te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
FluidTank tank = te.getTank();
if (tank.getFluidAmount() == 0) return;
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
GlStateManager.enableBlend();
GlStateManager.disableAlpha();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
AxisAlignedBB bounds = getRenderBounds(tank);
PneumaticCraftUtils.renderFluid(tank.getFluid().getFluid(), bounds);
GlStateManager.disableBlend();
GlStateManager.enableAlpha();
GlStateManager.popMatrix();
}
示例2: render
import net.minecraftforge.fluids.FluidTank; //导入方法依赖的package包/类
@Override
public void render(TileEntityLiquidHopper te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
FluidTank tank = te.getTank();
if (tank.getFluidAmount() == 0) return;
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
GlStateManager.enableBlend();
GlStateManager.disableAlpha();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
doRotate(te.getInputDirection());
AxisAlignedBB bounds = getRenderBounds(te.getInputDirection(), tank);
PneumaticCraftUtils.renderFluid(tank.getFluid().getFluid(), bounds);
GlStateManager.disableBlend();
GlStateManager.enableAlpha();
GlStateManager.popMatrix();
}
示例3: serializeTank
import net.minecraftforge.fluids.FluidTank; //导入方法依赖的package包/类
/**
* Serialize some tank data onto an ItemStack. Useful to preserve tile entity tank data when breaking
* the block.
*
* @param tank the fluid tank
* @param stack the itemstack to save to
* @param tagName name of the tag in the itemstack's NBT to store the tank data
*/
public static void serializeTank(FluidTank tank, ItemStack stack, String tagName) {
if (tank.getFluidAmount() > 0) {
if (!stack.hasTagCompound()) {
stack.setTagCompound(new NBTTagCompound());
}
NBTTagCompound tag = stack.getTagCompound();
if (!tag.hasKey(SAVED_TANKS, Constants.NBT.TAG_COMPOUND)) {
tag.setTag(SAVED_TANKS, new NBTTagCompound());
}
NBTTagCompound subTag = tag.getCompoundTag(SAVED_TANKS);
NBTTagCompound tankTag = new NBTTagCompound();
tank.writeToNBT(tankTag);
subTag.setTag(tagName, tankTag);
}
}
示例4: apply
import net.minecraftforge.fluids.FluidTank; //导入方法依赖的package包/类
/** Applies the recipe to the storage provided, determining whether or not the output should be produced. Optionally
* consumes the items.
*/
public boolean apply(FluidTank tank, IItemHandler inventory, boolean consume) {
if (consume && !apply(tank, inventory, false)) return false; //Always dry-run before destructive ops
if (tank.getFluid()==null) return false;
//Next line shouldn't happen but it pays to plan for the impossible
if (tank.getFluid().getFluid() != FluidRegistry.WATER) return false;
if (tank.getFluidAmount()<water) return false;
FluidStack fluidExtracted = tank.drainInternal(water, consume);
if (fluidExtracted.amount<water) return false;
int remaining = count;
for(int i=0; i<inventory.getSlots(); i++) {
ItemStack stack = inventory.getStackInSlot(i);
if (stack.isEmpty()) continue;
if (item.apply(stack)) {
ItemStack extracted = inventory.extractItem(i, remaining, !consume);
if (extracted.isEmpty()) continue;
remaining -= extracted.getCount();
}
}
return remaining<=0;
}
示例5: addDrops
import net.minecraftforge.fluids.FluidTank; //导入方法依赖的package包/类
@Override
public void addDrops(NonNullList<ItemStack> drops) {
super.addDrops(drops);
boolean shouldAddTag = false;
for (int i = 0; i < filters.getSlots(); i++) {
if (!filters.getStackInSlot(i).isEmpty()) { //Only set a tag when there are requests.
shouldAddTag = true;
break;
}
}
for (FluidTank fluidFilter : fluidFilters) {
if (fluidFilter.getFluidAmount() > 0) {
shouldAddTag = true;
break;
}
}
if (invisible) shouldAddTag = true;
if (shouldAddTag) {
ItemStack drop = drops.get(0);
NBTTagCompound tag = new NBTTagCompound();
writeToNBT(tag);
drop.setTagCompound(tag);
}
}
示例6: passesFilter
import net.minecraftforge.fluids.FluidTank; //导入方法依赖的package包/类
protected boolean passesFilter(Fluid fluid) {
boolean hasFilter = false;
for (FluidTank filter : fluidFilters) {
if (filter.getFluidAmount() > 0) {
if (filter.getFluid().getFluid() == fluid) return true;
hasFilter = true;
}
}
return !hasFilter;
}
示例7: saveTank
import net.minecraftforge.fluids.FluidTank; //导入方法依赖的package包/类
public static void saveTank(NBTTagCompound nbtRoot, FluidTank tank) {
if(tank.getFluidAmount() > 0) {
NBTTagCompound fluidRoot = new NBTTagCompound();
tank.getFluid().writeToNBT(fluidRoot);
nbtRoot.setTag(FluidHandlerItemStack.FLUID_NBT_KEY, fluidRoot);
} else {
nbtRoot.removeTag(FluidHandlerItemStack.FLUID_NBT_KEY);
}
}