Java Code Examples for net.minecraftforge.fluids.FluidUtil#getFluidContained()
The following examples show how to use
net.minecraftforge.fluids.FluidUtil#getFluidContained() .
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: 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 2
Source File: GTHelperFluid.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
public static String getFluidName(ItemStack stack) { FluidStack fluid = FluidUtil.getFluidContained(stack); if (fluid != null) { return fluid.amount + "mB of " + fluid.getLocalizedName(); } return "Empty"; }
Example 3
Source File: GTHelperFluid.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
public static Boolean isFluidBurnable(ItemStack stack) { FluidStack fluid = FluidUtil.getFluidContained(stack); if (fluid != null) { return (GTFluidHandler.getBurnableToolTipList().contains(fluid.getFluid().getName())); } return false; }
Example 4
Source File: GTItemFluidTube.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
@Override @Nonnull public ActionResult<ItemStack> onItemRightClick(@Nonnull World world, @Nonnull EntityPlayer player, @Nonnull EnumHand hand) { ItemStack itemstack = player.getHeldItem(hand); FluidStack fluidStack = FluidUtil.getFluidContained(itemstack); if (fluidStack == null) { return tryPickUpFluid(world, player, hand, itemstack, fluidStack); } return tryPlaceFluid(world, player, hand, itemstack, fluidStack); }
Example 5
Source File: GTItemOverrideTestTube.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
@Override public IBakedModel handleItemState(IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity) { FluidStack fluidStack = FluidUtil.getFluidContained(stack); if (fluidStack == null) return originalModel; IBakedModel baked = CACHE.get(fluidStack.getFluid().getName()); if (baked == null) { GTBakedTestTube bakedCell = (GTBakedTestTube) originalModel; GTModelTestTube model = new GTModelTestTube(fluidStack.getFluid()); CACHE.put(fluidStack.getFluid().getName(), (baked = model.bake(TRSRTransformation.identity(), bakedCell.format, GTModelUtils.getTextureGetter()))); } return baked; }
Example 6
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 7
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 8
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 9
Source File: GTHelperFluid.java From GT-Classic with GNU Lesser General Public License v3.0 | 4 votes |
public static Boolean isFluidPlaceable(ItemStack stack) { FluidStack fluid = FluidUtil.getFluidContained(stack); return fluid != null && fluid.getFluid().canBePlacedInWorld(); }
Example 10
Source File: GTHelperFluid.java From GT-Classic with GNU Lesser General Public License v3.0 | 4 votes |
public static Boolean isFluidGas(ItemStack stack) { FluidStack fluid = FluidUtil.getFluidContained(stack); return fluid != null && fluid.getFluid().isGaseous(); }
Example 11
Source File: SingleFluidBucketFillHandler.java From OpenModsLib with MIT License | 4 votes |
public SingleFluidBucketFillHandler(@Nonnull ItemStack filledBucket) { this.filledBucket = filledBucket; this.containedFluid = FluidUtil.getFluidContained(filledBucket); Preconditions.checkState(containedFluid != null, "Item %s is not a filled bucket", filledBucket); }