public final class MaterialSourceImpl extends java.lang.Object implements MaterialSource
| Constructor and Description |
|---|
MaterialSourceImpl(boolean isCreative,
net.minecraftforge.items.IItemHandler itemHandler,
net.minecraftforge.fluids.capability.IFluidHandler fluidHandler) |
| Modifier and Type | Method and Description |
|---|---|
net.minecraftforge.fluids.FluidStack |
extractFluid(net.minecraftforge.fluids.FluidStack wantStack,
boolean simulate)
Try to extract the specified fluid stack from the underlying fluid
handler.
|
net.minecraft.item.ItemStack |
extractItem(net.minecraft.item.ItemStack wantStack,
boolean simulate)
Try to extract the specified item stack from the underlying item handler.
|
net.minecraftforge.fluids.capability.IFluidHandler |
getFluidHandler()
Get the underlying fluid handler feeding this material source.
|
net.minecraftforge.items.IItemHandler |
getItemHandler()
Get the underlying item handler feeding this material source.
|
boolean |
isCreative()
Whether this is a creative mode item source.
|
public MaterialSourceImpl(boolean isCreative,
net.minecraftforge.items.IItemHandler itemHandler,
net.minecraftforge.fluids.capability.IFluidHandler fluidHandler)
public boolean isCreative()
MaterialSource
When this is true, the Converter should generally
not consume any materials. The MaterialSource.extractItem(ItemStack, boolean)
and MaterialSource.extractFluid(FluidStack, boolean) methods automatically
perform this check and will always succeed when in creative mode.
isCreative in interface MaterialSourcepublic net.minecraftforge.items.IItemHandler getItemHandler()
MaterialSource
Use this only if MaterialSource.extractItem(ItemStack, boolean) does not work
for the type of item you need to look up. If you do, however, make sure
to respect the current MaterialSource.isCreative() state.
getItemHandler in interface MaterialSourcepublic net.minecraft.item.ItemStack extractItem(net.minecraft.item.ItemStack wantStack,
boolean simulate)
MaterialSourceThis will look for a stack that is both item and tag equals to the specified stack. The number of items consumed is defined by the size of the provided stack. If the specified amount cannot be met, will fail.
extractItem in interface MaterialSourcewantStack - the type of item to look for.simulate - whether to merely simulate the extraction.public net.minecraftforge.fluids.capability.IFluidHandler getFluidHandler()
MaterialSource
Use this only if MaterialSource.extractFluid(FluidStack, boolean) does not work
for the type of fluid you need to look up. If you do, however, make sure
to respect the current MaterialSource.isCreative() state.
getFluidHandler in interface MaterialSource@Nullable
public net.minecraftforge.fluids.FluidStack extractFluid(net.minecraftforge.fluids.FluidStack wantStack,
boolean simulate)
MaterialSourceThis will look for a stack that is both fluid and tag equals to the specified stack. The amount of fluid consumed is defined by the size of the provided stack. If the specified amount cannot be met, will fail.
extractFluid in interface MaterialSourcewantStack - the type of fluid to look for.simulate - whether to merely simulate the extraction.