28 lines
1.4 KiB
Java
28 lines
1.4 KiB
Java
package nl.kallestruik.riseofblocks.registry;
|
|
|
|
import net.minecraft.core.registries.Registries;
|
|
import net.minecraft.world.level.block.entity.BlockEntityType;
|
|
import net.neoforged.neoforge.registries.DeferredRegister;
|
|
import nl.kallestruik.riseofblocks.RiseOfBlocks;
|
|
import nl.kallestruik.riseofblocks.blockentities.FlagBlockEntity;
|
|
|
|
import java.util.function.Supplier;
|
|
|
|
public class BlockEntityRegistry {
|
|
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITY_TYPES =
|
|
DeferredRegister.create(Registries.BLOCK_ENTITY_TYPE, RiseOfBlocks.MODID);
|
|
|
|
public static final Supplier<BlockEntityType<FlagBlockEntity>> FLAG = BLOCK_ENTITY_TYPES.register(
|
|
"flag",
|
|
// The block entity type, created using a builder.
|
|
() -> BlockEntityType.Builder.of(
|
|
// The supplier to use for constructing the block entity instances.
|
|
FlagBlockEntity::new,
|
|
// A vararg of blocks that can have this block entity.
|
|
// This assumes the existence of the referenced blocks as DeferredBlock<Block>s.
|
|
BlockRegistry.FLAG.get()
|
|
)
|
|
// Build using null; vanilla does some datafixer shenanigans with the parameter that we don't need.
|
|
.build(null)
|
|
);
|
|
}
|