Interface BlockProvider

All Known Implementing Classes:
BlackHoleTalismanItem.BlockProviderImpl, DepthsRodItem.BlockProviderImpl, EnderHandItem.BlockProviderImpl, LandsRodItem.BlockProviderImpl, TerraFirmaRodItem.BlockProviderImpl

public interface BlockProvider
An Item that has this capability can provide blocks to other items that use them. For example, the Black Hole Talisman uses this in order to allow for the Rod of the Shifting Crust to pull blocks from it. Mutations to objects of this type propagate directly to the underlying stack it was retrieved from.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.resources.ResourceLocation
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    getBlockCount(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack requestor, net.minecraft.world.level.block.Block block)
    Gets the amount of blocks of the type passed stored in this item.
    boolean
    provideBlock(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack requestor, net.minecraft.world.level.block.Block block, boolean doit)
    Provides the requested item.
  • Field Details

    • ID

      static final net.minecraft.resources.ResourceLocation ID
  • Method Details

    • provideBlock

      boolean provideBlock(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack requestor, net.minecraft.world.level.block.Block block, boolean doit)
      Provides the requested item. The doit paremeter specifies whether this is just a test (false) or if the item should actually be removed (true). If you need to use calls to ManaItemHandler.requestMana[Exact], use the requestor as the ItemStack passed in.
    • getBlockCount

      int getBlockCount(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack requestor, net.minecraft.world.level.block.Block block)
      Gets the amount of blocks of the type passed stored in this item. You must check for the block passed in to not give the counter for a wrong block. Returning -1 states that the item can provide infinite of the item passed in (for example, the Rod of the Lands would return -1 if the block is dirt).