net.minecraftforge.fluids.FluidUtil Java Examples
The following examples show how to use
net.minecraftforge.fluids.FluidUtil.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UpgradeCobbestone.java From BetterChests with GNU Lesser General Public License v3.0 | 6 votes |
public static Predicate<ItemStack> getFluidPredicate(Fluid fluid) { return new Predicate<ItemStack>() { @Override public boolean test(ItemStack itemStack) { IFluidHandlerItem handler = FluidUtil.getFluidHandler(itemStack); if (handler == null) { return false; } for (IFluidTankProperties properties : handler.getTankProperties()) { FluidStack stack = properties.getContents(); if (stack != null && stack.getFluid() == fluid) { return true; } } return false; } }; }
Example #2
Source File: RecipeSteroidSyringe.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
@Override public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World worldIn) { boolean foundSyringe = false; boolean foundMana = false; boolean foundNacre = false; boolean foundLava = false; boolean foundDevilDust = false; ItemStack mana = FluidUtil.getFilledBucket(new FluidStack(ModFluids.MANA.getActual(), 1)); ItemStack nacre = FluidUtil.getFilledBucket(new FluidStack(ModFluids.NACRE.getActual(), 1)); for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.getStackInSlot(i); if (stack.getItem() == ModItems.SYRINGE && stack.getItemDamage() == 0) foundSyringe = true; if (ItemStack.areItemStacksEqual(mana, stack)) foundMana = true; if (ItemStack.areItemStacksEqual(nacre, stack)) foundNacre = true; if (stack.getItem() == Items.LAVA_BUCKET) foundLava = true; if (stack.getItem() == ModItems.DEVIL_DUST) foundDevilDust = true; } return foundSyringe && foundMana && foundDevilDust && foundLava && foundNacre; }
Example #3
Source File: GTHelperFluid.java From GT-Classic with GNU Lesser General Public License v3.0 | 6 votes |
public static boolean doClickableFluidContainerEmptyThings(EntityPlayer player, EnumHand hand, World world, BlockPos pos, IC2Tank tank) { ItemStack playerStack = player.getHeldItem(hand); if (!playerStack.isEmpty()) { FluidActionResult result = FluidUtil.tryEmptyContainer(playerStack, tank, tank.getCapacity() - tank.getFluidAmount(), player, true); if (result.isSuccess()) { playerStack.shrink(1); ItemStack resultStack = result.getResult(); if (!resultStack.isEmpty()) { if (!player.inventory.addItemStackToInventory(resultStack)) { player.dropItem(resultStack, false); } } return true; } } return false; }
Example #4
Source File: GTHelperFluid.java From GT-Classic with GNU Lesser General Public License v3.0 | 6 votes |
public static boolean doClickableFluidContainerFillThings(EntityPlayer player, EnumHand hand, World world, BlockPos pos, IC2Tank tank) { ItemStack playerStack = player.getHeldItem(hand); if (!playerStack.isEmpty()) { FluidActionResult result = FluidUtil.tryFillContainer(playerStack, tank, tank.getCapacity(), player, true); if (result.isSuccess()) { playerStack.shrink(1); ItemStack resultStack = result.getResult(); if (!resultStack.isEmpty()) { if (!player.inventory.addItemStackToInventory(resultStack)) { player.dropItem(resultStack, false); } } return true; } } return false; }
Example #5
Source File: RecipeManaSyringe.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
@Override public boolean matches(@Nonnull InventoryCrafting inv, @Nonnull World worldIn) { boolean foundSyringe = false; boolean foundMana = false; ItemStack bucket = FluidUtil.getFilledBucket(new FluidStack(ModFluids.MANA.getActual(), 1)); for (int i = 0; i < inv.getSizeInventory(); i++) { ItemStack stack = inv.getStackInSlot(i); if (stack.getItem() == ModItems.SYRINGE && stack.getItemDamage() == 0) { foundSyringe = true; } else if (stack.getItem() == ModItems.ORB && ManaManager.isManaFull(stack)) { foundMana = true; } else if (ItemStack.areItemStacksEqual(bucket, stack)) foundMana = true; } return foundSyringe && foundMana; }
Example #6
Source File: TileCrucible.java From ExNihiloAdscensio with MIT License | 6 votes |
public boolean onBlockActivated(ItemStack stack, EntityPlayer player) { if (stack == null) return false; //Bucketing out the fluid. if (stack != null && stack.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, null)) { boolean result = FluidUtil.interactWithFluidHandler(stack, tank, player); if (result) { PacketHandler.sendNBTUpdate(this); } return true; } //Adding a meltable. ItemStack addStack = stack.copy(); addStack.stackSize = 1; ItemStack insertStack = itemHandler.insertItem(0, addStack, true); if (!ItemStack.areItemStacksEqual(addStack, insertStack)) { itemHandler.insertItem(0, addStack, false); stack.stackSize--; PacketHandler.sendNBTUpdate(this); return true; } return true; }
Example #7
Source File: GTTileTranslocatorFluid.java From GT-Classic with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void onBufferTick() { BlockPos importPos = this.pos.offset(this.getFacing().getOpposite()); BlockPos exportPos = this.pos.offset(this.getFacing()); if (!world.isBlockLoaded(importPos) || !world.isBlockLoaded(exportPos)) { return; } IFluidHandler start = FluidUtil.getFluidHandler(world, importPos, getFacing()); IFluidHandler end = FluidUtil.getFluidHandler(world, exportPos, getFacing().getOpposite()); boolean canExport = start != null && end != null; if (canExport && filter == null) { FluidUtil.tryFluidTransfer(end, start, 500, true); } if (canExport && filter != null) { FluidStack fake = FluidUtil.tryFluidTransfer(end, start, 500, false); if (fake != null && (fake.getFluid().getName().equals(filter.getFluid().getName()))) { FluidUtil.tryFluidTransfer(end, start, 500, true); } } }
Example #8
Source File: RecipeShapedFluid.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
@Override public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) { NonNullList<ItemStack> remains = ForgeHooks.defaultRecipeGetRemainingItems(inv); for (int i = 0; i < height * width; i++) { ItemStack stack = inv.getStackInSlot(i); NonNullList<Ingredient> matchedIngredients = this.input; if (matchedIngredients.get(i) instanceof IngredientFluidStack) { if (!stack.isEmpty()) { ItemStack copy = stack.copy(); copy.setCount(1); remains.set(i, copy); } IFluidHandlerItem handler = FluidUtil.getFluidHandler(remains.get(i)); if (handler != null) { FluidStack fluid = ((IngredientFluidStack) matchedIngredients.get(i)).getFluid(); handler.drain(fluid.amount, true); remains.set(i, handler.getContainer()); } } } return remains; }
Example #9
Source File: MetaTileEntityPump.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
private void tryPumpFirstBlock() { BlockPos fluidBlockPos = fluidSourceBlocks.poll(); if (fluidBlockPos == null) return; IBlockState blockHere = getWorld().getBlockState(fluidBlockPos); if (blockHere.getBlock() instanceof BlockLiquid || blockHere.getBlock() instanceof IFluidBlock) { IFluidHandler fluidHandler = FluidUtil.getFluidHandler(getWorld(), fluidBlockPos, null); FluidStack drainStack = fluidHandler.drain(Integer.MAX_VALUE, false); if (drainStack != null && exportFluids.fill(drainStack, false) == drainStack.amount) { exportFluids.fill(drainStack, true); fluidHandler.drain(drainStack.amount, true); this.fluidSourceBlocks.remove(fluidBlockPos); energyContainer.changeEnergy(-GTValues.V[getTier()]); } } }
Example #10
Source File: GTItemFluidTube.java From GT-Classic with GNU Lesser General Public License v3.0 | 6 votes |
public ActionResult<ItemStack> tryPickUpFluid(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand, ItemStack itemstack, FluidStack fluidStack) { RayTraceResult mop = this.rayTrace(world, player, true); ActionResult<ItemStack> ret = ForgeEventFactory.onBucketUse(player, world, itemstack, mop); if (ret != null) return ret; if (mop == null) { return ActionResult.newResult(EnumActionResult.PASS, itemstack); } BlockPos clickPos = mop.getBlockPos(); if (world.isBlockModifiable(player, clickPos)) { FluidActionResult result = FluidUtil.tryPickUpFluid(itemstack, player, world, clickPos, mop.sideHit); if (result.isSuccess()) { ItemHandlerHelper.giveItemToPlayer(player, result.getResult()); itemstack.shrink(1); return ActionResult.newResult(EnumActionResult.SUCCESS, itemstack); } } return ActionResult.newResult(EnumActionResult.FAIL, itemstack); }
Example #11
Source File: BlockBTank.java From BetterChests with GNU Lesser General Public License v3.0 | 6 votes |
@Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack original = player.getHeldItem(hand); if (!original.isEmpty()) { ItemStack stack = original.copy(); stack.setCount(1); TileEntity tank = getTileEntity(world, pos); if (tank instanceof TileEntityBTank) { IFluidHandler handler = ((TileEntityBTank) tank).getFluidHandler(); FluidActionResult result = FluidUtil.tryEmptyContainer(stack, handler, Fluid.BUCKET_VOLUME, player, true); if (!result.success) { result = FluidUtil.tryFillContainer(stack, handler, Fluid.BUCKET_VOLUME, player, true); } if (result.success) { original.setCount(original.getCount() - 1); stack = InvUtil.putStackInInventory(result.result, player.inventory, true, false, false, null); if (!stack.isEmpty()) { WorldUtil.dropItemsRandom(world, stack, player.getPosition()); } return true; } } } return super.onBlockActivated(world, pos, state, player, hand, facing, hitX, hitY, hitZ); }
Example #12
Source File: MetaTileEntity.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
public boolean fillInternalTankFromFluidContainer(IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, int inputSlot, int outputSlot) { ItemStack inputContainerStack = importItems.extractItem(inputSlot, 1, true); FluidActionResult result = FluidUtil.tryEmptyContainer(inputContainerStack, importFluids, Integer.MAX_VALUE, null, false); if (result.isSuccess()) { ItemStack remainingItem = result.getResult(); if (ItemStack.areItemStacksEqual(inputContainerStack, remainingItem)) return false; //do not fill if item stacks match if (!remainingItem.isEmpty() && !exportItems.insertItem(outputSlot, remainingItem, true).isEmpty()) return false; //do not fill if can't put remaining item FluidUtil.tryEmptyContainer(inputContainerStack, importFluids, Integer.MAX_VALUE, null, true); importItems.extractItem(inputSlot, 1, false); exportItems.insertItem(outputSlot, remainingItem, false); return true; } return false; }
Example #13
Source File: BlockMixin.java From customstuff4 with GNU General Public License v3.0 | 6 votes |
private boolean interactWithFluidItem(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing) { if (getContent().canInteractWithFluidItem.get(getSubtype(state)).orElse(true)) { TileEntity tile = worldIn.getTileEntity(pos); if (tile != null && tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, facing)) { if (worldIn.isRemote) { return true; } if (FluidUtil.interactWithFluidHandler(playerIn, hand, worldIn, pos, facing)) { playerIn.inventoryContainer.detectAndSendChanges(); return true; } } } return false; }
Example #14
Source File: BlockBarrel.java From Sakura_mod with MIT License | 6 votes |
@Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if (world.isRemote) { return true; } ItemStack stack = player.getHeldItem(hand); TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityBarrel) { IFluidHandlerItem handler = FluidUtil.getFluidHandler(ItemHandlerHelper.copyStackWithSize(stack, 1)); if (handler != null) { FluidUtil.interactWithFluidHandler(player, hand, tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side)); return true; } player.openGui(SakuraMain.instance, SakuraGuiHandler.ID_BARREL, world, pos.getX(), pos.getY(), pos.getZ()); return true; } return true; }
Example #15
Source File: BlockBarrelDistillation.java From Sakura_mod with MIT License | 6 votes |
@Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if (world.isRemote) { return true; } ItemStack stack = player.getHeldItem(hand); TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityDistillation) { IFluidHandlerItem handler = FluidUtil.getFluidHandler(ItemHandlerHelper.copyStackWithSize(stack, 1)); if (handler != null) { FluidUtil.interactWithFluidHandler(player, hand, tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side)); return true; } player.openGui(SakuraMain.instance, SakuraGuiHandler.ID_DISTILLATION, world, pos.getX(), pos.getY(), pos.getZ()); return true; } return true; }
Example #16
Source File: BlockTFStorage.java From TofuCraftReload with MIT License | 6 votes |
@Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if (worldIn.isRemote) { return true; } else { ItemStack stack = playerIn.getHeldItem(hand); TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityTFStorage) { IFluidHandlerItem handler = FluidUtil.getFluidHandler(ItemHandlerHelper.copyStackWithSize(stack, 1)); if (handler != null) { FluidUtil.interactWithFluidHandler(playerIn, hand, tileentity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side)); return true; } else { playerIn.openGui(TofuMain.instance, TofuGuiHandler.ID_STORAGE_MACHINE_GUI, worldIn, pos.getX(), pos.getY(), pos.getZ()); } } return true; } }
Example #17
Source File: BlockTFBattery.java From TofuCraftReload with MIT License | 6 votes |
@Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (!worldIn.isRemote) { ItemStack stack = playerIn.getHeldItem(hand); TileEntity tileentity = worldIn.getTileEntity(pos); if (tileentity instanceof TileEntityTofuBattery) { IFluidHandlerItem handler = FluidUtil.getFluidHandler(ItemHandlerHelper.copyStackWithSize(stack, 1)); if (handler != null) { FluidUtil.interactWithFluidHandler(playerIn, hand, tileentity.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, facing)); return true; } else { playerIn.openGui(TofuMain.instance, TofuGuiHandler.ID_BATTERY_GUI, worldIn, pos.getX(), pos.getY(), pos.getZ()); } } } return true; }
Example #18
Source File: GTContainerTranslocatorFluid.java From GT-Classic with GNU Lesser General Public License v3.0 | 6 votes |
@Nullable @Override public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) { if (slotId == 0) { ItemStack stack = player.inventory.getItemStack(); if (stack.isEmpty()) { this.block.setStackInSlot(0, ItemStack.EMPTY); this.block.filter = null; return ItemStack.EMPTY; } if (FluidUtil.getFluidContained(stack) != null) { FluidStack fluidStack = FluidUtil.getFluidContained(stack); FluidStack newStack = new FluidStack(fluidStack.getFluid(), 1000); this.block.setStackInSlot(0, ItemDisplayIcon.createWithFluidStack(newStack)); this.block.filter = newStack; } return ItemStack.EMPTY; } return super.slotClick(slotId, dragType, clickTypeIn, player); }
Example #19
Source File: BlockWaterTank.java From AgriCraft with MIT License | 5 votes |
@Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { // Attempt to interact with fluid stuff. FluidUtil.interactWithFluidHandler(player, hand, world, pos, side); // Figure out if this is a fluid thing or not. final ItemStack stack = player.getHeldItem(hand); final FluidStack fluid = FluidUtil.getFluidContained(stack); // Return depending if holding a fluid stack to prevent accidental water placement. return (fluid != null); }
Example #20
Source File: BlockTank.java From YouTubeModdingTutorial with MIT License | 5 votes |
@Override public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { if (!world.isRemote) { FluidUtil.interactWithFluidHandler(player, hand, world, pos, side); } return true; }
Example #21
Source File: IngredientFluidStack.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@Override public ItemStack[] getMatchingStacks() { if (cachedStacks == null) { cachedStacks = new ItemStack[]{FluidUtil.getFilledBucket(fluid)}; } return this.cachedStacks; }
Example #22
Source File: IngredientFluidStack.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean apply(@Nullable ItemStack stack) { if (stack == null) { return false; } else { FluidStack fluidStack = FluidUtil.getFluidContained(stack); return fluidStack == null && this.fluid == null || fluidStack != null && fluidStack.containsFluid(fluid); } }
Example #23
Source File: TileEnderTank.java From EnderStorage with MIT License | 5 votes |
@Override public boolean activate(PlayerEntity player, int subHit, Hand hand) { if (subHit == 4) { pressure_state.invert(); return true; } return FluidUtil.interactWithFluidHandler(player, hand, getStorage()); }
Example #24
Source File: BlockMisoBarrel.java From TofuCraftReload with MIT License | 5 votes |
@Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (playerIn.getHeldItem(hand).getItem() == Items.BUCKET && hasSoy(state)) { if (playerIn.getHeldItem(hand).getCount() > 1) { playerIn.getHeldItem(hand).shrink(1); playerIn.inventory.addItemStackToInventory(FluidUtil.getFilledBucket(new FluidStack(BlockLoader.SOYSAUCE_FLUID, 1000))); } else { playerIn.setHeldItem(hand, FluidUtil.getFilledBucket(new FluidStack(BlockLoader.SOYSAUCE_FLUID, 1000))); } worldIn.setBlockState(pos, this.withFerm(8), 2); } return super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ); }
Example #25
Source File: EntityFluidCow.java From Moo-Fluids with GNU General Public License v3.0 | 5 votes |
private boolean attemptToGetFluidFromCow(final ItemStack currentItemStack, final EntityPlayer entityPlayer) { boolean canGetFluid = false; if (!currentItemStack.isEmpty() && entityFluid != null) { ItemStack filledItemStack = ItemHandlerHelper.copyStackWithSize(currentItemStack, 1); IFluidHandlerItem fluidHandlerItem = FluidUtil.getFluidHandler(filledItemStack); if (fluidHandlerItem != null) { if (fluidHandlerItem.fill( new FluidStack(entityFluid, Fluid.BUCKET_VOLUME), true) == Fluid.BUCKET_VOLUME) { filledItemStack = fluidHandlerItem.getContainer(); currentItemStack.shrink(1); if (currentItemStack.isEmpty()) { entityPlayer.inventory.setInventorySlotContents( entityPlayer.inventory.currentItem, filledItemStack.copy()); } else { ItemHandlerHelper.giveItemToPlayer(entityPlayer, filledItemStack.copy()); } canGetFluid = true; } } } return canGetFluid; }
Example #26
Source File: EntityFluidCow.java From Moo-Fluids with GNU General Public License v3.0 | 5 votes |
private boolean attemptToHealCowWithFluidContainer(final ItemStack currentItemStack, final EntityPlayer entityPlayer) { boolean cowHealed = false; if (!currentItemStack.isEmpty() && entityFluid != null) { IFluidHandlerItem fluidHandlerItem = FluidUtil.getFluidHandler(currentItemStack); if (fluidHandlerItem != null) { FluidStack containedFluid = fluidHandlerItem .drain(new FluidStack(entityFluid, Fluid.BUCKET_VOLUME), false); ItemStack emptyItemStack; if (containedFluid != null && containedFluid.getFluid().getName().equalsIgnoreCase(entityFluid.getName())) { fluidHandlerItem.drain(new FluidStack(entityFluid, Fluid.BUCKET_VOLUME), false); emptyItemStack = fluidHandlerItem.getContainer(); currentItemStack.shrink(1); if (currentItemStack.isEmpty()) { entityPlayer.inventory.setInventorySlotContents( entityPlayer.inventory.currentItem, emptyItemStack.copy()); } else { ItemHandlerHelper.giveItemToPlayer(entityPlayer, emptyItemStack.copy()); } heal(4F); cowHealed = true; } } } return cowHealed; }
Example #27
Source File: ContainerBucketFillHandler.java From OpenModsLib with MIT License | 5 votes |
public ContainerBucketFillHandler addFilledBucket(ItemStack filledBucket) { FluidStack containedFluid = FluidUtil.getFluidContained(filledBucket); if (containedFluid != null) { buckets.add(Pair.of(containedFluid.copy(), filledBucket.copy())); } else { Log.warn("Item %s is not a filled bucket", filledBucket); } return this; }
Example #28
Source File: ContainerBucketFillHandler.java From OpenModsLib with MIT License | 5 votes |
@SubscribeEvent public void onBucketFill(FillBucketEvent evt) { if (evt.getResult() != Result.DEFAULT) return; if (evt.getEmptyBucket().getItem() != EMPTY_BUCKET) return; final RayTraceResult target = evt.getTarget(); if (target == null || target.typeOfHit != RayTraceResult.Type.BLOCK) return; final TileEntity te = evt.getWorld().getTileEntity(target.getBlockPos()); if (te == null) return; if (!canFill(evt.getWorld(), target.getBlockPos(), te)) { return; } if (te.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, target.sideHit)) { final IFluidHandler source = te.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, target.sideHit); final FluidStack fluidInContainer = source.drain(Fluid.BUCKET_VOLUME, false); if (fluidInContainer != null) { final ItemStack filledBucket = getFilledBucket(fluidInContainer); if (!filledBucket.isEmpty()) { final IFluidHandlerItem container = FluidUtil.getFluidHandler(filledBucket); if (container != null) { final FluidStack fluidInBucket = container.drain(Integer.MAX_VALUE, false); if (fluidInBucket != null && fluidInBucket.isFluidStackIdentical(source.drain(fluidInBucket, false))) { source.drain(fluidInBucket, true); evt.setFilledBucket(filledBucket.copy()); evt.setResult(Result.ALLOW); } } } } } }
Example #29
Source File: ContainerBucketFillHandler.java From OpenModsLib with MIT License | 5 votes |
private ItemStack getFilledBucket(FluidStack fluid) { for (Pair<FluidStack, ItemStack> e : buckets) { if (e.getLeft().isFluidEqual(fluid)) return e.getRight(); } return FluidUtil.getFilledBucket(fluid); }
Example #30
Source File: GTIFilters.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean matches(ItemStack stack) { if (FluidUtil.getFluidHandler(stack) == null) { return false; } if (this.tile.getTankInstance().getFluid() == null || this.tile.getTankInstance().getFluidAmount() == 0) { return true; } return this.tile.getTankInstance().getFluid().getFluid() == FluidUtil.getFluidContained(stack).getFluid(); }