类 BlockEntityTypeAddBlocksEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.BlockEntityTypeAddBlocksEvent
所有已实现的接口:
net.neoforged.fml.event.IModBusEvent

public class BlockEntityTypeAddBlocksEvent extends net.neoforged.bus.api.Event implements net.neoforged.fml.event.IModBusEvent
Allows injecting new blocks into a block entity's BlockEntityType.validBlocks field in a safe manner. The class of the newly injected block should share the highest common class that all existing blocks in the targeted validBlocks has. Please use this event instead of manipulating BlockEntityType directly.

Example: If the valid blocks list has StandingSignBlock entry and WallSignBlock entry, the common class is SignBlock, the given block must be a SignBlock or have SignBlock as a parent class in its hierarchy. Example:

public static void onBlockEntityValidBlocks(BlockEntityTypeAddBlocksEvent event) {
    event.modify(BlockEntityType.SIGN, MODDED_SIGN_BLOCK.get());
}
  • 字段详细资料

  • 构造器详细资料

    • BlockEntityTypeAddBlocksEvent

      public BlockEntityTypeAddBlocksEvent()
  • 方法详细资料