Class DeferredBlock<T extends net.minecraft.world.level.block.Block>

java.lang.Object
net.neoforged.neoforge.registries.DeferredHolder<net.minecraft.world.level.block.Block,T>
net.neoforged.neoforge.registries.DeferredBlock<T>
Type Parameters:
T - The specific Block type.
All Implemented Interfaces:
Supplier<T>, net.minecraft.core.Holder<net.minecraft.world.level.block.Block>, net.minecraft.world.level.ItemLike, IHolderExtension<net.minecraft.world.level.block.Block>, IWithData<net.minecraft.world.level.block.Block>
Direct Known Subclasses:
DeferredBlockBuilder

public class DeferredBlock<T extends net.minecraft.world.level.block.Block> extends DeferredHolder<net.minecraft.world.level.block.Block,T> implements net.minecraft.world.level.ItemLike
Special DeferredHolder for Blocks that implements ItemLike.
  • Constructor Details

    • DeferredBlock

      protected DeferredBlock(net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.Block> key)
  • Method Details

    • toStack

      public net.minecraft.world.item.ItemStack toStack()
      Creates a new ItemStack with a default size of 1 from this Block
    • toStack

      public net.minecraft.world.item.ItemStack toStack(int count)
      Creates a new ItemStack with the given size from this Block
      Parameters:
      count - The size of the stack to create
    • createBlock

      public static <T extends net.minecraft.world.level.block.Block> DeferredBlock<T> createBlock(net.minecraft.resources.ResourceLocation key)
      Creates a new DeferredHolder targeting the Block with the specified name.
      Type Parameters:
      T - The type of the target Block.
      Parameters:
      key - The name of the target Block.
    • createBlock

      public static <T extends net.minecraft.world.level.block.Block> DeferredBlock<T> createBlock(net.minecraft.resources.ResourceKey<net.minecraft.world.level.block.Block> key)
      Creates a new DeferredHolder targeting the specified Block.
      Type Parameters:
      T - The type of the target Block.
      Parameters:
      key - The resource key of the target Block.
    • asItem

      public net.minecraft.world.item.Item asItem()
      Specified by:
      asItem in interface net.minecraft.world.level.ItemLike