本文整理汇总了Java中net.minecraftforge.fluids.FluidContainerRegistry.isEmptyContainer方法的典型用法代码示例。如果您正苦于以下问题:Java FluidContainerRegistry.isEmptyContainer方法的具体用法?Java FluidContainerRegistry.isEmptyContainer怎么用?Java FluidContainerRegistry.isEmptyContainer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraftforge.fluids.FluidContainerRegistry
的用法示例。
在下文中一共展示了FluidContainerRegistry.isEmptyContainer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isItemValidForSlot
import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
@Override
public boolean isItemValidForSlot(int slotID, ItemStack itemstack)
{
if(slotID == 1)
{
return false;
}
else if(slotID == 0)
{
return FluidContainerRegistry.isEmptyContainer(itemstack);
}
else if(slotID == 2)
{
return ChargeUtils.canBeDischarged(itemstack);
}
return true;
}
示例2: canExtractItem
import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
@Override
public boolean canExtractItem(int slotID, ItemStack itemstack, int side)
{
if(slotID == 3)
{
return ChargeUtils.canBeOutputted(itemstack, false);
}
else if(slotID == 0)
{
return FluidContainerRegistry.isEmptyContainer(itemstack);
}
else if(slotID == 1 || slotID == 2)
{
return itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).getGas(itemstack) != null &&
((IGasItem)itemstack.getItem()).getGas(itemstack).amount == ((IGasItem)itemstack.getItem()).getMaxGas(itemstack);
}
return false;
}
示例3: setInventorySlotContents
import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
@Override
public void setInventorySlotContents(int slot, ItemStack stack)
{
inventory[slot] = stack;
if (stack != null && stack.stackSize > getInventoryStackLimit())
{
stack.stackSize = getInventoryStackLimit();
}
if(FluidContainerRegistry.isFilledContainer(stack) && GeneralReference.isValidFuel(FluidContainerRegistry.getFluidForFilledItem(stack).getFluid()))
{
InventoryActions.transferContainerTank(this, fuelTank, 0);
}else
if(FluidContainerRegistry.isEmptyContainer(stack) && fuelTank.getFluid()!=null && FluidUtils.isContainerForFluid(stack, fuelTank.getFluid().getFluid()))
{
InventoryActions.transferContainerTank(this, fuelTank, 0);
}
dirtyTanks();
dirtyInventory();
}
示例4: onInventoryChanged
import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
public void onInventoryChanged()
{
for (int i = 0; i < inventory.length; i++)
{
if (i == 0)
{
ItemStack container = getStackInSlot(i);
if(FluidContainerRegistry.isFilledContainer(container) && FluidUtils.isContainerForFluid(container, FluidRegistry.WATER))
{
InventoryActions.transferContainerTank(this, waterTank, i);
}else
if(FluidContainerRegistry.isEmptyContainer(container) && waterTank.getFluid()!=null && FluidUtils.isContainerForFluid(container, FluidRegistry.WATER))
{
InventoryActions.transferContainerTank(this, waterTank, i);
}
}
}
markDirty();
}
示例5: isItemValidForSlot
import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
@Override
public boolean isItemValidForSlot(int i, ItemStack itemstack)
{
if (gridTE != null)
{
ICraftingPattern currentPattern = Util.getAssemblerPattern(itemstack);
if (currentPattern == null || currentPattern.getRequirements() == null)
return false;
if (FluidContainerRegistry.isEmptyContainer(currentPattern.getOutput()))
return false;
for (ItemStack entry : currentPattern.getRequirements())
{
if (entry != null && entry.getItem() instanceof IFluidContainerItem || FluidContainerRegistry.isFilledContainer(entry))
{
return doesRecipeExist((ICraftingPatternMAC) currentPattern);
}
}
}
return false;
}
示例6: isEmptyContainerFor
import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
/**
* Tests for any empty container which can accept the specified fluid
* Either Galacticraft canisters or Forge containers
*
* @param var4
* @param canisterType
* @return
*/
public static boolean isEmptyContainerFor(ItemStack var4, FluidStack targetFluid)
{
if (var4.getItem() instanceof ItemCanisterGeneric)
{
if (var4.getItemDamage() == ItemCanisterGeneric.EMPTY) return true;
if (var4.getItemDamage() == 1) return false;
return fluidsSame(((ItemCanisterGeneric)var4.getItem()).getFluid(var4), targetFluid);
}
if (FluidContainerRegistry.isEmptyContainer(var4)) return true;
return fluidsSame(FluidContainerRegistry.getFluidForFilledItem(var4), targetFluid);
}
示例7: isEmptyContainer
import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
/**
* Test for any completely empty container of either type
* Used, for example, in canExtractItem() logic
* @param var4 The ItemStack being tested
* @return True if the container is empty
*/
public static boolean isEmptyContainer(ItemStack var4)
{
if (var4.getItem() instanceof ItemCanisterGeneric)
return var4.getItemDamage() == ItemCanisterGeneric.EMPTY;
return FluidContainerRegistry.isEmptyContainer(var4);
}
示例8: emptyTankIntoContainer
import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
public static boolean emptyTankIntoContainer(IFluidHandler tank, EntityPlayer player, FluidStack tankLiquid)
{
ItemStack stack = player.getCurrentEquippedItem();
if(!FluidContainerRegistry.isEmptyContainer(stack))
return false;
ItemStack filled = FluidContainerRegistry.fillFluidContainer(tankLiquid, stack);
FluidStack liquid = FluidContainerRegistry.getFluidForFilledItem(filled);
if(liquid == null || filled == null)
return false;
tank.drain(ForgeDirection.UNKNOWN, liquid.amount, true);
if(!player.capabilities.isCreativeMode)
{
if(stack.stackSize == 1)
player.inventory.setInventorySlotContents(player.inventory.currentItem, filled);
else if(player.inventory.addItemStackToInventory(filled))
stack.stackSize--;
else
return false;
}
player.inventoryContainer.detectAndSendChanges();
return true;
}
示例9: harvestBlock
import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
@Override
public ItemStack[] harvestBlock(World world, int x, int y, int z, EntityPlayer player, IToggleController controller)
{
Block block = world.getBlock(x, y, z);
System.out.println(block.getClass().getSimpleName());
if (block instanceof IFluidBlock)
{
IToggleStorage storage = controller.getStorageHandler();
IFluidBlock fluidBlock = (IFluidBlock) block;
FluidStack containing = fluidBlock.drain(world, x, y, z, true);
ItemStack emptyContainer = null;
for (int s = 0; s < storage.getStorageSlots(); s++)
{
ItemStack inSlot = storage.getItemFromSlot(s);
if (FluidContainerRegistry.isEmptyContainer(inSlot))
{
emptyContainer = inSlot;
break;
}
}
if (emptyContainer == null) return null;
ItemStack filledContainer = FluidContainerRegistry.fillFluidContainer(containing, emptyContainer);
emptyContainer.stackSize--;
return new ItemStack[]{filledContainer};
} else if (block instanceof BlockStaticLiquid)
{
ItemStack emptyBucket = controller.getStorageHandler().getItemFromStorage(new ItemStack(Items.bucket));
if (emptyBucket != null)
{
emptyBucket.stackSize--;
ItemStack filledBucket = null;
if (block == Blocks.water) filledBucket = new ItemStack(Items.water_bucket);
else if (block == Blocks.lava) filledBucket = new ItemStack(Items.lava_bucket);
world.setBlockToAir(x, y, z);
return filledBucket != null ? new ItemStack[]{filledBucket} : null;
}
}
return null;
}
示例10: canExtractItem
import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
@Override
public boolean canExtractItem(int slotID, ItemStack itemstack, int side)
{
if(slotID == 1)
{
return ChargeUtils.canBeOutputted(itemstack, true);
}
else if(slotID == 0)
{
return FluidContainerRegistry.isEmptyContainer(itemstack);
}
return false;
}
示例11: removeLiquid
import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
public ItemStack removeLiquid(ItemStack is)
{
if(is == null || is.stackSize > 1)
return is;
if(FluidContainerRegistry.isEmptyContainer(is))
{
ItemStack out = FluidContainerRegistry.fillFluidContainer(cookingPotFluid, is);
if(out != null)
{
FluidStack fs = FluidContainerRegistry.getFluidForFilledItem(out);
cookingPotFluid.amount -= fs.amount;
is = null;
if(cookingPotFluid.amount <= 0)
{
cookingPotFluid = null;
}
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
recipeHandling();
return out;
}
}
else if(cookingPotFluid != null && is.getItem() instanceof IFluidContainerItem)
{
FluidStack isfs = ((IFluidContainerItem) is.getItem()).getFluid(is);
if(isfs == null || cookingPotFluid.isFluidEqual(isfs))
{
cookingPotFluid.amount -= ((IFluidContainerItem) is.getItem()).fill(is, cookingPotFluid, true);
if(cookingPotFluid.amount <= 0)
cookingPotFluid = null;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
recipeHandling();
}
}
return is;
}
示例12: isMachineItemValidForSlot
import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
@Override
protected boolean isMachineItemValidForSlot(int i, @Nullable ItemStack item) {
if (i == 0 && item != null) {
return FluidContainerRegistry.isEmptyContainer(item) || item.getItem() == Items.bucket;
}
return false;
}
示例13: interactFirst
import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
@Override
public boolean interactFirst(EntityPlayer player)
{
if(!player.worldObj.isRemote)
{
if(player.getCurrentEquippedItem() != null)
{
if(FluidContainerRegistry.isFilledContainer(player.getCurrentEquippedItem()))
{
this.tank.fill(FluidContainerRegistry.getFluidForFilledItem(player.getCurrentEquippedItem()), true);
if(!player.capabilities.isCreativeMode)
{
player.inventory.consumeInventoryItem(player.getCurrentEquippedItem().getItem());
player.inventory.addItemStackToInventory(new ItemStack(Items.bucket, 1));
}
}
if(FluidContainerRegistry.isEmptyContainer(player.getCurrentEquippedItem()))
{
if(this.tank.getFluidAmount() > 0 && this.tank.getFluid().getFluid()!= AdvancedUtilitiesBlocks.fluidSteam)
{
player.inventory.addItemStackToInventory(FluidContainerRegistry.fillFluidContainer(this.tank.drain(FluidContainerRegistry.BUCKET_VOLUME, true), player.getCurrentEquippedItem()));
if(!player.capabilities.isCreativeMode)
{
player.inventory.getCurrentItem().stackSize-=1;
if(player.inventory.getCurrentItem().stackSize <= 0)
{
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
}
}
}
}
if(tank.getFluidAmount() > 0)
player.addChatComponentMessage(new ChatComponentText("Fluid: "+tank.getFluid().getFluid().getName()+" Amount: "+tank.getFluidAmount()+" mB"));
else
player.addChatComponentMessage(new ChatComponentText("Empty"));
}
return true;
}
示例14: isEmptyContainer
import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
public static boolean isEmptyContainer(ItemStack stackInSlot) {
if (stackInSlot.getItem() instanceof IFluidContainerItem) {
FluidStack fluidStack = ((IFluidContainerItem) stackInSlot.getItem()).getFluid(stackInSlot);
if (fluidStack != null) {
return false;
}
else {
return true;
}
}
else {
return FluidContainerRegistry.isEmptyContainer(stackInSlot);
}
}
示例15: fillContainerFromHandler
import net.minecraftforge.fluids.FluidContainerRegistry; //导入方法依赖的package包/类
public static boolean fillContainerFromHandler(World world, IFluidHandler handler, EntityPlayer player, FluidStack tankFluid) {
ItemStack container = player.getCurrentEquippedItem();
if (FluidContainerRegistry.isEmptyContainer(container)) {
ItemStack returnStack = FluidContainerRegistry.fillFluidContainer(tankFluid, container);
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(returnStack);
if (fluid == null || returnStack == null) {
return false;
}
if (!player.capabilities.isCreativeMode) {
if (container.stackSize == 1) {
container = container.copy();
player.inventory.setInventorySlotContents(player.inventory.currentItem, returnStack);
} else if (!player.inventory.addItemStackToInventory(returnStack)) {
return false;
}
handler.drain(ForgeDirection.UNKNOWN, fluid.amount, true);
container.stackSize--;
if (container.stackSize <= 0) {
container = null;
}
} else {
handler.drain(ForgeDirection.UNKNOWN, fluid.amount, true);
}
return true;
}
return false;
}