public interface MaterialSource
Converters when deserializing blocks.| Modifier and Type | Method and Description |
|---|---|
net.minecraftforge.fluids.FluidStack |
extractFluid(net.minecraftforge.fluids.FluidStack stack,
boolean simulate)
Try to extract the specified fluid stack from the underlying fluid
handler.
|
net.minecraft.item.ItemStack |
extractItem(net.minecraft.item.ItemStack stack,
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.
|
boolean isCreative()
When this is true, the Converter should generally
not consume any materials. The extractItem(ItemStack, boolean)
and extractFluid(FluidStack, boolean) methods automatically
perform this check and will always succeed when in creative mode.
net.minecraftforge.items.IItemHandler getItemHandler()
Use this only if 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 isCreative() state.
net.minecraft.item.ItemStack extractItem(net.minecraft.item.ItemStack stack,
boolean simulate)
This 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.
stack - the type of item to look for.simulate - whether to merely simulate the extraction.net.minecraftforge.fluids.capability.IFluidHandler getFluidHandler()
Use this only if 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 isCreative() state.
@Nullable
net.minecraftforge.fluids.FluidStack extractFluid(net.minecraftforge.fluids.FluidStack stack,
boolean simulate)
This 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.
stack - the type of fluid to look for.simulate - whether to merely simulate the extraction.