I'm a new modder and just trying to make a simple mod ,but when I put my block ,the game crash with "Registry Object not present".
I've tried to fix it ,but still can't find where wrong.
Thanks for helping.
crash report :
conveyor_belt_block.java :
@Nullable
@Override
public TileEntity createTileEntity(final BlockState state, final IBlockReader world) {
return ModTileEntityTypes.CONVEYOR_BELT.get().create(); // line38
}
ModTileEntityTypes.java :
public final class ModTileEntityTypes {
public static final DeferredRegister<TileEntityType<?>> TILE_ENTITY_TYPES = new DeferredRegister<>(ForgeRegistries.TILE_ENTITIES, Conveyor.modid);
public static final RegistryObject<TileEntityType<conveyor_belt_tile_entity>> CONVEYOR_BELT = TILE_ENTITY_TYPES.register("conveyor_belt", () ->
TileEntityType.Builder.create(conveyor_belt_tile_entity::new, ModBlocks.CONVEYOR_BELT.get().setRegistryName("conveyor_belt"))
.build(null)
);
}
ModBlocks.java :
public final class ModBlocks {
public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, Conveyor.modid);
public static final RegistryObject<Block> CONVEYOR_BELT = BLOCKS.register("conveyor_belt", () -> new conveyor_belt_block());
}
conveyor_belt_tile_entity.java :
public class conveyor_belt_tile_entity extends TileEntity implements ITickableTileEntity{
public conveyor_belt_tile_entity() {
super(ModTileEntityTypes.CONVEYOR_BELT.get());
}
@Override
public void tick() {
System.out.println("test tick");
}
}